Subversion Repositories Applications.papyrus

Rev

Rev 302 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
229 alex 1
<?php
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
8
// | This library is free software; you can redistribute it and/or                                        |
9
// | modify it under the terms of the GNU Lesser General Public                                           |
10
// | License as published by the Free Software Foundation; either                                         |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
12
// |                                                                                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
16
// | Lesser General Public License for more details.                                                      |
17
// |                                                                                                      |
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                                  |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// +------------------------------------------------------------------------------------------------------+
923 jp_milcent 22
// CVS : $Id: admin_application.php,v 1.5 2006-09-07 13:28:39 jp_milcent Exp $
229 alex 23
/**
24
* Application gérant les applications de Papyrus
25
*
302 jpm 26
* Cette application permet de gérer les applications de papyrus
229 alex 27
* elle permet de spécifier pour un monde quel annuaire utiliser
28
* et de gérer des authentifications de spip et ou wikini
29
*
30
*@package Admin_auth
31
//Auteur original :
32
*@author        Alexandre GRANIER <alexandre@tela-botanica.org>
33
*@copyright     Tela-Botanica 2000-2004
923 jp_milcent 34
*@version       $Revision: 1.5 $
229 alex 35
// +------------------------------------------------------------------------------------------------------+
36
*/
37
 
38
// +------------------------------------------------------------------------------------------------------+
39
// |                                            ENTÊTE du PROGRAMME                                       |
40
// +------------------------------------------------------------------------------------------------------+
41
/** Inclusion du fichier de configuration de cette application.*/
42
require_once GEN_CHEMIN_PAP.'applications/admin_application/configuration/adap_configuration.inc.php';
43
 
44
//Utilisation de la bibliothèque PEAR NET_URL
45
 
46
/** Inclusion de la bibliothèque PEAR de conception de formulaire.*/
47
require_once ADAP_CHEMIN_BIBLIOTHEQUE_PEAR.'HTML/QuickForm.php';
48
require_once ADAP_CHEMIN_BIBLIOTHEQUE_PEAR.'HTML/QuickForm/select.php';
49
 
50
/** Inclusion de l'API de fonctions gérant les erreurs sql.*/
276 jpm 51
require_once ADAP_CHEMIN_BIBLIOTHEQUE_API.'debogage/BOG_sql.fonct.php';
229 alex 52
 
53
/** Inclusion des fonctions de manipulation du sql.
54
* Permet la récupération d'un nouvel identifiant d'une table.*/
276 jpm 55
require_once ADAP_CHEMIN_BIBLIOTHEQUE_API.'sql/SQL_manipulation.fonct.php';
229 alex 56
 
57
require_once ADAP_CHEMIN_BIBLIOTHEQUE_API.'html/HTML_TableFragmenteur.php' ;
58
 
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';
61
 
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';
64
 
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';
67
 
68
/** <BR> Inclusion de la bibliothèque de fonctions concernant l'affichage commun.*/
302 jpm 69
require_once ADAP_CHEMIN_BIBLIOTHEQUE.'adap_application.fonct.php';
229 alex 70
 
71
require_once ADAP_CHEMIN_BIBLIOTHEQUE.'HTML_formulaireAppli.class.php' ;
72
 
73
 
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')) {
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';
78
} else {
79
    /** Inclusion du fichier de traduction par défaut.*/
80
    require_once ADAP_CHEMIN_LANGUE.'adap_langue_'.ADAP_I18N_DEFAUT.'.inc.php';
81
}
82
 
83
// Stockage des styles de l'application
84
GEN_stockerStyleExterne('adap_standard', ADAP_CHEMIN_STYLE.'adap_standard.css');
85
 
86
// +------------------------------------------------------------------------------------------------------+
87
// |                                            CORPS du PROGRAMME                                        |
88
// +------------------------------------------------------------------------------------------------------+
89
 
