Wip website module

This commit is contained in:
Laurent Destailleur 2021-02-21 14:46:52 +01:00
parent 1bb27f8f18
commit 0a7e692fbf
4 changed files with 29 additions and 19 deletions

View File

@ -205,7 +205,7 @@ function dolWebsiteReplacementOfLinks($website, $content, $removephppart = 0, $c
/**
* Render a string of an HTML content and output it.
* Used to ouput the page when viewed from server (Dolibarr or Apache).
* Used to ouput the page when viewed from a server (Dolibarr or Apache).
*
* @param string $content Content string
* @param string $contenttype Content type
@ -231,7 +231,7 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '')
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
if (defined('USEDOLIBARREDITOR')) // REPLACEMENT OF LINKS When page called from Dolibarr editor
if (defined('USEDOLIBARREDITOR')) // REPLACEMENT OF LINKS When page called from Dolibarr editor (this case should not happen)
{
// We remove the <head> part of content
if ($contenttype == 'html')
@ -296,7 +296,7 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '')
if (empty($includehtmlcontentopened)) {
$content = str_replace('!~!~!~', '', $content);
}
} else // REPLACEMENT OF LINKS When page called from virtual host
} else // REPLACEMENT OF LINKS When page called from virtual host web server
{
$symlinktomediaexists = 1;
if ($website->virtualhost) {
@ -355,7 +355,7 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '')
}
}
$content = str_replace(' contenteditable="true"', ' contenteditable="false"', $content);
//$content = str_replace(' contenteditable="true"', ' contenteditable="false"', $content);
if (!empty($conf->global->WEBSITE_ADD_CSS_TO_BODY)) {
$content = str_replace('<body id="bodywebsite" class="bodywebsite', '<body id="bodywebsite" class="bodywebsite '.$conf->global->WEBSITE_ADD_CSS_TO_BODY, $content);

View File

@ -4633,6 +4633,10 @@ span.websitebuttonsitepreviewdisabled img, a.websitebuttonsitepreviewdisabled im
line-height: 1em;
}
#divbodywebsite section p {
margin: unset;
}
/* ============================================================================== */

View File

@ -4509,6 +4509,10 @@ span.websitebuttonsitepreviewdisabled img, a.websitebuttonsitepreviewdisabled im
line-height: 1em;
}
#divbodywebsite section p {
margin: unset;
}
/* ============================================================================== */
/* Module agenda */

View File

@ -358,7 +358,7 @@ if ($action == 'seteditinline')
{
dolibarr_set_const($db, 'WEBSITE_EDITINLINE', 1);
setEventMessages($langs->trans("FeatureNotYetAvailable"), null, 'warnings');
dolibarr_set_const($db, 'WEBSITE_SUBCONTAINERSINLINE', 0); // Force disable of 'Include dynamic content'
//dolibarr_set_const($db, 'WEBSITE_SUBCONTAINERSINLINE', 0); // Force disable of 'Include dynamic content'
header("Location: ".$_SERVER["PHP_SELF"].'?website='.GETPOST('website', 'alphanohtml').'&pageid='.GETPOST('pageid', 'int'));
exit;
}
@ -371,7 +371,7 @@ if ($action == 'unseteditinline')
if ($action == 'setshowsubcontainers')
{
dolibarr_set_const($db, 'WEBSITE_SUBCONTAINERSINLINE', 1);
dolibarr_set_const($db, 'WEBSITE_EDITINLINE', 0); // Force disable of edit inline
//dolibarr_set_const($db, 'WEBSITE_EDITINLINE', 0); // Force disable of edit inline
header("Location: ".$_SERVER["PHP_SELF"].'?website='.GETPOST('website', 'alphanohtml').'&pageid='.GETPOST('pageid', 'int'));
exit;
}
@ -2743,7 +2743,19 @@ if (!GETPOST('hide_websitemenu'))
print '<!-- button EditInLine and ShowSubcontainers -->'."\n";
print '<div class="websiteselectionsection inline-block">';
print '<div class="inline-block marginrightonly">';
print '<div class="inline-block marginrightonly">'; // Button include dynamic contant
print $langs->trans("ShowSubcontainers");
if (empty($conf->global->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', '', false, 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', '', false, 0, 0, '', 'nomarginleft').'</a>';
}
print '</div>';
print '<div class="inline-block marginrightonly">'; // Button edit inline
print '<span id="switchckeditorinline">'."\n";
print '<!-- Code to enabled edit inline ckeditor -->'."\n";
@ -2812,17 +2824,7 @@ if (!GETPOST('hide_websitemenu'))
}
print '</div>';
print '<div class="inline-block marginrightonly">';
print $langs->trans("ShowSubcontainers");
if (empty($conf->global->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', '', false, 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', '', false, 0, 0, '', 'nomarginleft').'</a>';
}
/*}*/
print '</div>';
print '</div>';
// Set page as homepage
@ -4275,7 +4277,7 @@ if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpa
// REPLACEMENT OF LINKS When page called by website editor
$out .= '<!-- style of website from file -->'."\n";
$out .= '<style scoped>'."\n"; // "scoped" means "apply to parent element only". No more supported by browsers, snif !
$out .= '<style scoped>'."\n"; // "scoped" means "apply to parent element only and not grand parent". No more supported by browsers, snif !
$tmpout = '';
$tmpout .= '/* Include website CSS file */'."\n";
//$csscontent = @file_get_contents($filecss);