Work on website module

This commit is contained in:
Laurent Destailleur 2018-07-23 14:08:20 +02:00
parent 45c7a47d7f
commit 174394c476
7 changed files with 42 additions and 20 deletions

View File

@ -40,6 +40,14 @@ function dolWebsiteReplacementOfLinks($website, $content, $removephppart=0)
if ($removephppart) $replacewith='';
$content = preg_replace('/value="<\?php((?!\?>).)*\?>\n*/ims', 'value="'.$replacewith.'"', $content);
$replacewith='"callto=#';
if ($removephppart) $replacewith='';
$content = preg_replace('/"callto:<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
$replacewith='"mailto=#';
if ($removephppart) $replacewith='';
$content = preg_replace('/"mailto:<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
$replacewith='<span class="phptag">...php...</span>';
if ($removephppart) $replacewith='';
$content = preg_replace('/<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);

View File

@ -196,11 +196,10 @@ if ($forgetpasslink || $helpcenterlink)
if ($dol_use_jmobile) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_use_jmobile='.$dol_use_jmobile;
echo '<br>';
echo '<div class="center" style="margin-top: 8px;">';
echo '<div class="center" style="margin-top: 15px;">';
if ($forgetpasslink) {
echo '<a class="alogin" href="'.DOL_URL_ROOT.'/user/passwordforgotten.php'.$moreparam.'">(';
echo '<a class="alogin" href="'.DOL_URL_ROOT.'/user/passwordforgotten.php'.$moreparam.'">';
echo $langs->trans('PasswordForgotten');
if (! $helpcenterlink) echo ')';
echo '</a>';
}
@ -210,9 +209,8 @@ if ($forgetpasslink || $helpcenterlink)
$url=DOL_URL_ROOT.'/support/index.php'.$moreparam;
if (! empty($conf->global->MAIN_HELPCENTER_LINKTOUSE)) $url=$conf->global->MAIN_HELPCENTER_LINKTOUSE;
echo '<a class="alogin" href="'.dol_escape_htmltag($url).'" target="_blank">';
if (! $forgetpasslink) echo '(';
echo $langs->trans('NeedHelpCenter');
echo ')</a>';
echo '</a>';
}
echo '</div>';
}

View File

@ -155,7 +155,7 @@ if (! empty($morelogincontent)) {
<br><input type="submit" <?php echo $disabled; ?> class="button" name="button_password" value="<?php echo $langs->trans('SendNewPassword'); ?>" tabindex="4" />
<br>
<div align="center" style="margin-top: 8px;">
<div align="center" style="margin-top: 15px;">
<?php
$moreparam='';
if (! empty($conf->dol_hide_topmenu)) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_hide_topmenu='.$conf->dol_hide_topmenu;
@ -163,7 +163,7 @@ if (! empty($morelogincontent)) {
if (! empty($conf->dol_no_mouse_hover)) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_no_mouse_hover='.$conf->dol_no_mouse_hover;
if (! empty($conf->dol_use_jmobile)) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_use_jmobile='.$conf->dol_use_jmobile;
print '<a class="alogin" href="'.$dol_url_root.'/index.php'.$moreparam.'">('.$langs->trans('BackToLoginPage').')</a>';
print '<a class="alogin" href="'.$dol_url_root.'/index.php'.$moreparam.'">'.$langs->trans('BackToLoginPage').'</a>';
?>
</div>

View File

@ -1664,6 +1664,9 @@ div.mainmenu.menu {
#mainmenutd_menu a.tmenuimage {
display: unset;
}
a.tmenuimage {
display: block;
}
/* Do not load menu img for other if hidden to save bandwidth */

View File

@ -1809,7 +1809,9 @@ foreach($mainmenuusedarray as $val)
display: none;
<?php } ?>
}
a.tmenuimage {
display: block;
}
/* Login */

View File

@ -781,13 +781,21 @@ class Website extends CommonObject
return '';
}
$srcdir = $conf->website->dir_output.'/'.$website->ref;
$destdir = $conf->website->dir_temp.'/'.$website->ref.'/containers';
$destdir = $conf->website->dir_temp.'/'.$website->ref;
dol_syslog("Clear temp dir ".$destdir);
$count=0; $countreallydeleted=0;
$counttodelete = dol_delete_dir_recursive($destdir, $count, 1, 0, $countreallydeleted);
if ($counttodelete != $countreallydeleted)
{
setEventMessages("Failed to clean temp directory ".$destdir, null, 'errors');
return '';
}
$arrayreplacement=array();
dol_syslog("Clear temp dir ".$destdir);
dol_delete_dir($destdir, 1);
$srcdir = $conf->website->dir_output.'/'.$website->ref;
$destdir = $conf->website->dir_temp.'/'.$website->ref.'/containers';
dol_syslog("Copy content from ".$srcdir." into ".$destdir);
dolCopyDir($srcdir, $destdir, 0, 1, $arrayreplacement);

