From bf591f5f916ae06102913a7b9fcb5d239956b402 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Feb 2017 21:13:40 +0100 Subject: [PATCH] Work on module website --- htdocs/core/lib/functions.lib.php | 1 + htdocs/core/lib/website.lib.php | 51 ++++++++++++++++++++++++++ htdocs/core/search_page.php | 2 +- htdocs/ecm/index.php | 24 +++---------- htdocs/ecm/index_auto.php | 22 +++--------- htdocs/langs/en_US/website.lang | 2 +- htdocs/main.inc.php | 10 +++--- htdocs/public/test/test_arrays.php | 3 +- htdocs/public/websites/index.php | 2 +- htdocs/theme/eldy/style.css.php | 15 ++++++-- htdocs/websites/index.php | 57 +++++++++++++++++++----------- 11 files changed, 117 insertions(+), 72 deletions(-) create mode 100644 htdocs/core/lib/website.lib.php diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e7a1c6e6a76..c178bf0fd7e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5538,6 +5538,7 @@ function printCommonFooter($zone='private') { print ''."\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 00000000000..ebbd261984e --- /dev/null +++ b/htdocs/core/lib/website.lib.php @@ -0,0 +1,51 @@ + + * + * 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 . + */ + +/** + * \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 09b37f4bb8a..ffbad81a30f 100644 --- a/htdocs/core/search_page.php +++ b/htdocs/core/search_page.php @@ -111,7 +111,7 @@ else $searchform=$hookmanager->resPrint; print "\n"; print "\n"; -print '
'; +print '
'; print ''; //print '
'; print '
'."\n"; diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index 5ca14fe5dff..be0520e9298 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 ?> -
+ +
trans("ECMAreaDesc2"); - - - // Root of manual section - /* - print ''; - print ''; - 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 ''; - print ''; - print ' '; - print ' '; - print ' '; - print ''; - print ''; - */ if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) { @@ -677,12 +661,12 @@ else print ' '; ?>
-
+
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 23a96e4367b..065d14b4593 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 ?> -
+ +
trans("ECMAreaDesc2"); - // Root title line (Automatic section) - /*print ''; - print ''; - 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 ''; - print ' '; - print ' '; - print ' '; - print ' '; - print ''; - print ''; - */ - $sectionauto=dol_sort_array($sectionauto,'label','ASC',true,false); print ''; @@ -532,12 +518,12 @@ include_once DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirpreview.php';
-
+
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 463d1c9e81e..fcb09c8d5c1 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 %s, 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.
URL of %s served by external server:
%s -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.
The inconvenient is that URL of pages are using path of your Dolibarr.
URL of %s served by Dolibarr:
%s +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.
The inconvenient is that URL of pages are not user friendly and start with path of your Dolibarr.
URL of %s served by Dolibarr:
%s diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 5801f7a51e0..5cb73be28e7 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 "\n\n"; } - if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile)) print '
'; + if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile)) print '
'; } @@ -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".''."\n".'
'."\n"; + print "\n".''."\n".'
'."\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 '
'; // End div id="id-left" + print '
'; // 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 '
'; - print '
'."\n"; + print ''."\n".'
'."\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 '
'."\n"; - if (! empty($conf->dol_use_jmobile)) print '
'; // end data-role="page" if (empty($conf->dol_hide_leftmenu)) print '
'; // End div id-right diff --git a/htdocs/public/test/test_arrays.php b/htdocs/public/test/test_arrays.php index 175352f404b..3de7196a696 100644 --- a/htdocs/public/test/test_arrays.php +++ b/htdocs/public/test/test_arrays.php @@ -48,7 +48,6 @@ if (empty($usedolheader)) -
-
+ diff --git a/htdocs/public/websites/index.php b/htdocs/public/websites/index.php index 44789409058..4c2eec0edc5 100644 --- a/htdocs/public/websites/index.php +++ b/htdocs/public/websites/index.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2016-2017 Laurent Destailleur * * 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 be2e7465067..bdb60c23ee6 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 0a7eb94cca2..e6bfec0d84a 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 ''."\n".'
'."\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 = ''."\n"; + $csscontent = ''."\n"; + $csscontent.= ''."\n"; $csscontent.= '"."\n"; @@ -291,7 +296,7 @@ if ($action == 'setashome') dol_delete_file($fileindex); $indexcontent = ''."\n"; $result = file_put_contents($fileindex, $indexcontent); @@ -350,7 +355,7 @@ if ($action == 'updatemeta') dol_delete_file($filemaster); $mastercontent = ''."\n"; $result = file_put_contents($filemaster, $mastercontent); @@ -368,7 +373,7 @@ if ($action == 'updatemeta') } $aliascontent = 'id.".tpl.php';\n"; $aliascontent.= '?>'."\n"; $result = file_put_contents($filealias, $aliascontent); @@ -390,6 +395,7 @@ if ($action == 'updatemeta') $tplcontent.= ''."\n"; $tplcontent.= ''."\n"; $tplcontent.= ''."\n"; + $tplcontent.= ''."\n"; $tplcontent.= ''."\n"; $tplcontent.= ''."\n"; $tplcontent.= ''."\n"; @@ -485,7 +491,7 @@ if ($action == 'updatecontent') } $aliascontent = '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.= ""."\n"; + $tplcontent.= "\n"; $tplcontent.= ''."\n"; $tplcontent.= '
'."\n"; $tplcontent.= ''."\n"; @@ -517,6 +526,11 @@ if ($action == 'updatecontent') $tplcontent.= ''."\n"; $tplcontent.= $objectpage->content."\n"; $tplcontent.= ''."\n"; + + $tplcontent.= '"."\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 '
'; + print '
'; print $langs->trans("Website").': '; print '
'; // List of websites print '
'; $out=''; - $out.=''; if (empty($object->records)) $out.=''; // Loop on each sites $i=0; @@ -619,6 +633,7 @@ if (count($object->records) > 0) $i++; } $out.=''; + $out.=ajax_combobox('website'); print $out; print ''; @@ -688,7 +703,7 @@ if (count($object->records) > 0) $atleastonepage=(is_array($array) && count($array) > 0); print '
'; - print '
'; + print '
'; print $langs->trans("Page").': '; print '
'; print '
'; @@ -696,7 +711,7 @@ if (count($object->records) > 0) if ($action != 'add') { $out=''; - $out.=''; 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.=''; $out.=''; + $out.=ajax_combobox('pageid'); print $out; } else @@ -853,8 +869,8 @@ if ($action == 'editcss') print '
'; $csscontent = @file_get_contents($filecss); - // Clean php css file to get only css part - $csscontent = preg_replace('//s', '', $csscontent); + // Clean the php css file to remove php code and get only css part + $csscontent = preg_replace('//s', '', $csscontent); dol_fiche_head(); @@ -992,15 +1008,12 @@ if ($action == 'preview') { $objectpage->fetch($pageid); - print "\n".''."\n"; - - - $csscontent = @file_get_contents($filecss); - - $out=''; + $out = "\n".''."\n"; $out.='
'."\n"; + $csscontent = @file_get_contents($filecss); + $out.=''."\n"; @@ -1009,6 +1022,8 @@ if ($action == 'preview') $out.='
'; + $out.= "\n".''."\n\n"; + print $out; /*file_put_contents($filetpl, $out);