Subversion Repositories Applications.papyrus

Rev

Rev 1372 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1372 Rev 1534
1
<?php
1
<?php
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
3
// +------------------------------------------------------------------------------------------------------+
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
4
// | PHP version 4.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
7
// +------------------------------------------------------------------------------------------------------+
8
// | This library is free software; you can redistribute it and/or                                        |
8
// | This library is free software; you can redistribute it and/or                                        |
9
// | modify it under the terms of the GNU Lesser General Public                                           |
9
// | modify it under the terms of the GNU Lesser General Public                                           |
10
// | License as published by the Free Software Foundation; either                                         |
10
// | License as published by the Free Software Foundation; either                                         |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
12
// |                                                                                                      |
12
// |                                                                                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
16
// | Lesser General Public License for more details.                                                      |
16
// | Lesser General Public License for more details.                                                      |
17
// |                                                                                                      |
17
// |                                                                                                      |
18
// | You should have received a copy of the GNU Lesser General Public                                     |
18
// | You should have received a copy of the GNU Lesser General Public                                     |
19
// | License along with this library; if not, write to the Free Software                                  |
19
// | License along with this library; if not, write to the Free Software                                  |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// +------------------------------------------------------------------------------------------------------+
21
// +------------------------------------------------------------------------------------------------------+
22
// CVS : $Id: admin_application.php,v 1.8 2007-03-20 14:17:36 alexandre_tb Exp $
22
// CVS : $Id: admin_application.php,v 1.8.2.1 2007-08-06 15:24:32 jp_milcent Exp $
23
/**
23
/**
24
* Application gérant les applications de Papyrus
24
* Application gérant les applications de Papyrus
25
*
25
*
26
* Cette application permet de gérer les applications de papyrus
26
* Cette application permet de gérer les applications de papyrus
27
* elle permet de spécifier pour un monde quel annuaire utiliser
27
* elle permet de spécifier pour un monde quel annuaire utiliser
28
* et de gérer des authentifications de spip et ou wikini
28
* et de gérer des authentifications de spip et ou wikini
29
*
29
*
30
*@package Admin_auth
30
*@package Admin_auth
31
//Auteur original :
31
//Auteur original :
32
*@author        Alexandre GRANIER <alexandre@tela-botanica.org>
32
*@author        Alexandre GRANIER <alexandre@tela-botanica.org>
33
*@copyright     Tela-Botanica 2000-2004
33
*@copyright     Tela-Botanica 2000-2004
34
*@version       $Revision: 1.8 $
34
*@version       $Revision: 1.8.2.1 $
35
// +------------------------------------------------------------------------------------------------------+
35
// +------------------------------------------------------------------------------------------------------+
36
*/
36
*/
37
 
37
 
38
// +------------------------------------------------------------------------------------------------------+
38
// +------------------------------------------------------------------------------------------------------+
39
// |                                            ENTÊTE du PROGRAMME                                       |
39
// |                                            ENTÊTE du PROGRAMME                                       |
40
// +------------------------------------------------------------------------------------------------------+
40
// +------------------------------------------------------------------------------------------------------+
41
/** Inclusion du fichier de configuration de cette application.*/
41
/** Inclusion du fichier de configuration de cette application.*/
42
require_once GEN_CHEMIN_PAP.'applications/admin_application/configuration/adap_configuration.inc.php';
42
require_once GEN_CHEMIN_PAP.'applications/admin_application/configuration/adap_configuration.inc.php';
43
 
43
 
44
//Utilisation de la bibliothèque PEAR NET_URL
44
//Utilisation de la bibliothèque PEAR NET_URL
45
 
45
 
46
/** Inclusion de la bibliothèque PEAR de conception de formulaire.*/
46
/** Inclusion de la bibliothèque PEAR de conception de formulaire.*/
47
require_once ADAP_CHEMIN_BIBLIOTHEQUE_PEAR.'HTML/QuickForm.php';
47
require_once ADAP_CHEMIN_BIBLIOTHEQUE_PEAR.'HTML/QuickForm.php';
48
require_once ADAP_CHEMIN_BIBLIOTHEQUE_PEAR.'HTML/QuickForm/select.php';
48
require_once ADAP_CHEMIN_BIBLIOTHEQUE_PEAR.'HTML/QuickForm/select.php';
49
 
49
 
50
/** Inclusion de l'API de fonctions gérant les erreurs sql.*/
50
/** Inclusion de l'API de fonctions gérant les erreurs sql.*/
51
require_once ADAP_CHEMIN_BIBLIOTHEQUE_API.'debogage/BOG_sql.fonct.php';
51
require_once ADAP_CHEMIN_BIBLIOTHEQUE_API.'debogage/BOG_sql.fonct.php';
52
 
