* Copyright (C) 2005-2011 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, see . * */ /** * \file htdocs/admin/fckeditor.php * \ingroup fckeditor * \brief Page d'activation du module FCKeditor dans les autres modules */ require("../main.inc.php"); require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php"); $langs->load("admin"); $langs->load("fckeditor"); if (!$user->admin) accessforbidden(); // Constante et traduction de la description du module $modules = array( 'SOCIETE' => 'FCKeditorForCompany', 'PRODUCTDESC' => 'FCKeditorForProduct', 'MAILING' => 'FCKeditorForMailing', 'DETAILS' => 'FCKeditorForProductDetails', ); // Conditions pour que l'option soit proposee $conditions = array( 'SOCIETE' => 1, 'PRODUCTDESC' => ($conf->product->enabled||$conf->service->enabled), 'MAILING' => $conf->mailing->enabled, 'DETAILS' => ($conf->facture->enabled||$conf->propal->enabled||$conf->commande->enabled), ); // Picto $picto = array( 'SOCIETE' => 'generic', 'PRODUCTDESC' => 'product', 'MAILING' => 'email', 'DETAILS' => 'generic', ); /* * Actions */ foreach($modules as $const => $desc) { if ($_GET["action"] == 'activate_'.strtolower($const)) { dolibarr_set_const($db, "FCKEDITOR_ENABLE_".$const, "1",'chaine',0,'',$conf->entity); // Si fckeditor est active dans la description produit/service, on l'active dans les formulaires if ($const == 'PRODUCTDESC' && $conf->global->PRODUIT_DESC_IN_FORM) { dolibarr_set_const($db, "FCKEDITOR_ENABLE_DETAILS", "1",'chaine',0,'',$conf->entity); } Header("Location: ".$_SERVER["PHP_SELF"]); exit; } if ($_GET["action"] == 'disable_'.strtolower($const)) { dolibarr_del_const($db, "FCKEDITOR_ENABLE_".$const,$conf->entity); Header("Location: ".$_SERVER["PHP_SELF"]); exit; } } if ($_POST["save"]) { dolibarr_set_const($db, "FCKEDITOR_TEST", $_POST["formtestfield"],'chaine',0,'',$conf->entity); } /* * View */ llxHeader(); $linkback=''.$langs->trans("BackToModuleList").''; print_fiche_titre($langs->trans("AdvancedEditor"),$linkback,'setup'); print '
'; $var=true; print ''; print ''; print ''; print ''; print "\n"; // Modules foreach($modules as $const => $desc) { // Si condition non remplie, on ne propose pas l'option if (! $conditions[$const]) continue; $var=!$var; print ""; print ''; print ''; print '"; print ''; } print '
'.$langs->trans("ActivateFCKeditor").''.$langs->trans("Action").'
'.img_object("",$picto[$const]).''.$langs->trans($desc).''; $constante = 'FCKEDITOR_ENABLE_'.$const; $value = $conf->global->$constante; if($value == 0) { print ''.img_picto($langs->trans("Disabled"),'switch_off').''; } else if($value == 1) { print ''.img_picto($langs->trans("Enabled"),'switch_on').''; } print "
'."\n"; print '
'."\n"; print_fiche_titre($langs->trans("TestSubmitForm"),'',''); print '
'."\n"; $uselocalbrowser=true; $editor=new DolEditor('formtestfield',isset($conf->global->FCKEDITOR_TEST)?$conf->global->FCKEDITOR_TEST:'Test','',200,'dolibarr_notes','In', true, $uselocalbrowser); $editor->Create(); print '

'."\n"; print '
'."\n"; /* print ''; print $_POST["formtestfield"]; print ''; print $conf->global->FCKEDITOR_TEST; */ $db->close(); llxFooter(); ?>