Subversion Repositories Applications.papyrus

Rev

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

Rev 1293 Rev 1298
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: adwi_HTML_formulaireWikini.class.php,v 1.9 2007-04-06 08:40:13 neiluj Exp $
22
// CVS : $Id: adwi_HTML_formulaireWikini.class.php,v 1.10 2007-04-11 08:30:12 neiluj Exp $
23
/**
23
/**
24
*
24
*
25
* Admin Wikini
25
* Admin Wikini
26
*
26
*
27
* Classe affichage gestion des Wikini de Papyrus
27
* Classe affichage gestion des Wikini de Papyrus
28
*
28
*
29
*@package projet
29
*@package projet
30
//Auteur original :
30
//Auteur original :
31
*@author        David Delon <david.delon@clapas.net>
31
*@author        David Delon <david.delon@clapas.net>
32
//Autres auteurs :
32
//Autres auteurs :
33
*@author        Aucun
33
*@author        Aucun
34
*@copyright     Tela-Botanica 2000-2004
34
*@copyright     Tela-Botanica 2000-2004
35
*@version       $Revision: 1.9 $
35
*@version       $Revision: 1.10 $
36
// +------------------------------------------------------------------------------------------------------+
36
// +------------------------------------------------------------------------------------------------------+
37
*/
37
*/
38
 
38
 
39
 
39
 
40
// +------------------------------------------------------------------------------------------------------+
40
// +------------------------------------------------------------------------------------------------------+
41
// |                                            ENTETE du PROGRAMME                                       |
41
// |                                            ENTETE du PROGRAMME                                       |
42
// +------------------------------------------------------------------------------------------------------+
42
// +------------------------------------------------------------------------------------------------------+
43
 
43
 
44
/** Inclure le fichier de langue pour utiliser cette classe de façon autonome. */
44
/** Inclure le fichier de langue pour utiliser cette classe de façon autonome. */
45
 
45
 
46
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm.php' ;
46
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm.php' ;
47
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/checkbox.php' ;
47
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/checkbox.php' ;
48
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/select.php' ;
48
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/select.php' ;
49
 
49
 
50
// +------------------------------------------------------------------------------------------------------+
50
// +------------------------------------------------------------------------------------------------------+
51
// |                                           LISTE des constantes                                       |
51
// |                                           LISTE des constantes                                       |
52
// +------------------------------------------------------------------------------------------------------+
52
// +------------------------------------------------------------------------------------------------------+
53
 
53
 
54
 
54
 
55
/**
55
/**
56
 * class HTML_formulaireProjet
56
 * class HTML_formulaireProjet
57
 * Cette classe représente un formulaire pour saisir un wikini ou le modifier
57
 * Cette classe représente un formulaire pour saisir un wikini ou le modifier
58
 */
58
 */
59
class HTML_formulaireWikini extends HTML_QuickForm
59
class HTML_formulaireWikini extends HTML_QuickForm
60
{
60
{
61
	
-
 
62
	var $me;
-
 
63
	var $squelette;
-
 
64
	
-
 
65
    /**
61
    /**
66
     * Constructeur
62
     * Constructeur
67
     *
63
     *
68
     * @param string formName Le nom du formulaire.
64
     * @param string formName Le nom du formulaire.
69
     * @param string method Soit get soit post, voir le protocole HTTP
65
     * @param string method Soit get soit post, voir le protocole HTTP
70
     * @param string action L'action du formulaire.
66
     * @param string action L'action du formulaire.
71
     * @param string target La cible du formulaire.
67
     * @param string target La cible du formulaire.
72
     * @param Array attributes Des attributs supplémentaires pour la balise <form>
68
     * @param Array attributes Des attributs supplémentaires pour la balise <form>
73
     * @param bool trackSubmit Pour repérer si la formulaire a été soumis.
69
     * @param bool trackSubmit Pour repérer si la formulaire a été soumis.
74
     * @return void
70
     * @return void
75
     * @access public
71
     * @access public
76
     */
72
     */
77
    function HTML_formulaireWikini( $formName = "",  $method = "post",  $action = "",  $target = "_self",  $attributes = "",  $trackSubmit = false )
73
    function HTML_formulaireWikini( $formName = "",  $method = "post",  $action = "",  $target = "_self",  $attributes = "",  $trackSubmit = false )
78
    {
74
    {
79
        HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit) ;
75
        HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit) ;
80
    	$this->squelette = & $this->defaultRenderer();
-
 
81
    } // end of member function HTML_formulaireProjet
76
    } // end of member function HTML_formulaireProjet
