diff --git a/ecrire/ajax_page.php b/ecrire/ajax_page.php index 5dcfe2a2670a83924be5dcb36d3d56f7ea796984..0e555e0ce0775b0c3b03c15ada41ac3c6ad8f2b0 100644 --- a/ecrire/ajax_page.php +++ b/ecrire/ajax_page.php @@ -14,6 +14,7 @@ include ("inc.php3"); $charset = lire_meta("charset"); echo "<"."?xml version='1.0' encoding='$charset'?>"; + if ($GLOBALS["id_ajax_fonc"]) { $res = spip_query("SELECT * FROM spip_ajax_fonc WHERE id_ajax_fonc = $id_ajax_fonc AND id_auteur=$connect_id_auteur"); if ($row = spip_fetch_array($res)) { @@ -34,6 +35,95 @@ echo "<"."?xml version='1.0' encoding='$charset'?>"; } +if ($GLOBALS["recherche"]) { + $recherche = $GLOBALS["recherche"]; + + $query_articles = "SELECT * FROM spip_articles WHERE"; + $query_breves = "SELECT * FROM spip_breves WHERE "; + $query_rubriques = "SELECT * FROM spip_rubriques WHERE "; + $query_sites = "SELECT * FROM spip_syndic WHERE "; + + if (ereg("^[0-9]+$", $recherche)) { + $query_articles .= " (id_article = $recherche) OR "; + $query_breves .= " (id_breve = $recherche) OR "; + $query_rubriques .= " (id_rubrique = $recherche) OR "; + $query_sites .= " (id_syndic = $recherche) OR "; + } + + // Eviter les symboles '%', caracteres SQL speciaux + $recherche = str_replace("%","\%",$recherche); + $rech2 = split("[[:space:]]+", $recherche); + if ($rech2) + $where = " (titre LIKE '%".join("%' AND titre LIKE '%", $rech2)."%') "; + else + $where = " 1=2"; + + $query_articles .= " $where ORDER BY date_modif DESC"; + $query_breves .= " $where ORDER BY maj DESC"; + $query_rubriques .= " $where ORDER BY maj DESC"; + + $query_sites .= " $where ORDER BY maj DESC"; + $query_sites = ereg_replace("titre LIKE", "nom_site LIKE", $query_sites); + + $activer_moteur = (lire_meta('activer_moteur') == 'oui'); + if ($activer_moteur) { // texte integral + include_ecrire ('inc_index.php3'); + list($hash_recherche,) = requete_hash ($recherche); + $query_articles_int = requete_txt_integral('article', $hash_recherche); + $query_breves_int = requete_txt_integral('breve', $hash_recherche); + $query_rubriques_int = requete_txt_integral('rubrique', $hash_recherche); + $query_sites_int = requete_txt_integral('syndic', $hash_recherche); + $query_auteurs_int = requete_txt_integral('auteur', $hash_recherche); + } + + if ($query_articles) + $nba = afficher_articles (_T('info_articles_trouves'), $query_articles, false, false); + if ($activer_moteur) { + if ($nba) { + $doublons = join($nba, ","); + $query_articles_int = ereg_replace ("WHERE", "WHERE objet.id_article NOT IN ($doublons) AND", $query_articles_int); + } + $nba1 = afficher_articles (_T('info_articles_trouves_dans_texte'), $query_articles_int, false, false); + } + + if ($query_breves) + $nbb = afficher_breves (_T('info_breves_touvees'), $query_breves, true); + if ($activer_moteur) { + if ($nbb) { + $doublons = join($nbb, ","); + $query_breves_int = ereg_replace ("WHERE", "WHERE objet.id_breve NOT IN ($doublons) AND", $query_breves_int); + } + $nbb1 = afficher_breves (_T('info_breves_touvees_dans_texte'), $query_breves_int, true); + } + + if ($query_rubriques) + $nbr = afficher_rubriques (_T('info_rubriques_trouvees'), $query_rubriques); + if ($activer_moteur) { + if ($nbr) { + $doublons = join($nbr, ","); + $query_rubriques_int = ereg_replace ("WHERE", "WHERE objet.id_rubrique NOT IN ($doublons) AND", $query_rubriques_int); + } + $nbr1 = afficher_rubriques (_T('info_rubriques_trouvees_dans_texte'), $query_rubriques_int); + } + + if ($activer_moteur) + $nbt = afficher_auteurs (_T('info_auteurs_trouves'), $query_auteurs_int); + + if ($query_sites) + $nbs = afficher_sites (_T('info_sites_trouves'), $query_sites); + if ($activer_moteur) { + if ($nbs) { + $doublons = join($nbs, ","); + $query_sites_int = ereg_replace ("WHERE", "WHERE objet.id_syndic NOT IN ($doublons) AND", $query_sites_int); + } + $nbs1 = afficher_sites (_T('info_sites_trouves_dans_texte'), $query_sites_int); + } + + if (!$nba AND !$nba1 AND !$nbb AND !$nbb1 AND !$nbr AND !$nbr1 AND !$nbt AND !$nbs AND !$nbs1) { + echo "<FONT FACE='Verdana,Arial,Sans,sans-serif'>"._T('avis_aucun_resultat')."</FONT><P>"; + } +} + ?> \ No newline at end of file diff --git a/ecrire/inc_presentation.php3 b/ecrire/inc_presentation.php3 index 16f8b152ae04c9fb7d44f90f40ee5fddaad94432..696af1c97be8f18337754f645ec797b079cdedc8 100644 --- a/ecrire/inc_presentation.php3 +++ b/ecrire/inc_presentation.php3 @@ -512,7 +512,7 @@ function afficher_tranches_requete(&$query, $colspan, $tmp_var=false, $javascrip $ancre++; $texte .= "<a name='a$ancre'></a>"; - if ($spip_display != 4) $texte .= "<tr style='background-color: #dddddd;'><td class=\"arial2\" style='border-bottom: 1px solid #444444;' colspan=\"".($colspan - 1)."\">"; + if ($spip_display != 4) $texte .= "<tr style='background-color: #dddddd;'><td class=\"arial11\" style='border-bottom: 1px solid #444444;' colspan=\"".($colspan - 1)."\">"; for ($i = 0; $i < $num_rows; $i += $nb_aff){ $deb = $i + 1; @@ -542,7 +542,7 @@ function afficher_tranches_requete(&$query, $colspan, $tmp_var=false, $javascrip } if ($deb_aff == -1) { - $texte .= "<B>"._T('info_tout_afficher')."</B>"; + //$texte .= "<B>"._T('info_tout_afficher')."</B>"; } else { $link = new Link; $link->addVar($tmp_var, -1); @@ -806,20 +806,23 @@ function afficher_articles($titre_table, $requete, $afficher_visites = false, $a include_ecrire ("inc_abstract_sql.php3"); $id_fonc = spip_abstract_insert("spip_ajax_fonc", "(id_auteur, fonction, variables, hash, date)", "($connect_id_auteur, 'afficher_articles', '$jjscript', $hash, NOW())"); } - echo "<div id='$tmp_var'>"; - - } + - echo "<div style='height: 12px;'></div>"; - echo "<div class='liste'>"; + echo "<div style='height: 12px;'></div>"; + echo "<div class='liste'>"; + + $id_img = "img_".$tmp_var; + $texte_img .= "<img src='img_pack/searching.gif' id='$id_img' style='visibility: hidden; border: 0px; float: $spip_lang_right' />"; - $id_img = "img_".$tmp_var; - $texte_img .= "<img src='img_pack/searching.gif' id='$id_img' style='visibility: hidden; margin-left: 10px; border: 0px; vertical-align: middle;' />"; + bandeau_titre_boite2($texte_img.$titre_table, "article-24.gif"); - bandeau_titre_boite2($titre_table.$texte_img, "article-24.gif"); + echo "<div id='$tmp_var'>"; + + } + //echo "<table width='100%' cellpadding='2' cellspacing='0' border='0'>"; echo afficher_liste_debut_tableau(); @@ -922,7 +925,7 @@ function afficher_articles($titre_table, $requete, $afficher_visites = false, $a $largeurs = array(11, '', 80, 100, 50); $styles = array('', 'arial2', 'arial1', 'arial1', 'arial1'); } else { - $largeurs = array(11, '', 100, 35); + $largeurs = array(11, '', 100, 50); $styles = array('', 'arial2', 'arial1', 'arial1'); } } else { @@ -2343,7 +2346,7 @@ else { else echo "<a href='brouteur.php3' class='icone26' onMouseOver=\"changestyle('bandeaunavrapide','visibility','visible');\" >" . http_img_pack("naviguer-site.png", "", "width='26' height='20' border='0'") . "</a>"; - echo "<a href='recherche.php3' class='icone26' onMouseOver=\"changestyle('bandeaurecherche','visibility','visible');\" >" . + echo "<a href='recherche.php3' class='icone26' onMouseOver=\"changestyle('bandeaurecherche','visibility','visible'); findObj('form_recherche').focus();\" >" . http_img_pack("loupe.png", "", "width='26' height='20' border='0'") ."</a>"; echo http_img_pack("rien.gif", " ", "width='10'"); @@ -2583,12 +2586,20 @@ else { // GADGET Recherche - echo "<div id='bandeaurecherche' class='bandeau_couleur_sous' style='width: 100px; $spip_lang_left: 60px;'>"; + echo "<div id='bandeaurecherche' class='bandeau_couleur_sous' style='width: 450px; $spip_lang_left: 60px;'>"; global $recherche; $recherche_aff = _T('info_rechercher'); - $onfocus = "onfocus=this.value='';"; - echo "<form method='get' style='margin: 0px;' action='recherche.php3'>"; - echo '<input type="text" size="10" value="'.$recherche_aff.'" name="recherche" class="formo" accesskey="r" '.$onfocus.'>'; + // $onfocus = "onfocus=this.value='';"; + echo "<form method='get' style='margin: 0px; position: relative;' action='recherche.php3'>"; + + echo "<img src='img_pack/searching.gif' style='position: absolute; left: -25px; top: 5px; visibility: hidden;' id='img_resultats_recherche'>"; + + echo '<input type="search" id="form_recherche" style="width: 200px;" size="10" value="'.$recherche_aff.'" name="recherche" onkeypress="if (this.value.length > 3) charger_id_url(\'ajax_page.php?recherche=\'+this.value,\'resultats_recherche\')" autocomplete="off" class="formo" accesskey="r" '.$onfocus.'>'; + + echo "<div id='resultats_recherche'></div>"; + + + echo "</form>"; echo "</div>"; // FIN GADGET recherche