View File

@ -1420,7 +1420,7 @@ if (count($object->records) > 0)
$out.=ajax_combobox('website');
print $out;
//print '<input type="submit" class="button" name="refreshsite" value="'.$langs->trans("Load").'">';
print '<input type="image" class="valignbottom" src="'.img_picto('', 'refresh', '', 0, 1).'" name="refreshpage" value="'.$langs->trans("Load").'">';
print '<input type="image" class="valignmiddle" src="'.img_picto('', 'refresh', '', 0, 1).'" name="refreshpage" value="'.$langs->trans("Load").'">';
if ($websitekey)
@ -1587,7 +1587,7 @@ if (count($object->records) > 0)
}
//print '<input type="submit" class="button" name="refreshpage" value="'.$langs->trans("Load").'"'.($atleastonepage?'':' disabled="disabled"').'>';
print '<input type="image" class="valignbottom" src="'.img_picto('', 'refresh', '', 0, 1).'" name="refreshpage" value="'.$langs->trans("Load").'"'.($atleastonepage?'':' disabled="disabled"').'>';
print '<input type="image" class="valignmiddle" src="'.img_picto('', 'refresh', '', 0, 1).'" name="refreshpage" value="'.$langs->trans("Load").'"'.($atleastonepage?'':' disabled="disabled"').'>';
// Print nav arrows
@ -1619,10 +1619,10 @@ if (count($object->records) > 0)
else dol_print_error($db);
}
if ($pagepreviousid) print '<a href="'.$_SERVER['PHP_SELF'].'?website='.urlencode($object->ref).'&pageid='.$pagepreviousid.'&action='.$action.'">'.img_previous($langs->trans("PreviousContainer")).'</a>';
else print '<span class="opacitymedium">'.img_previous($langs->trans("PreviousContainer")).'</span>';
if ($pagenextid) print '<a href="'.$_SERVER['PHP_SELF'].'?website='.urlencode($object->ref).'&pageid='.$pagenextid.'&action='.$action.'">'.img_next($langs->trans("NextContainer")).'</a>';
else print '<span class="opacitymedium">'.img_next($langs->trans("NextContainer")).'</span>';
if ($pagepreviousid) print '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?website='.urlencode($object->ref).'&pageid='.$pagepreviousid.'&action='.$action.'">'.img_previous($langs->trans("PreviousContainer")).'</a>';
else print '<span class="valignmiddle opacitymedium">'.img_previous($langs->trans("PreviousContainer")).'</span>';
if ($pagenextid) print '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?website='.urlencode($object->ref).'&pageid='.$pagenextid.'&action='.$action.'">'.img_next($langs->trans("NextContainer")).'</a>';
else print '<span class="valignmiddle opacitymedium">'.img_next($langs->trans("NextContainer")).'</span>';
$websitepage = new WebSitePage($db);
if ($pageid > 0 && ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone'))
@ -2321,7 +2321,6 @@ if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpa
{
// Ouput page under the Dolibarr top menu
$objectpage->fetch($pageid);
$csscontent = @file_get_contents($filecss);
$jscontent = @file_get_contents($filejs);
$out = '<!-- Page content '.$filetpl.' : Div with (CSS Of website from file + Style/htmlheader of page from database + Page content from database) -->'."\n";
@ -2341,7 +2340,11 @@ if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpa
$out.='<style scoped>'."\n"; // "scoped" means "apply to parent element only". No more supported by browsers, snif !
$tmpout='';
$tmpout.= '/* Include website CSS file */'."\n";
//var_dump($website);
//$csscontent = @file_get_contents($filecss);
ob_start();
include $filecss;
$csscontent = ob_get_contents();
ob_end_clean();
$tmpout.= dolWebsiteReplacementOfLinks($object, $csscontent, 1);
$tmpout.= '/* Include style from the HTML header of page */'."\n";
// Clean the html header of page to get only <style> content