Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2025-05-10 00:55:04 +02:00
commit c6b7b3fe3e
5 changed files with 90 additions and 9 deletions

View file

@ -327,7 +327,69 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage,
// Page content
$tplcontent .= '<!-- File content defined in Dolibarr website module editor -->'."\n";
$tplcontent .= '<body id="bodywebsite" class="bodywebsite bodywebpage-'.$objectpage->ref.'">'."\n";
// Import necessary environment for the config page
if ($objectpage->type_container == 'setup') {
$content = '';
$content .= '<?php'."\n";
$content .= 'require_once DOL_DOCUMENT_ROOT.\'/core/class/html.formsetup.class.php\';'."\n";
$content .= '$formSetup = new FormSetup($db);'."\n";
$content .= '?>'."\n";
$tplcontent .= $content."\n";
}
$tplcontent .= $objectpage->content."\n";
// Add logic to handle view and actions for managing parameters in the config page
if ($objectpage->type_container == 'setup') {
$content = '<div id="websitetemplateconfigpage">'."\n";
$content .= '<?php'."\n";
$content .= '/*' . "\n";
$content .= ' * Actions' . "\n";
$content .= ' */' . "\n";
$content .= '$websitetemplateconf = GETPOSTINT(\'websitetemplateconf\');' . "\n";
$content .= 'include DOL_DOCUMENT_ROOT.\'/core/actions_setmoduleoptions.inc.php\';' . "\n";
$content .= '' . "\n";
$content .= '/*' . "\n";
$content .= ' * View' . "\n";
$content .= ' */' . "\n";
$content .= 'print load_fiche_titre($langs->trans(\'SetupAndProperties\'), \'\', \'title_setup\');' . "\n";
$content .= '' . "\n";
$content .= 'if (!empty($message)) {' . "\n";
$content .= ' print $message;' . "\n";
$content .= '}' . "\n";
$content .= '' . "\n";
$content .= 'if (!empty($formSetup->items)) {' . "\n";
$content .= ' $html = \'\';' . "\n";
$content .= '' . "\n";
$content .= ' $html .= \'<form action="config.php" method="POST">\';' . "\n";
$content .= ' // Generate hidden values from $formSetup->formHiddenInputs' . "\n";
$content .= ' if (!empty($formSetup->formHiddenInputs) && is_array($formSetup->formHiddenInputs)) {' . "\n";
$content .= ' foreach ($formSetup->formHiddenInputs as $hiddenKey => $hiddenValue) {' . "\n";
$content .= ' $html .= \'<input type="hidden" name="\' . dol_escape_htmltag($hiddenKey) . \'" value="\' . dol_escape_htmltag($hiddenValue) . \'">\';' . "\n";
$content .= ' }' . "\n";
$content .= ' }' . "\n";
$content .= '' . "\n";
$content .= ' // Generate output table' . "\n";
$content .= ' $html .= $formSetup->generateTableOutput(true);' . "\n";
$content .= '' . "\n";
$content .= ' // Submit button' . "\n";
$content .= ' $html .= \'<input type="hidden" name="action" value="save">\';' . "\n";
$content .= ' $html .= \'<input type="hidden" name="websitetemplateconf" value="1">\';' . "\n";
$content .= ' $html .= \'<br>\';' . "\n";
$content .= ' $html .= \'<div class="form-setup-button-container center">\';' . "\n";
$content .= ' $html .= \'<input class="button button-submit" type="submit" value="\' . $langs->trans("Save") . \'">\';' . "\n";
$content .= ' $html .= \'</div>\';' . "\n";
$content .= ' $html .= \'</form>\';' . "\n";
$content .= '' . "\n";
$content .= ' print $html;' . "\n";
$content .= '}' . "\n";
$content .= '?>' . "\n";
$content .= '</div>' . "\n";
$tplcontent .= $content."\n";
}
$tplcontent .= '</body>'."\n";
$tplcontent .= '</html>'."\n";

View file

