Subversion Repositories Applications.papyrus

Rev

Rev 832 | Rev 850 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 832 Rev 846
Line 19... Line 19...
19
// |                                                                                                      |
19
// |                                                                                                      |
20
// | You should have received a copy of the GNU General Public License                                    |
20
// | You should have received a copy of the GNU General Public License                                    |
21
// | along with Foobar; if not, write to the Free Software                                                |
21
// | along with Foobar; if not, write to the Free Software                                                |
22
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
22
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
23
// +------------------------------------------------------------------------------------------------------+
23
// +------------------------------------------------------------------------------------------------------+
24
// CVS : $Id: moteur_recherche.php,v 1.9 2006-04-28 12:41:49 florian Exp $
24
// CVS : $Id: moteur_recherche.php,v 1.10 2006-05-19 10:04:55 jp_milcent Exp $
25
/**
25
/**
26
* Applette : moteur de recherche
26
* Applette : moteur de recherche
27
*
27
*
28
* Génère un formulaire contenant une zone de saisie permettant de taper un texte à rechercher sur l'ensemble
28
* Génère un formulaire contenant une zone de saisie permettant de taper un texte à rechercher sur l'ensemble
29
* des sites gérés par Papyrus.
29
* des sites gérés par Papyrus.
Line 36... Line 36...
36
//Auteur original :
36
//Auteur original :
37
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
37
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
38
//Autres auteurs :
38
//Autres auteurs :
39
*@author        Aucun
39
*@author        Aucun
40
*@copyright     Tela-Botanica 2000-2004
40
*@copyright     Tela-Botanica 2000-2004
41
*@version       $Revision: 1.9 $ $Date: 2006-04-28 12:41:49 $
41
*@version       $Revision: 1.10 $ $Date: 2006-05-19 10:04:55 $
42
// +------------------------------------------------------------------------------------------------------+
42
// +------------------------------------------------------------------------------------------------------+
43
*/
43
*/
Line 44... Line 44...
44
 
44
 
45
// +------------------------------------------------------------------------------------------------------+
45
// +------------------------------------------------------------------------------------------------------+
Line 51... Line 51...
51
// --------------------------------------------------------------------------------------------------------
51
// --------------------------------------------------------------------------------------------------------
52
//Utilisation de la bibliothèque Papyrus pap_meta.fonct.php inclue par Papyrus
52
//Utilisation de la bibliothèque Papyrus pap_meta.fonct.php inclue par Papyrus
53
//Utilisation de la bibliothèque PEAR NET_URL inclue par Papyrus
53
//Utilisation de la bibliothèque PEAR NET_URL inclue par Papyrus
54
/** Inclusion du fichier de configuration de cette application.*/
54
/** Inclusion du fichier de configuration de cette application.*/
55
require_once GEN_CHEMIN_APPLETTE.'moteur_recherche/configuration/more_configuration.inc.php';
55
require_once GEN_CHEMIN_APPLETTE.'moteur_recherche/configuration/more_configuration.inc.php';
-
 
56
/** Inclusion du fichier de configuration des Spip.*/
-
 
57
require_once GEN_CHEMIN_APPLETTE.'moteur_recherche/configuration/more_config_spip.inc.php';
56
/** Inclusion de la bibliothèque PEAR de conception de formulaire.*/
58
/** Inclusion de la bibliothèque PEAR de conception de formulaire.*/
57
require_once MORE_CHEMIN_BIBLIOTHEQUE_PEAR.'HTML/QuickForm.php';
59
require_once MORE_CHEMIN_BIBLIOTHEQUE_PEAR.'HTML/QuickForm.php';
58
/** Inclusion de la bibliothèque PEAR de modification des squelettes des formulaires QuickForm.*/
60
/** Inclusion de la bibliothèque PEAR de modification des squelettes des formulaires QuickForm.*/
59
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/Renderer/Default.php';
61
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/Renderer/Default.php';
Line 71... Line 73...
71
// |                                            CORPS du PROGRAMME                                        |
73
// |                                            CORPS du PROGRAMME                                        |
72
// +------------------------------------------------------------------------------------------------------+
74
// +------------------------------------------------------------------------------------------------------+
Line 73... Line 75...
73
 
75
 
