From a0221f54d53522d53c677bcb6ce4cea210ea778b Mon Sep 17 00:00:00 2001 From: sparkyx Date: Thu, 22 Feb 2007 20:24:02 +0000 Subject: [PATCH] Bug cosmetic : recherche dans les fiches --- html/index.php | 6 ++--- include/fiche.inc.php | 61 ++++++++++++++++++++++++++----------------- 2 files changed, 40 insertions(+), 27 deletions(-) diff --git a/html/index.php b/html/index.php index 1e149ca0e..3dbbd2613 100644 --- a/html/index.php +++ b/html/index.php @@ -17,9 +17,9 @@ *
  • Tant que possible réutiliser ce qui existe déjà,
  • *
  • Améliorer ce qui existe déjà et vérifier que cela fonctionne toujours
  • *
  • Documenter avec les tags doxygen votre nouveau code,
  • - *
  • Les noms de fichiers sont *.inc.php pour les fichiers à éxécuter
  • - *
  • Les noms de fichiers sont *.php pour les fichiers contenant des fonctions uniquement
  • - *
  • Les noms de fichier sont class_*.php pour les fichiers contenant des classes.
  • + *
  • Dans le répertoire include: Les noms de fichiers sont *.inc.php pour les fichiers à éxécuter
  • + *
  • Dans le répertoire include: Les noms de fichiers sont *.php pour les fichiers contenant des fonctions uniquement
  • + *
  • Dans le répertoire include: Les noms de fichier sont class_*.php pour les fichiers contenant des classes.
  • *
  • Utiliser sql/upgrade.sql comme fichier temporaire pour modifier la base de données, en général * ce fichier deviendra l'un des patch
  • *
  • Faire de la doc
  • diff --git a/include/fiche.inc.php b/include/fiche.inc.php index f297ab7c9..b41662767 100644 --- a/include/fiche.inc.php +++ b/include/fiche.inc.php @@ -52,6 +52,20 @@ if ($read+$write == 0 ){ /* Cannot Access */ NoAccess(); } + +function ShowRecherche() { + echo '
    '; + echo '
    '; + $w=new widget('text'); + $search_text=(isset($_REQUEST['search_text']))?$_REQUEST['search_text']:""; + $h=new widget('hidden'); + echo $h->IOValue('p_action','fiche'); + echo $h->IOValue('action','search'); + echo "Recherche :".$w->IOValue('search_text',$search_text); + echo $w->Submit('submit','Rechercher'); + echo '
    '; + echo '
    '; +} function ShowFicheDefInput($p_fiche_def) { $r=""; @@ -70,6 +84,8 @@ function ShowFicheDefInput($p_fiche_def) $r.= ""; return $r; } + +$recherche=true; // Creation of a new model of card // in the database if ( isset($_POST['add_modele']) and $write != 0) { @@ -93,6 +109,7 @@ if ( isset ($_POST["add_line"]) ) { } $r.= ''; + $recherche=false; } // Change the name of the card model if ( isset ($_POST["change_name"] ) ) { @@ -105,6 +122,7 @@ if ( isset ($_POST["change_name"] ) ) { $r.=ShowFicheDefInput($fiche_def); } $r.= ''; + $recherche=false; } //var_dump($_GET); @@ -120,12 +138,14 @@ if ( isset ( $_GET["action"]) ) { && ! isset ($_POST['add_fiche']) && ! isset ($_POST['update_fiche']) && ! isset ($_POST['delete'])) { + ShowRecherche(); echo '
    '; $fiche_def=new fiche_def($cn,$_GET['fiche']); $fiche_def->myList(); echo '
    '; + $recherche=false; } //_________________________________________________________________________ // Display the detail of a card @@ -166,6 +186,7 @@ if ( isset ( $_GET["action"]) ) { '">'; if ( $write != 0 ) echo ''; echo ''; + $recherche=false; } //_________________________________________________________________________ // Display the form where you can enter @@ -174,6 +195,7 @@ if ( isset ( $_GET["action"]) ) { echo '
    '; CreateCategory($cn,$search); echo '
    '; + $recherche=false; } //_________________________________________________________________________ // Modify a card Model @@ -198,11 +220,13 @@ if ( isset ( $_GET["action"]) ) { echo ""; } echo ''; + $recherche=false; } //_________________________________________________________________________ // Search a card if ( $action == "search" ) { + ShowRecherche(); $sql="select distinct f_id,fd_id,av_text from fiche join jnt_fic_att_value using (f_id) join attr_value using (jft_id) where upper(av_text) like upper('%".FormatString($_GET["search_text"])."%') order by av_text,f_id"; @@ -224,21 +248,13 @@ if ( isset ( $_GET["action"]) ) { else { echo '
    '; - echo '
    '; - $w=new widget('text'); - $search_text=(isset($_REQUEST['search_text']))?$_REQUEST['search_text']:""; - $h=new widget('hidden'); - echo $h->IOValue('action','search'); - echo $h->IOValue('p_action','fiche'); - echo "Recherche :".$w->IOValue('search_text',$search_text); - echo $w->Submit('submit','Rechercher'); - echo '
    '; echo "Aucun résultat trouvé"; echo '
    '; } } + $recherche=false; } // Display a blank card from the selected category if ( isset ($_POST["fiche"]) && isset ($_POST["add"] ) ) { @@ -260,11 +276,13 @@ if ( isset ($_POST["fiche"]) && isset ($_POST["add"] ) ) { echo ''; } echo ''; + $recherche=false; exit(); } //------------------------------------------------------------------------------ // delete a card if (isset($_POST['delete']) ) { + ShowRecherche(); echo '
    '; if ( $write ==0) echo "

    Pas d'accès

    "; @@ -282,12 +300,15 @@ if (isset($_POST['delete']) ) { //------------------------------------------------------------------------------ // Add the data (attribute) of the card if ( isset ($_POST["add_fiche"]) ) { - echo '
    '; - if ( $write ==0) + if ( $write ==0) { + echo '
    '; echo "

    Pas d'accès

    "; + } else { + ShowRecherche(); + echo '
    '; $fiche=new fiche($cn); $fiche->Save($_REQUEST['fiche']); $fiche_def=new fiche_def($cn,$_GET['fiche']); @@ -296,11 +317,12 @@ if ( isset ($_POST["add_fiche"]) ) { } echo '
    '; - exit(); + $recherche=false; } //------------------------------------------------------------------------------ // Update a card if ( isset ($_POST["update_fiche"]) ) { + ShowRecherche(); echo '
    '; if ( $write ==0) echo "

    Pas d'accès

    "; @@ -318,20 +340,11 @@ if ( isset ($_POST["update_fiche"]) ) { echo '
    '; + $recherche=false; } //--Search menu -if ( ! isset($_REQUEST['action']) ){ - echo '
    '; - echo '
    '; - $w=new widget('text'); - $search_text=(isset($_REQUEST['search_text']))?$_REQUEST['search_text']:""; - $h=new widget('hidden'); - echo $h->IOValue('p_action','fiche'); - echo $h->IOValue('action','search'); - echo "Recherche :".$w->IOValue('search_text',$search_text); - echo $w->Submit('submit','Rechercher'); - echo '
    '; - echo '
    '; +if ( $recherche==true) { + ShowRecherche(); } html_page_stop(); ?>