Subversion Repositories Applications.papyrus

Compare Revisions

Ignore whitespace Rev 280 → Rev 281

/trunk/papyrus/applications/admin_site/admin_site.php
3,7 → 3,6
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2001 Laurent COUDOUNEAU (lc@gsite.org) |
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
36,19 → 35,18
*
*@package Admin_site
//Auteur original :
*@author Laurent COUDOUNEAU <lc@gsite.org>
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
//Autres auteurs :
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.5 $ $Date: 2005-02-28 10:32:06 $
*@version $Revision: 1.6 $ $Date: 2005-02-28 10:58:38 $
// +------------------------------------------------------------------------------------------------------+
//
// $Id: admin_site.php,v 1.5 2005-02-28 10:32:06 jpm Exp $
// $Id: admin_site.php,v 1.6 2005-02-28 10:58:38 jpm Exp $
// FICHIER : $RCSfile: admin_site.php,v $
// AUTEUR : $Author: jpm $
// VERSION : $Revision: 1.5 $
// DATE : $Date: 2005-02-28 10:32:06 $
// VERSION : $Revision: 1.6 $
// DATE : $Date: 2005-02-28 10:58:38 $
// +------------------------------------------------------------------------------------------------------+
**/
 
75,16 → 73,13
* Permet la suppression d'un dossier et de son contenu.*/
require_once ADSI_CHEMIN_BIBLIOTHEQUE_API.'fichier/FIC_manipulation.fonct.php';
 
/** <BR> Inclusion de la bibliothèque de fonctions concernant les tables "gen_menu..." de Papyrus.
/** Inclusion de la bibliothèque de fonctions concernant les tables "gen_menu..." de Papyrus.
* Permet d'inclure la fonction d'affichage du "Vous êtes ici".*/
require_once ADSI_CHEMIN_BIBLIOTHEQUE_GEN.'pap_menu.fonct.php';
 
/** <BR> Inclusion de la bibliothèque de fonctions concernant les tables "gen_site..." de Papyrus.*/
/** Inclusion de la bibliothèque de fonctions concernant les tables "gen_site..." de Papyrus.*/
require_once ADSI_CHEMIN_BIBLIOTHEQUE_GEN.'pap_site.fonct.php';
 
/** Inclusion de la bibliotheque de fonctions gérant les administrateur de Papyrus.*/
require_once ADSI_CHEMIN_BIBLIOTHEQUE_ADSI.'adsi_admin.fonct.php';
 
/** Inclusion de la bibliotheque de fonction gérant l'affichage de l'application Administrateur.*/
require_once ADSI_CHEMIN_BIBLIOTHEQUE_ADSI.'adsi_affichage.fonct.php';
 
