Subversion Repositories Applications.papyrus

Rev

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

Rev 832 Rev 1033
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.18 2006-04-28 12:41:49 florian Exp $
22
// CVS : $Id: afficheur.admin.php,v 1.19 2006-10-16 15:49:07 ddelon 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.18 $ $Date: 2006-04-28 12:41:49 $
35
*@version       $Revision: 1.19 $ $Date: 2006-10-16 15:49:07 $
36
// +------------------------------------------------------------------------------------------------------+
36
// +------------------------------------------------------------------------------------------------------+
37
*/
37
*/
Line 38... Line 38...
38
 
38
 
39
// +------------------------------------------------------------------------------------------------------+
39
// +------------------------------------------------------------------------------------------------------+
Line 89... Line 89...
89
        }
89
        }
90
        $this->sortie_xhtml .= $this->_redigerContenu($this->objet_pear_db, $this->objet_pear_url, $_GET['adme_site_id'], $_GET['adme_menu_id'], $_GET['adme_action']);
90
        $this->sortie_xhtml .= $this->_redigerContenu($this->objet_pear_db, $this->objet_pear_url, $_GET['adme_site_id'], $_GET['adme_menu_id'], $_GET['adme_action']);
91
        return $this->sortie_xhtml;
91
        return $this->sortie_xhtml;
92
    }
92
    }
Line -... Line 93...
-
 
93
    
-
 
94
    function _redigerContenu($db, $url, $adme_site_id, $adme_menu_id, $adme_action) {
-
 
95
    
-
 
96
   
-
 
97
    	$contenu='';
-
 
98
    	
-
 
99
        //-------------------------------------------------------------------------------------------------------------------
-
 
100
        // Initialisation de variable
-
 
101
        $url->addQueryString('adme_site_id', $adme_site_id);
-
 
102
        $url->addQueryString('adme_menu_id', $adme_menu_id);
-
 
103
        $url->addQueryString('adme_action', $adme_action);
-
 
104
    
-
 
105
   
-
 
106
   
-
 
107
   		$ligne_dernier_contenu=GEN_rechercheContenu($db,$adme_menu_id,DB_FETCHMODE_ASSOC);
-
 
108
   
-
 
109
        
-
 
110
        // Hack :
-
 
111
        
-
 
112
        $retour = '<h1>'.'Rédaction'.'</h1>'."\n";
-
 
113
        //-------------------------------------------------------------------------------------------------------------------
-
 
114
        // Création du formulaire
-
 
115
        $form =& new HTML_QuickForm('form_modifier_contenu', 'post', str_replace('&amp;', '&', $url->getUrl()));
-
 
116
        $tab_index = 1000;
-
 
117
        $squelette =& $form->defaultRenderer();
-
 
118
        $squelette->setFormTemplate("\n".'<form{attributes}>'."\n".'<ul>'."\n".'{content}'."\n".'</ul>'."\n".'</form>'."\n");
-
 
119
        $squelette->setElementTemplate(  '<li>'."\n".
-
 
120
                                        '{label}'."\n".
-
 
121
                                        '{element}'."\n".
-
 
122
                                        '<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required -->'."\n".
-
 
123
                                        '<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
-
 
124
                                        '</li>'."\n");
-
 
125
        //$squelette->setHeaderTemplate('<p>{header}</p>');
-
 
126
        //$form->addElement('header', 'Entete', 'REDACTION');
-
 
127
        $aso_options = array();
-
 
128
        $aso_options[1] = 'XHTML';
-
 
129
        $aso_options[2] = 'WIKINI';
-
 
130
        $id = 'gmc_ce_type_contenu';
-
 
131
        $aso_attributs = array('id'=> $id, 'tabindex' => $tab_index++);
-
 
132
        $label = '<label for="'.$id.'">'.'Type de contenu : '.'</label>';
-
 
133
        $form->addElement('select', $id, $label, $aso_options, $aso_attributs);
-
 
134
        
-
 
135
        if ($GLOBALS['_AFFI_']['fckeditor']['utilisation']) {
-
 
136
            /** Inclusion du fichier de FCKeditor*/
-
 
137
            require_once AFFI_CHEMIN_FCKEDITOR.'fckeditor.php';
-
 
138
            $fckeditor = new FCKeditor('gmc_contenu');
-
 
139
            if ($ligne_dernier_contenu['gmc_contenu']) {
-
 
140
	            $fckeditor->Value = $ligne_dernier_contenu['gmc_contenu'];
-
 
141
            }
-
 
142
            else {
-
 
143
            	if ($contenu) {
-
 
144
            		$fckeditor->Value = $contenu;
-
 
145
            	}
-
 
146
            	else {
-
 
147
            		$fckeditor->Value = '';
-
 
148
            	}
-
 
149
            } 
-
 
150
            
-
 
151
            $fckeditor->Height = $GLOBALS['_AFFI_']['fckeditor']['hauteur'];
-
 
152
            $fckeditor->ToolbarSet = $GLOBALS['_AFFI_']['fckeditor']['barre'];
-
 
153
            $fckeditor->Config['CustomConfigurationsPath']=$GLOBALS['_AFFI_']['fckeditor']['CustomConfigurationsPath'];
-
 
154
            $fckeditor->Config['AutoDetectLanguage'] = false;
-
 
155
            $fckeditor->Config['DefaultLanguage'] = $GLOBALS['_AFFI_']['fckeditor']['langue'];
-
 
156
            $fckeditor->BasePath = AFFI_CHEMIN_FCKEDITOR;
-
 
157
            if ($fckeditor->IsCompatible()) {
-
 
158
                $form->addElement('html', '<li>'.$fckeditor->CreateHtml().'</li>');
-
 
159
            } else {
-
 
160
                $GLOBALS['_AFFI_']['fckeditor']['utilisation'] = false;
-
 
161
            }
-
 
162
        }
-
 
163
        if (!$GLOBALS['_AFFI_']['fckeditor']['utilisation']) {
-
 
164
            $id = 'gmc_contenu';
-
 
165
            $aso_attributs = array('id'=> $id, 'tabindex' => $tab_index++, 'rows' => 20, 'cols' => 100);
-
 
166
            $label = '<label for="'.$id.'">'.'Contenu : '.'</label>';
-
 
167
            $form->addElement('textarea', $id, $label, $aso_attributs);
-
 
168
        } 
-
 
169
        
-
 
170
        $aso_options = array();
-
 
171
        $aso_options[1] = 'Mineure';
-
 
172
        $aso_options[2] = 'Majeure';
-
 
173
        $id = 'gmc_ce_type_modification';
-
 
174
        $aso_attributs = array('id'=> $id, 'tabindex' => $tab_index++);
-
 
175
        $label = '<label for="'.$id.'">'.'Type de modification : '.'</label>';
-
 
176
        $form->addElement('select', $id, $label, $aso_options, $aso_attributs);
-
 
177
        
-
 
178
        $id = 'gmc_resume_modification';
-
 
179
        $aso_attributs = array('id'=> $id, 'tabindex' => $tab_index++, 'size' => 45, 'maxlength' => 255);
-
 
180
        $label = '<label for="'.$id.'">'.'Resumé modification : '.'</label>';
-
 
181
        $form->addElement('text', $id, $label, $aso_attributs);
-
 
182
        $form->addElement('hidden','gmc_ce_menu',$ligne_dernier_contenu['gmc_ce_menu']);
-
 
183
        $form->addElement('hidden','gmc_ce_type_contenu_table',$ligne_dernier_contenu['gmc_ce_type_contenu']);
-
 
184
        
-
 
185
        $liste_bouton_debut = '<ul class="liste_bouton">'."\n";
-
 
186
        $form->addElement('html', $liste_bouton_debut);
-
 
187
        $form->addElement('submit', 'afficheur_enregistrer_quitter', 'Enregistrer et quitter');
-
 
188
        $form->addElement('submit', 'afficheur_enregistrer_rester', 'Enregistrer et rester en édition');
-
 
189
        $form->addElement('submit', 'afficheur_enregistrer_ss_entite', 'Remplacer les entités xhtml');
-
 
190
        $form->addElement('submit', 'afficheur_annuler', 'Annuler');
-
 
191
        $liste_bouton_fin = '</ul>'."\n";
-
 
192
        $form->addElement('html', $liste_bouton_fin);
-
 
193
        
-
 
194
        $form->setDefaults($ligne_dernier_contenu);
-
 
195
        
-
 
196
        $retour .= $form->toHTML()."\n";
-
 
197
        
-
 
198
        return $retour;
-
 
199
    
-
 
200
   
-
 
201
	} 
