Subversion Repositories Applications.papyrus

Rev

Rev 1184 | Rev 1498 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1184 Rev 1496
Line 17... Line 17...
17
// |                                                                                                      |
17
// |                                                                                                      |
18
// | You should have received a copy of the GNU Lesser General Public                                     |
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                                  |
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: afficheur.admin.php,v 1.22 2007-01-03 11:28:34 ddelon Exp $
22
// CVS : $Id: afficheur.admin.php,v 1.23 2007-06-26 13:30:48 jp_milcent Exp $
23
/**
23
/**
24
* Gestion de la rédaction du contenu pour Papyrus.
24
* Gestion de la rédaction du contenu pour Papyrus.
25
*
25
*
26
* Contient les fonctions nécessaires à la gestion du contenu de Papyrus.
26
* Contient les fonctions nécessaires à la gestion du contenu de Papyrus.
27
*
27
*
Line 30... Line 30...
30
//Auteur original :
30
//Auteur original :
31
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
31
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
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.22 $ $Date: 2007-01-03 11:28:34 $
35
*@version       $Revision: 1.23 $ $Date: 2007-06-26 13:30:48 $
36
// +------------------------------------------------------------------------------------------------------+
36
// +------------------------------------------------------------------------------------------------------+
37
*/
37
*/
Line 38... Line 38...
38
 
38
 
39
// +------------------------------------------------------------------------------------------------------+
39
// +------------------------------------------------------------------------------------------------------+
Line 86... Line 86...
86
        }
86
        }
87
        $this->sortie_xhtml .= $this->_redigerContenu($this->objet_pear_db, $this->objet_pear_url, $_GET['adme_site_id'], $_GET['adme_menu_id'], $_GET['adme_action']);
87
        $this->sortie_xhtml .= $this->_redigerContenu($this->objet_pear_db, $this->objet_pear_url, $_GET['adme_site_id'], $_GET['adme_menu_id'], $_GET['adme_action']);
88
        return $this->sortie_xhtml;
88
        return $this->sortie_xhtml;
89
    }
89
    }
Line 90... Line 90...
90
    
90
    