123,33 → 118,18
*/
function afficherContenuCorps()
{
// Initialisation des variables. A faire migrer dans le fichier de configuration!!!
// Globals variables from auth.php:
//
// $project : current project
// $locale : current locale
// $db : database name
// $link : link to database
// $DOCrow : current document
// $CURRENTPAGErow : current page
// $annuName : name of the current annu
// $userid : id of the current user
// +----------------------------------------------------------------------------------------------+
// Initialisation des variables
// +----------------------------------------------------------------------------------------------+
// Initialisation variables globales de Papyrus
global $db, $_GEN_commun;
// +----------------------------------------------------------------------------------------------+
// Objet Pear Auth
$objet_pear_auth = $_GEN_commun['pear_auth'];
$objet_pear_auth = $GLOBALS['_GEN_commun']['pear_auth'];
// +----------------------------------------------------------------------------------------------+
// Gestion de l'URL pour revenir sur le menu courant.
$url = $_GEN_commun['url']->getUrl();
$url = $GLOBALS['_GEN_commun']['url']->getUrl();
// +----------------------------------------------------------------------------------------------+
// Gestion de la langue de l'interface.
$id_langue = $_GEN_commun['url_i18n'];
// +----------------------------------------------------------------------------------------------+
// Arguments d'appel de cette application par un menu de Papyrus
$application_arguments = $_GEN_commun['info_menu']->gm_application_arguments;
$id_langue = $GLOBALS['_GEN_commun']['url_i18n'];
if ($objet_pear_auth->getAuth()) {
// +----------------------------------------------------------------------------------------------+
158,11 → 138,8
$msg = '';
// +----------------------------------------------------------------------------------------------+
// Arguments passé par le menu de Génésia à l'application l'Administrateur???
// Arguments passé par le menu de Papyrus à l'application l'Administrateur de site.
// Récupération des arguments
$tab_arguments = explode(' ', $application_arguments);
// Initialisation des variables qui contiendront les arguments
$id_site_a_administrer = '';
$bool_site = false;
172,39 → 149,34
$bool_style = false;
// Instantciation des variables arguments
for ($i = 0; $i < count($tab_arguments); $i++) {
$argument = explode('=', $tab_arguments[$i]);
if ($argument[0] == 'id_site') {
$id_site_a_administrer = $argument[1];
}
if ($argument[0] == 'bool_site') {
// Interface d'administration des sites
$bool_site = ($argument[1] == 'true');
}
if ($argument[0] == 'bool_auth') {
// Interface d'administration du cache d'un site
$bool_cache = ($argument[1] == 'true');
}
if ($argument[0] == 'bool_cache') {
// Interface d'administration du cache d'un site
$bool_cache = ($argument[1] == 'true');
}
if ($argument[0] == 'bool_squelette') {
// Interface d'administration du fichier squelette d'un site
$bool_squelette = ($argument[1] == 'true');
}
if ($argument[0] == 'bool_style') {
// Interface d'administration du fichier de styles d'un site
$bool_style = ($argument[1] == 'true');
}
if (isset($GLOBALS['_GEN_commun']['info_application']->id_site)) {
$id_site_a_administrer = $GLOBALS['_GEN_commun']['info_application']->id_site;
}
if (isset($GLOBALS['_GEN_commun']['info_application']->bool_site) && $GLOBALS['_GEN_commun']['info_application']->bool_site == 'true') {
// Interface d'administration des sites
$bool_site = true;
}
if (isset($GLOBALS['_GEN_commun']['info_application']->bool_auth) && $GLOBALS['_GEN_commun']['info_application']->bool_auth == 'true') {
// Interface d'administration du cache d'un site
$bool_cache = true;
}
if (isset($GLOBALS['_GEN_commun']['info_application']->bool_cache) && $GLOBALS['_GEN_commun']['info_application']->bool_cache == 'true') {
// Interface d'administration du cache d'un site
$bool_cache = true;
}
if (isset($GLOBALS['_GEN_commun']['info_application']->bool_squelette) && $GLOBALS['_GEN_commun']['info_application']->bool_squelette == 'true') {
// Interface d'administration du fichier squelette d'un site
$bool_squelette = true;
}
if (isset($GLOBALS['_GEN_commun']['info_application']->bool_style) && $GLOBALS['_GEN_commun']['info_application']->bool_style == 'true') {
// Interface d'administration du fichier de styles d'un site
$bool_style = true;
}
// Si aucun argument transmis on affiche l'interface de gestion des sites
if ( !($bool_site && $bool_cache && $bool_squelette && $bool_style) ) {
$bool_site = true;
215,85 → 187,85
if ($bool_site) {
if (isset($_POST['form_sites_ajouter'])) {
// Nous voulons le formulaire d'ajout d'un site
$sortie_xhtml .= ADMIN_afficherFormSite($db, $url);
$sortie_xhtml .= ADMIN_afficherFormSite($GLOBALS['_GEN_commun']['pear_db'] $url);
return $sortie_xhtml;
} else if (isset($_POST['site_enregistrer'])) {
// Nous cherchons à enregistrer un site
$message = ADMIN_validerFormSite($db, $_POST);
$message = ADMIN_validerFormSite($GLOBALS['_GEN_commun']['pear_db'], $_POST);
if (!empty($message)) {
// Les données ne sont pas valide. Nous retournons le formulaires avec les messages d'erreurs.
$sortie_xhtml .= ADMIN_afficherFormSite($db, $url, $_POST, $message);
$sortie_xhtml .= ADMIN_afficherFormSite($GLOBALS['_GEN_commun']['pear_db'], $url, $_POST, $message);
} else {
// Les données sont valide. Nous les enregistrons et retournons au formulaire de départ.
$message = ADMIN_enregistrerSite($db, $_POST, $objet_pear_auth->getAuthData('ga_id_administrateur'));
$sortie_xhtml .= ADMIN_afficherFormListeSites($db, $url, $message);
$message = ADMIN_enregistrerSite($GLOBALS['_GEN_commun']['pear_db'], $_POST, $objet_pear_auth->getAuthData('ga_id_administrateur'));
$sortie_xhtml .= ADMIN_afficherFormListeSites($GLOBALS['_GEN_commun']['pear_db'], $url, $message);
}
return $sortie_xhtml;
} else if (isset($_POST['form_sites_modifier'])) {
// Nous cherchons à modifier un site
$message = ADMIN_validerFormListesSites($db, $_POST);
$message = ADMIN_validerFormListesSites($GLOBALS['_GEN_commun']['pear_db'], $_POST);
if (!empty($message)) {
// Les données ne sont pas valide. Nous retournons le formulaires avec les messages d'erreurs.
$sortie_xhtml .= ADMIN_afficherFormListeSites($db, $url, $message);
$sortie_xhtml .= ADMIN_afficherFormListeSites($GLOBALS['_GEN_commun']['pear_db'], $url, $message);
} else {
// Les données sont valide. Nous affichons le formulaire de modification.
$sortie_xhtml .= ADMIN_afficherFormSite($db, $url, $_POST, $message);
$sortie_xhtml .= ADMIN_afficherFormSite($GLOBALS['_GEN_commun']['pear_db'], $url, $_POST, $message);
}
return $sortie_xhtml;
} else if (isset($_POST['site_modifier'])) {
// Nous cherchons à enregistrer les modification d'un site
$message = ADMIN_validerFormSite($db, $_POST);
$message = ADMIN_validerFormSite($GLOBALS['_GEN_commun']['pear_db'], $_POST);
if (!empty($message)) {
// Les données ne sont pas valide. Nous retournons le formulaires avec les messages d'erreurs.
$sortie_xhtml .= ADMIN_afficherFormSite($db, $url, $_POST, $message);
$sortie_xhtml .= ADMIN_afficherFormSite($GLOBALS['_GEN_commun']['pear_db'], $url, $_POST, $message);
} else {
// Les données sont valide. Nous les enregistrons et retournons au formulaire de départ.
$message = ADMIN_modifierSite($db, $_POST, $objet_pear_auth->getAuthData('ga_id_administrateur'));
$sortie_xhtml .= ADMIN_afficherFormListeSites($db, $url, $message);
$message = ADMIN_modifierSite($GLOBALS['_GEN_commun']['pear_db'], $_POST, $objet_pear_auth->getAuthData('ga_id_administrateur'));
$sortie_xhtml .= ADMIN_afficherFormListeSites($GLOBALS['_GEN_commun']['pear_db'], $url, $message);
}
return $sortie_xhtml;
} else if (isset($_POST['form_sites_supprimer'])) {
// Nous cherchons à supprimer un site
$message = ADMIN_validerFormListesSites($db, $_POST);
$message = ADMIN_validerFormListesSites($GLOBALS['_GEN_commun']['pear_db'], $_POST);
if (!empty($message)) {
// Les données ne sont pas valide. Nous retournons le formulaires avec les messages d'erreurs.
$sortie_xhtml .= ADMIN_afficherFormListeSites($db, $url, $message);
$sortie_xhtml .= ADMIN_afficherFormListeSites($GLOBALS['_GEN_commun']['pear_db'], $url, $message);
} else {
// Les données sont valide. Nous supprimons et retournons au formulaire de départ.
$message = ADMIN_supprimerSite($db, $_POST);
$sortie_xhtml .= ADMIN_afficherFormListeSites($db, $url, $message);
$message = ADMIN_supprimerSite($GLOBALS['_GEN_commun']['pear_db'], $_POST);
$sortie_xhtml .= ADMIN_afficherFormListeSites($GLOBALS['_GEN_commun']['pear_db'], $url, $message);
}
return $sortie_xhtml;
} else if (isset($_POST['form_sites_traduire'])) {
// Nous cherchons à modifier un site
$message = ADMIN_validerFormListesSites($db, $_POST);
$message = ADMIN_validerFormListesSites($GLOBALS['_GEN_commun']['pear_db'], $_POST);
if (!empty($message)) {
// Les données ne sont pas valide. Nous retournons le formulaires avec les messages d'erreurs.
$sortie_xhtml .= ADMIN_afficherFormListeSites($db, $url, $message);
$sortie_xhtml .= ADMIN_afficherFormListeSites($GLOBALS['_GEN_commun']['pear_db'], $url, $message);
} else {
// Les données sont valide. Nous supprimons et retournons au formulaire de départ.
$sortie_xhtml .= ADMIN_afficherFormTraduireSite($db, $url, $_POST, $message);
$sortie_xhtml .= ADMIN_afficherFormTraduireSite($GLOBALS['_GEN_commun']['pear_db'], $url, $_POST, $message);
}
return $sortie_xhtml;
} else if (isset($_POST['form_trad_site_enregistrer'])) {
// Nous cherchons à enregistrer la traduction d'un site
$message = ADMIN_validerFormTraduireSite($db, $_POST);
$message = ADMIN_validerFormTraduireSite($GLOBALS['_GEN_commun']['pear_db'], $_POST);
if (!empty($message)) {
// Les données ne sont pas valide. Nous retournons le formulaires avec les messages d'erreurs.
$sortie_xhtml .= ADMIN_afficherFormModifierSite($db, $url, $message);
$sortie_xhtml .= ADMIN_afficherFormModifierSite($GLOBALS['_GEN_commun']['pear_db'], $url, $message);
} else {
// Les données sont valide. Nous les enregistrons et retournons au formulaire de départ.
$message = ADMIN_enregistrerFormModifierSite($db, $_POST);
$sortie_xhtml .= ADMIN_afficherFormListeSites($db, $url, $message);
$message = ADMIN_enregistrerFormModifierSite($GLOBALS['_GEN_commun']['pear_db'], $_POST);
$sortie_xhtml .= ADMIN_afficherFormListeSites($GLOBALS['_GEN_commun']['pear_db'], $url, $message);
}
return $sortie_xhtml;
} else if (isset($_POST['form_annuler'])) {
// Retour à la liste des sites
$sortie_xhtml .= ADMIN_afficherFormListeSites($db, $url);
$sortie_xhtml .= ADMIN_afficherFormListeSites($GLOBALS['_GEN_commun']['pear_db'], $url);
return $sortie_xhtml;
} else {
// Liste des sites
$sortie_xhtml .= ADMIN_afficherFormListeSites($db, $url);
$sortie_xhtml .= ADMIN_afficherFormListeSites($GLOBALS['_GEN_commun']['pear_db'], $url);
}
}
// +----------------------------------------------------------------------------------------------+
300,30 → 272,11
// Gestion du cache... A FAIRE
if ($bool_cache) {
$msg = '';
if ($guscmd == 'delcache') {
delCache($db, $gusprjid);
}
// Defaut : nous listons tous les caches
$sortie_xhtml .= listCaches($db, $id_site, $id_langue, $url, $msg);
return $sortie_xhtml;
}
// +----------------------------------------------------------------------------------------------+
// Gestion des squelettes... A FAIRE
if ($bool_squelette) {
switch ($guscmd) {
case 'updpres':
$sortie_xhtml .= updatePresentation($db, $id_site, $id_langue, $url, $baseHidden, $gusprjid);
return $sortie_xhtml;
break;
case 'commitupdpres' :
$sortie_xhtml .= commitUpdatePresentation($db, $id_site, $id_langue, $id_site_a_administrer, $url);
return $sortie_xhtml;
break;
}
}
// +----------------------------------------------------------------------------------------------+
// Gestion des styles... A FAIRE
331,7 → 284,7
}
return $sortie_xhtml ;
return $sortie_xhtml;
} else {
// L'utilisateur n'est pas identifier, nous lui demandons de le faire.
return GEN_afficherInfoIdentification();
340,6 → 293,9
 
/* +--Fin du code ---------------------------------------------------------------------------------------+
* $Log: not supported by cvs2svn $
* Revision 1.5 2005/02/28 10:32:06 jpm
* Changement de nom de dossier.
*
* Revision 1.4 2004/12/03 19:22:57 jpm
* Gestion des types de sites externes gérés par Papyrus.
*