Subversion Repositories Applications.papyrus

Rev

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

Rev Author Line No. Line
1361 neiluj 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 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
// +------------------------------------------------------------------------------------------------------+
1497 florian 22
// CVS : $Id: adwi_HTML_formulaireWikini.class.php,v 1.13 2007-06-26 14:18:53 florian Exp $
1361 neiluj 23
/**
24
*
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
1497 florian 35
*@version       $Revision: 1.13 $
1361 neiluj 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
 
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' ;
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
{
61
    /**
62
     * Constructeur
63
     *
64
     * @param string formName Le nom du formulaire.
65
     * @param string method Soit get soit post, voir le protocole HTTP
66
     * @param string action L'action du formulaire.
67
     * @param string target La cible du formulaire.
68
     * @param Array attributes Des attributs supplémentaires pour la balise <form>
69
     * @param bool trackSubmit Pour repérer si la formulaire a été soumis.
70
     * @return void
71
     * @access public
72
     */
73
    function HTML_formulaireWikini( $formName = "",  $method = "post",  $action = "",  $target = "_self",  $attributes = "",  $trackSubmit = false )
74
    {
75
        HTML_QuickForm::HTML_QuickForm($formName, $method, $action, $target, $attributes, $trackSubmit) ;
76
    } // end of member function HTML_formulaireProjet
77
 
78
    /**
79
     * Renvoie le code HTML du formulaire.
80
     *
81
     * @return string
82
     * @access public
83
     */
84
    function toHTML( )
85
    {
86
        $res = HTML_QuickForm::toHTML() ;
87
        return $res ;
88
    } // end of member function toHTML
89
 
90
    /**
91
     * Ajoute les champs nécessaire au formulaire.
92
     *
93
     * @return void
94
     * @access public
95
     */
96
    function construitFormulaire($url_retour)
97
    {
1497 florian 98
		$squelette =& $this->defaultRenderer();
99
        $squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'{content}'."\n".'</form>'."\n");
100
		$squelette->setElementTemplate( '<p class="formulaire_element"><span class="form_label">'."\n".
101
			'{label}'."\n".
102
			'<!-- BEGIN required --><span style="color:red; width:5px; margin:0; padding:0;">*</span><!-- END required -->'."\n".
103
			'</span>'."\n".'{element}'."\n".
104
			'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
105
			'</p>'."\n");
106
		$squelette->setGroupElementTemplate('<p style="display:inline">{element}</p>', 'form_boutons');
107
		$squelette->setRequiredNoteTemplate("\n".'<p class="symbole_obligatoire">*&nbsp;:&nbsp;{requiredNote}</p>'."\n");
108
		//Note pour les erreurs javascript
109
		$this->setJsWarnings('Erreur de saisie', 'Veuillez verifier vos informations saisies');
1361 neiluj 110
 
1497 florian 111
        $this->addElement ('text', 'code_alpha_wikini', ADWI_NOM_WIKINI, array ('size' => 35)) ;
1361 neiluj 112
        $this->addRule ('code_alpha_wikini', ADWI_NOM_WIKINI_ALERTE, 'required', '', 'client') ;
113
		$this->addRule ('code_alpha_wikini', ADWI_NOM_WIKINI_NON_VALIDE, 'lettersonly', '', 'client');
1497 florian 114
 
115
		$script = 'function switchMenu(obj) {
116
				var el = document.getElementById(obj);
117
				if(el.style.display != "block")
118
				{
119
					el.style.display = "block";
120
				}
121
				else
122
				{
123
					el.style.display = "none";
124
				}
125
			}';
126
    	GEN_stockerCodeScript($script);
127
    	//Lien javascript pour cacher les options compliquées
128
    	$this->addElement('html', '<br /><a href="#" onclick="switchMenu(\'config_avancee\');" title="Afficher/Cacher la configuration avanc&eacute;e">Afficher/Cacher la configuration avanc&eacute;e</a><br />'."\n");
129
 
130
	    //début de la div cachée pour les options compliquées-----------------------------------------------
131
	    $this->addElement('html', '<div id="config_avancee" style="display:none;">');
132
		// Défault : PagePrincipale
133
        $this->addElement ('text', 'page', ADWI_PAGE, array ('size' => 35)) ;
134
        $this->addElement ('text', 'bdd_hote', ADWI_BDD_HOTE, array ('size' => 35)) ;
135
        $this->addElement ('text', 'bdd_nom', ADWI_BDD_NOM, array ('size' => 35)) ;
136
        $this->addElement ('text', 'bdd_utilisateur', ADWI_BDD_UTILISATEUR, array ('size' => 35)) ;
137
        $this->addElement ('password', 'bdd_mdp', ADWI_BDD_MDP, array ('size' => 35)) ;
138
        $this->addElement ('text', 'table_prefix', ADWI_TABLE_PREFIX, array ('size' => 35)) ;
139
        $this->addElement ('text', 'chemin', ADWI_CHEMIN, array ('size' => 35)) ;
140
		//fin de la div cachée pour les options compliquées-------------------------------------------------
141
    	$this->addElement('html', "\n".'</div>');
142
 
143
        $this->setRequiredNote(ADWI_CHAMPS_REQUIS) ;
1361 neiluj 144
 
145
        // on fait un groupe avec les boutons pour les mettres sur la même ligne
146
        $buttons[] = &HTML_QuickForm::createElement('button', 'annuler', ADWI_ANNULER, array ("onclick" => "javascript:document.location.href='".str_replace ('&amp;', '&', $url_retour->getURL())."'",
147
        												'id' => 'annuler', 'class' => 'bouton'));
148
        $buttons[] = &HTML_QuickForm::createElement('submit', 'valider', ADWI_VALIDER, array ('id' => 'valider', 'class' =>'bouton'));
1497 florian 149
        $this->addGroup($buttons, 'form_boutons', null, '&nbsp;');
1361 neiluj 150
 
151
    } // end of member function _construitFormulaire
152
} // end of HTML_formulaireProjet
153
?>