93
    
202
    
94
    /** Méthode redigerContenu() - Enregistre les infos du formulaire de saisie d'un menu
203
    /** Méthode redigerContenu() - Enregistre les infos du formulaire de saisie d'un menu
95
    *
204
    *
96
    *
205
    *
97
    *   @return  void  les données sont enregistrées dans la base de données.
206
    *   @return  void  les données sont enregistrées dans la base de données.
98
    */
207
    */
99
    function _redigerContenu($db, $url, $adme_site_id, $adme_menu_id, $adme_action)
208
    function _redigerContenuOld($db, $url, $adme_site_id, $adme_menu_id, $adme_action)
Line 100... Line 209...
100
    {
209
    {
Line 389... Line 498...
389
        $retour .= $form->toHTML()."\n";
498
        $retour .= $form->toHTML()."\n";
Line 390... Line 499...
390
        
499
        
391
        return $retour;
500
        return $retour;
Line -... Line 501...
-
 
501
    }
-
 
502
    
392
    }
503
    
393
    
504
    
394
    /** Méthode ajouterContenu() - Enregistre les infos du formulaire de saisie d'un menu
505
    /** Méthode ajouterContenu() - Enregistre les infos du formulaire de saisie d'un menu
395
    *
506
    *
396
    *
507
    *
Line 401... Line 512...
401
    	//-------------------------------------------------------------------------------------------------------------------
512
    	//-------------------------------------------------------------------------------------------------------------------
402
        // Récupération des informations du contenu concerné.
513
        // Récupération des informations du contenu concerné.
403
        $ligne_menu = GEN_lireInfoMenu($db, $adme_menu_id, DB_FETCHMODE_ASSOC);
514
        $ligne_menu = GEN_lireInfoMenu($db, $adme_menu_id, DB_FETCHMODE_ASSOC);
Line 404... Line -...
404
        
-
 
405
	        
-
 
406
	          
-
 
407
	    $id_langue = $GLOBALS['_GEN_commun']['i18n'];
-
 
408
	    
-
 
409
	    if (isset($id_langue) && ($id_langue!='')) {
-
 
410
			$langue_test=$id_langue;
-
 
411
		} else {
-
 
412
			$langue_test=GEN_I18N_ID_DEFAUT;
-
 
413
		}
-
 
414
	        
-
 
415
        
515
        
416
        
516
	        
417
        if ($ligne_menu == false) {
517
        if ($ligne_menu == false) {
418
            die('ERREUR Papyrus Administrateur de Menus: impossible de lire les infos du menu.<br />'.
518
            die('ERREUR Papyrus Administrateur de Menus: impossible de lire les infos du menu.<br />'.
419
                'Idenitifiant du menu n° : '. $adme_menu_id .'<br />'.
519
                'Idenitifiant du menu n° : '. $adme_menu_id .'<br />'.
Line 440... Line 540...
440
        // Obtention d'un nouvel identifiant de contenu
540
        // Obtention d'un nouvel identifiant de contenu
441
        $nouveau_id_contenu = SQL_obtenirNouveauId($db, 'gen_menu_contenu', 'gmc_id_contenu');
541
        $nouveau_id_contenu = SQL_obtenirNouveauId($db, 'gen_menu_contenu', 'gmc_id_contenu');
Line 442... Line 542...
442
        
542
        
443
        //-------------------------------------------------------------------------------------------------------------------
543
        //-------------------------------------------------------------------------------------------------------------------
444
        // Ajout du nouveau contenu pour ce menu
-
 
445
        $tab_valeur['gmc_ce_type_contenu']=$tab_valeur['gmc_ce_type_contenu']+(10*$adme_menu_id);
544
        // Ajout du nouveau contenu pour ce menu
446
        $requete =  'INSERT INTO gen_menu_contenu SET '.
545
        $requete =  'INSERT INTO gen_menu_contenu SET '.
447
                    'gmc_id_contenu = '.$nouveau_id_contenu.', '.
546
                    'gmc_id_contenu = '.$nouveau_id_contenu.', '.
448
                    'gmc_ce_admin = '.$auth->getAuthData('ga_id_administrateur').', '.
547
                    'gmc_ce_admin = '.$auth->getAuthData('ga_id_administrateur').', '.
449
                    'gmc_ce_menu = '.$ligne_menu['gm_code_num'].', '.
548
                    'gmc_ce_menu = '.$adme_menu_id.', '.
450
                    'gmc_ce_type_contenu = '.$tab_valeur['gmc_ce_type_contenu'].', '.
549
                    'gmc_ce_type_contenu = '.$tab_valeur['gmc_ce_type_contenu'].', '.
451
                    'gmc_contenu = "'.$tab_valeur['gmc_contenu'].'", '.
550
                    'gmc_contenu = "'.$tab_valeur['gmc_contenu'].'", '.
452
                    'gmc_ce_type_modification = '.$tab_valeur['gmc_ce_type_modification'].', '.
551
                    'gmc_ce_type_modification = '.$tab_valeur['gmc_ce_type_modification'].', '.
453
                    'gmc_resume_modification = "'.$tab_valeur['gmc_resume_modification'].'", '.
552
                    'gmc_resume_modification = "'.$tab_valeur['gmc_resume_modification'].'", '.
454
                    'gmc_date_modification = "'.date('Y-m-d H:i:s').'", '.
553
                    'gmc_date_modification = "'.date('Y-m-d H:i:s').'", '.
455
                    'gmc_bool_dernier = 1';
-
 
456
        
554
                    'gmc_bool_dernier = 1';
457
        $result = $db->query($requete);
555
        $result = $db->query($requete);
458
        (DB::isError($result)) ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $result->getMessage(), $requete)) : '';
556
        (DB::isError($result)) ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $result->getMessage(), $requete)) : '';
459
    }
557
    }
Line 465... Line 563...
465
 
563
 
466
 
564
 
467
/* +--Fin du code ----------------------------------------------------------------------------------------+
565
/* +--Fin du code ----------------------------------------------------------------------------------------+
-
 
566
*
-
 
567
* $Log: not supported by cvs2svn $
-
 
568
* Revision 1.18  2006/04/28 12:41:49  florian
468
*
569
* corrections erreurs chemin
469
* $Log: not supported by cvs2svn $
570
*
470
* Revision 1.17  2006/03/27 13:42:32  ddelon
571
* Revision 1.17  2006/03/27 13:42:32  ddelon
471
* the last but not the least
572
* the last but not the least
472
*
573
*