Work on module website
This commit is contained in:
parent
63bee0c2d0
commit
bf591f5f91
@ -5538,6 +5538,7 @@ function printCommonFooter($zone='private')
|
|||||||
{
|
{
|
||||||
print '<!-- Set handler to switch left menu page -->'."\n";
|
print '<!-- Set handler to switch left menu page -->'."\n";
|
||||||
print 'jQuery(".menuhider").click(function() {';
|
print 'jQuery(".menuhider").click(function() {';
|
||||||
|
print ' console.log("We click on .menuhider");'."\n";
|
||||||
print " $('.side-nav').toggle();";
|
print " $('.side-nav').toggle();";
|
||||||
if ($conf->theme == 'md') print " $('.login_block').toggle();";
|
if ($conf->theme == 'md') print " $('.login_block').toggle();";
|
||||||
print '});'."\n";
|
print '});'."\n";
|
||||||
|
|||||||
51
htdocs/core/lib/website.lib.php
Normal file
51
htdocs/core/lib/website.lib.php
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/core/lib/website.lib.php
|
||||||
|
* \ingroup website
|
||||||
|
* \brief Library for website module
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render a string of an HTML content and output it.
|
||||||
|
*
|
||||||
|
* @param string $content Content string
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function dolWebsiteOutput($content)
|
||||||
|
{
|
||||||
|
global $db, $langs, $conf, $user;
|
||||||
|
|
||||||
|
dol_syslog("dolWebsiteOutput start");
|
||||||
|
|
||||||
|
if (! defined('USEDOLIBARRSERVER'))
|
||||||
|
{
|
||||||
|
// Replace link of Dolibarr medias with direct link for virtual server
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
dol_syslog("dolWebsiteOutput end");
|
||||||
|
|
||||||
|
print $content;
|
||||||
|
}
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ else $searchform=$hookmanager->resPrint;
|
|||||||
|
|
||||||
print "\n";
|
print "\n";
|
||||||
print "<!-- Begin SearchForm -->\n";
|
print "<!-- Begin SearchForm -->\n";
|
||||||
print '<div class="center" data-role="page" align="center"><div align="center" style="padding: 6px;">';
|
print '<div class="center" align="center"><div align="center" style="padding: 6px;">';
|
||||||
print '<style>.menu_titre { padding-top: 7px; }</style>';
|
print '<style>.menu_titre { padding-top: 7px; }</style>';
|
||||||
//print '<div id="distance"></div><div id="container" class="center">';
|
//print '<div id="distance"></div><div id="container" class="center">';
|
||||||
print '<div id="blockvmenusearch">'."\n";
|
print '<div id="blockvmenusearch">'."\n";
|
||||||
|
|||||||
@ -371,7 +371,8 @@ dol_fiche_head($head, 'index', $langs->trans("ECMArea").' - '.$langs->trans("ECM
|
|||||||
|
|
||||||
// Start container of all panels
|
// Start container of all panels
|
||||||
?>
|
?>
|
||||||
<div id="containerlayout"> <!-- begin div id="containerlayout" -->
|
<!-- Begin div id="containerlayout" -->
|
||||||
|
<div id="containerlayout">
|
||||||
<div id="ecm-layout-north" class="toolbar largebutton">
|
<div id="ecm-layout-north" class="toolbar largebutton">
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
@ -430,23 +431,6 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti
|
|||||||
// Manual section
|
// Manual section
|
||||||
$htmltooltip=$langs->trans("ECMAreaDesc2");
|
$htmltooltip=$langs->trans("ECMAreaDesc2");
|
||||||
|
|
||||||
|
|
||||||
// Root of manual section
|
|
||||||
/*
|
|
||||||
print '<tr class="ecmroot">';
|
|
||||||
print '<td class="ecmroot">';
|
|
||||||
print img_picto_common('','treemenu/base.gif','class="inline-block valignmiddle"');
|
|
||||||
$txt=$langs->trans("ECMRoot").' ('.$langs->trans("ECMSectionsManual").')';
|
|
||||||
print $form->textwithpicto($txt, $htmltooltip, 1, 'info');
|
|
||||||
print '</td>';
|
|
||||||
print '<td class="ecmroot"></td>';
|
|
||||||
print '<td class="ecmroot"> </td>';
|
|
||||||
print '<td class="ecmroot"> </td>';
|
|
||||||
print '<td class="ecmroot"> </td>';
|
|
||||||
print '<td class="ecmroot"></td>';
|
|
||||||
print '</tr>';
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))
|
if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))
|
||||||
{
|
{
|
||||||
print '<tr><td colspan="6">';
|
print '<tr><td colspan="6">';
|
||||||
@ -677,12 +661,12 @@ else print ' ';
|
|||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div> <!-- end div id="containerlayout" -->
|
</div> <!-- End div id="containerlayout" -->
|
||||||
<?php
|
<?php
|
||||||
// End of page
|
// End of page
|
||||||
|
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end(1);
|
||||||
|
|
||||||
|
|
||||||
if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) {
|
if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) {
|
||||||
|
|||||||
@ -401,7 +401,8 @@ dol_fiche_head($head, 'index_auto', $langs->trans("ECMArea").' - '.$langs->trans
|
|||||||
|
|
||||||
// Start container of all panels
|
// Start container of all panels
|
||||||
?>
|
?>
|
||||||
<div id="containerlayout"> <!-- begin div id="containerlayout" -->
|
<!-- Begin div id="containerlayout" -->
|
||||||
|
<div id="containerlayout">
|
||||||
<div id="ecm-layout-north" class="toolbar largebutton">
|
<div id="ecm-layout-north" class="toolbar largebutton">
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
@ -448,21 +449,6 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti
|
|||||||
{
|
{
|
||||||
$htmltooltip=$langs->trans("ECMAreaDesc2");
|
$htmltooltip=$langs->trans("ECMAreaDesc2");
|
||||||
|
|
||||||
// Root title line (Automatic section)
|
|
||||||
/*print '<tr class="ecmroot">';
|
|
||||||
print '<td class="ecmroot">';
|
|
||||||
print img_picto_common('','treemenu/base.gif','class="inline-block valignmiddle"');
|
|
||||||
$txt=$langs->trans("ECMRoot").' ('.$langs->trans("ECMSectionsAuto").')';
|
|
||||||
print $form->textwithpicto($txt, $htmltooltip, 1, 0);
|
|
||||||
print '</td>';
|
|
||||||
print '<td class="ecmroot"> </td>';
|
|
||||||
print '<td class="ecmroot"> </td>';
|
|
||||||
print '<td class="ecmroot"> </td>';
|
|
||||||
print '<td class="ecmroot"> </td>';
|
|
||||||
print '<td class="ecmroot"></td>';
|
|
||||||
print '</tr>';
|
|
||||||
*/
|
|
||||||
|
|
||||||
$sectionauto=dol_sort_array($sectionauto,'label','ASC',true,false);
|
$sectionauto=dol_sort_array($sectionauto,'label','ASC',true,false);
|
||||||
|
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
@ -532,12 +518,12 @@ include_once DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirpreview.php';
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div> <!-- end div id="containerlayout" -->
|
</div> <!-- End div id="containerlayout" -->
|
||||||
<?php
|
<?php
|
||||||
// End of page
|
// End of page
|
||||||
|
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end(1);
|
||||||
|
|
||||||
|
|
||||||
if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) {
|
if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) {
|
||||||
|
|||||||
@ -25,4 +25,4 @@ RealURL=Real URL
|
|||||||
ViewWebsiteInProduction=View web site using home URLs
|
ViewWebsiteInProduction=View web site using home URLs
|
||||||
SetHereVirtualHost=If you can set, on your web server, a dedicated virtual host with a root directory on <strong>%s</strong>, define here the virtual hostname so the preview can be done also using this direct web server access and not only using Dolibarr server.
|
SetHereVirtualHost=If you can set, on your web server, a dedicated virtual host with a root directory on <strong>%s</strong>, define here the virtual hostname so the preview can be done also using this direct web server access and not only using Dolibarr server.
|
||||||
PreviewSiteServedByWebServer=Preview %s in a new tab. The %s will be served by an external web server (like Apache, Nginx, IIS). You must instal and setup this server before.<br>URL of %s served by external server:<br><strong>%s</strong>
|
PreviewSiteServedByWebServer=Preview %s in a new tab. The %s will be served by an external web server (like Apache, Nginx, IIS). You must instal and setup this server before.<br>URL of %s served by external server:<br><strong>%s</strong>
|
||||||
PreviewSiteServedByDolibarr=Preview %s in a new tab. The %s will be served by Dolibarr server so it does not need any extra web server (like Apache, Nginx, IIS) to be installed.<br>The inconvenient is that URL of pages are using path of your Dolibarr.<br>URL of %s served by Dolibarr:<br><strong>%s</strong>
|
PreviewSiteServedByDolibarr=Preview %s in a new tab. The %s will be served by Dolibarr server so it does not need any extra web server (like Apache, Nginx, IIS) to be installed.<br>The inconvenient is that URL of pages are not user friendly and start with path of your Dolibarr.<br>URL of %s served by Dolibarr:<br><strong>%s</strong>
|
||||||
|
|||||||
@ -1500,7 +1500,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
|
|||||||
print "<!-- End top horizontal menu -->\n\n";
|
print "<!-- End top horizontal menu -->\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile)) print '<div id="id-container" class="id-container'.($morecss?' '.$morecss:'').'">';
|
if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile)) print '<!-- Begin div id-container --><div id="id-container" class="id-container'.($morecss?' '.$morecss:'').'">';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1533,7 +1533,7 @@ function left_menu($menu_array_before, $helppagename='', $notused='', $menu_arra
|
|||||||
// Instantiate hooks of thirdparty module
|
// Instantiate hooks of thirdparty module
|
||||||
$hookmanager->initHooks(array('searchform','leftblock'));
|
$hookmanager->initHooks(array('searchform','leftblock'));
|
||||||
|
|
||||||
print "\n".'<!-- Begin id-left -->'."\n".'<div class="side-nav"><div id="id-left">'."\n";
|
print "\n".'<!-- Begin side-nav id-left -->'."\n".'<div class="side-nav"><div id="id-left">'."\n";
|
||||||
|
|
||||||
print "\n";
|
print "\n";
|
||||||
|
|
||||||
@ -1697,7 +1697,7 @@ function left_menu($menu_array_before, $helppagename='', $notused='', $menu_arra
|
|||||||
$reshook=$hookmanager->executeHooks('printLeftBlock',$parameters); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('printLeftBlock',$parameters); // Note that $action and $object may have been modified by some hooks
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
|
|
||||||
print '</div></div> <!-- end id-left -->'; // End div id="id-left"
|
print '</div></div> <!-- End side-nav id-left -->'; // End div id="side-nav" div id="id-left"
|
||||||
}
|
}
|
||||||
|
|
||||||
print "\n";
|
print "\n";
|
||||||
@ -1721,8 +1721,7 @@ function main_area($title='')
|
|||||||
|
|
||||||
print "\n";
|
print "\n";
|
||||||
|
|
||||||
if (! empty($conf->dol_use_jmobile)) print '<div data-role="page">';
|
print '<!-- Begin div class="fiche" -->'."\n".'<div class="fiche">'."\n";
|
||||||
print '<div class="fiche"> <!-- begin div class="fiche" -->'."\n";
|
|
||||||
if (! empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) print info_admin($langs->trans("WarningYouAreInMaintenanceMode",$conf->global->MAIN_ONLY_LOGIN_ALLOWED));
|
if (! empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) print info_admin($langs->trans("WarningYouAreInMaintenanceMode",$conf->global->MAIN_ONLY_LOGIN_ALLOWED));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1861,7 +1860,6 @@ if (! function_exists("llxFooter"))
|
|||||||
|
|
||||||
print "\n\n";
|
print "\n\n";
|
||||||
print '</div> <!-- End div class="fiche" -->'."\n";
|
print '</div> <!-- End div class="fiche" -->'."\n";
|
||||||
if (! empty($conf->dol_use_jmobile)) print '</div>'; // end data-role="page"
|
|
||||||
|
|
||||||
if (empty($conf->dol_hide_leftmenu)) print '</div> <!-- End div id-right -->'; // End div id-right
|
if (empty($conf->dol_hide_leftmenu)) print '</div> <!-- End div id-right -->'; // End div id-right
|
||||||
|
|
||||||
|
|||||||
@ -48,7 +48,6 @@ if (empty($usedolheader))
|
|||||||
|
|
||||||
<body style="padding: 10px;">
|
<body style="padding: 10px;">
|
||||||
|
|
||||||
<div data-role="page">
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
@ -350,7 +349,7 @@ if (! empty($usedolheader))
|
|||||||
{
|
{
|
||||||
llxFooter();
|
llxFooter();
|
||||||
} else { ?>
|
} else { ?>
|
||||||
</div>
|
|
||||||
</body>
|
</body>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@ -740,6 +740,7 @@ div.fiche>form>div.div-table-responsive {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.hideonsmartphone { display: none; }
|
.hideonsmartphone { display: none; }
|
||||||
|
.hideonsmartphoneimp { display: none !important; }
|
||||||
.noenlargeonsmartphone { width : 50px !important; display: inline !important; }
|
.noenlargeonsmartphone { width : 50px !important; display: inline !important; }
|
||||||
.maxwidthonsmartphone, #search_newcompany.ui-autocomplete-input { max-width: 100px; }
|
.maxwidthonsmartphone, #search_newcompany.ui-autocomplete-input { max-width: 100px; }
|
||||||
.maxwidth50onsmartphone { max-width: 40px; }
|
.maxwidth50onsmartphone { max-width: 40px; }
|
||||||
@ -868,6 +869,8 @@ div.vmenu, td.vmenu {
|
|||||||
.side-nav {
|
.side-nav {
|
||||||
border-bottom: 1px solid #BBB;
|
border-bottom: 1px solid #BBB;
|
||||||
background: #FFF;
|
background: #FFF;
|
||||||
|
padding-left: 20px;
|
||||||
|
padding-right: 20px;
|
||||||
}
|
}
|
||||||
.side-nav {
|
.side-nav {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@ -3250,6 +3253,7 @@ td.hidden {
|
|||||||
.websitebar {
|
.websitebar {
|
||||||
border-bottom: 1px solid #888;
|
border-bottom: 1px solid #888;
|
||||||
background: #eee;
|
background: #eee;
|
||||||
|
display: inline-block;
|
||||||
}
|
}
|
||||||
.websitebar .button, .websitebar .buttonDelete
|
.websitebar .button, .websitebar .buttonDelete
|
||||||
{
|
{
|
||||||
@ -3261,11 +3265,15 @@ td.hidden {
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
line-height: 29px;
|
/* line-height: 29px; */
|
||||||
}
|
}
|
||||||
.websitetools {
|
.websitetools {
|
||||||
float: right;
|
float: right;
|
||||||
height: 28px;
|
/* height: 28px; */
|
||||||
|
}
|
||||||
|
.websiteselection, .websitetools {
|
||||||
|
padding-top: 3px;
|
||||||
|
padding-bottom: 3px;
|
||||||
}
|
}
|
||||||
.websiteinputurl {
|
.websiteinputurl {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
@ -3274,6 +3282,9 @@ td.hidden {
|
|||||||
.websiteiframenoborder {
|
.websiteiframenoborder {
|
||||||
border: 0px;
|
border: 0px;
|
||||||
}
|
}
|
||||||
|
a.websitebuttonsitepreview {
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
a.websitebuttonsitepreview img {
|
a.websitebuttonsitepreview img {
|
||||||
width: 26px;
|
width: 26px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
|||||||
@ -60,6 +60,7 @@ function llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0,
|
|||||||
|
|
||||||
// main area
|
// main area
|
||||||
//main_area($title);
|
//main_area($title);
|
||||||
|
print '<!-- Begin div class="fiche" -->'."\n".'<div class="fichebutwithotherclass">'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -76,7 +77,10 @@ $langs->load("website");
|
|||||||
|
|
||||||
if (! $user->admin) accessforbidden();
|
if (! $user->admin) accessforbidden();
|
||||||
|
|
||||||
$conf->dol_hide_leftmenu = 1;
|
if (! ((GETPOST('testmenuhider') || ! empty($conf->global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)))
|
||||||
|
{
|
||||||
|
$conf->dol_hide_leftmenu = 1; // Force hide of left menu.
|
||||||
|
}
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
$website=GETPOST('website', 'alpha');
|
$website=GETPOST('website', 'alpha');
|
||||||
@ -239,7 +243,8 @@ if ($action == 'updatecss')
|
|||||||
$db->rollback();
|
$db->rollback();
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
$csscontent = '<!-- START DOLIBARR-WEBSITE-ADDED-HEADER -->'."\n";
|
$csscontent = '<!-- BEGIN DOLIBARR-WEBSITE-ADDED-HEADER -->'."\n";
|
||||||
|
$csscontent.= '<!-- File generated to wrap the css file - DO NOT MODIFY - It is just a copy of database css content -->'."\n";
|
||||||
$csscontent.= '<?php '."\n";
|
$csscontent.= '<?php '."\n";
|
||||||
$csscontent.= "header('Content-type: text/css');\n";
|
$csscontent.= "header('Content-type: text/css');\n";
|
||||||
$csscontent.= "?>"."\n";
|
$csscontent.= "?>"."\n";
|
||||||
@ -291,7 +296,7 @@ if ($action == 'setashome')
|
|||||||
dol_delete_file($fileindex);
|
dol_delete_file($fileindex);
|
||||||
|
|
||||||
$indexcontent = '<?php'."\n";
|
$indexcontent = '<?php'."\n";
|
||||||
$indexcontent.= '// File generated to wrap the home page'."\n";
|
$indexcontent.= '// File generated to wrap the home page - DO NOT MODIFY - It is just an include'."\n";
|
||||||
$indexcontent.= "include_once './".basename($filetpl)."'\n";
|
$indexcontent.= "include_once './".basename($filetpl)."'\n";
|
||||||
$indexcontent.= '?>'."\n";
|
$indexcontent.= '?>'."\n";
|
||||||
$result = file_put_contents($fileindex, $indexcontent);
|
$result = file_put_contents($fileindex, $indexcontent);
|
||||||
@ -350,7 +355,7 @@ if ($action == 'updatemeta')
|
|||||||
dol_delete_file($filemaster);
|
dol_delete_file($filemaster);
|
||||||
|
|
||||||
$mastercontent = '<?php'."\n";
|
$mastercontent = '<?php'."\n";
|
||||||
$mastercontent.= '// File generated to link to the master file'."\n";
|
$mastercontent.= '// File generated to link to the master file - DO NOT MODIFY - It is just an include'."\n";
|
||||||
$mastercontent.= "if (! defined('USEDOLIBARRSERVER')) require '".DOL_DOCUMENT_ROOT."/master.inc.php';\n";
|
$mastercontent.= "if (! defined('USEDOLIBARRSERVER')) require '".DOL_DOCUMENT_ROOT."/master.inc.php';\n";
|
||||||
$mastercontent.= '?>'."\n";
|
$mastercontent.= '?>'."\n";
|
||||||
$result = file_put_contents($filemaster, $mastercontent);
|
$result = file_put_contents($filemaster, $mastercontent);
|
||||||
@ -368,7 +373,7 @@ if ($action == 'updatemeta')
|
|||||||
}
|
}
|
||||||
|
|
||||||
$aliascontent = '<?php'."\n";
|
$aliascontent = '<?php'."\n";
|
||||||
$aliascontent.= '// File generated to wrap the alias page'."\n";
|
$aliascontent.= '// File generated to wrap the page - DO NOT MODIFY - It is just an include'."\n";
|
||||||
$aliascontent.= "include_once './page".$objectpage->id.".tpl.php';\n";
|
$aliascontent.= "include_once './page".$objectpage->id.".tpl.php';\n";
|
||||||
$aliascontent.= '?>'."\n";
|
$aliascontent.= '?>'."\n";
|
||||||
$result = file_put_contents($filealias, $aliascontent);
|
$result = file_put_contents($filealias, $aliascontent);
|
||||||
@ -390,6 +395,7 @@ if ($action == 'updatemeta')
|
|||||||
$tplcontent.= '<meta http-equiv="content-type" content="text/html; charset=utf-8" />'."\n";
|
$tplcontent.= '<meta http-equiv="content-type" content="text/html; charset=utf-8" />'."\n";
|
||||||
$tplcontent.= '<meta name="robots" content="index, follow" />'."\n";
|
$tplcontent.= '<meta name="robots" content="index, follow" />'."\n";
|
||||||
$tplcontent.= '<meta name="viewport" content="width=device-width, initial-scale=0.8">'."\n";
|
$tplcontent.= '<meta name="viewport" content="width=device-width, initial-scale=0.8">'."\n";
|
||||||
|
$tplcontent.= '<link rel="canonical" href="'.$objectpage->pageurl.'">'."\n";
|
||||||
$tplcontent.= '<meta name="keywords" content="'.join(', ', explode(',',$objectpage->keywords)).'" />'."\n";
|
$tplcontent.= '<meta name="keywords" content="'.join(', ', explode(',',$objectpage->keywords)).'" />'."\n";
|
||||||
$tplcontent.= '<meta name="title" content="'.dol_escape_htmltag($objectpage->title).'" />'."\n";
|
$tplcontent.= '<meta name="title" content="'.dol_escape_htmltag($objectpage->title).'" />'."\n";
|
||||||
$tplcontent.= '<meta name="description" content="'.dol_escape_htmltag($objectpage->description).'" />'."\n";
|
$tplcontent.= '<meta name="description" content="'.dol_escape_htmltag($objectpage->description).'" />'."\n";
|
||||||
@ -485,7 +491,7 @@ if ($action == 'updatecontent')
|
|||||||
}
|
}
|
||||||
|
|
||||||
$aliascontent = '<?php'."\n";
|
$aliascontent = '<?php'."\n";
|
||||||
$aliascontent.= '// File generated to wrap the alias page'."\n";
|
$aliascontent.= "// File generated to wrap the alias page - DO NOT MODIFY - It is just a copy of database page content\n";
|
||||||
$aliascontent.= "include_once './page".$objectpage->id.".tpl.php';\n";
|
$aliascontent.= "include_once './page".$objectpage->id.".tpl.php';\n";
|
||||||
$aliascontent.= '?>'."\n";
|
$aliascontent.= '?>'."\n";
|
||||||
$result = file_put_contents($filealias, $aliascontent);
|
$result = file_put_contents($filealias, $aliascontent);
|
||||||
@ -495,12 +501,15 @@ if ($action == 'updatecontent')
|
|||||||
if (! $result) setEventMessages('Failed to write file '.$filealias, null, 'errors');
|
if (! $result) setEventMessages('Failed to write file '.$filealias, null, 'errors');
|
||||||
|
|
||||||
|
|
||||||
// Now create the .tpl file
|
// Now create the .tpl file with code to be able to make dynamic changes
|
||||||
// TODO Keep a one time generate file or include a dynamicaly generated content ?
|
|
||||||
dol_delete_file($filetpl);
|
dol_delete_file($filetpl);
|
||||||
|
|
||||||
$tplcontent ='';
|
$tplcontent ='';
|
||||||
$tplcontent.= "<?php if (! defined('USEDOLIBARRSERVER')) require './master.inc.php'; ?>"."\n";
|
$tplcontent.= "<?php // BEGIN PHP\n";
|
||||||
|
$tplcontent.= "if (! defined('USEDOLIBARRSERVER')) { require './master.inc.php'; } // Not already loaded"."\n";
|
||||||
|
$tplcontent.= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n";
|
||||||
|
$tplcontent.= "ob_start();\n";
|
||||||
|
$tplcontent.= "// END PHP ?>\n";
|
||||||
$tplcontent.= '<html>'."\n";
|
$tplcontent.= '<html>'."\n";
|
||||||
$tplcontent.= '<header>'."\n";
|
$tplcontent.= '<header>'."\n";
|
||||||
$tplcontent.= '<meta http-equiv="content-type" content="text/html; charset=utf-8" />'."\n";
|
$tplcontent.= '<meta http-equiv="content-type" content="text/html; charset=utf-8" />'."\n";
|
||||||
@ -517,6 +526,11 @@ if ($action == 'updatecontent')
|
|||||||
$tplcontent.= '<body>'."\n";
|
$tplcontent.= '<body>'."\n";
|
||||||
$tplcontent.= $objectpage->content."\n";
|
$tplcontent.= $objectpage->content."\n";
|
||||||
$tplcontent.= '</body>'."\n";
|
$tplcontent.= '</body>'."\n";
|
||||||
|
|
||||||
|
$tplcontent.= '<?php // BEGIN PHP'."\n";
|
||||||
|
$tplcontent.= '$tmp = ob_get_contents(); ob_end_clean(); dolWebsiteOutput($tmp);'."\n";
|
||||||
|
$tplcontent.= "// END PHP ?>"."\n";
|
||||||
|
|
||||||
//var_dump($filetpl);exit;
|
//var_dump($filetpl);exit;
|
||||||
$result = file_put_contents($filetpl, $tplcontent);
|
$result = file_put_contents($filetpl, $tplcontent);
|
||||||
if (! empty($conf->global->MAIN_UMASK))
|
if (! empty($conf->global->MAIN_UMASK))
|
||||||
@ -596,14 +610,14 @@ if (count($object->records) > 0)
|
|||||||
{
|
{
|
||||||
// ***** Part for web sites
|
// ***** Part for web sites
|
||||||
|
|
||||||
print '<div class="websiteselection">';
|
print '<div class="websiteselection hideonsmartphoneimp">';
|
||||||
print $langs->trans("Website").': ';
|
print $langs->trans("Website").': ';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
// List of websites
|
// List of websites
|
||||||
print '<div class="websiteselection">';
|
print '<div class="websiteselection">';
|
||||||
$out='';
|
$out='';
|
||||||
$out.='<select name="website">';
|
$out.='<select name="website" id="website">';
|
||||||
if (empty($object->records)) $out.='<option value="-1"> </option>';
|
if (empty($object->records)) $out.='<option value="-1"> </option>';
|
||||||
// Loop on each sites
|
// Loop on each sites
|
||||||
$i=0;
|
$i=0;
|
||||||
@ -619,6 +633,7 @@ if (count($object->records) > 0)
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$out.='</select>';
|
$out.='</select>';
|
||||||
|
$out.=ajax_combobox('website');
|
||||||
print $out;
|
print $out;
|
||||||
print '<input type="submit" class="button" name="refreshsite" value="'.$langs->trans("Load").'">';
|
print '<input type="submit" class="button" name="refreshsite" value="'.$langs->trans("Load").'">';
|
||||||
|
|
||||||
@ -688,7 +703,7 @@ if (count($object->records) > 0)
|
|||||||
$atleastonepage=(is_array($array) && count($array) > 0);
|
$atleastonepage=(is_array($array) && count($array) > 0);
|
||||||
|
|
||||||
print '<div class="centpercent websitebar"'.($style?' style="'.$style.'"':'').'">';
|
print '<div class="centpercent websitebar"'.($style?' style="'.$style.'"':'').'">';
|
||||||
print '<div class="websiteselection">';
|
print '<div class="websiteselection hideonsmartphoneimp">';
|
||||||
print $langs->trans("Page").': ';
|
print $langs->trans("Page").': ';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '<div class="websiteselection">';
|
print '<div class="websiteselection">';
|
||||||
@ -696,7 +711,7 @@ if (count($object->records) > 0)
|
|||||||
if ($action != 'add')
|
if ($action != 'add')
|
||||||
{
|
{
|
||||||
$out='';
|
$out='';
|
||||||
$out.='<select name="pageid">';
|
$out.='<select name="pageid" id="pageid" class="minwidth200">';
|
||||||
if ($atleastonepage)
|
if ($atleastonepage)
|
||||||
{
|
{
|
||||||
if (empty($pageid) && $action != 'create') // Page id is not defined, we try to take one
|
if (empty($pageid) && $action != 'create') // Page id is not defined, we try to take one
|
||||||
@ -722,6 +737,7 @@ if (count($object->records) > 0)
|
|||||||
}
|
}
|
||||||
else $out.='<option value="-1"> </option>';
|
else $out.='<option value="-1"> </option>';
|
||||||
$out.='</select>';
|
$out.='</select>';
|
||||||
|
$out.=ajax_combobox('pageid');
|
||||||
print $out;
|
print $out;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -853,8 +869,8 @@ if ($action == 'editcss')
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
$csscontent = @file_get_contents($filecss);
|
$csscontent = @file_get_contents($filecss);
|
||||||
// Clean php css file to get only css part
|
// Clean the php css file to remove php code and get only css part
|
||||||
$csscontent = preg_replace('/<!-- START DOLIBARR.*END -->/s', '', $csscontent);
|
$csscontent = preg_replace('/<!-- BEGIN DOLIBARR.*END -->/s', '', $csscontent);
|
||||||
|
|
||||||
dol_fiche_head();
|
dol_fiche_head();
|
||||||
|
|
||||||
@ -992,15 +1008,12 @@ if ($action == 'preview')
|
|||||||
{
|
{
|
||||||
$objectpage->fetch($pageid);
|
$objectpage->fetch($pageid);
|
||||||
|
|
||||||
print "\n".'<!-- Page content '.$filetpl.' : Div with (CSS + Page content from database) -->'."\n";
|
$out = "\n".'<!-- Page content '.$filetpl.' : Div with (CSS + Page content from database) -->'."\n";
|
||||||
|
|
||||||
|
|
||||||
$csscontent = @file_get_contents($filecss);
|
|
||||||
|
|
||||||
$out='';
|
|
||||||
|
|
||||||
$out.='<div id="websitecontent" class="websitecontent">'."\n";
|
$out.='<div id="websitecontent" class="websitecontent">'."\n";
|
||||||
|
|
||||||
|
$csscontent = @file_get_contents($filecss);
|
||||||
|
|
||||||
$out.='<style scoped>'."\n"; // "scoped" means "apply to parent element only". Not yet supported by browsers
|
$out.='<style scoped>'."\n"; // "scoped" means "apply to parent element only". Not yet supported by browsers
|
||||||
$out.=$csscontent;
|
$out.=$csscontent;
|
||||||
$out.='</style>'."\n";
|
$out.='</style>'."\n";
|
||||||
@ -1009,6 +1022,8 @@ if ($action == 'preview')
|
|||||||
|
|
||||||
$out.='</div>';
|
$out.='</div>';
|
||||||
|
|
||||||
|
$out.= "\n".'<!-- End page content '.$filetpl.' -->'."\n\n";
|
||||||
|
|
||||||
print $out;
|
print $out;
|
||||||
|
|
||||||
/*file_put_contents($filetpl, $out);
|
/*file_put_contents($filetpl, $out);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user