82
 
77
 
83
    /**
78
    /**
84
     * Renvoie le code HTML du formulaire.
79
     * Renvoie le code HTML du formulaire.
85
     *
80
     *
86
     * @return string
81
     * @return string
87
     * @access public
82
     * @access public
88
     */
83
     */
89
    function toHTML( )
84
    function toHTML( )
90
    {
85
    {
91
        $res = HTML_QuickForm::toHTML() ;
86
        $res = HTML_QuickForm::toHTML() ;
92
       return $res ;
87
        return $res ;
93
    } // end of member function toHTML
88
    } // end of member function toHTML
94
 
89
 
95
    /**
90
    /**
96
     * Ajoute les champs nécessaire au formulaire.
91
     * Ajoute les champs nécessaire au formulaire.
97
     *
92
     *
98
     * @return void
93
     * @return void
99
     * @access public
94
     * @access public
100
     */
95
     */
101
    function construitFormulaire($url_retour)
96
    function construitFormulaire($url_retour)
102
    {
97
    {
103
		// template
-
 
104
		$this->addElement('html'," 
-
 
105
			<script type=\"text/javascript\">
-
 
106
				//<![CDATA[
-
 
107
				var options = false;
-
 
108
				function showOptions() { 
-
 
109
							el = document.getElementById(\"advanced\");
-
 
110
							btn = document.getElementById('optionsbtn');
-
 
111
							if (!options) {
-
 
112
									el.style.display = 'block';
-
 
113
									options = true;
-
 
114
									btn.value = 'Options Avancees <<';
-
 
115
							}else{
-
 
116
							   	el.style.display = 'none';
-
 
117
							   	options = false;
-
 
118
							   	btn.value = 'Options Avancees >>';
-
 
119
						}
-
 
120
						return options;
-
 
121
				}
-
 
122
				//]]>
-
 
123
				</script>");
-
 
124
				
-
 
125
		
-
 
126
		$this->squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'{content}'."\n".'</form>'."\n");
-
 
127
		$this->squelette->setElementTemplate( '<p class="formulaire_element">'."\n".'<label>'."\n".
-
 
128
			'{label}'."\n".
-
 
129
			'<!-- BEGIN required --><span class="symbole_obligatoire">&nbsp;*</span><!-- END required -->&nbsp;'."\n".
-
 
130
			'</label>'."\n".
-
 
131
			'{element}'."\n".
-
 
132
			'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
-
 
133
			'</p>'."\n");
-
 
134
		
-
 
135
		$this->squelette->setRequiredNoteTemplate("\n".'<p class="symbole_obligatoire">*&nbsp;:&nbsp;{requiredNote}</p>'."\n");
-
 
136
	
-
 
137
		
98
 
138
        $this->addElement ('text', 'code_alpha_wikini', ADWI_NOM_WIKINI, array('class' => 'champs_input')) ;
99
        $this->addElement ('text', 'code_alpha_wikini', ADWI_NOM_WIKINI, array ('size' => 60)) ;
139
        $this->addRule ('code_alpha_wikini', ADWI_NOM_WIKINI_ALERTE, 'required', '', 'client') ;
100
        $this->addRule ('code_alpha_wikini', ADWI_NOM_WIKINI_ALERTE, 'required', '', 'client') ;
140
		// UPDATE: Depuis la nouvelle fonction genere_nom_wiki() les espaces / accents sont autorisés.
-
 
141
		// $this->addRule ('code_alpha_wikini', ADWI_NOM_WIKINI_NON_VALIDE, 'lettersonly', '', 'client');
101
		$this->addRule ('code_alpha_wikini', ADWI_NOM_WIKINI_NON_VALIDE, 'lettersonly', '', 'client');
142
        $this->addRule ('code_alpha_wikini', ADWI_NOM_WIKINI_NON_VALIDE, 'required', '', 'client');
-
 
143
        // Défaut : PagePrincipale
102
        // Défault : PagePrincipale
144
        $this->addElement ('text', 'page', ADWI_PAGE, array('class' => 'champs_input')) ;
103
        $this->addElement ('text', 'page', ADWI_PAGE, array ('size' => 60)) ;
145
        $this->addElement('button', 'Options Avanc&eacute;es >>', 'Options Avancees >>', array ("onclick" => "showOptions()",
-
 
146
        												'id' => 'optionsbtn', 'class' => 'bouton'));
-
 
147
		$this->addElement ('html', '<div id="advanced" style="display:none;">');
-
 
148
     
104
 
149
       // $this->addElement ('static', '', 'Configuration avanc&eacute;e : ') ;
105
        $this->addElement ('static', '', 'Configuration avancée : ') ;
150
 
106
 
151
        $this->addElement ('text', 'bdd_hote', ADWI_BDD_HOTE, array('class' => 'champs_input')) ;
107
        $this->addElement ('text', 'bdd_hote', ADWI_BDD_HOTE, array ('size' => 60)) ;
152
        $this->addElement ('text', 'bdd_nom', ADWI_BDD_NOM, array('class' => 'champs_input')) ;
108
        $this->addElement ('text', 'bdd_nom', ADWI_BDD_NOM, array ('size' => 60)) ;
153
        $this->addElement ('text', 'bdd_utilisateur', ADWI_BDD_UTILISATEUR, array('class' => 'champs_input')) ;
109
        $this->addElement ('text', 'bdd_utilisateur', ADWI_BDD_UTILISATEUR, array ('size' => 60)) ;
154
        $this->addElement ('password', 'bdd_mdp', ADWI_BDD_MDP, array('class' => 'champs_input')) ;
110
        $this->addElement ('password', 'bdd_mdp', ADWI_BDD_MDP, array ('size' => 60)) ;
155
        $this->addElement ('text', 'table_prefix', ADWI_TABLE_PREFIX, array('class' => 'champs_input')) ;
111
        $this->addElement ('text', 'table_prefix', ADWI_TABLE_PREFIX, array ('size' => 60)) ;
156
        $this->addElement ('text', 'chemin', ADWI_CHEMIN, array('class' => 'champs_input')) ;
112
        $this->addElement ('text', 'chemin', ADWI_CHEMIN, array ('size' => 60)) ;
157
 
113
 
158
        $this->setRequiredNote('<span style="color: #ff0000">*</span>'.ADWI_CHAMPS_REQUIS) ;
114
        $this->setRequiredNote('<span style="color: #ff0000">*</span>'.ADWI_CHAMPS_REQUIS) ;
159
		 
-
 
160
		$this->addElement ('html', '</div>');
-
 
161
		
115
 
162
        // on fait un groupe avec les boutons pour les mettres sur la même ligne
116
        // on fait un groupe avec les boutons pour les mettres sur la même ligne
163
        $buttons[] = $this->createElement('button', 'annuler', ADWI_ANNULER, array ("onclick" => "javascript:document.location.href='".str_replace ('&amp;', '&', $url_retour->getURL())."'",
117
        $buttons[] = &HTML_QuickForm::createElement('button', 'annuler', ADWI_ANNULER, array ("onclick" => "javascript:document.location.href='".str_replace ('&amp;', '&', $url_retour->getURL())."'",
164
        												'id' => 'annuler', 'class' => 'bouton'));
118
        												'id' => 'annuler', 'class' => 'bouton'));
165
        $buttons[] = $this->createElement('submit', 'valider', ADWI_VALIDER, array ('id' => 'valider', 'class' =>'bouton'));
119
        $buttons[] = &HTML_QuickForm::createElement('submit', 'valider', ADWI_VALIDER, array ('id' => 'valider', 'class' =>'bouton'));
166
        $this->addGroup($buttons, null, null, '&nbsp;');
120
        $this->addGroup($buttons, null, null, '&nbsp;');
167
       
121
 
168
    } // end of member function _construitFormulaire
122
    } // end of member function _construitFormulaire
169
} // end of HTML_formulaireProjet
123
} // end of HTML_formulaireProjet
170
?>
124
?>