From 583452114b93e07780cc23b9ae681ba4202a6433 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 22 Jul 2017 20:19:10 +0200 Subject: [PATCH] Split editor in 2 (html source and wysiwyg) --- htdocs/langs/en_US/website.lang | 3 ++- htdocs/websites/index.php | 29 +++++++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index b3af3d3e0fc..fa53c0bf2bd 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -12,7 +12,8 @@ MediaFiles=Media library EditCss=Edit Style/CSS EditMenu=Edit menu EditPageMeta=Edit Meta -EditPageContent=Edit Content +EditPageSource=Edit HTML Source +EditPageContent=Edit with CKEditor Website=Web site Webpage=Web page AddPage=Add page diff --git a/htdocs/websites/index.php b/htdocs/websites/index.php index 0b621577463..9fbd6e6a4e0 100644 --- a/htdocs/websites/index.php +++ b/htdocs/websites/index.php @@ -98,6 +98,7 @@ if (GETPOST('editcss')) { $action='editcss'; } if (GETPOST('editmenu')) { $action='editmenu'; } if (GETPOST('setashome')) { $action='setashome'; } if (GETPOST('editmeta')) { $action='editmeta'; } +if (GETPOST('editsource')) { $action='editsource'; } if (GETPOST('editcontent')) { $action='editcontent'; } if (empty($action)) $action='preview'; @@ -665,6 +666,10 @@ if ($action == 'editmeta') { print ''; } +if ($action == 'editsource') +{ + print ''; +} if ($action == 'editcontent') { print ''; @@ -677,7 +682,7 @@ if ($action == 'edit') // Add a margin under toolbar ? $style=''; -if ($action != 'preview' && $action != 'editcontent') $style=' margin-bottom: 5px;'; +if ($action != 'preview' && $action != 'editcontent' && $action != 'editsource') $style=' margin-bottom: 5px;'; //var_dump($objectpage);exit; print '
'; @@ -835,6 +840,7 @@ if (count($object->records) > 0) if ($object->fk_default_home > 0 && $pageid == $object->fk_default_home) print ''; else print ''; print ''; + print ''; print ''; //print ''.dol_escape_htmltag($langs->trans("EditPageMeta")).''; //print ''.dol_escape_htmltag($langs->trans("EditPageContent")).''; @@ -891,7 +897,7 @@ if (count($object->records) > 0) print '
'; print '
'; - if (GETPOST('editcontent', 'alpha')) + if (GETPOST('editsource', 'alpha') || GETPOST('editcontent', 'alpha')) { $htmltext=$langs->transnoentitiesnoconv("YouCanEditHtmlSource"); print $form->textwithpicto($langs->trans("SyntaxHelp"), $htmltext, 1, 'help', 'inline-block', 0, 2, 'tooltipsubstitution'); @@ -1083,6 +1089,25 @@ if ($action == 'editmenu') print '
'.$langs->trans("FeatureNotYetAvailable").''; } +if ($action == 'editsource') +{ + /* + * 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); +} + if ($action == 'editcontent') { /*