diff --git a/htdocs/modulebuilder/admin/setup.php b/htdocs/modulebuilder/admin/setup.php new file mode 100644 index 00000000000..f84bf8989ad --- /dev/null +++ b/htdocs/modulebuilder/admin/setup.php @@ -0,0 +1,159 @@ + + * + * 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 3 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/modulebuilder/admin/setup.php + * \ingroup modulebuilder + * \brief Page setup for modulebuilder module + */ +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; + +global $conf,$langs,$user, $db; +$langs->loadLangs(array("admin", "other", "modulebuilder")); + +if (!$user->admin || empty($conf->modulebuilder->enabled)) + accessforbidden(); + +$action = GETPOST('action', 'alpha'); +$backtopage = GETPOST('backtopage', 'alpha'); + +/* + * Actions + */ +if($action=="update"){ + $res1=dolibarr_set_const($db, 'MODULEBUILDER_SPECIFIC_README', GETPOST('MODULEBUILDER_SPECIFIC_README'), 'chaine', 0, '', $conf->entity); + if ($res1 < 0) + { + setEventMessages('ErrorFailedToSaveDate', null, 'errors'); + $db->rollback(); + } + else + { + setEventMessages('RecordModifiedSuccessfully', null, 'mesgs'); + $db->commit(); + } +} + +if (preg_match('/set_(.*)/', $action, $reg)) { + $code = $reg[1]; + $values = GETPOST($code); + if (is_array($values)) + $values = implode(',', $values); + + if (dolibarr_set_const($db, $code, $values, 'chaine', 0, '', $conf->entity) > 0) { + header("Location: " . $_SERVER["PHP_SELF"]); + exit; + } else { + dol_print_error($db); + } +} + +if (preg_match('/del_(.*)/', $action, $reg)) { + $code = $reg[1]; + if (dolibarr_del_const($db, $code, 0) > 0) { + Header("Location: " . $_SERVER["PHP_SELF"]); + exit; + } else { + dol_print_error($db); + } +} + + +/* + * View + */ + +$form = new Form($db); + +llxHeader('', $langs->trans("ModulebuilderSetup")); + +$linkback = ''; +if (GETPOST('withtab', 'alpha')) { + $linkback = '' . $langs->trans("BackToModuleList") . ''; +} + +print load_fiche_titre($langs->trans("ModuleSetup") . ' ' . $langs->trans('Modulebuilder'), $linkback); + +if (GETPOST('withtab', 'alpha')) { + dol_fiche_head($head, 'modulebuilder', '', -1); +} + + +print '' . $langs->trans("ModuleBuilderDesc") . "
\n"; + +print '
'; + +print ''; +print ''; +print ''; +print ''; +print "\n"; + +print ''; +print ''; +print ''; + + + +print ''; +print ''; +print ''; + +print ''; +print ''; +print ''; + +print ''; +print ''; +print ''; +print ''; +print ''; +print '
' . $langs->trans("Key") . '' . $langs->trans("Value") . '
' . $langs->trans("UseAboutPage") . ''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MODULEBUILDER_USE_ABOUT'); +} else { + if (empty($conf->global->MODULEBUILDER_USE_ABOUT)) { + print '' . img_picto($langs->trans("Disabled"), 'off') . ''; + } else { + print '' . img_picto($langs->trans("Enabled"), 'on') . ''; + } +} +print '
' . $langs->trans("UseDocFolder") . ''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MODULEBUILDER_USE_DOCFOLDER'); +} else { + if (empty($conf->global->MODULEBUILDER_USE_DOCFOLDER)) { + print '' . img_picto($langs->trans("Disabled"), 'off') . ''; + } else { + print '' . img_picto($langs->trans("Enabled"), 'on') . ''; + } +} +print '
' . $langs->trans("UseSpecificReadme") . ''; +print ''; +print '
'; +print ''; +print '
'; + +if (GETPOST('withtab', 'alpha')) { + dol_fiche_end(); +} + +print '

'; + +llxFooter(); +$db->close();