Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
434 ddelon 1
<?php
600 ddelon 2
/*vim: set expandtab tabstop=4 shiftwidth=4: */
434 ddelon 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 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
// | General Public License for more details.                                                             |
17
// |                                                                                                      |
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                                  |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// +------------------------------------------------------------------------------------------------------+
1293 neiluj 22
// CVS : $Id: adwi_HTML_formulaireWikini.class.php,v 1.9 2007-04-06 08:40:13 neiluj Exp $
434 ddelon 23
/**
600 ddelon 24
*
434 ddelon 25
* Admin Wikini
26
*
27
* Classe affichage gestion des Wikini de Papyrus
28
*
29
*@package projet
30
//Auteur original :
31
*@author        David Delon <david.delon@clapas.net>
32
//Autres auteurs :
33
*@author        Aucun
34
*@copyright     Tela-Botanica 2000-2004
1293 neiluj 35
*@version       $Revision: 1.9 $
434 ddelon 36
// +------------------------------------------------------------------------------------------------------+
37
*/
38
 
39
 
40
// +------------------------------------------------------------------------------------------------------+
41
// |                                            ENTETE du PROGRAMME                                       |
42
// +------------------------------------------------------------------------------------------------------+
43
 
44
/** Inclure le fichier de langue pour utiliser cette classe de façon autonome. */
45
 
832 florian 46
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm.php' ;
47
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/checkbox.php' ;
48
require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/select.php' ;
434 ddelon 49
 
50
// +------------------------------------------------------------------------------------------------------+
51
// |                                           LISTE des constantes                                       |
52
// +------------------------------------------------------------------------------------------------------+
53
 
54
 
55
/**
56
 * class HTML_formulaireProjet
57
 * Cette classe représente un formulaire pour saisir un wikini ou le modifier
58
 */
59
class HTML_formulaireWikini extends HTML_QuickForm
60
{
1293 neiluj 61
 
62
	var $me;
63
	var $squelette;
64
 
434 ddelon 65
    /**
66
     * Constructeur
67
     *
68
     * @param string formName Le nom du formulaire.
69
     * @param string method Soit get soit post, voir le protocole HTTP
70
     * @param string action L'action du formulaire.
71
     * @param string target La cible du formulaire.
72
     * @param Array attributes Des attributs supplémentaires pour la balise <form>
73
     * @param bool trackSubmit Pour repérer si la formulaire a été soumis.
74
     * @return void
75
     * @access public
76
     */
77
    function HTML_formulaireWikini( $formName = "",  $method = "post",  $action = "",  $target = "_self",  $attributes = "",  $trackSubmit = false )
78
    {
79
        HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit) ;
1293 neiluj 80
    	$this->squelette = & $this->defaultRenderer();
434 ddelon 81
    } // end of member function HTML_formulaireProjet
82
 
83
    /**
84
     * Renvoie le code HTML du formulaire.
85
     *
86
     * @return string
87
     * @access public
88
     */
89
    function toHTML( )
90
    {
91
        $res = HTML_QuickForm::toHTML() ;
1293 neiluj 92
       return $res ;
434 ddelon 93
    } // end of member function toHTML
94
 
95
    /**
96
     * Ajoute les champs nécessaire au formulaire.
97
     *
98
     * @return void
99
     * @access public
100
     */
101
    function construitFormulaire($url_retour)
102
    {
1293 neiluj 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
 
138
        $this->addElement ('text', 'code_alpha_wikini', ADWI_NOM_WIKINI, array('class' => 'champs_input')) ;
434 ddelon 139
        $this->addRule ('code_alpha_wikini', ADWI_NOM_WIKINI_ALERTE, 'required', '', 'client') ;
1293 neiluj 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');
142
        $this->addRule ('code_alpha_wikini', ADWI_NOM_WIKINI_NON_VALIDE, 'required', '', 'client');
143
        // Défaut : PagePrincipale
144
        $this->addElement ('text', 'page', ADWI_PAGE, array('class' => 'champs_input')) ;
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
 
149
       // $this->addElement ('static', '', 'Configuration avanc&eacute;e : ') ;
600 ddelon 150
 
1293 neiluj 151
        $this->addElement ('text', 'bdd_hote', ADWI_BDD_HOTE, array('class' => 'champs_input')) ;
152
        $this->addElement ('text', 'bdd_nom', ADWI_BDD_NOM, array('class' => 'champs_input')) ;
153
        $this->addElement ('text', 'bdd_utilisateur', ADWI_BDD_UTILISATEUR, array('class' => 'champs_input')) ;
154
        $this->addElement ('password', 'bdd_mdp', ADWI_BDD_MDP, array('class' => 'champs_input')) ;
155
        $this->addElement ('text', 'table_prefix', ADWI_TABLE_PREFIX, array('class' => 'champs_input')) ;
156
        $this->addElement ('text', 'chemin', ADWI_CHEMIN, array('class' => 'champs_input')) ;
600 ddelon 157
 
434 ddelon 158
        $this->setRequiredNote('<span style="color: #ff0000">*</span>'.ADWI_CHAMPS_REQUIS) ;
1293 neiluj 159
 
160
		$this->addElement ('html', '</div>');
161
 
434 ddelon 162
        // on fait un groupe avec les boutons pour les mettres sur la même ligne
1293 neiluj 163
        $buttons[] = $this->createElement('button', 'annuler', ADWI_ANNULER, array ("onclick" => "javascript:document.location.href='".str_replace ('&amp;', '&', $url_retour->getURL())."'",
946 alexandre_ 164
        												'id' => 'annuler', 'class' => 'bouton'));
1293 neiluj 165
        $buttons[] = $this->createElement('submit', 'valider', ADWI_VALIDER, array ('id' => 'valider', 'class' =>'bouton'));
434 ddelon 166
        $this->addGroup($buttons, null, null, '&nbsp;');
1293 neiluj 167
 
434 ddelon 168
    } // end of member function _construitFormulaire
169
} // end of HTML_formulaireProjet
170
?>