From 8b91f4fb5ee537980ced85843a983ec98ccb4a9a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 3 Jul 2017 12:04:45 +0200 Subject: [PATCH] Debug module website --- htdocs/collab/index.php | 62 ++++++++++++++++----------------- htdocs/langs/en_US/website.lang | 3 +- htdocs/websites/index.php | 6 ++-- 3 files changed, 36 insertions(+), 35 deletions(-) diff --git a/htdocs/collab/index.php b/htdocs/collab/index.php index ea7abde4151..7f08beff955 100644 --- a/htdocs/collab/index.php +++ b/htdocs/collab/index.php @@ -49,7 +49,7 @@ function llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); print ''; - + // top menu and left menu area if (empty($conf->dol_hide_topmenu)) { @@ -108,7 +108,7 @@ if (empty($action)) $action='preview'; */ if (GETPOST('refreshsite')) $pageid=0; // If we change the site, we reset the pageid. -if (GETPOST('refreshpage')) $action='preview'; +if (GETPOST('refreshpage')) $action='preview'; // Add a collab page @@ -146,7 +146,7 @@ if ($action == 'add') { $db->rollback(); } - + $action = 'preview'; $id = $objectpage->id; } @@ -173,7 +173,7 @@ if ($action == 'delete') { $db->commit(); setEventMessages($langs->trans("PageDeleted", $objectpage->pageurl, $website), null, 'mesgs'); - + header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website); exit; } @@ -218,7 +218,7 @@ print '
'; if (count($object->records) > 0) { // ***** Part for web sites - + print '
'; print $langs->trans("Website").': '; print '
'; @@ -252,20 +252,20 @@ if (count($object->records) > 0) $dataroot=DOL_DATA_ROOT.'/websites/'.$website; if (! empty($object->virtualhost)) $virtualurl=$object->virtualhost; } - + if ($website && $action == 'preview') { $disabled=''; if (empty($user->rights->websites->write)) $disabled=' disabled="disabled"'; - + print '   '; - + //print ''; print ''; print ''; print ''; } - + print '
'; // Button for websites @@ -279,7 +279,7 @@ if (count($object->records) > 0) $htmltext=$langs->trans("SetHereVirtualHost", $dataroot); print $form->textwithpicto('', $htmltext); print ''; - + $urlext=$virtualurl; $urlint=$urlwithroot.'/public/websites/index.php?website='.$website; //if (! empty($object->virtualhost)) @@ -288,7 +288,7 @@ if (count($object->records) > 0) print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext?$urlext:$langs->trans("VirtualHostUrlNotDefined")), 1, 'preview_ext'); print ''; //} - + print 'transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint)).'">'; print $form->textwithpicto('', $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint, $dataroot), 1, 'preview'); print ''; @@ -300,12 +300,12 @@ if (count($object->records) > 0) if (preg_match('/^create/',$action)) print ''; if (preg_match('/^edit/',$action)) print ''; } - + print ''; // ***** Part for pages - + if ($website) { print ''; @@ -313,13 +313,13 @@ if (count($object->records) > 0) $array=$objectpage->fetchAll($object->id); if (! is_array($array) && $array < 0) dol_print_error('', $objectpage->error, $objectpage->errors); $atleastonepage=(is_array($array) && count($array) > 0); - + print '
'; print '
'; print $langs->trans("Page").': '; print '
'; print '
'; - + if ($action != 'add') { $out=''; @@ -336,7 +336,7 @@ if (count($object->records) > 0) } $pageid=$homepageid?$homepageid:$firstpageid; // We choose home page and if not defined yet, we take first page } - + foreach($array as $key => $valpage) { $out.='
'; print '
'; print '
'; @@ -389,17 +389,17 @@ if (count($object->records) > 0) { $websitepage = new WebSitePage($db); $websitepage->fetch($pageid); - + $realpage=$urlwithroot.'/public/websites/index.php?website='.$website.'&page='.$pageid; $pagealias = $websitepage->pageurl; - + print '
'; print ''; //print ''; $htmltext=$langs->trans("WEBSITE_PAGENAME", $pagealias); print $form->textwithpicto('', $htmltext); print '
'; - + if (! empty($object->virtualhost)) { $urlext=$virtualurl.'/'.$pagealias.'.php'; @@ -413,12 +413,12 @@ if (count($object->records) > 0) print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $dataroot, $urlext?$urlext:$langs->trans("VirtualHostUrlNotDefined")), 1, 'preview_ext'); print ''; } - + print 'transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $realpage)).'">'; - print $form->textwithpicto('', $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $realpage, $dataroot), 1, 'preview'); + print $form->textwithpicto('', $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $realpage, $dataroot), 1, 'preview'); print ''; // View page in new Tab //print ''; - + // TODO Add js to save alias like we save virtual host name and use dynamic virtual host for url of id=previewpageext } if (! in_array($action, array('editcss','editmenu','create'))) @@ -427,7 +427,7 @@ if (count($object->records) > 0) if (preg_match('/^create/',$action)) print ''; if (preg_match('/^edit/',$action)) print ''; } - + print '
'; if ($action == 'preview') @@ -454,7 +454,7 @@ if (count($object->records) > 0) }, context: document.body }); - + jQuery("#previewsiteext").attr("href",newurl); jQuery("#previewpageext").attr("href",newpage); }); @@ -483,15 +483,15 @@ if ($action == 'editcontent') /* * Editing global variables not related to a specific theme */ - + $csscontent = @file_get_contents($filecss); - + $contentforedit = ''; /*$contentforedit.=''."\n";*/ $contentforedit .= $objectpage->content; - + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor=new DolEditor('PAGE_CONTENT',$contentforedit,'',500,'Full','',true,true,true,ROWS_5,'90%'); $doleditor->Create(0, '', false); diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index dd6332b11a7..abb7f7e56d3 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -6,6 +6,7 @@ ConfirmDeleteWebsite=Are you sure you want to delete this web site. All its page WEBSITE_PAGENAME=Page name/alias WEBSITE_CSS_URL=URL of external CSS file WEBSITE_CSS_INLINE=CSS content +PageNameAliasHelp=Name or alias of the page.
This alias is also used to forge a SEO URL when website is read from a Virtual host of a Web server (like Apacke, Nginx, ...). Use the button "%s" to edit this alias. MediaFiles=Media library EditCss=Edit Style/CSS EditMenu=Edit menu @@ -24,7 +25,7 @@ ViewPageInNewTab=View page in new tab SetAsHomePage=Set as Home page 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. +SetHereVirtualHost=If you can create, on your web server (Apache, Nginx, ...), a dedicated Virtual Host with PHP enabled and a Root directory on %s
then enter here the virtual hostname you have created, 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 install and setup this server before to point to directory:
%s
URL 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 not user friendly and start with path of your Dolibarr.
URL served by Dolibarr:
%s

To use your own external web server to serve this web site, create a virtual host on your web server that point on directory
%s
then enter the name of this virtual server and click on the other preview button. NoPageYet=No pages yet \ No newline at end of file diff --git a/htdocs/websites/index.php b/htdocs/websites/index.php index 1a11ea2a4e1..a5c2ae4e046 100644 --- a/htdocs/websites/index.php +++ b/htdocs/websites/index.php @@ -727,7 +727,7 @@ if (count($object->records) > 0) print ''; //print ''; $htmltext=$langs->trans("SetHereVirtualHost", $dataroot); - print $form->textwithpicto('', $htmltext); + print $form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'helpvirtualhost'); print ''; $urlext=$virtualurl; @@ -846,8 +846,8 @@ if (count($object->records) > 0) print '
'; print ''; //print ''; - $htmltext=$langs->trans("WEBSITE_PAGENAME", $pagealias); - print $form->textwithpicto('', $htmltext); + $htmltext=$langs->trans("PageNameAliasHelp", $langs->transnoentitiesnoconv("EditPageMeta")); + print $form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'helppagealias'); print '
'; if (! empty($object->virtualhost))