52
 
53
/** Inclusion des fonctions de manipulation du sql.
53
/** Inclusion des fonctions de manipulation du sql.
54
* Permet la récupération d'un nouvel identifiant d'une table.*/
54
* Permet la récupération d'un nouvel identifiant d'une table.*/
55
require_once ADAP_CHEMIN_BIBLIOTHEQUE_API.'sql/SQL_manipulation.fonct.php';
55
require_once ADAP_CHEMIN_BIBLIOTHEQUE_API.'sql/SQL_manipulation.fonct.php';
56
 
56
 
57
require_once ADAP_CHEMIN_BIBLIOTHEQUE_API.'html/HTML_TableFragmenteur.php' ;
57
require_once ADAP_CHEMIN_BIBLIOTHEQUE_API.'html/HTML_TableFragmenteur.php' ;
58
 
58
 
59
/** <BR> Inclusion de la bibliothèque de fonctions concernant les tables "gen_site..." de Papyrus.*/
59
/** <BR> Inclusion de la bibliothèque de fonctions concernant les tables "gen_site..." de Papyrus.*/
60
require_once ADAP_CHEMIN_BIBLIOTHEQUE_GEN.'pap_site.fonct.php';
60
require_once ADAP_CHEMIN_BIBLIOTHEQUE_GEN.'pap_site.fonct.php';
61
 
61
 
62
/** <BR> Inclusion de la bibliothèque de fonctions concernant les tables "gen_menu..." de Papyrus.*/
62
/** <BR> Inclusion de la bibliothèque de fonctions concernant les tables "gen_menu..." de Papyrus.*/
63
require_once ADAP_CHEMIN_BIBLIOTHEQUE_GEN.'pap_menu.fonct.php';
63
require_once ADAP_CHEMIN_BIBLIOTHEQUE_GEN.'pap_menu.fonct.php';
64
 
64
 
65
/** <BR> Inclusion de la bibliothèque de fonctions concernant les tables "gen_applications..." de Papyrus.*/
65
/** <BR> Inclusion de la bibliothèque de fonctions concernant les tables "gen_applications..." de Papyrus.*/
66
require_once ADAP_CHEMIN_BIBLIOTHEQUE_GEN.'pap_application.fonct.php';
66
require_once ADAP_CHEMIN_BIBLIOTHEQUE_GEN.'pap_application.fonct.php';
67
 
67
 
68
/** <BR> Inclusion de la bibliothèque de fonctions concernant l'affichage commun.*/
68
/** <BR> Inclusion de la bibliothèque de fonctions concernant l'affichage commun.*/
69
require_once ADAP_CHEMIN_BIBLIOTHEQUE.'adap_application.fonct.php';
69
require_once ADAP_CHEMIN_BIBLIOTHEQUE.'adap_application.fonct.php';
70
 
70
 
71
require_once ADAP_CHEMIN_BIBLIOTHEQUE.'HTML_formulaireAppli.class.php' ;
71
require_once ADAP_CHEMIN_BIBLIOTHEQUE.'HTML_formulaireAppli.class.php' ;
72
 
72
 
73
 
73
 
74
// Inclusion des fichiers de traduction de l'appli ADME dePapyrus
74
// Inclusion des fichiers de traduction de l'appli ADME dePapyrus
75
if (file_exists(ADAP_CHEMIN_LANGUE.'adap_langue_'.$GLOBALS['_GEN_commun']['i18n'].'.inc.php')) {
75
if (file_exists(ADAP_CHEMIN_LANGUE.'adap_langue_'.$GLOBALS['_GEN_commun']['i18n'].'.inc.php')) {
76
    /** Inclusion du fichier de traduction suite à la transaction avec le navigateur.*/
76
    /** Inclusion du fichier de traduction suite à la transaction avec le navigateur.*/
77
    require_once ADAP_CHEMIN_LANGUE.'adap_langue_'.$GLOBALS['_GEN_commun']['i18n'].'.inc.php';
77
    require_once ADAP_CHEMIN_LANGUE.'adap_langue_'.$GLOBALS['_GEN_commun']['i18n'].'.inc.php';
78
} else {
78
} else {
79
    /** Inclusion du fichier de traduction par défaut.*/
79
    /** Inclusion du fichier de traduction par défaut.*/
80
    require_once ADAP_CHEMIN_LANGUE.'adap_langue_'.ADAP_I18N_DEFAUT.'.inc.php';
80
    require_once ADAP_CHEMIN_LANGUE.'adap_langue_'.ADAP_I18N_DEFAUT.'.inc.php';
81
}
81
}
82
 