91
    function _redigerContenu($db, $url, $adme_site_id, $adme_menu_id, $adme_action) {
-
 
92
    
-
 
93
   
91
    function _redigerContenu($db, $url, $adme_site_id, $adme_menu_id, $adme_action)
94
    	$contenu='';
-
 
95
    	
92
    {
96
        //-------------------------------------------------------------------------------------------------------------------
93
        //-------------------------------------------------------------------------------------------------------------------
-
 
94
        // Initialisation de variable
-
 
95
    	$contenu = '';
97
        // Initialisation de variable
96
    	$donnees = array();
98
        $url->addQueryString('adme_site_id', $adme_site_id);
97
        $url->addQueryString('adme_site_id', $adme_site_id);
99
        $url->addQueryString('adme_menu_id', $adme_menu_id);
98
        $url->addQueryString('adme_menu_id', $adme_menu_id);
100
        $url->addQueryString('adme_action', $adme_action);
-
 
Line 101... Line -...
101
    
-
 
102
   
99
        $url->addQueryString('adme_action', $adme_action);
103
   
-
 
104
   		$ligne_dernier_contenu=GEN_rechercheContenu($db,$adme_menu_id,DB_FETCHMODE_ASSOC);
-
 
105
   
-
 
106
        
100
   
107
        // Hack :
-
 
108
        
101
   		$ligne_dernier_contenu = GEN_rechercheContenu($db, $adme_menu_id, DB_FETCHMODE_ASSOC);
109
        $retour = '<h1>'.'Rédaction'.'</h1>'."\n";
102
 
110
        //-------------------------------------------------------------------------------------------------------------------
103
        //-------------------------------------------------------------------------------------------------------------------
111
        // Création du formulaire
-
 
112
        $form =& new HTML_QuickForm('form_modifier_contenu', 'post', str_replace('&amp;', '&', $url->getUrl()));
-
 
113
        $tab_index = 1000;
-
 
114
        $squelette =& $form->defaultRenderer();
-
 
115
        $squelette->setFormTemplate("\n".'<form{attributes}>'."\n".'<ul>'."\n".'{content}'."\n".'</ul>'."\n".'</form>'."\n");
-
 
116
        $squelette->setElementTemplate(  '<li>'."\n".
-
 
117
                                        '{label}'."\n".
-
 
118
                                        '{element}'."\n".
-
 
119
                                        '<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required -->'."\n".
-
 
120
                                        '<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
-
 
121
                                        '</li>'."\n");
-
 
122
        //$squelette->setHeaderTemplate('<p>{header}</p>');
-
 
123
        //$form->addElement('header', 'Entete', 'REDACTION');.liste_bouton li{display:inline;}
-
 
124
        $aso_options = array();
104
        // Récupération des données
-
 
105
        $donnees['form_url'] = str_replace('&', '&amp;', $url->getUrl());
-
 
106
		
125
        $form->addElement('hidden','gmc_ce_type_contenu',1);
107
		// Gestion de FckEditor
126
        
108
		$donnees['fck_editor'] = '';
127
        if ($GLOBALS['_AFFI_']['fckeditor']['utilisation']) {
109
        if ($GLOBALS['_AFFI_']['fckeditor']['utilisation']) {
128
            /** Inclusion du fichier de FCKeditor*/
110
            /** Inclusion du fichier de FCKeditor*/
129
            require_once AFFI_CHEMIN_FCKEDITOR.'fckeditor.php';
111
            require_once AFFI_CHEMIN_FCKEDITOR.'fckeditor.php';
130
            $fckeditor = new FCKeditor('gmc_contenu');
112
            $fckeditor = new FCKeditor('gmc_contenu');
131
            if ($ligne_dernier_contenu['gmc_contenu']) {
-
 
132
	            $fckeditor->Value = $ligne_dernier_contenu['gmc_contenu'];
113
            if ($ligne_dernier_contenu['gmc_contenu']) {
133
            }
114
	            $fckeditor->Value = $ligne_dernier_contenu['gmc_contenu'];
134
            else {
115
            } else {
135
            	if ($contenu) {
-
 
136
            		$fckeditor->Value = $contenu;
116
            	if ($contenu) {
137
            	}
117
            		$fckeditor->Value = $contenu;
138
            	else {
118
            	} else {
139
            		$fckeditor->Value = '';
119
            		$fckeditor->Value = '';
140
            	}
-
 
141
            } 
120
            	}
142
            
121
            } 
143
            $fckeditor->Height = $GLOBALS['_AFFI_']['fckeditor']['hauteur'];
122
            $fckeditor->Height = $GLOBALS['_AFFI_']['fckeditor']['hauteur'];
144
            $fckeditor->ToolbarSet = $GLOBALS['_AFFI_']['fckeditor']['barre'];
123
            $fckeditor->ToolbarSet = $GLOBALS['_AFFI_']['fckeditor']['barre'];
145
            $fckeditor->Config['CustomConfigurationsPath']=$GLOBALS['_AFFI_']['fckeditor']['CustomConfigurationsPath'];
124
            $fckeditor->Config['CustomConfigurationsPath']=$GLOBALS['_AFFI_']['fckeditor']['CustomConfigurationsPath'];
146
            $fckeditor->Config['AutoDetectLanguage'] = false;
125
            $fckeditor->Config['AutoDetectLanguage'] = false;
147
            $fckeditor->Config['DefaultLanguage'] = $GLOBALS['_AFFI_']['fckeditor']['langue'];
126
            $fckeditor->Config['DefaultLanguage'] = $GLOBALS['_AFFI_']['fckeditor']['langue'];
148
            $fckeditor->BasePath = AFFI_CHEMIN_FCKEDITOR;
127
            $fckeditor->BasePath = AFFI_CHEMIN_FCKEDITOR;
149
            if ($fckeditor->IsCompatible()) {
-
 
150
                $form->addElement('html', '<li>'.$fckeditor->CreateHtml().'</li>');
-
 
151
            } else {
128
            if ($fckeditor->IsCompatible()) {
152
                $GLOBALS['_AFFI_']['fckeditor']['utilisation'] = false;
129
                $donnees['fck_editor'] = $fckeditor->CreateHtml();
153
            }
-
 
154
        }
-
 
155
        if (!$GLOBALS['_AFFI_']['fckeditor']['utilisation']) {
-
 
156
            $id = 'gmc_contenu';
-
 
157
            $aso_attributs = array('id'=> $id, 'tabindex' => $tab_index++, 'rows' => 20, 'cols' => 100);
-
 
158
            $label = '<label for="'.$id.'">'.'Contenu : '.'</label>';
-
 
159
            $form->addElement('textarea', $id, $label, $aso_attributs);
130
            }
160
        } 
131
        }
161
        
-
 
162
        $aso_options = array();
-
 
163
        $aso_options[1] = 'Mineure';
132
 
164
        $aso_options[2] = 'Majeure';
-
 
165
        $id = 'gmc_ce_type_modification';
-
 
166
        $aso_attributs = array('id'=> $id, 'tabindex' => $tab_index++);
-
 
167
        $label = '<label for="'.$id.'">'.'Type de modification : '.'</label>';
133
        // Identifiant du menu
168
        $form->addElement('select', $id, $label, $aso_options, $aso_attributs);
134
        $donnees['gmc_ce_menu'] = $adme_menu_id;
169
        
-
 
170
        $id = 'gmc_resume_modification';
-
 
171
        $aso_attributs = array('id'=> $id, 'tabindex' => $tab_index++, 'size' => 45, 'maxlength' => 255);
135
        
172
        $label = '<label for="'.$id.'">'.'Resumé modification : '.'</label>';
136
        // Type de contenu
173
        $form->addElement('text', $id, $label, $aso_attributs);
137
        // Par défaut c'est du XHTML (donc 1)
174
        $ligne_dernier_contenu['gmc_ce_menu']=$adme_menu_id;
138
		$donnees['gmc_ce_type_contenu'] = 1;
-
 
139
        if (isset($ligne_dernier_contenu['gmc_ce_type_contenu'])) {
175
        $form->addElement('hidden','gmc_ce_menu',$ligne_dernier_contenu['gmc_ce_menu']);
140
        	$donnees['gmc_ce_type_contenu'] = $ligne_dernier_contenu['gmc_ce_type_contenu'];
-
 
141
        }
176
        $form->addElement('hidden','gmc_ce_type_contenu_table',$ligne_dernier_contenu['gmc_ce_type_contenu']);
142
        
177
        
-
 
178
        // .liste_bouton li{display:inline;}
143
		//+------------------------------------------------------------------------------------------------------------+
179
        
144
		// Extrait les variables et les ajoutes à l'espace de noms local
180
        $liste_bouton_debut = '<ul class="liste_bouton">'."\n";
145
		// Gestion des squelettes
-
 
146
		extract($donnees);
181
        $form->addElement('html', $liste_bouton_debut);
147
		// Démarre le buffer
182
        $form->addElement('submit', 'afficheur_enregistrer_quitter', 'Enregistrer et quitter');
148
		ob_start();
183
        $form->addElement('submit', 'afficheur_enregistrer_rester', 'Enregistrer et rester en édition');
149
		// Inclusion du fichier
184
        $form->addElement('submit', 'afficheur_annuler', 'Annuler');
150
		include(AFFI_CHEMIN_SQUELETTE.'formulaire.tpl.html');
185
        $liste_bouton_fin = '</ul>'."\n";
-
 
186
        $form->addElement('html', $liste_bouton_fin);
151
		// Récupérer le  contenu du buffer
187
        
-
 
188
        $form->setDefaults($ligne_dernier_contenu);
152
		$contenu = ob_get_contents();
Line 189... Line 153...
189
        
153
		// Arrête et détruit le buffer
190
        $retour .= $form->toHTML()."\n";
-
 
191
        
-
 
192
        return $retour;
154
		ob_end_clean();
Line 193... Line -...
193
    
-
 
194
   
155
        
195
	} 
156
        return $contenu;
196
    
157
	} 
