--- /tmp/dsg/dolibarr/htdocs/modulebuilder/admin/github_19.0.3_setup.php +++ /tmp/dsg/dolibarr/htdocs/modulebuilder/admin/client_setup.php @@ -29 +29,4 @@ -$action = GETPOST('action', 'aZ09'); +if (!$user->admin || empty($conf->modulebuilder->enabled)) + accessforbidden(); + +$action = GETPOST('action', 'alpha'); @@ -31,5 +33,0 @@ - -if (!$user->admin || !isModEnabled('modulebuilder')) { - accessforbidden(); -} - @@ -40,20 +38,21 @@ - -if ($action == "update") { - $res1 = dolibarr_set_const($db, 'MODULEBUILDER_SPECIFIC_README', GETPOST('MODULEBUILDER_SPECIFIC_README', 'restricthtml'), 'chaine', 0, '', $conf->entity); - $res2 = dolibarr_set_const($db, 'MODULEBUILDER_ASCIIDOCTOR', GETPOST('MODULEBUILDER_ASCIIDOCTOR', 'alphanohtml'), 'chaine', 0, '', $conf->entity); - $res3 = dolibarr_set_const($db, 'MODULEBUILDER_ASCIIDOCTORPDF', GETPOST('MODULEBUILDER_ASCIIDOCTORPDF', 'alphanohtml'), 'chaine', 0, '', $conf->entity); - $res4 = dolibarr_set_const($db, 'MODULEBUILDER_SPECIFIC_EDITOR_NAME', GETPOST('MODULEBUILDER_SPECIFIC_EDITOR_NAME', 'alphanohtml'), 'chaine', 0, '', $conf->entity); - $res5 = dolibarr_set_const($db, 'MODULEBUILDER_SPECIFIC_EDITOR_URL', GETPOST('MODULEBUILDER_SPECIFIC_EDITOR_URL', 'alphanohtml'), 'chaine', 0, '', $conf->entity); - $res6 = dolibarr_set_const($db, 'MODULEBUILDER_SPECIFIC_FAMILY', GETPOST('MODULEBUILDER_SPECIFIC_FAMILY', 'alphanohtml'), 'chaine', 0, '', $conf->entity); - $res7 = dolibarr_set_const($db, 'MODULEBUILDER_SPECIFIC_AUTHOR', GETPOST('MODULEBUILDER_SPECIFIC_AUTHOR', 'html'), 'chaine', 0, '', $conf->entity); - $res8 = dolibarr_set_const($db, 'MODULEBUILDER_SPECIFIC_VERSION', GETPOST('MODULEBUILDER_SPECIFIC_VERSION', 'alphanohtml'), 'chaine', 0, '', $conf->entity); - if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0 || $res7 < 0 || $res8 < 0) { - setEventMessages('ErrorFailedToSaveDate', null, 'errors'); - $db->rollback(); - } else { - setEventMessages('RecordModifiedSuccessfully', null, 'mesgs'); - $db->commit(); - } -} - -$reg = array(); +if ($action == "update") +{ + $res1 = dolibarr_set_const($db, 'MODULEBUILDER_SPECIFIC_README', GETPOST('MODULEBUILDER_SPECIFIC_README', 'none'), 'chaine', 0, '', $conf->entity); + $res2 = dolibarr_set_const($db, 'MODULEBUILDER_ASCIIDOCTOR', GETPOST('MODULEBUILDER_ASCIIDOCTOR', 'nohtml'), 'chaine', 0, '', $conf->entity); + $res3 = dolibarr_set_const($db, 'MODULEBUILDER_ASCIIDOCTORPDF', GETPOST('MODULEBUILDER_ASCIIDOCTORPDF', 'nohtml'), 'chaine', 0, '', $conf->entity); + $res4 = dolibarr_set_const($db, 'MODULEBUILDER_SPECIFIC_EDITOR_NAME', GETPOST('MODULEBUILDER_SPECIFIC_EDITOR_NAME', 'nohtml'), 'chaine', 0, '', $conf->entity); + $res5 = dolibarr_set_const($db, 'MODULEBUILDER_SPECIFIC_EDITOR_URL', GETPOST('MODULEBUILDER_SPECIFIC_EDITOR_URL', 'nohtml'), 'chaine', 0, '', $conf->entity); + $res6 = dolibarr_set_const($db, 'MODULEBUILDER_SPECIFIC_FAMILY', GETPOST('MODULEBUILDER_SPECIFIC_FAMILY', 'nohtml'), 'chaine', 0, '', $conf->entity); + $res7 = dolibarr_set_const($db, 'MODULEBUILDER_SPECIFIC_AUTHOR', GETPOST('MODULEBUILDER_SPECIFIC_AUTHOR', 'html'), 'chaine', 0, '', $conf->entity); + $res8 = dolibarr_set_const($db, 'MODULEBUILDER_SPECIFIC_VERSION', GETPOST('MODULEBUILDER_SPECIFIC_VERSION', 'nohtml'), 'chaine', 0, '', $conf->entity); + if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0 || $res7 < 0 || $res8 < 0) { + setEventMessages('ErrorFailedToSaveDate', null, 'errors'); + $db->rollback(); + } + else + { + setEventMessages('RecordModifiedSuccessfully', null, 'mesgs'); + $db->commit(); + } +} + @@ -61,12 +60,11 @@ - $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); - } + $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); + } @@ -76,7 +74,7 @@ - $code = $reg[1]; - if (dolibarr_del_const($db, $code, 0) > 0) { - Header("Location: ".$_SERVER["PHP_SELF"]); - exit; - } else { - dol_print_error($db); - } + $code = $reg[1]; + if (dolibarr_del_const($db, $code, 0) > 0) { + Header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } else { + dol_print_error($db); + } @@ -92,2 +90 @@ -$help_url = ''; -llxHeader('', $langs->trans("ModulebuilderSetup"), $help_url); +llxHeader('', $langs->trans("ModulebuilderSetup")); @@ -104 +101 @@ - print dol_get_fiche_head($head, 'modulebuilder', '', -1); + dol_fiche_head($head, 'modulebuilder', '', -1); @@ -114 +111 @@ -print ''.$langs->trans("Parameter").''; +print ''.$langs->trans("Key").''; @@ -119,2 +116,3 @@ -if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { - // What is use case of this 2 options ? +if ($conf->global->MAIN_FEATURES_LEVEL >= 2) +{ + // What is use cas of this 2 options ? @@ -124 +122 @@ - print ''; + print ''; @@ -126 +124 @@ - print ajax_constantonoff('MODULEBUILDER_USE_ABOUT'); + print ajax_constantonoff('MODULEBUILDER_USE_ABOUT'); @@ -128,5 +126,5 @@ - if (!getDolGlobalString('MODULEBUILDER_USE_ABOUT')) { - print ''.img_picto($langs->trans("Disabled"), 'off').''; - } else { - print ''.img_picto($langs->trans("Enabled"), 'on').''; - } + if (empty($conf->global->MODULEBUILDER_USE_ABOUT)) { + print ''.img_picto($langs->trans("Disabled"), 'off').''; + } else { + print ''.img_picto($langs->trans("Enabled"), 'on').''; + } @@ -134,0 +133,35 @@ + + print ''; + print ''.$langs->trans("UseSpecificEditorName").''; + print ''; + print ''; + print ''; + print ''; + + print ''; + print ''.$langs->trans("UseSpecificEditorURL").''; + print ''; + print ''; + print ''; + print ''; + + print ''; + print ''.$langs->trans("UseSpecificFamily").''; + print ''; + print ''; + print ''; + print ''; + + print ''; + print ''.$langs->trans("UseSpecificAuthor").''; + print ''; + print ''; + print ''; + print ''; + + print ''; + print ''.$langs->trans("UseSpecificVersion").''; + print ''; + print ''; + print ''; + print ''; @@ -138 +171 @@ -print ''.$langs->trans("UseSpecificEditorName").''; +print ''.$langs->trans("UseSpecificReadme").''; @@ -140 +173 @@ -print ''; +print ''; @@ -145 +178 @@ -print ''.$langs->trans("UseSpecificEditorURL").''; +print ''.$langs->trans("AsciiToHtmlConverter").''; @@ -147,38 +180 @@ -print ''; -print ''; -print ''; - -if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { - print ''; - print ''.$langs->trans("UseSpecificFamily").''; - print ''; - print ''; - print ''; - print ''; - - print ''; - print ''.$langs->trans("UseSpecificAuthor").''; - print ''; - print ''; - print ''; - print ''; - - print ''; - print ''.$langs->trans("UseSpecificVersion").''; - print ''; - print ''; - print ''; - print ''; -} - -print ''; -print ''.$langs->trans("UseSpecificReadme").''; -print ''; -print ''; -print ''; -print ''; - -print ''; -print ''.$langs->trans("AsciiToHtmlConverter").''; -print ''; -print ''; +print ''; @@ -190 +186 @@ -print ''.$langs->trans("AsciiToPdfConverter").''; +print ''.$langs->trans("AsciiToPdfConverter").''; @@ -192 +188 @@ -print ''; +print ''; @@ -199 +195 @@ -print $form->buttonsSaveCancel("Save", ''); +print '
'; @@ -202 +198 @@ - print dol_get_fiche_end(); + dol_fiche_end();