Subversion Repositories Applications.papyrus

Rev

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

Rev 332 Rev 832
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 General Public                                                  |
9
// | modify it under the terms of the GNU 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
// | General Public License for more details.                                                             |
16
// | General Public License for more details.                                                             |
17
// |                                                                                                      |
17
// |                                                                                                      |
18
// | You should have received a copy of the GNU General Public                                            |
18
// | You should have received a copy of the GNU 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: HTML_formulaireAuth.class.php,v 1.3 2005-04-14 13:54:51 jpm Exp $
22
// CVS : $Id: HTML_formulaireAuth.class.php,v 1.4 2006-04-28 12:41:49 florian Exp $
23
/**
23
/**
24
* Application projet
24
* Application projet
25
*
25
*
26
* La classe HTML_formulaireAuth
26
* La classe HTML_formulaireAuth
27
*
27
*
28
*@package projet
28
*@package projet
29
//Auteur original :
29
//Auteur original :
30
*@author        Alexandre Granier <alexandre@tela-botanica.org>
30
*@author        Alexandre Granier <alexandre@tela-botanica.org>
31
//Autres auteurs :
31
//Autres auteurs :
32
*@author        Aucun
32
*@author        Aucun
33
*@copyright     Tela-Botanica 2000-2004
33
*@copyright     Tela-Botanica 2000-2004
34
*@version       $Revision: 1.3 $
34
*@version       $Revision: 1.4 $
35
// +------------------------------------------------------------------------------------------------------+
35
// +------------------------------------------------------------------------------------------------------+
36
*/
36
*/
37
 
37
 
38
 
38
 
39
// +------------------------------------------------------------------------------------------------------+
39
// +------------------------------------------------------------------------------------------------------+
40
// |                                            ENTETE du PROGRAMME                                       |
40
// |                                            ENTETE du PROGRAMME                                       |
41
// +------------------------------------------------------------------------------------------------------+
41
// +------------------------------------------------------------------------------------------------------+
42
 
42
 
43
/** Inclure le fichier de langue pour utiliser cette classe de façon autonome. */
43
/** Inclure le fichier de langue pour utiliser cette classe de façon autonome. */
44
 
44
 
45
require_once 'HTML/QuickForm.php' ;
45
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm.php' ;
46
require_once 'HTML/QuickForm/checkbox.php' ;
46
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/checkbox.php' ;
47
require_once 'HTML/QuickForm/select.php' ;
47
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/select.php' ;
48
 
48
 
49
// +------------------------------------------------------------------------------------------------------+
49
// +------------------------------------------------------------------------------------------------------+
50
// |                                           LISTE des constantes                                       |
50
// |                                           LISTE des constantes                                       |
51
// +------------------------------------------------------------------------------------------------------+
51
// +------------------------------------------------------------------------------------------------------+
52
 
52
 
53
 
53
 
54
/**
54
/**
55
 * class HTML_formulaireProjet
55
 * class HTML_formulaireProjet
56
 * Cette classe représente un formulaire pour saisir un projet ou le modifier.
56
 * Cette classe représente un formulaire pour saisir un projet ou le modifier.
57
 */
57
 */