197
    
158
    
198
    /** Méthode ajouterContenu() - Enregistre les infos du formulaire de saisie d'un menu
159
    /** Méthode ajouterContenu() - Enregistre les infos du formulaire de saisie d'un menu
199
    *
160
    *
200
    *
161
    *
201
    *   @return  void  les données sont enregistrées dans la base de données.
162
    *   @return  void  les données sont enregistrées dans la base de données.
202
    */
163
    */
203
    function _ajouterContenu($db, $url, $auth, $adme_menu_id, $tab_valeur)
164
    function _ajouterContenu($db, $url, $auth, $adme_menu_id, $tab_valeur)
204
    {
-
 
Line 205... Line 165...
205
    	//-------------------------------------------------------------------------------------------------------------------
165
    {
206
        // Récupération des informations du contenu concerné.
166
    	//-------------------------------------------------------------------------------------------------------------------
207
        $ligne_menu = GEN_lireInfoMenu($db, $adme_menu_id, DB_FETCHMODE_ASSOC);
167
        // Récupération des informations du contenu concerné.
208
        
168
        $ligne_menu = GEN_lireInfoMenu($db, $adme_menu_id, DB_FETCHMODE_ASSOC);
Line 256... Line 216...
256
 
216
 
257
 
217
 
258
/* +--Fin du code ----------------------------------------------------------------------------------------+
218
/* +--Fin du code ----------------------------------------------------------------------------------------+
-
 
219
*
-
 
220
* $Log: not supported by cvs2svn $
-
 
221
* Revision 1.22  2007-01-03 11:28:34  ddelon
259
*
222
* correction bug multilinguisme (portage bug livraison)
260
* $Log: not supported by cvs2svn $
223
*
261
* Revision 1.21  2006/12/01 16:59:45  florian
224
* Revision 1.21  2006/12/01 16:59:45  florian
262
* Ajout d'une variable parametrant la recherche de balise d'applette dans le contenu généré par l'appli.
225
* Ajout d'une variable parametrant la recherche de balise d'applette dans le contenu généré par l'appli.
263
*
226
*