74
if (isset($_POST['more_motif']) && $_POST['more_motif'] != '') {
76
if (isset($_POST['more_motif']) && $_POST['more_motif'] != '') {
75
    // Initialisation de variable extérieures
77
    // Initialisation de variable extérieures
76
    $GLOBALS['_VEI_']['usurpation'] = MORE_LG_USURPATION.$_POST['more_motif'];
78
    $GLOBALS['_VEI_']['usurpation'] = MORE_LG_USURPATION.htmlentities(stripslashes($_POST['more_motif']));
77
    $GLOBALS['_GEN_commun']['info_menu'] = null;
79
    $GLOBALS['_GEN_commun']['info_menu'] = null;
78
    $GLOBALS['_PAPYRUS_']['general']['application_chemin'] = null;
-
 
79
    // Titre de la page
-
 
80
    $GLOBALS['_PAPYRUS_']['rendu']['TITRE_PAGE'] = MORE_LG_TITRE.$_POST['more_motif'];
80
    $GLOBALS['_PAPYRUS_']['general']['application_chemin'] = null;
81
    // Modification des meta de l'entête de la page
81
    // Modification des meta de l'entête de la page
82
    GEN_modifierMetaHttpEquiv('Content-Type', 'text/html; charset=iso-8859-15');
82
    GEN_modifierMetaHttpEquiv('Content-Type', 'text/html; charset=ISO-8859-15');
83
    GEN_modifierMetaHttpEquiv('Content-style-type', 'text/css');
83
    GEN_modifierMetaHttpEquiv('Content-style-type', 'text/css');
84
    GEN_modifierMetaHttpEquiv('Content-script-type', 'text/javascript');
84
    GEN_modifierMetaHttpEquiv('Content-script-type', 'text/javascript');
Line 85... Line 85...
85
    GEN_modifierMetaHttpEquiv('Content-language', $GLOBALS['_GEN_commun']['i18n']);
85
    GEN_modifierMetaHttpEquiv('Content-language', $GLOBALS['_GEN_commun']['i18n']);
Line 120... Line 120...
120
    $url_id_type_site = GEN_URL_ID_TYPE_SITE;
120
    $url_id_type_site = GEN_URL_ID_TYPE_SITE;
121
    $indent_origine = 12;// Indentation de départ en nombre d'espace
121
    $indent_origine = 12;// Indentation de départ en nombre d'espace
122
    $indent_pas     = 4;// Pas d'indentation en nombre d'espace
122
    $indent_pas     = 4;// Pas d'indentation en nombre d'espace
123
    $retour = '';
123
    $retour = '';
124
    $retour_resultats = '';
124
    $retour_resultats = '';
-
 
125
    // Titre de la page
-
 
126
    $GLOBALS['_PAPYRUS_']['rendu']['TITRE_PAGE'] = MORE_LG_TITRE.htmlentities(stripslashes($_POST['more_motif']));
Line 125... Line 127...
125
    
127
    
126
    // --------------------------------------------------------------------------------------------------------
128
    // --------------------------------------------------------------------------------------------------------
Line 127... Line 129...
127
    // Lancement de la recherche si nécessaire
129
    // Lancement de la recherche si nécessaire
Line 131... Line 133...
131
        $_SESSION['_MOTEUR_RECHERCHE_']['rechercher']['more_motif'] = MORE_LG_FORM_MOTIF_VALUE;
133
        $_SESSION['_MOTEUR_RECHERCHE_']['rechercher']['more_motif'] = MORE_LG_FORM_MOTIF_VALUE;
132
    } else {
134
    } else {
133
        $_SESSION['_MOTEUR_RECHERCHE_']['rechercher']['more_motif'] = $_POST['more_motif'];
135
        $_SESSION['_MOTEUR_RECHERCHE_']['rechercher']['more_motif'] = $_POST['more_motif'];
134
        /** Inclusion de la classe Recherche.*/
136
        /** Inclusion de la classe Recherche.*/
135
        require_once MORE_CHEMIN_BIBLIO.'more_recherche.class.php';
137
        require_once MORE_CHEMIN_BIBLIO.'more_recherche.class.php';
136
        /** Inclusion de la classe Recherche_Menu_Meta.*/
138
        /** Inclusion de la classe Recherche_Papyrus_Menu.*/
137
        require_once MORE_CHEMIN_BIBLIO.'more_recherche_papyrus_menu.class.php';
139
        require_once MORE_CHEMIN_BIBLIO.'more_recherche_papyrus_menu.class.php';
-
 
140
        /** Inclusion de la classe Recherche_Spip_Article.*/
-
 
141
        require_once MORE_CHEMIN_BIBLIO.'more_recherche_spip_article.class.php';
138
        $moteur = new Recherche($_SESSION['_MOTEUR_RECHERCHE_']['rechercher']['more_motif']);
142
        $moteur = new Recherche($_SESSION['_MOTEUR_RECHERCHE_']['rechercher']['more_motif']);
139
        $recherche_papyrus_menu = new Recherche_Papyrus_Menu($_SESSION['_MOTEUR_RECHERCHE_']['rechercher']['more_motif']);
143
        $recherche_papyrus_menu = new Recherche_Papyrus_Menu($_SESSION['_MOTEUR_RECHERCHE_']['rechercher']['more_motif']);
-
 
144
        $recherche_spip_article = new Recherche_Spip_Article($_SESSION['_MOTEUR_RECHERCHE_']['rechercher']['more_motif']);
140
        $moteur->ajouterRecherche($recherche_papyrus_menu);
145
        $moteur->ajouterRecherche($recherche_papyrus_menu);
-
 
146
        $moteur->ajouterRecherche($recherche_spip_article);
141
        $aso_resultats = $moteur->rechercherMotif();
147
        $aso_resultats = $moteur->rechercherMotif();
142
        //$GLOBALS['_DEBOGAGE_'] = '<pre>'.print_r($aso_resultats, true).'</pre>';
148
        //$GLOBALS['_DEBOGAGE_'] = '<pre>'.print_r($aso_resultats, true).'</pre>';
-
 
149
        $nbre_pages = count($aso_resultats);
-
 
150
        if ($nbre_pages <= 1) {
143
        $retour_resultats .= '<h1>'.MORE_LG_RESULTAT_TITRE.'</h1>'."\n";
151
        	$retour_resultats .= '<h1>'.sprintf(MORE_LG_RESULTAT_TITRE, $nbre_pages).'</h1>'."\n";
-
 
152
        } else {
-
 
153
        	$retour_resultats .= '<h1>'.sprintf(MORE_LG_RESULTAT_TITRE_PLURIEL, $nbre_pages).'</h1>'."\n";
-
 
154
        }
144
        if (count($aso_resultats) == 0) {
155
        if ($nbre_pages == 0) {
145
            $retour_resultats .= '<p class="information">'.MORE_LG_RESULTAT_VIDE.'</p>'."\n";
156
            $retour_resultats .= '<p class="information">'.MORE_LG_RESULTAT_VIDE.'</p>'."\n";
146
        } else {
157
        } else {
147
            $retour_resultats .= '<ul id="more_resultat">'."\n";
158
            $retour_resultats .= '<ul id="more_resultat">'."\n";
148
            foreach ($aso_resultats as $val) {
159
            foreach ($aso_resultats as $val) {
149
                if (!empty($val['url'])) {
160
                if (!empty($val['url'])) {
Line 207... Line 218...
207
    $partie_menu_debut = '<fieldset>'."\n".'<legend>'.MORE_LG_FORM_TITRE.'</legend>'."\n";
218
    $partie_menu_debut = '<fieldset>'."\n".'<legend>'.MORE_LG_FORM_TITRE.'</legend>'."\n";
208
    $more_form->addElement('html', $partie_menu_debut);
219
    $more_form->addElement('html', $partie_menu_debut);
Line 209... Line 220...
209
    
220
    
210
    $id = 'more_motif';
221
    $id = 'more_motif';
211
    $aso_attributs = array( 'id'=>$id, 'tabindex' => $tab_index++, 'maxlength' => MORE_FORM_MOTIF_MAXLENGTH,
222
    $aso_attributs = array( 'id'=>$id, 'tabindex' => $tab_index++, 'maxlength' => MORE_FORM_MOTIF_MAXLENGTH,
212
                            'accesskey' => MORE_LG_FORM_ACCESSKEY, 'onclick' => "javascript: this.value='';");
223
                            'accesskey' => MORE_LG_FORM_ACCESSKEY);
213
    $label = '<label for="'.$id.'">'.MORE_LG_FORM_MOTIF.'</label>';
224
    $label = '<label for="'.$id.'">'.MORE_LG_FORM_MOTIF.'</label>';
Line 214... Line 225...
214
    $more_form->addElement('text', $id, $label, $aso_attributs);
225
    $more_form->addElement('text', $id, $label, $aso_attributs);
215
    
226
    
Line 236... Line 247...
236
 
247
 
237
 
248
 
238
/* +--Fin du code ----------------------------------------------------------------------------------------+
249
/* +--Fin du code ----------------------------------------------------------------------------------------+
-
 
250
*
-
 
251
* $Log: not supported by cvs2svn $
-
 
252
* Revision 1.9  2006/04/28 12:41:49  florian
239
*
253
* corrections erreurs chemin
240
* $Log: not supported by cvs2svn $
254
*
241
* Revision 1.8  2006/03/02 10:49:49  ddelon
255
* Revision 1.8  2006/03/02 10:49:49  ddelon
242
* Fusion branche multilinguisme dans branche principale
256
* Fusion branche multilinguisme dans branche principale
243
*
257
*