From 48c113107b063d56c3833968c6dd98d316551b8b Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 22 Mar 2010 12:13:15 +0000 Subject: [PATCH] Fix: move "editeur" module to external module --- htdocs/admin/editeur.php | 119 ------------------- htdocs/includes/modules/modEditeur.class.php | 112 ----------------- 2 files changed, 231 deletions(-) delete mode 100644 htdocs/admin/editeur.php delete mode 100644 htdocs/includes/modules/modEditeur.class.php diff --git a/htdocs/admin/editeur.php b/htdocs/admin/editeur.php deleted file mode 100644 index 0f2e7d25ffa..00000000000 --- a/htdocs/admin/editeur.php +++ /dev/null @@ -1,119 +0,0 @@ - - * Copyright (C) 2007-2009 Laurent Destailleur - * Copyright (C) 2009 Regis Houssin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/** - * \file htdocs/admin/editeur.php - * \ingroup editeur - * \brief Page d'administration/configuration du module Editeur - * \version $Id$ - */ - -require("../main.inc.php"); -require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php"); - -$langs->load("admin"); - -if (!$user->admin) - accessforbidden(); - - -// Action activation d'un sous module du module adherent -if ($_POST["action"] == 'set') -{ - $name = "EDITEUR_LIVRE_FORMAT_".time(); - $result=dolibarr_set_const($db, $name, $_POST["format"],'chaine',0,'',$conf->entity); - if ($result < 0) - { - print $db->error(); - } -} - -// Action desactivation d'un sous module -if ($_GET["action"] == 'unset') -{ - $sql = "DELETE FROM ".MAIN_DB_PREFIX."const"; - $sql.= " WHERE ".$db->decrypt('name'); - $sql.= " LIKE 'EDITEUR_LIVRE_FORMAT_%'"; - $sql.= " AND rowid='".$_GET["id"]."';"; - if ($db->query($sql)) - { - Header("Location: editeur.php"); - exit; - } -} - - -/* - * View - */ - -llxHeader(); - -$linkback=''.$langs->trans("BackToModuleList").''; -print_fiche_titre($langs->trans("Configuration du module Editeur"),$linkback,'setup'); -print '
'; - -print '
'; -print ''; -print ''; - -print ''; -print "\n"; - -print '
".$langs->trans("NewFormat").''; -print ''; -print ''; -print ''; -print "
'; -print '
'; -print '
'; - -print ''; -print ''; -print ''; -print ''; -print "\n"; -$var=true; - -$sql = "SELECT"; -$sql.= " rowid"; -$sql.= ", ".$db->decrypt('value')." as value"; -$sql.= " FROM ".MAIN_DB_PREFIX."const"; -$sql.= " WHERE ".$db->decrypt('name'); -$sql.= " LIKE 'EDITEUR_LIVRE_FORMAT_%'"; -$result = $db->query($sql); - -while ($obj = $db->fetch_object($result) ) -{ - $var=!$var; - - print "\n"; - - print '\n"; -} - -print '
'.$langs->trans("Formats").''.$langs->trans("Action").'
".nl2br($obj->value)."'; - print ''.$langs->trans('Delete').''; - print "
'; - -$db->close(); - -llxFooter('$Date$ - $Revision$'); -?> \ No newline at end of file diff --git a/htdocs/includes/modules/modEditeur.class.php b/htdocs/includes/modules/modEditeur.class.php deleted file mode 100644 index 4d2f52c39cb..00000000000 --- a/htdocs/includes/modules/modEditeur.class.php +++ /dev/null @@ -1,112 +0,0 @@ - - * Copyright (C) 2009 Laurent Destailleur - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/** - * \defgroup editeur Module editor - * \brief Module pour gerer les livres et editeurs - * \version $Id$ - */ - -/** - * \file htdocs/includes/modules/modEditeur.class.php - * \ingroup editeur - * \brief Fichier de description et activation du module Editeur - */ - -include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php"); - - -/** - * \class modEditeur - * \brief Classe de description et activation du module Editeur - */ -class modEditeur extends DolibarrModules -{ - - /** - * \brief Constructeur. Definit les noms, constantes et boites - * \param DB Database handler - */ - function modEditeur($DB) - { - $this->db = $DB ; - $this->numero = 49 ; - - $this->family = "other"; - // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) - $this->name = preg_replace('/^mod/i','',get_class($this)); - $this->description = "Gestion des livres et editeurs"; - // Possible values for version are: 'development', 'experimental', 'dolibarr' or version - $this->version = 'development'; - - $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->special = 3; - $this->picto='book'; - - // Data directories to create when module is enabled - $this->dirs = array('/smarty/cache/temp','/smarty/templates/temp'); - - // Config pages - $this->config_page_url = array("editeur.php"); - - // Dependances - $this->depends = array(); - $this->requiredby = array(); - $this->conflictwith = array(); - $this->needleftmenu = array(); - $this->needtotopmenu = array(); - $this->langfiles = array("orders","bills","companies"); - - // Constants - //Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',0), - // 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0) ); - $this->const=array(1=>array('MAIN_MODULE_DROITPRET_NEEDSMARTY','chaine',1,'Need smarty',0)); - - // Boxes - $this->boxes = array(); - - // Permissions - $this->rights = array(); - } - - - /** - * \brief Fonction appelee lors de l'activation du module. Insere en base les constantes, boites, permissions du module. - * Definit egalement les repertoires de donnees a creer pour ce module. - */ - function init() - { - global $conf; - - return $this->_init($sql); - } - - - /** - * \brief Fonction appelee lors de la desactivation d'un module. - * Supprime de la base les constantes, boites et permissions du module. - */ - function remove() - { - global $conf; - - return $this->_remove($sql); - } -} -?>