diff --git a/htdocs/core/class/html.formwebsite.class.php b/htdocs/core/class/html.formwebsite.class.php index c6a6826251f..ed4b56be831 100644 --- a/htdocs/core/class/html.formwebsite.class.php +++ b/htdocs/core/class/html.formwebsite.class.php @@ -231,6 +231,8 @@ class FormWebsite */ public function selectContainer($website, $htmlname = 'pageid', $pageid = 0, $showempty = 0, $action = '', $morecss = 'minwidth200', $excludeids = null) { + global $conf, $langs; + $this->num = 0; $atleastonepage = (is_array($website->lines) && count($website->lines) > 0); @@ -239,13 +241,18 @@ class FormWebsite if ($atleastonepage && $action != 'editsource') { $out .= ''; + $out .= ''; if (empty($object->records)) { $out .= ''; } + + /* if (!empty($conf->use_javascript_ajax)) { $valueoption = ''.img_picto('', 'add', 'class="paddingrightonly"').$langs->trans("AddWebsite").''; $out .= ''; - } + }*/ + // Loop on each sites $i = 0; foreach ($object->records as $key => $valwebsite) { @@ -2826,6 +2830,10 @@ if (!GETPOST('hide_websitemenu')) { print ''; } + print ''; + + print ''; + if ($websitekey && $websitekey != '-1' && ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone' || $action == 'deletesite')) { print '   '; @@ -2852,10 +2860,15 @@ if (!GETPOST('hide_websitemenu')) { // Delete website if ($website->status == $website::STATUS_VALIDATED) { - print ''; + $disabled = ' disabled="disabled"'; + $title = $langs->trans("WebsiteMustBeDisabled", $langs->transnoentitiesnoconv($website->LibStatut(0, 0))); + $url = '#'; } else { - print ''; + $disabled = ''; + $title = $langs->trans("Delete"); + $url = $_SERVER["PHP_SELF"].'?action=deletesite&token='.newToken().'&website='.urlencode($website->ref); } + print ''.img_picto('', 'delete', 'class=""').''.$langs->trans("Delete").''; // Regenerate all pages print 'ref).'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("RegenerateWebsiteContent")).'">'; @@ -2863,6 +2876,7 @@ if (!GETPOST('hide_websitemenu')) { // Generate site map print 'ref).'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("GenerateSitemaps")).'">'; + // Find / replace tool print 'ref).'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("ReplaceWebsiteContent")).'">'; } @@ -2970,53 +2984,53 @@ if (!GETPOST('hide_websitemenu')) { print ''; print '
'; - print ''; + print '
'; print $langs->trans("PageContainer").': '; - print ''; + print '
'; - print ''; - print 'ref).'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("AddPage")).'">'; + print ''; + print 'ref).'" class=""'.$disabled.' title="'.dol_escape_htmltag($langs->trans("AddPage")).'">'; print ''; //print ''; - if ($action != 'addcontainer') { + //if ($action != 'addcontainer') { $out = ''; - $s = $formwebsite->selectContainer($website, 'pageid', $pageid, 0, $action, 'maxwidth200onsmartphone'); + $s = $formwebsite->selectContainer($website, 'pageid', $pageid, 0, $action, 'minwidth100 maxwidth200onsmartphone'); - if ($formwebsite->num > 0) { - $out .= ''; - $out .= $s; - $out .= ''; + if ($formwebsite->num >= 0) { + $out .= ''; + $out .= $s; + $out .= ''; - $urltocreatenewpage = $_SERVER["PHP_SELF"].'?action=createcontainer&token='.newToken().'&website='.urlencode($website->ref); + $urltocreatenewpage = $_SERVER["PHP_SELF"].'?action=createcontainer&token='.newToken().'&website='.urlencode($website->ref); - if (!empty($conf->use_javascript_ajax)) { - $out .= ''; - } + if (!empty($conf->use_javascript_ajax)) { + $out .= ''; } + } print $out; - } else { + /*} else { print $langs->trans("New"); - } + }*/ print ''; - print ''; + print ''; // Print nav arrows $pagepreviousid = 0; @@ -3240,7 +3254,19 @@ if (!GETPOST('hide_websitemenu')) { print 'ref).'&pageid='.((int) $pageid).'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("SetAsHomePage")).'">'; } print ''; - print ''; + + // Delete + //print ''; + if ($websitepage->status == $websitepage::STATUS_DRAFT || !$atleastonepage) { + $disabled = ' disabled="disabled"'; + $title = $langs->trans("WebpageMustBeDisabled", $langs->transnoentitiesnoconv($websitepage->LibStatut(0, 0))); + $url = '#'; + } else { + $disabled = ''; + $title = ''; + $url = $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&website='.urlencode($website->ref); + } + print ''.img_picto('', 'delete', 'class=""').''.$langs->trans("Delete").''; } } @@ -3881,7 +3907,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties $pageusermodifid = $objectpage->fk_user_modif; $pageauthoralias = $objectpage->author_alias; $pagestatus = $objectpage->status; - } else { + } else { // $action = 'createcontainer' $type_container = 'page'; $pageurl = ''; $pagealiasalt = ''; @@ -4179,6 +4205,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties print ''; print ''; + if ($action == 'createcontainer') { print '
'; @@ -4207,7 +4234,10 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties $arraygrabimagesinto = array('root'=>$langs->trans("WebsiteRootOfImages"), 'subpage'=>$langs->trans("SubdirOfPage")); print $form->selectarray('grabimagesinto', $arraygrabimagesinto, GETPOSTISSET('grabimagesinto') ? GETPOST('grabimagesinto') : 'root', 0, 0, 0, '', 0, 0, 0, '', '', 1); print '
'; - print ''; + + print ''; + print ''; + print ''; print ''; }