From d22f3449248efd9823e7d0331093fc72859b149c Mon Sep 17 00:00:00 2001 From: Cerdic <cedric@yterium.com> Date: Tue, 14 Aug 2007 17:56:21 +0000 Subject: [PATCH] unifier le formulaire de recherche privee --- ecrire/exec/auteurs.php | 9 +-------- ecrire/exec/controle_forum.php | 10 ++-------- ecrire/exec/recherche.php | 9 +-------- ecrire/inc/presentation.php | 12 ++++++++++++ 4 files changed, 16 insertions(+), 24 deletions(-) diff --git a/ecrire/exec/auteurs.php b/ecrire/exec/auteurs.php index 89c25d44e7..0bac882394 100644 --- a/ecrire/exec/auteurs.php +++ b/ecrire/exec/auteurs.php @@ -50,14 +50,7 @@ function exec_auteurs_dist() echo bandeau_auteurs($tri, !statut_min_redac($statut)); - $recherche_aff = entites_html($recherche); - if (!strlen($recherche)) { - $recherche_aff = _T('info_rechercher'); - $onfocus = " onfocus=\"this.value='';\""; - } else $onfocus = ''; - $onfocus = '<input type="text" size="10" value="'.$recherche_aff.'" name="recherche" class="spip_recherche" accesskey="r"' . $onfocus . ' />'; - echo "<div style='width:200px;float:$spip_lang_right;'>".generer_form_ecrire("auteurs", $onfocus, " method='get'")."</div>" - . "<br class='nettoyeur' />"; + echo formulaire_recherche("auteurs") . "<br class='nettoyeur' />"; echo "<div id='auteurs'>", $res, "</div>"; echo pipeline('affiche_milieu',array('args'=>array('exec'=>'auteurs'),'data'=>'')); diff --git a/ecrire/exec/controle_forum.php b/ecrire/exec/controle_forum.php index 9ccec99d17..33ba1e1ba7 100644 --- a/ecrire/exec/controle_forum.php +++ b/ecrire/exec/controle_forum.php @@ -209,12 +209,7 @@ function exec_controle_forum_dist() $recherche = _request('recherche'); if (!preg_match('/^\w+$/', $type)) $type = 'public'; - $recherche_aff = entites_html($recherche); - if (!strlen($recherche)) { - $recherche_aff = _T('info_rechercher'); - $onfocus = " onfocus=\"this.value='';\""; - } else $onfocus = ''; - $onfocus = '<input type="text" size="10" value="'.$recherche_aff.'" name="recherche" class="spip_recherche" accesskey="r"' . $onfocus . " /><input type='hidden' name='type' value='$type' />"; + $formulaire_recherche = formulaire_recherche("controle_forum","<input type='hidden' name='type' value='$type' />"); list($from,$where)=critere_statut_controle_forum($type, $id_rubrique, $recherche); @@ -288,8 +283,7 @@ function exec_controle_forum_dist() echo debut_droite('', true); echo pipeline('affiche_milieu',array('args'=>array('exec'=>'controle_forum', 'type'=>$type),'data'=>'')); - echo "<div style='width:200px;float:$spip_lang_right;'>".generer_form_ecrire("controle_forum", $onfocus, " method='get'")."</div>" - . "<br class='nettoyeur' />"; + echo $formulaire_recherche . "<br class='nettoyeur' />"; echo "<div id='$ancre' class='serif2'>$mess</div>"; echo fin_gauche(), fin_page(); diff --git a/ecrire/exec/recherche.php b/ecrire/exec/recherche.php index 9e7563a31d..e66fb7d1f8 100644 --- a/ecrire/exec/recherche.php +++ b/ecrire/exec/recherche.php @@ -56,14 +56,7 @@ function exec_recherche_dist() { echo debut_grand_cadre(true); - if (!strlen($recherche)) { - $recherche_aff = _T('info_rechercher'); - $onfocus = " onfocus=\"this.value='';\""; - } else $onfocus = ''; - - $form = '<input type="text" size="10" value="'.$recherche_aff.'" name="recherche" class="recherche" accesskey="r"' . $onfocus . ' />'; - $form .= "<input type='image' width='26' height='20' src='"._DIR_IMG_PACK."loupe.png' name='submit' class='submit' alt='"._T('info_rechercher')."' />"; - echo "<div class='spip_recherche'>".generer_form_ecrire("recherche", $form, " method='get'")."</div>"; + echo formulaire_recherche("recherche"); /* // Si on est autorise a modifier, proposer le choix de REMPLACER diff --git a/ecrire/inc/presentation.php b/ecrire/inc/presentation.php index 997679cafd..34905522d1 100644 --- a/ecrire/inc/presentation.php +++ b/ecrire/inc/presentation.php @@ -1099,6 +1099,18 @@ function fin_cadre_formulaire($return=false){ } +function formulaire_recherche($page, $complement=""){ + $recherche = _request('recherche'); + $recherche_aff = entites_html($recherche); + if (!strlen($recherche)) { + $recherche_aff = _T('info_rechercher'); + $onfocus = " onfocus=\"this.value='';\""; + } else $onfocus = ''; + + $form = '<input type="text" size="10" value="'.$recherche_aff.'" name="recherche" class="recherche" accesskey="r"' . $onfocus . ' />'; + $form .= "<input type='image' width='26' height='20' src='"._DIR_IMG_PACK."loupe.png' name='submit' class='submit' alt='"._T('info_rechercher')."' />"; + return "<div class='spip_recherche'>".generer_form_ecrire($page, $form . $complement, " method='get'")."</div>"; +} // // Debut de la colonne de gauche -- GitLab