82
 
83
// Stockage des styles de l'application
83
// Stockage des styles de l'application
84
GEN_stockerStyleExterne('adap_standard', ADAP_CHEMIN_STYLE.'adap_standard.css');
84
GEN_stockerStyleExterne('adap_standard', ADAP_CHEMIN_STYLE.'adap_standard.css');
85
 
85
 
86
// +------------------------------------------------------------------------------------------------------+
86
// +------------------------------------------------------------------------------------------------------+
87
// |                                            CORPS du PROGRAMME                                        |
87
// |                                            CORPS du PROGRAMME                                        |
88
// +------------------------------------------------------------------------------------------------------+
88
// +------------------------------------------------------------------------------------------------------+
89
 
89
 
90
function afficherContenuCorps()
90
function afficherContenuCorps()
91
{
91
{
92
    $db = &$GLOBALS['_GEN_commun']['pear_db'] ;
92
    $db = &$GLOBALS['_GEN_commun']['pear_db'] ;
93
    $url = $GLOBALS['_GEN_commun']['url'] ;
93
    $url = $GLOBALS['_GEN_commun']['url'] ;
94
    $auth = &$GLOBALS['_GEN_commun']['pear_auth'] ;
94
    $auth = &$GLOBALS['_GEN_commun']['pear_auth'] ;
95
    
95
    
96
    $res='';
96
    $res='';
97
    if (!$auth->getAuth()) {
97
    if (!$auth->getAuth()) {
98
    	$res .= '<p class="zone_alert">'.ADAP_IDENTIFIEZ_VOUS.'</p>'."\n" ;
98
    	$res .= '<p class="zone_alert">'.ADAP_IDENTIFIEZ_VOUS.'</p>'."\n" ;
99
		$res .= '<form id="form_connexion" style="clear:both;" class="form_identification" action="' ;
99
		$res .= '<form id="form_connexion" style="clear:both;" class="form_identification" action="' ;
100
		$res .= $url->getURL();
100
		$res .= $url->getURL();
101
		$res .= '" method="post">
101
		$res .= '" method="post">
102
                <fieldset>
102
                <fieldset>
103
                    <legend>Identifiez vous</legend>                    
103
                    <legend>Identifiez vous</legend>                    
104
                        <label for="username">Courriel : </label>
104
                        <label for="username">Courriel : </label>
105
                        <input type="text"  id="username" name="username" maxlength="80" tabindex="1" value="courriel" />                    
105
                        <input type="text"  id="username" name="username" maxlength="80" tabindex="1" value="courriel" />                    
106
                        <label for="password">Mot de passe : </label>
106
                        <label for="password">Mot de passe : </label>
107
                        <input type="password" id="password" name="password" maxlength="80" tabindex="2" value="mot de passe" />                    
107
                        <input type="password" id="password" name="password" maxlength="80" tabindex="2" value="mot de passe" />                    
108
                        <input type="submit" id="connexion" name="connexion" tabindex="3" value="ok" />                    
108
                        <input type="submit" id="connexion" name="connexion" tabindex="3" value="ok" />                    
109
                </fieldset>
109
                </fieldset>
110
                </form>';
110
                </form>';
111
        return $res ;
111
        return $res ;
112
    } else {
112
    } else {
113
	    // Le lien pour une nouvelle entrée
113
	    // Le lien pour une nouvelle entrée
-
 
114
	    $url->addQueryString('action', 'nouveau');
-
 
115
	    $url_nouveau = $url->getURL();
-
 
116
	    $url->removeQueryString('action', 'nouveau');
114
	    $res .= '<a href="'.$url->getURL().'&amp;action=nouveau">'.ADAP_AJOUTER.'</a>'."\n<br />" ;
117
	    $res .= '<a href="'.$url_nouveau.'">'.ADAP_AJOUTER.'</a>'."\n<br />" ;
115
	    // traitement de la suppression
118
	    // traitement de la suppression
116
	    if (isset ($_REQUEST['action']) && $_REQUEST['action'] == 'supprimer') adap_supprimer_application($_REQUEST['id_appl'], $db) ;
119
	    if (isset ($_REQUEST['action']) && $_REQUEST['action'] == 'supprimer') adap_supprimer_application($_REQUEST['id_appl'], $db) ;
117
	    
120
	    
118
	    // traitement de l'ajout
121
	    // traitement de l'ajout
119
	    if (isset ($_REQUEST['action']) || isset ($_REQUEST['id_appl'])) {
122
	    if (isset ($_REQUEST['action']) || isset ($_REQUEST['id_appl'])) {
120
	        $formulaire = new HTML_formulaireAppl('formulaire_appl', '', str_replace ('&amp;', '&', $url->getURL())) ;
123
	        $formulaire = new HTML_formulaireAppl('formulaire_appl', '', str_replace ('&amp;', '&', $url->getURL())) ;
121
	        $formulaire->construitFormulaire($url) ;
124
	        $formulaire->construitFormulaire($url) ;
122
	        
125
	        
123
	        // On ajoute un champs caché avec action=nouveau_v
126
	        // On ajoute un champs caché avec action=nouveau_v
124
	        if (isset ($_REQUEST['action']) && $_REQUEST['action'] == 'nouveau') {
127
	        if (isset ($_REQUEST['action']) && $_REQUEST['action'] == 'nouveau') {
125
	            $formulaire->addElement ('hidden', 'action', 'nouveau_v') ;
128
	            $formulaire->addElement ('hidden', 'action', 'nouveau_v') ;
126
	            return $formulaire->toHTML() ;
129
	            return $formulaire->toHTML() ;
127
	        }
130
	        }
128
	        if (isset ($_REQUEST['id_appl']) && !isset ($_REQUEST['action'])) {
131
	        if (isset ($_REQUEST['id_appl']) && !isset ($_REQUEST['action'])) {
129
	            $formulaire->addElement ('hidden', 'action', 'modifier_v') ;
132
	            $formulaire->addElement ('hidden', 'action', 'modifier_v') ;
130
	            $formulaire->addElement ('hidden', 'id_appl', $_REQUEST['id_appl']) ;
133
	            $formulaire->addElement ('hidden', 'id_appl', $_REQUEST['id_appl']) ;
131
	            $formulaire->setDefaults(adap_valeurs_par_defaut($_REQUEST['id_appl'], $db)) ;
134
	            $formulaire->setDefaults(adap_valeurs_par_defaut($_REQUEST['id_appl'], $db)) ;
132
	            return $formulaire->toHTML() ;
135
	            return $formulaire->toHTML() ;
133
	        }
136
	        }
134
	        if ($_REQUEST['action'] == 'modifier_v') {
137
	        if ($_REQUEST['action'] == 'modifier_v') {
135
	            if ($formulaire->validate()) {
138
	            if ($formulaire->validate()) {
136
	                mise_a_jour ($formulaire->getSubmitValues(), $db) ;
139
	                mise_a_jour ($formulaire->getSubmitValues(), $db) ;
137
	            }
140
	            }
138
	        }
141
	        }
139
	        if ($_REQUEST['action'] == 'nouveau_v') {
142
	        if ($_REQUEST['action'] == 'nouveau_v') {
140
	            if ($formulaire->validate()) {
143
	            if ($formulaire->validate()) {
141
	                insertion ($formulaire->getSubmitValues(), $db) ;
144
	                insertion ($formulaire->getSubmitValues(), $db) ;
142
	            }
145
	            }
143
	        }
146
	        }
144
	        
147
	        
145
	    }
148
	    }
146
	    // Comportement par défaut
149
	    // Comportement par défaut
147
	    // requete sur la table gen_application
150
	    // requete sur la table gen_application
148
	    $requete = 'SELECT gap_id_application, gap_nom FROM gen_application where gap_id_application <> 0 ORDER BY gap_nom ASC' ;
151
	    $requete = 'SELECT gap_id_application, gap_nom FROM gen_application where gap_id_application <> 0 ORDER BY gap_nom ASC' ;
149
	    
152
	    
150
	    $resultat = $db->query ($requete) ;
153
	    $resultat = $db->query ($requete) ;
151
	    if (DB::isError ($resultat)) {
154
	    if (DB::isError ($resultat)) {
152
	        $GLOBALS['_GEN_commun']['debogage_erreur']->gererErreur(E_USER_WARNING, "Echec de la requete : $requete<br />".$resultat->getMessage(),
155
	        $GLOBALS['_GEN_commun']['debogage_erreur']->gererErreur(E_USER_WARNING, "Echec de la requete : $requete<br />".$resultat->getMessage(),
153
	                                                                        __FILE__, __LINE__, 'admin_appl')   ;
156
	                                                                        __FILE__, __LINE__, 'admin_appl')   ;
154
	        return ;
157
	        return ;
155
	    }
158
	    }
156
	    $liste = new HTML_TableFragmenteur () ;
159
	    $liste = new HTML_TableFragmenteur () ;
157
	    $liste->construireEntete(array (ADAP_NOM_APPL, ADAP_SUPPRIMER)) ;
160
	    $liste->construireEntete(array (ADAP_NOM_APPL, ADAP_SUPPRIMER)) ;
158
	    $tableau_appl = array() ;
161
	    $tableau_appl = array() ;
159
	    while ($ligne = $resultat->fetchRow()) {
162
	    while ($ligne = $resultat->fetchRow()) {
160
	        $url->addQueryString ('id_appl', $ligne[0]) ;
163
	        $url->addQueryString ('id_appl', $ligne[0]) ;
161
	        array_push ($tableau_appl, array ('<a href="'.$url->getURL().'">'.$ligne[1].'</a>'."\n",    // Première colonne, le nom de l'application
164
	        array_push ($tableau_appl, array ('<a href="'.$url->getURL().'">'.$ligne[1].'</a>'."\n",    // Première colonne, le nom de l'application
162
	                                            '<a href="'.$url->getURL().'&amp;action=supprimer" onclick="javascript:return confirm (\''.ADAP_SUPPRIMER.' ?\');">'.ADAP_SUPPRIMER.'</a>'."\n"
165
	                                            '<a href="'.$url->getURL().'&amp;action=supprimer" onclick="javascript:return confirm (\''.ADAP_SUPPRIMER.' ?\');">'.ADAP_SUPPRIMER.'</a>'."\n"
163
	                                            ));
166
	                                            ));
164
	    }
167
	    }
165
	    $liste->construireListe($tableau_appl) ;
168
	    $liste->construireListe($tableau_appl) ;
166
	    $res .= $liste->toHTML();
169
	    $res .= $liste->toHTML();
167
	    return $res ;
170
	    return $res ;
168
    }
171
    }
169
}// Fin de la fonction afficherContenuCorps()
172
}// Fin de la fonction afficherContenuCorps()
170
 
