diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e7a1c6e6a7609b325cd25a866e620b538d32be38..c178bf0fd7e1abc0e3e3df73b17ed3816981e8dc 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5538,6 +5538,7 @@ function printCommonFooter($zone='private') { print '<!-- Set handler to switch left menu page -->'."\n"; print 'jQuery(".menuhider").click(function() {'; + print ' console.log("We click on .menuhider");'."\n"; print " $('.side-nav').toggle();"; if ($conf->theme == 'md') print " $('.login_block').toggle();"; print '});'."\n"; diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php new file mode 100644 index 0000000000000000000000000000000000000000..ebbd261984e4a061d0c442ccc2ba490bec80eff2 --- /dev/null +++ b/htdocs/core/lib/website.lib.php @@ -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; +} + diff --git a/htdocs/core/search_page.php b/htdocs/core/search_page.php index 09b37f4bb8a454bc009109ab7db55ec4b0924d7c..ffbad81a30f4b3267f689b440b115c214d585ea1 100644 --- a/htdocs/core/search_page.php +++ b/htdocs/core/search_page.php @@ -111,7 +111,7 @@ else $searchform=$hookmanager->resPrint; print "\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 '<div id="distance"></div><div id="container" class="center">'; print '<div id="blockvmenusearch">'."\n"; diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index 5ca14fe5dff687e6b5d1f25300efe08b00bfdd99..be0520e92984b18ccbb9e76be291397413a7196f 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -371,7 +371,8 @@ dol_fiche_head($head, 'index', $langs->trans("ECMArea").' - '.$langs->trans("ECM // 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"> <?php @@ -429,23 +430,6 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti // Manual section $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)) { @@ -677,12 +661,12 @@ else print ' '; ?> </div> </div> -</div> <!-- end div id="containerlayout" --> +</div> <!-- End div id="containerlayout" --> <?php // End of page -dol_fiche_end(); +dol_fiche_end(1); if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) { diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php index 23a96e4367b37fa35d0ea027e9bde349f2d9eb81..065d14b4593bba11cab9f5b574d92ff744f138e4 100644 --- a/htdocs/ecm/index_auto.php +++ b/htdocs/ecm/index_auto.php @@ -401,7 +401,8 @@ dol_fiche_head($head, 'index_auto', $langs->trans("ECMArea").' - '.$langs->trans // 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"> <?php @@ -448,21 +449,6 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti { $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); print '<tr>'; @@ -532,12 +518,12 @@ include_once DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirpreview.php'; </div> </div> -</div> <!-- end div id="containerlayout" --> +</div> <!-- End div id="containerlayout" --> <?php // End of page -dol_fiche_end(); +dol_fiche_end(1); if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) { diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index 463d1c9e81e23301ad073416e9b18d6a7d4c1c5e..fcb09c8d5c13f102cc30b2f48602e76139cc6810 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -25,4 +25,4 @@ RealURL=Real URL 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. 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> diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 5801f7a51e00db23d8a342fe5352ee7d189e6948..5cb73be28e7bcdc7e4d48f84725b013e9ab55cc9 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1500,7 +1500,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a 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 $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"; @@ -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 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"; @@ -1721,8 +1721,7 @@ function main_area($title='') print "\n"; - if (! empty($conf->dol_use_jmobile)) print '<div data-role="page">'; - print '<div class="fiche"> <!-- begin div class="fiche" -->'."\n"; + print '<!-- Begin div class="fiche" -->'."\n".'<div class="fiche">'."\n"; 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 '</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 diff --git a/htdocs/public/test/test_arrays.php b/htdocs/public/test/test_arrays.php index 175352f404bca5f1d263ade82405f9fc9e5b8d6f..3de7196a696a71dbea61cf9272670beb7eab5436 100644 --- a/htdocs/public/test/test_arrays.php +++ b/htdocs/public/test/test_arrays.php @@ -48,7 +48,6 @@ if (empty($usedolheader)) <body style="padding: 10px;"> - <div data-role="page"> <?php } @@ -350,7 +349,7 @@ if (! empty($usedolheader)) { llxFooter(); } else { ?> -</div> + </body> <?php } ?> diff --git a/htdocs/public/websites/index.php b/htdocs/public/websites/index.php index 44789409058cffe4f78a12eef20fa3251622af14..4c2eec0edc57c95c3f16f2e71757e2d49d437639 100644 --- a/htdocs/public/websites/index.php +++ b/htdocs/public/websites/index.php @@ -1,5 +1,5 @@ <?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 * it under the terms of the GNU General Public License as published by diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index be2e746506778420f657ac25fe7e47be82e031f5..bdb60c23ee6c697c0b9221d038baacec1d33a8bf 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -740,6 +740,7 @@ div.fiche>form>div.div-table-responsive { } .hideonsmartphone { display: none; } + .hideonsmartphoneimp { display: none !important; } .noenlargeonsmartphone { width : 50px !important; display: inline !important; } .maxwidthonsmartphone, #search_newcompany.ui-autocomplete-input { max-width: 100px; } .maxwidth50onsmartphone { max-width: 40px; } @@ -868,6 +869,8 @@ div.vmenu, td.vmenu { .side-nav { border-bottom: 1px solid #BBB; background: #FFF; + padding-left: 20px; + padding-right: 20px; } .side-nav { position: absolute; @@ -3250,6 +3253,7 @@ td.hidden { .websitebar { border-bottom: 1px solid #888; background: #eee; + display: inline-block; } .websitebar .button, .websitebar .buttonDelete { @@ -3261,11 +3265,15 @@ td.hidden { display: inline-block; padding-left: 10px; vertical-align: middle; - line-height: 29px; + /* line-height: 29px; */ } .websitetools { float: right; - height: 28px; + /* height: 28px; */ +} +.websiteselection, .websitetools { + padding-top: 3px; + padding-bottom: 3px; } .websiteinputurl { display: inline-block; @@ -3274,6 +3282,9 @@ td.hidden { .websiteiframenoborder { border: 0px; } +a.websitebuttonsitepreview { + vertical-align: middle; +} a.websitebuttonsitepreview img { width: 26px; display: inline-block; diff --git a/htdocs/websites/index.php b/htdocs/websites/index.php index 0a7eb94cca2b8894c273d85db00eb37ce329e982..e6bfec0d84a26f8c7f49870ace542bac9ad19a3b 100644 --- a/htdocs/websites/index.php +++ b/htdocs/websites/index.php @@ -60,6 +60,7 @@ function llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, // main area //main_area($title); + print '<!-- Begin div class="fiche" -->'."\n".'<div class="fichebutwithotherclass">'."\n"; } @@ -76,7 +77,10 @@ $langs->load("website"); 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; $website=GETPOST('website', 'alpha'); @@ -239,7 +243,8 @@ if ($action == 'updatecss') $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.= "header('Content-type: text/css');\n"; $csscontent.= "?>"."\n"; @@ -291,7 +296,7 @@ if ($action == 'setashome') dol_delete_file($fileindex); $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.= '?>'."\n"; $result = file_put_contents($fileindex, $indexcontent); @@ -350,7 +355,7 @@ if ($action == 'updatemeta') dol_delete_file($filemaster); $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.= '?>'."\n"; $result = file_put_contents($filemaster, $mastercontent); @@ -368,7 +373,7 @@ if ($action == 'updatemeta') } $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.= '?>'."\n"; $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 name="robots" content="index, follow" />'."\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="title" content="'.dol_escape_htmltag($objectpage->title).'" />'."\n"; $tplcontent.= '<meta name="description" content="'.dol_escape_htmltag($objectpage->description).'" />'."\n"; @@ -485,7 +491,7 @@ if ($action == 'updatecontent') } $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.= '?>'."\n"; $result = file_put_contents($filealias, $aliascontent); @@ -495,12 +501,15 @@ if ($action == 'updatecontent') if (! $result) setEventMessages('Failed to write file '.$filealias, null, 'errors'); - // Now create the .tpl file - // TODO Keep a one time generate file or include a dynamicaly generated content ? + // Now create the .tpl file with code to be able to make dynamic changes dol_delete_file($filetpl); $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.= '<header>'."\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.= $objectpage->content."\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; $result = file_put_contents($filetpl, $tplcontent); if (! empty($conf->global->MAIN_UMASK)) @@ -596,14 +610,14 @@ if (count($object->records) > 0) { // ***** Part for web sites - print '<div class="websiteselection">'; + print '<div class="websiteselection hideonsmartphoneimp">'; print $langs->trans("Website").': '; print '</div>'; // List of websites print '<div class="websiteselection">'; $out=''; - $out.='<select name="website">'; + $out.='<select name="website" id="website">'; if (empty($object->records)) $out.='<option value="-1"> </option>'; // Loop on each sites $i=0; @@ -619,6 +633,7 @@ if (count($object->records) > 0) $i++; } $out.='</select>'; + $out.=ajax_combobox('website'); print $out; 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); print '<div class="centpercent websitebar"'.($style?' style="'.$style.'"':'').'">'; - print '<div class="websiteselection">'; + print '<div class="websiteselection hideonsmartphoneimp">'; print $langs->trans("Page").': '; print '</div>'; print '<div class="websiteselection">'; @@ -696,7 +711,7 @@ if (count($object->records) > 0) if ($action != 'add') { $out=''; - $out.='<select name="pageid">'; + $out.='<select name="pageid" id="pageid" class="minwidth200">'; if ($atleastonepage) { 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>'; $out.='</select>'; + $out.=ajax_combobox('pageid'); print $out; } else @@ -853,8 +869,8 @@ if ($action == 'editcss') print '<br>'; $csscontent = @file_get_contents($filecss); - // Clean php css file to get only css part - $csscontent = preg_replace('/<!-- START DOLIBARR.*END -->/s', '', $csscontent); + // Clean the php css file to remove php code and get only css part + $csscontent = preg_replace('/<!-- BEGIN DOLIBARR.*END -->/s', '', $csscontent); dol_fiche_head(); @@ -992,15 +1008,12 @@ if ($action == 'preview') { $objectpage->fetch($pageid); - print "\n".'<!-- Page content '.$filetpl.' : Div with (CSS + Page content from database) -->'."\n"; - - - $csscontent = @file_get_contents($filecss); - - $out=''; + $out = "\n".'<!-- Page content '.$filetpl.' : Div with (CSS + Page content from database) -->'."\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.=$csscontent; $out.='</style>'."\n"; @@ -1009,6 +1022,8 @@ if ($action == 'preview') $out.='</div>'; + $out.= "\n".'<!-- End page content '.$filetpl.' -->'."\n\n"; + print $out; /*file_put_contents($filetpl, $out);