90
function afficherContenuCorps()
91
{
92
    $db = &$GLOBALS['_GEN_commun']['pear_db'] ;
93
    $url = $GLOBALS['_GEN_commun']['url'] ;
94
    $auth = &$GLOBALS['_GEN_commun']['pear_auth'] ;
95
    isset ($GLOBALS['action']) ? '' : $GLOBALS['action'] = '' ; // On déclare action si elle n'existe pas
96
    if (!$auth->getAuth()) {
97
        return 'Identifiez-vous' ;
98
    }
99
    // Le lien pour une nouvelle entrée
300 alex 100
    $res = '<a href="'.$url->getURL().'&amp;action=nouveau">'.ADAP_AJOUTER.'</a>'."\n<br />" ;
229 alex 101
    // traitement de la suppression
300 alex 102
    if (isset ($GLOBALS['action']) && $GLOBALS['action'] == 'supprimer') adap_supprimer_application($GLOBALS['id_appl'], $db) ;
229 alex 103
 
104
    // traitement de l'ajout
300 alex 105
    if (isset ($GLOBALS['action']) || isset ($GLOBALS['id_appl'])) {
106
        $formulaire = new HTML_formulaireAppl('formulaire_appl', '', str_replace ('&amp;', '&', $url->getURL())) ;
229 alex 107
        $formulaire->construitFormulaire($url) ;
108
 
109
        // On ajoute un champs caché avec action=nouveau_v
110
        if ($GLOBALS['action'] == 'nouveau') {
111
            $formulaire->addElement ('hidden', 'action', 'nouveau_v') ;
112
            return $formulaire->toHTML() ;
113
        }
300 alex 114
        if (isset ($GLOBALS['id_appl']) && $GLOBALS['action'] != 'modifier_v' && $GLOBALS['action'] != 'supprimer') {
229 alex 115
            $formulaire->addElement ('hidden', 'action', 'modifier_v') ;
300 alex 116
            $formulaire->addElement ('hidden', 'id_appl', $GLOBALS['id_appl']) ;
117
            $formulaire->setDefaults(adap_valeurs_par_defaut($GLOBALS['id_appl'], $db)) ;
229 alex 118
            return $formulaire->toHTML() ;
119
        }
120
        if ($GLOBALS['action'] == 'modifier_v') {
121
            if ($formulaire->validate()) {
122
                mise_a_jour ($formulaire->getSubmitValues(), $db) ;
123
            }
124
        }
125
        if ($GLOBALS['action'] == 'nouveau_v') {
126
            if ($formulaire->validate()) {
127
                insertion ($formulaire->getSubmitValues(), $db) ;
128
            }
129
        }
130
 
131
    }
132
    // Comportement par défaut
300 alex 133
    // requete sur la table gen_application
923 jp_milcent 134
    $requete = 'SELECT gap_id_application, gap_nom FROM gen_application ORDER BY gap_nom ASC' ;
229 alex 135
 
136
    $resultat = $db->query ($requete) ;
137
    if (DB::isError ($resultat)) {
138
        $GLOBALS['_GEN_commun']['debogage_erreur']->gererErreur(E_USER_WARNING, "Echec de la requete : $requete<br />".$resultat->getMessage(),
300 alex 139
                                                                        __FILE__, __LINE__, 'admin_appl')   ;
229 alex 140
        return ;
141
    }
142
    $liste = new HTML_TableFragmenteur () ;
300 alex 143
    $liste->construireEntete(array (ADAP_NOM_APPL, ADAP_SUPPRIMER)) ;
144
    $tableau_appl = array() ;
229 alex 145
    while ($ligne = $resultat->fetchRow()) {
300 alex 146
        $url->addQueryString ('id_appl', $ligne[0]) ;
147
        array_push ($tableau_appl, array ('<a href="'.$url->getURL().'">'.$ligne[1].'</a>'."\n",    // Première colonne, le nom de l'application
148
                                            '<a href="'.$url->getURL().'&amp;action=supprimer" onclick="javascript:return confirm (\''.ADAP_SUPPRIMER.' ?\');">'.ADAP_SUPPRIMER.'</a>'."\n"
229 alex 149
                                            ));
150
    }
300 alex 151
    $liste->construireListe($tableau_appl) ;
229 alex 152
    $res .= $liste->toHTML();
153
    return $res ;
154
}// Fin de la fonction afficherContenuCorps()
155
 
156
// +------------------------------------------------------------------------------------------------------+
157
// |                                            PIED du PROGRAMME                                         |
158
// +------------------------------------------------------------------------------------------------------+
159
 
160
 
161
 
162
/* +--Fin du code ----------------------------------------------------------------------------------------+
163
*
164
* $Log: not supported by cvs2svn $
923 jp_milcent 165
* Revision 1.4  2005/03/09 10:46:17  jpm
166
* Changement d'un nom de fichier.
167
*
302 jpm 168
* Revision 1.3  2005/03/09 10:40:26  alex
169
* version initiale
170
*
300 alex 171
* Revision 1.2  2005/02/28 10:32:59  jpm
172
* Changement de nom de dossier.
173
*
276 jpm 174
* Revision 1.1  2004/12/13 18:07:19  alex
175
* version initiale
229 alex 176
*
276 jpm 177
*
229 alex 178
* +-- Fin du code ----------------------------------------------------------------------------------------+
179
*/
180
?>