Enhance website

This commit is contained in:
Laurent Destailleur 2020-03-11 12:53:41 +01:00
parent c4b5a6f54b
commit 26fec2f366
5 changed files with 48 additions and 15 deletions

View File

@ -51,11 +51,14 @@ function dolStripPhpCode($str, $replacewith = '')
$partlings = explode('?>', $part);
if (!empty($partlings))
{
$phppart = $partlings[0];
//$phppart = $partlings[0];
//remove content before closing tag
if (count($partlings) > 1) $partlings[0] = ''; // Todo why a count > 1 and not >= 1 ?
//append to out string
$newstr .= '<span class="phptag" class="tooltip" title="'.dol_escape_htmltag(dolGetFirstLineOfText($phppart).'...').'">'.$replacewith.'<!-- '.$phppart.' --></span>'.implode('', $partlings);
//$newstr .= '<span class="phptag" class="tooltip" title="'.dol_escape_htmltag(dolGetFirstLineOfText($phppart).'...').'">'.$replacewith.'<!-- '.$phppart.' --></span>'.implode('', $partlings);
//$newstr .= '<span>'.$replacewith.'<!-- '.$phppart.' --></span>'.implode('', $partlings);
$newstr .= '<span phptag>'.$replacewith.'</span>'.implode('', $partlings);
//$newstr .= $replacewith.implode('', $partlings);
}
}
}

View File

@ -42,7 +42,8 @@ ViewPageInNewTab=View page in new tab
SetAsHomePage=Set as Home page
RealURL=Real URL
ViewWebsiteInProduction=View web site using home URLs
SetHereVirtualHost=<u>Use with Apache/NGinx/...</u><br>If you can create, on your web server (Apache, Nginx, ...), a dedicated Virtual Host with PHP enabled and a Root directory on<br><strong>%s</strong><br>then set the name of the virtual host you have created in the properties of web site, so the preview can be done also using this dedicated web server access instead of the internal Dolibarr server.
SetHereVirtualHost=<u>Use with Apache/NGinx/...</u><br>Create on your web server (Apache, Nginx, ...) a dedicated Virtual Host with PHP enabled and a Root directory on<br><strong>%s</strong>
ExampleToUseInApacheVirtualHostConfig=Example to use in Apache virtual host setup:
YouCanAlsoTestWithPHPS=<u>Use with PHP embedded server</u><br>On develop environment, you may prefer to test the site with the PHP embedded web server (PHP 5.5 required) by running<br><strong>php -S 0.0.0.0:8080 -t %s</strong>
YouCanAlsoDeployToAnotherWHP=<u>Run your web site with another Dolibarr Hosting provider</u><br>If you don't have a web server like Apache or NGinx available on internet, you can export and import your web site onto another Dolibarr instance provided by another Dolibarr hosting provider that provide full integration with the Website module. You can find a list of some Dolibarr hosting providers on <a href="https://saas.dolibarr.org" target="_blank">https://saas.dolibarr.org</a>
CheckVirtualHostPerms=Check also that virtual host has permission <strong>%s</strong> on files into<br><strong>%s</strong>

View File