@ -99,7 +99,7 @@ if (!empty($pageid) && $pageid > 0) {
$pagelangs->setDefaultLang($websitepage->lang ? $websitepage->lang : $weblangs->shortlang);
if (!defined('USEDOLIBARREDITOR') && (in_array($websitepage->type_container, array('menu', 'other')) || empty($websitepage->status) && !defined('USEDOLIBARRSERVER'))) {
if (!defined('USEDOLIBARREDITOR') && (in_array($websitepage->type_container, array('menu', 'setup', 'other')) || empty($websitepage->status) && !defined('USEDOLIBARRSERVER'))) {
$weblangs->load("website");
// Security options

View file

@ -6172,6 +6172,11 @@ span.websitebuttonsitepreviewdisabled img, a.websitebuttonsitepreviewdisabled im
margin: unset;
}
#divbodywebsite #websitetemplateconfigpage{
max-width: 1200px;
margin: 50px auto 0;
}
/* ============================================================================== */
/* Module agenda */

View file

@ -6123,6 +6123,11 @@ span.websitebuttonsitepreviewdisabled img, a.websitebuttonsitepreviewdisabled im
margin: unset;
}
#divbodywebsite #websitetemplateconfigpage{
max-width: 1200px;
margin: 50px auto 0;
}
/* ============================================================================== */
/* Module agenda */

View file

@ -3520,7 +3520,9 @@ if (!GETPOST('hide_websitemenu')) {
print '<span class="valignmiddle disabled opacitymedium">'.img_picto($langs->trans($text_off), 'switch_on').'</span>';
}
} else {
print ajax_object_onoff($websitepage, 'status', 'status', 'Online', 'Offline', array(), 'valignmiddle inline-block'.(empty($websitepage->id) ? ' opacitymedium disabled' : ''), 'statuswebsitepage', 1, 'website='.urlencode($website->ref).'&pageid='.((int) $websitepage->id));
if ($objectpage->type_container != 'setup') { // we do not allow to change status of setup pages
print ajax_object_onoff($websitepage, 'status', 'status', 'Online', 'Offline', array(), 'valignmiddle inline-block'.(empty($websitepage->id) ? ' opacitymedium disabled' : ''), 'statuswebsitepage', 1, 'website='.urlencode($website->ref).'&pageid='.((int) $websitepage->id));
}
}
//print '</div>';
print '</span>';
@ -3674,14 +3676,21 @@ if (!GETPOST('hide_websitemenu')) {
print '<!-- button EditInLine and ShowSubcontainers -->'."\n";
print '<div class="websiteselectionsection inline-block">';
print '<div class="inline-block marginrightonly">'; // Button includes dynamic content
print $langs->trans("ShowSubcontainers");
if (!getDolGlobalString('WEBSITE_SUBCONTAINERSINLINE')) {
print '<a class="nobordertransp nohoverborder marginleftonlyshort valignmiddle"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=setshowsubcontainers&token='.newToken().'">'.img_picto($langs->trans("ShowSubContainersOnOff", $langs->transnoentitiesnoconv("Off")), 'switch_off', '', 0, 0, 0, '', 'nomarginleft').'</a>';
} else {
print '<a class="nobordertransp nohoverborder marginleftonlyshort valignmiddle"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=unsetshowsubcontainers&token='.newToken().'">'.img_picto($langs->trans("ShowSubContainersOnOff", $langs->transnoentitiesnoconv("On")), 'switch_on', '', 0, 0, 0, '', 'nomarginleft').'</a>';
// Force to show subcontainers if we are in setup mode
if ($objectpage->type_container == 'setup') {
dolibarr_set_const($db, 'WEBSITE_SUBCONTAINERSINLINE', 1);
}
if ($objectpage->type_container != 'setup') {
print '<div class="inline-block marginrightonly">'; // Button includes dynamic content
print $langs->trans("ShowSubcontainers");
if (!getDolGlobalString('WEBSITE_SUBCONTAINERSINLINE')) {
print '<a class="nobordertransp nohoverborder marginleftonlyshort valignmiddle"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=setshowsubcontainers&token='.newToken().'">'.img_picto($langs->trans("ShowSubContainersOnOff", $langs->transnoentitiesnoconv("Off")), 'switch_off', '', 0, 0, 0, '', 'nomarginleft').'</a>';
} else {
print '<a class="nobordertransp nohoverborder marginleftonlyshort valignmiddle"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=unsetshowsubcontainers&token='.newToken().'">'.img_picto($langs->trans("ShowSubContainersOnOff", $langs->transnoentitiesnoconv("On")), 'switch_on', '', 0, 0, 0, '', 'nomarginleft').'</a>';
}
print '</div>';
}
print '</div>';
print '<div class="inline-block marginrightonly">'; // Button edit inline