diff --git a/htdocs/core/class/html.formwebsite.class.php b/htdocs/core/class/html.formwebsite.class.php index c3316393ae2..9ab7494dc42 100644 --- a/htdocs/core/class/html.formwebsite.class.php +++ b/htdocs/core/class/html.formwebsite.class.php @@ -175,7 +175,6 @@ class FormWebsite $langs->load("admin"); $listofsamples = dol_dir_list(DOL_DOCUMENT_ROOT.'/website/samples', 'files', 0, '^page-sample-.*\.html$'); - $arrayofsamples = array(); $arrayofsamples['empty'] = 'EmptyPage'; // Always this one first foreach ($listofsamples as $sample) { @@ -189,6 +188,7 @@ class FormWebsite $arrayofsamples[$key] = $labelkey; } } + var_dump($arrayofsamples);exit; $out = ''; $out .= ''; + } + if ($template == 'empty') { + $out .= ''; + } + $out .= ''.($template != 'text' ? ucfirst($template) : ucfirst($templateFunction)).''; + $out .= ''; + } + $out .= ''; + + $out .= ""; + + return $out; + } } diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index 9c0c98a4076..a1543ba61f5 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -235,3 +235,4 @@ WebPortalPartnership=Partnership WebPortalPropal=Proposal WebPortalGroupMenuAdmin=Administration WebPortalGroupMenuTechnical=System +PreviewPageContent=Page content diff --git a/htdocs/website/index.php b/htdocs/website/index.php index d64888743cb..36afb8b0147 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -51,6 +51,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php'; require_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + // Load translation files required by the page $langs->loadLangs(array("admin", "other", "website", "errors")); @@ -1183,8 +1185,7 @@ if ($action == 'addcontainer' && $usercanedit) { $sample = 'empty'; } - $pathtosample = DOL_DOCUMENT_ROOT.'/website/samples/page-sample-'.dol_sanitizeFileName($sample).'.html'; - + $pathtosample = DOL_DOCUMENT_ROOT.'/website/samples/page-sample-'.dol_sanitizeFileName(strtolower($sample)).'.html'; // Init content with content into pagetemplate.html, blogposttempltate.html, ... $objectpage->content = make_substitutions(@file_get_contents($pathtosample), $substitutionarray); } @@ -4288,10 +4289,68 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties // Example/templates of page if ($action == 'createcontainer') { + $formmail = new FormMail($db); + $formmail->withaiprompt = 'html'; + + print ''; print $langs->trans('WEBSITE_PAGE_EXAMPLE'); print ''; - print $formwebsite->selectSampleOfContainer('sample', (GETPOSTISSET('sample') ? GETPOST('sample', 'alpha') : 'empty'), 0, '', 1, 'minwidth300'); + + $out = ''; + // Add link to add layout + $out .= ''; + $out .= img_picto($langs->trans("FillMessageWithALayout"), 'layout', 'class="paddingrightonly"'); + $out .= $langs->trans("FillMessageWithALayout").'...'; + $out .= '     '; + + $out .= ' + '; + + // Add link to add AI content + if ($formmail->withaiprompt && isModEnabled('ai')) { + $out .= ''; + $out .= img_picto($langs->trans("FillMessageWithAIContent"), 'ai', 'class="paddingrightonly"'); + $out .= $langs->trans("FillMessageWithAIContent").'...'; + $out .= ''; + $out .= ''; + } + + $out .= $formwebsite->getContentPageTemplate('content', $objectpage->content); + + if ($formmail->withaiprompt && isModEnabled('ai')) { + $out .= $formmail->getSectionForAIPrompt('', 'content'); + } + print $out; + //var_dump(GETPOST('sample')); + //print $formwebsite->selectSampleOfContainer('sample', (GETPOSTISSET('sample') ? GETPOST('sample', 'alpha') : 'empty'), 0, '', 1, 'minwidth300'); print ''; } @@ -4521,6 +4580,13 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties print ''; } + print ''; + print $langs->trans('PreviewPageContent'); + print ''; + $doleditor = new DolEditor('content', GETPOST('content', 'restricthtmlallowunvalid'), '', 600, 'dolibarr_mailings', '', true, true, getDolGlobalInt('FCKEDITOR_ENABLE_MAILING'), 20, '90%'); + $doleditor->Create(); + print ''; + print ''; $htmlhelp = $langs->trans("EditTheWebSiteForACommonHeader").'

'; $htmlhelp .= $langs->trans("Example").' :
';