@ -4112,7 +4112,14 @@ tr.visible {
/* Module website */
/* ============================================================================== */
.phptag {
.exampleapachesetup {
overflow-y: auto;
height: 100px;
font-size: 0.8em;
border: 1px solid #aaa;
}
span[phptag] {
background: #ddd; border: 1px solid #ccc; border-radius: 4px;
}

View File

@ -4115,7 +4115,14 @@ tr.visible {
/* Module website */
/* ============================================================================== */
.phptag {
.exampleapachesetup {
overflow-y: auto;
max-height: 100px;
font-size: 0.8em;
border: 1px solid #aaa;
}
span[phptag] {
background: #ddd; border: 1px solid #ccc; border-radius: 4px;
}

View File

@ -2195,7 +2195,26 @@ if (!GETPOST('hide_websitemenu'))
$htmltext .= '<br>';
$htmltext .= '<br>'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("ReadPerm"), DOL_DOCUMENT_ROOT);
$htmltext .= '<br>'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("WritePerm"), DOL_DATA_ROOT.'/website<br>'.DOL_DATA_ROOT.'/medias');
$htmltext .= '<br>';
$examplewithapache = '<Directory "'.DOL_DOCUMENT_ROOT.'">'."\n";
$examplewithapache .= 'AllowOverride FileInfo Options
Options -Indexes -MultiViews -FollowSymLinks -ExecCGI
Require all granted
</Directory>
<Directory "'.DOL_DATA_ROOT.'/website">
AllowOverride FileInfo Options
Options -Indexes -MultiViews +FollowSymLinks -ExecCGI
Require all granted
</Directory>
<Directory "'.DOL_DATA_ROOT.'/medias">
AllowOverride FileInfo Options
Options -Indexes -MultiViews -FollowSymLinks -ExecCGI
Require all granted
</Directory>';
$htmltext .= '<br>'.$langs->trans("ExampleToUseInApacheVirtualHostConfig").':<br>';
$htmltext .= '<div class="centpercent exampleapachesetup">'.dol_nl2br(dol_escape_htmltag($examplewithapache, 1, 1)).'</div>';
$htmltext .= '<br>';
$htmltext .= $langs->trans("YouCanAlsoTestWithPHPS", $dataroot);
$htmltext .= '<br>';
@ -2371,12 +2390,12 @@ if (!GETPOST('hide_websitemenu'))
if (! isEditingEnabled || forceenable)
{
console.log("Enable inline edit");
jQuery(\'section[contenteditable="true"]\').each(function(idx){
jQuery(\'section[contenteditable="true"],div[contenteditable="true"]\').each(function(idx){
var idtouse = $(this).attr(\'id\');
console.log("Enable inline edit for "+idtouse);
CKEDITOR.inline(idtouse, {
// Allow some non-standard markup that we used in the introduction.
extraAllowedContent: \'span(*);cite(*);q(*);dl(*);dt(*);dd(*);ul(*);li(*);header(*);button(*);h1(*);h2(*);\',
extraAllowedContent: \'span(*);cite(*);q(*);dl(*);dt(*);dd(*);ul(*);li(*);header(*);button(*);h1(*);h2(*);title(*);\',
//extraPlugins: \'sourcedialog\',
removePlugins: \'flash,stylescombo\',
// Show toolbar on startup (optional).
@ -2400,7 +2419,9 @@ if (!GETPOST('hide_websitemenu'))
print $langs->trans("EditInLine");
print '</span>';
if ($websitepage->grabbed_from)
//$disableeditinline = $websitepage->grabbed_from;
$disableeditinline = 0;
if ($disableeditinline)
{
//print '<input type="submit" class="button bordertransp" disabled="disabled" title="'.dol_escape_htmltag($langs->trans("OnlyEditionOfSourceForGrabbedContent")).'" value="'.dol_escape_htmltag($langs->trans("EditWithEditor")).'" name="editcontent">';
print '<a class="nobordertransp opacitymedium nohoverborder marginleftonlyshort"'.$disabled.' href="#" disabled="disabled" title="'.dol_escape_htmltag($langs->trans("OnlyEditionOfSourceForGrabbedContent")).'">'.img_picto($langs->trans("OnlyEditionOfSourceForGrabbedContent"), 'switch_off', '', false, 0, 0, '', 'nomarginleft').'</a>';
@ -2421,12 +2442,6 @@ if (!GETPOST('hide_websitemenu'))
print '</div>';
print '<div class="inline-block marginrightonly">';
print $langs->trans("ShowSubcontainers");
/*if ($websitepage->grabbed_from)
{
print '<a class="button nobordertransp opacitymedium nohoverborder"'.$disabled.' href="#" disabled="disabled" title="'.dol_escape_htmltag($langs->trans("OnlyEditionOfSourceForGrabbedContent")).'">'.img_picto($langs->trans("OnlyEditionOfSourceForGrabbedContent"),'switch_off','',false,0,0,'','nomarginleft').'</a>';
}
else
{*/
if (empty($conf->global->WEBSITE_SUBCONTAINERSINLINE))
{
print '<a class="nobordertransp nohoverborder marginleftonlyshort"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=setshowsubcontainers">'.img_picto($langs->trans("ShowSubContainersOnOff", $langs->transnoentitiesnoconv("Off")), 'switch_off', '', false, 0, 0, '', 'nomarginleft').'</a>';