58
class HTML_formulaireAuth extends HTML_QuickForm
58
class HTML_formulaireAuth extends HTML_QuickForm
59
{
59
{
60
    /**
60
    /**
61
     * Constructeur
61
     * Constructeur
62
     *
62
     *
63
     * @param string formName Le nom du formulaire.
63
     * @param string formName Le nom du formulaire.
64
     * @param string method Soit get soit post, voir le protocole HTTP
64
     * @param string method Soit get soit post, voir le protocole HTTP
65
     * @param string action L'action du formulaire.
65
     * @param string action L'action du formulaire.
66
     * @param string target La cible du formulaire.
66
     * @param string target La cible du formulaire.
67
     * @param Array attributes Des attributs supplémentaires pour la balise <form>
67
     * @param Array attributes Des attributs supplémentaires pour la balise <form>
68
     * @param bool trackSubmit Pour repérer si la formulaire a été soumis.
68
     * @param bool trackSubmit Pour repérer si la formulaire a été soumis.
69
     * @return void
69
     * @return void
70
     * @access public
70
     * @access public
71
     */
71
     */
72
    function HTML_formulaireAuth($formName = '', $method = 'post', $action = '', $target = '_self', $attributes = '', $trackSubmit = false)
72
    function HTML_formulaireAuth($formName = '', $method = 'post', $action = '', $target = '_self', $attributes = '', $trackSubmit = false)
73
    {
73
    {
74
        HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit);
74
        HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit);
75
        $squelette =& $this->defaultRenderer();
75
        $squelette =& $this->defaultRenderer();
76
        $squelette->setFormTemplate("\n".'<form{attributes}>'."\n".'{content}'."\n".'</form>'."\n");
76
        $squelette->setFormTemplate("\n".'<form{attributes}>'."\n".'{content}'."\n".'</form>'."\n");
77
        $squelette->setElementTemplate(  '<li>'."\n".
77
        $squelette->setElementTemplate(  '<li>'."\n".
78
                                    '{label}'."\n".
78
                                    '{label}'."\n".
79
                                    '{element}'."\n".
79
                                    '{element}'."\n".
80
                                    '<!-- BEGIN required --><span class="symbole_obligatoire">'.ADAU_SYMBOLE_CHP_OBLIGATOIRE.'</span><!-- END required -->'."\n".
80
                                    '<!-- BEGIN required --><span class="symbole_obligatoire">'.ADAU_SYMBOLE_CHP_OBLIGATOIRE.'</span><!-- END required -->'."\n".
81
                                    '<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
81
                                    '<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
82
                                    '</li>'."\n");
82
                                    '</li>'."\n");
83
        $squelette->setRequiredNoteTemplate("\n".'<p><span class="symbole_obligatoire">'.ADAU_SYMBOLE_CHP_OBLIGATOIRE.'</span> {requiredNote}</p>'."\n");
83
        $squelette->setRequiredNoteTemplate("\n".'<p><span class="symbole_obligatoire">'.ADAU_SYMBOLE_CHP_OBLIGATOIRE.'</span> {requiredNote}</p>'."\n");
84
    } // end of member function HTML_formulaireProjet
84
    } // end of member function HTML_formulaireProjet
85
 
85
 
86
    /**
86
    /**
87
     * Renvoie le code HTML du formulaire.
87
     * Renvoie le code HTML du formulaire.
88
     *
88
     *
89
     * @return string
89
     * @return string
90
     * @access public
90
     * @access public
91
     */
91
     */
92
    function toHTML()
92
    function toHTML()
93
    {
93
    {
94
        $res = HTML_QuickForm::toHTML();
94
        $res = HTML_QuickForm::toHTML();
95
        return $res;
95
        return $res;
96
    } // end of member function toHTML
96
    } // end of member function toHTML
97
 
97
 
98
    /**
98
    /**
99
     * Ajoute les champs nécessaire au formulaire.
99
     * Ajoute les champs nécessaire au formulaire.
100
     *
100
     *
101
     * @return void
101
     * @return void
102
     * @access public
102
     * @access public
103
     */
103
     */
104
    function construitFormulaire($url_retour)
104
    function construitFormulaire($url_retour)