173
 
171
// +------------------------------------------------------------------------------------------------------+
174
// +------------------------------------------------------------------------------------------------------+
172
// |                                            PIED du PROGRAMME                                         |
175
// |                                            PIED du PROGRAMME                                         |
173
// +------------------------------------------------------------------------------------------------------+
176
// +------------------------------------------------------------------------------------------------------+
174
 
177
 
175
 
178
 
176
 
179
 
177
/* +--Fin du code ----------------------------------------------------------------------------------------+
180
/* +--Fin du code ----------------------------------------------------------------------------------------+
178
*
181
*
179
* $Log: not supported by cvs2svn $
182
* $Log: not supported by cvs2svn $
-
 
183
* Revision 1.8  2007-03-20 14:17:36  alexandre_tb
-
 
184
* remplacement des varaibles $GLOBALS par $_REQUEST, pour que l appli fonctionne avec les register_globals à Off
-
 
185
*
180
* Revision 1.7  2006/12/01 10:39:14  alexandre_tb
186
* Revision 1.7  2006/12/01 10:39:14  alexandre_tb
181
* Suppression des références aux applettes
187
* Suppression des références aux applettes
182
*
188
*
183
* Revision 1.6  2006/10/06 10:40:51  florian
189
* Revision 1.6  2006/10/06 10:40:51  florian
184
* harmonisation des messages d'erreur de l'authentification
190
* harmonisation des messages d'erreur de l'authentification
185
*
191
*
186
* Revision 1.5  2006/09/07 13:28:39  jp_milcent
192
* Revision 1.5  2006/09/07 13:28:39  jp_milcent
187
* Mise en majuscule des termes SQL et trie des application par ordre alphabétique.
193
* Mise en majuscule des termes SQL et trie des application par ordre alphabétique.
188
*
194
*
189
* Revision 1.4  2005/03/09 10:46:17  jpm
195
* Revision 1.4  2005/03/09 10:46:17  jpm
190
* Changement d'un nom de fichier.
196
* Changement d'un nom de fichier.
191
*
197
*
192
* Revision 1.3  2005/03/09 10:40:26  alex
198
* Revision 1.3  2005/03/09 10:40:26  alex
193
* version initiale
199
* version initiale
194
*
200
*
195
* Revision 1.2  2005/02/28 10:32:59  jpm
201
* Revision 1.2  2005/02/28 10:32:59  jpm
196
* Changement de nom de dossier.
202
* Changement de nom de dossier.
197
*
203
*
198
* Revision 1.1  2004/12/13 18:07:19  alex
204
* Revision 1.1  2004/12/13 18:07:19  alex
199
* version initiale
205
* version initiale
200
*
206
*
201
*
207
*
202
* +-- Fin du code ----------------------------------------------------------------------------------------+
208
* +-- Fin du code ----------------------------------------------------------------------------------------+
203
*/
209
*/
204
?>
210
?>