105
    {
105
    {
106
        $tab_index = 1000;
106
        $tab_index = 1000;
107
        $size = 60;
107
        $size = 60;
108
        $cols = 50;
108
        $cols = 50;
109
        $rows = 6;
109
        $rows = 6;
110
        
110
        
111
        $form_debut = '<fieldset>'."\n".'<legend>'.ADAU_NOM_FORM.'</legend>'."\n".'<ul>'."\n";
111
        $form_debut = '<fieldset>'."\n".'<legend>'.ADAU_NOM_FORM.'</legend>'."\n".'<ul>'."\n";
112
        $this->addElement('html', $form_debut);
112
        $this->addElement('html', $form_debut);
113
        
113
        
114
        $id = 'nom_auth';
114
        $id = 'nom_auth';
115
        $aso_attributs = array('id'=> $id, 'tabindex' => $tab_index++, 'size' => $size);
115
        $aso_attributs = array('id'=> $id, 'tabindex' => $tab_index++, 'size' => $size);
116
        $label = '<label for="'.$id.'">'.ADAU_NOM_AUTH.'</label>';
116
        $label = '<label for="'.$id.'">'.ADAU_NOM_AUTH.'</label>';
117
        $this->addElement('text', $id, $label, $aso_attributs);
117
        $this->addElement('text', $id, $label, $aso_attributs);
118
        $this->addRule('nom_auth', ADAU_NOM_AUTH_ALERTE, 'required', '', 'client');
118
        $this->addRule('nom_auth', ADAU_NOM_AUTH_ALERTE, 'required', '', 'client');
119
        
119
        
120
        $id = 'abreviation';
120
        $id = 'abreviation';
121
        $aso_attributs = array('id'=> $id, 'tabindex' => $tab_index++, 'size' => $size);
121
        $aso_attributs = array('id'=> $id, 'tabindex' => $tab_index++, 'size' => $size);
122
        $label = '<label for="'.$id.'">'.ADAU_ABREVIATION.'</label>';
122
        $label = '<label for="'.$id.'">'.ADAU_ABREVIATION.'</label>';
123
        $this->addElement('text', $id, $label, $aso_attributs);
123
        $this->addElement('text', $id, $label, $aso_attributs);
124
        $this->addRule('abreviation', ADAU_ABREVIATION_ALERTE, 'required', '', 'client');
124
        $this->addRule('abreviation', ADAU_ABREVIATION_ALERTE, 'required', '', 'client');
125
        
125
        
126
        $id = 'dsn';
126
        $id = 'dsn';
127
        $aso_attributs = array('id'=> $id, 'tabindex' => $tab_index++, 'size' => $size);
127
        $aso_attributs = array('id'=> $id, 'tabindex' => $tab_index++, 'size' => $size);
128
        $label = '<label for="'.$id.'">'.ADAU_DSN.'</label>';
128
        $label = '<label for="'.$id.'">'.ADAU_DSN.'</label>';
129
        $this->addElement('text', $id, $label, $aso_attributs);
129
        $this->addElement('text', $id, $label, $aso_attributs);
130
        $this->addRule('dsn', ADAU_DSN_ALERTE, 'required', '', 'client');
130
        $this->addRule('dsn', ADAU_DSN_ALERTE, 'required', '', 'client');
131
        
131
        
132
        $id = 'nom_table';
132
        $id = 'nom_table';
133
        $aso_attributs = array('id'=> $id, 'tabindex' => $tab_index++, 'size' => $size);
133
        $aso_attributs = array('id'=> $id, 'tabindex' => $tab_index++, 'size' => $size);
134
        $label = '<label for="'.$id.'">'.ADAU_NOM_TABLE.'</label>';
134
        $label = '<label for="'.$id.'">'.ADAU_NOM_TABLE.'</label>';
135
        $this->addElement('text', $id, $label, $aso_attributs);
135
        $this->addElement('text', $id, $label, $aso_attributs);
136
        $this->addRule('nom_table', ADAU_NOM_TABLE_ALERTE, 'required', '', 'client');
136
        $this->addRule('nom_table', ADAU_NOM_TABLE_ALERTE, 'required', '', 'client');
137
        
137
        
138
        $id = 'champs_login';
138
        $id = 'champs_login';
139
        $aso_attributs = array('id'=> $id, 'tabindex' => $tab_index++, 'size' => $size);
139
        $aso_attributs = array('id'=> $id, 'tabindex' => $tab_index++, 'size' => $size);
140
        $label = '<label for="'.$id.'">'.ADAU_CHAMPS_LOGIN.'</label>';
140
        $label = '<label for="'.$id.'">'.ADAU_CHAMPS_LOGIN.'</label>';
141
        $this->addElement('text', $id, $label, $aso_attributs);
141
        $this->addElement('text', $id, $label, $aso_attributs);
142
        $this->addRule('champs_login', ADAU_CHAMPS_LOGIN_ALERTE, 'required', '', 'client');
142
        $this->addRule('champs_login', ADAU_CHAMPS_LOGIN_ALERTE, 'required', '', 'client');
143
        
143
        
144
        $id = 'champs_passe';
144
        $id = 'champs_passe';
145
        $aso_attributs = array('id'=> $id, 'tabindex' => $tab_index++, 'size' => $size);
145
        $aso_attributs = array('id'=> $id, 'tabindex' => $tab_index++, 'size' => $size);
146
        $label = '<label for="'.$id.'">'.ADAU_CHAMPS_PASSE.'</label>';
146
        $label = '<label for="'.$id.'">'.ADAU_CHAMPS_PASSE.'</label>';
147
        $this->addElement('text', $id, $label, $aso_attributs);
147
        $this->addElement('text', $id, $label, $aso_attributs);
148
        $this->addRule('champs_passe', ADAU_CHAMPS_PASSE_ALERTE, 'required', '', 'client');
148
        $this->addRule('champs_passe', ADAU_CHAMPS_PASSE_ALERTE, 'required', '', 'client');
149
        
149
        
150
        $id = 'cryptage';
150
        $id = 'cryptage';
151
        $aso_attributs = array('id'=> $id, 'tabindex' => $tab_index++, 'size' => $size);
151
        $aso_attributs = array('id'=> $id, 'tabindex' => $tab_index++, 'size' => $size);
152
        $label = '<label for="'.$id.'">'.ADAU_CRYPTAGE.'</label>';
152
        $label = '<label for="'.$id.'">'.ADAU_CRYPTAGE.'</label>';
153
        $this->addElement('text', $id, $label, $aso_attributs);
153
        $this->addElement('text', $id, $label, $aso_attributs);
154
        $this->addRule('cryptage', ADAU_CRYPTAGE_ALERTE, 'required', '', 'client');
154
        $this->addRule('cryptage', ADAU_CRYPTAGE_ALERTE, 'required', '', 'client');
155
        
155
        
156
        $id = 'parametres';
156
        $id = 'parametres';
157
        $aso_attributs = array('id'=> $id, 'tabindex' => $tab_index++, 'rows' => $rows, 'cols' => $cols);
157
        $aso_attributs = array('id'=> $id, 'tabindex' => $tab_index++, 'rows' => $rows, 'cols' => $cols);
158
        $label = '<label for="'.$id.'">'.ADAU_PARAMETRE.'</label>';
158
        $label = '<label for="'.$id.'">'.ADAU_PARAMETRE.'</label>';
159
        $this->addElement('textarea', $id, $label, $aso_attributs);
159
        $this->addElement('textarea', $id, $label, $aso_attributs);
160
        
160
        
161
        $form_fin = '</ul>'."\n".'</fieldset>'."\n";
161
        $form_fin = '</ul>'."\n".'</fieldset>'."\n";
162
        $this->addElement('html', $form_fin);
162
        $this->addElement('html', $form_fin);
163
        
163
        
164
        // Gestion des boutons
164
        // Gestion des boutons
165
        $liste_bouton_debut = '<ul class="liste_bouton">'."\n";
165
        $liste_bouton_debut = '<ul class="liste_bouton">'."\n";
166
        $this->addElement('html', $liste_bouton_debut);
166
        $this->addElement('html', $liste_bouton_debut);
167
        
167
        
168
        $this->addElement('submit', 'valider', ADAU_VALIDER);
168
        $this->addElement('submit', 'valider', ADAU_VALIDER);
169
        
169
        
170
        $bouton_annuler = '<li><a class="bouton" href="'.str_replace ('&amp;', '&', $url_retour->getURL()).'">'.ADAU_ANNULER.'</a></li>'."\n";
170
        $bouton_annuler = '<li><a class="bouton" href="'.str_replace ('&amp;', '&', $url_retour->getURL()).'">'.ADAU_ANNULER.'</a></li>'."\n";
171
        $this->addElement('html', $bouton_annuler);
171
        $this->addElement('html', $bouton_annuler);
172
        
172
        
173
        $liste_bouton_fin = '</ul>'."\n";
173
        $liste_bouton_fin = '</ul>'."\n";
174
        $this->addElement('html', $liste_bouton_fin);
174
        $this->addElement('html', $liste_bouton_fin);
175
        
175
        
176
        
176
        
177
        $this->setRequiredNote(ADAU_CHAMPS_REQUIS);
177
        $this->setRequiredNote(ADAU_CHAMPS_REQUIS);
178
        
178
        
179
    } // end of member function _construitFormulaire
179
    } // end of member function _construitFormulaire
180
 
180
 
181
} // end of HTML_formulaireProjet
181
} // end of HTML_formulaireProjet
182
?>
182
?>