2
0
forked from Wavyzz/dolibarr

NEW Include the tag editor of page as a popup into website editor

This commit is contained in:
Laurent Destailleur
2020-09-23 16:36:19 +02:00
parent d9dce98185
commit 09c6761dae
14 changed files with 249 additions and 167 deletions

View File

@@ -411,7 +411,7 @@ print "<br>\n";
// Confirmation de la suppression de la ligne
if ($action == 'delete')
{
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid, $langs->trans('DeleteWebsite'), $langs->trans('ConfirmDeleteWebsite'), 'confirm_delete', '', 0, 1);
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid, $langs->trans('DeleteWebsite'), $langs->trans('ConfirmDeleteWebsite'), 'confirm_delete', '', 0, 1, 220);
}
//var_dump($elementList);

View File

@@ -88,6 +88,10 @@ if ($action == 'add' && $user->rights->categorie->creer)
{
header("Location: ".$urlfrom);
exit;
} elseif ($backtopage)
{
header("Location: ".$backtopage);
exit;
} elseif ($idProdOrigin)
{
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProdOrigin.'&type='.$type);
@@ -235,13 +239,13 @@ if ($user->rights->categorie->creer)
// Ref
print '<tr>';
print '<td class="titlefieldcreate fieldrequired">'.$langs->trans("Ref").'</td><td><input id="label" class="minwidth100" name="label" value="'.$label.'">';
print '<td class="titlefieldcreate fieldrequired">'.$langs->trans("Ref").'</td><td><input id="label" class="minwidth100" name="label" value="'.dol_escape_htmltag($label).'">';
print'</td></tr>';
// Description
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('description', $description, '', 200, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_6, '90%');
$doleditor = new DolEditor('description', $description, '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_5, '90%');
$doleditor->Create();
print '</td></tr>';

View File

@@ -1616,9 +1616,10 @@ class Categorie extends CommonObject
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param string $option Sur quoi pointe le lien ('', 'xyz')
* @param int $maxlength Max length of text
* @param string $moreparam More param on URL link
* @return string Chaine avec URL
*/
public function getNomUrl($withpicto = 0, $option = '', $maxlength = 0)
public function getNomUrl($withpicto = 0, $option = '', $maxlength = 0, $moreparam = '')
{
global $langs;
@@ -1632,7 +1633,7 @@ class Categorie extends CommonObject
if (colorIsLight($this->color)) $forced_color = 'categtextblack';
}
$link = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$this->id.'&type='.$this->type.'&backtopage='.urlencode($_SERVER['PHP_SELF']).'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip '.$forced_color.'">';
$link = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$this->id.'&type='.$this->type.$moreparam.'&backtopage='.urlencode($_SERVER['PHP_SELF'].($moreparam?'?'.$moreparam:'')).'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip '.$forced_color.'">';
$linkend = '</a>';
$picto = 'category';

View File

@@ -39,6 +39,7 @@ if (!$user->rights->categorie->lire) accessforbidden();
$id = GETPOST('id', 'int');
$type = (GETPOST('type', 'aZ09') ? GETPOST('type', 'aZ09') : Categorie::TYPE_PRODUCT);
$catname = GETPOST('catname', 'alpha');
$nosearch = GETPOST('nosearch', 'int');
$categstatic = new Categorie($db);
if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
@@ -50,6 +51,8 @@ if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backwar
$form = new Form($db);
$moreparam = ($nosearch ? '&nosearch=1' : '');
$typetext = $type;
if ($type == Categorie::TYPE_ACCOUNT) $title = $langs->trans('AccountsCategoriesArea');
elseif ($type == Categorie::TYPE_WAREHOUSE) $title = $langs->trans('StocksCategoriesArea');
@@ -67,20 +70,20 @@ llxHeader('', $title, '', '', 0, 0, $arrayofjs, $arrayofcss);
$newcardbutton = '';
if (!empty($user->rights->categorie->creer)) {
$newcardbutton .= dolGetButtonTitle($langs->trans('NewCategory'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/categories/card.php?action=create&type='.$type.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type='.$type));
$newcardbutton .= dolGetButtonTitle($langs->trans('NewCategory'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/categories/card.php?action=create&type='.$type.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type='.$type.$moreparam).$moreparam);
}
print load_fiche_titre($title, $newcardbutton, 'object_category');
// Search categories
if (empty($nosearch)) {
print '<div class="fichecenter"><div class="fichethirdleft">';
/*
* Zone recherche produit/service
*/
print '<form method="post" action="index.php?type='.$type.'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="type" value="'.$type.'">';
print '<input type="hidden" name="nosearch" value="'.$nosearch.'">';
print '<table class="noborder nohover centpercent">';
@@ -92,7 +95,7 @@ print $langs->trans("Name").':</td><td><input class="flat inputsearch" type="tex
print '</table></form>';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
print '</div><div class="fichetwothirdright">';
/*
@@ -126,8 +129,8 @@ if ($catname || $id > 0)
print "</table>";
} else print '&nbsp;';
print '</div></div></div>';
print '</div></div>';
}
print '<div class="fichecenter"><br>';
@@ -156,7 +159,7 @@ foreach ($fulltree as $key => $val)
$categstatic->ref = $val['label'];
$categstatic->color = $val['color'];
$categstatic->type = $type;
$li = $categstatic->getNomUrl(1, '', 60);
$li = $categstatic->getNomUrl(1, '', 60, $moreparam.'&backtolist='.urlencode($_SERVER["PHP_SELF"].'?type='.$type.$moreparam));
$desc = dol_htmlcleanlastbr($val['description']);
$counter = '';
@@ -172,7 +175,7 @@ foreach ($fulltree as $key => $val)
'rowid'=>$val['rowid'],
'fk_menu'=>$val['fk_parent'],
'entry'=>'<table class="nobordernopadding centpercent"><tr><td><span class="noborderoncategories" '.($categstatic->color ? ' style="background: #'.$categstatic->color.';"' : ' style="background: #aaa"').'>'.$li.'</span></td>'.$counter.
'<td class="right" width="20px;"><a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$val['id'].'&type='.$type.'">'.img_view().'</a></td></tr></table>'
'<td class="right" width="20px;"><a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$val['id'].'&type='.$type.$moreparam.'&backtolist='.urlencode($_SERVER["PHP_SELF"].'?type='.$type.$moreparam).'">'.img_view().'</a></td></tr></table>'
);
}

View File

@@ -51,6 +51,7 @@ $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'myo
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');

View File

@@ -4038,7 +4038,7 @@ class Form
* type can be 'hidden', 'text', 'password', 'checkbox', 'radio', 'date', 'morecss', ...
* @param string $selectedchoice '' or 'no', or 'yes' or '1' or '0'
* @param int|string $useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx
* @param int $height Force height of box (0 = auto)
* @param int|string $height Force height of box (0 = auto)
* @param int $width Force width of box ('999' or '90%'). Ignored and forced to 90% on smartphones.
* @param int $disableformtag 1=Disable form tag. Can be used if we are already inside a <form> section.
* @return string HTML ajax code if a confirm ajax popup is required, Pure HTML code if it's an html form

View File

@@ -1130,4 +1130,15 @@ $(document).ready(function() {
});
<?php } ?>
// Force to hide menus when page is inside an iFrame
$(document).ready(function() {
if (window.location !== window.parent.location ) {
console.log("Page is detected to be into an iframe, we hide by CSS the menus");
// The page is in an iframe
jQuery(".side-nav-vert, .side-nav").hide();
jQuery(".id-container").css('width', '100%');
}
});
// End of lib_head.js.php

View File

@@ -109,9 +109,10 @@ function tree_showpad(&$fulltree, $key, $silent = 0)
* @param string $iddivjstree Id to use for parent ul element
* @param int $donoresetalreadyloaded Do not reset global array $donoresetalreadyloaded used to avoid to go down on an aleady processed record
* @param int $showfk 1=show fk_links to parent into label (used by menu editor only)
* @param string $moreparam Add more param on url of elements
* @return void
*/
function tree_recur($tab, $pere, $rang, $iddivjstree = 'iddivjstree', $donoresetalreadyloaded = 0, $showfk = 0)
function tree_recur($tab, $pere, $rang, $iddivjstree = 'iddivjstree', $donoresetalreadyloaded = 0, $showfk = 0, $moreparam = '')
{
global $tree_recur_alreadyadded, $menu_handler_to_search;
@@ -197,7 +198,7 @@ function tree_recur($tab, $pere, $rang, $iddivjstree = 'iddivjstree', $donoreset
if ($showfk)
{
print '<table class="nobordernopadding centpercent"><tr><td>';
print '<strong> &nbsp; <a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&menuId='.$tab[$x]['rowid'].'">';
print '<strong> &nbsp; <a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&menuId='.$tab[$x]['rowid'].$moreparam.'">';
print $tab[$x]['title'];
print '</a></strong>';
print '&nbsp; (mainmenu='.$tab[$x]['mainmenu'].' leftmenu='.$tab[$x]['leftmenu'].' - fk_mainmenu='.$tab[$x]['fk_mainmenu'].' fk_leftmenu='.$tab[$x]['fk_leftmenu'].')';

View File

@@ -61,7 +61,8 @@ if (!empty($actionsave))
* View
*/
llxHeader();
$help_url = '';
llxHeader('', '', $help_url);
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("CronSetup"), $linkback, 'title_setup');
@@ -81,10 +82,10 @@ print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print "<td>".$langs->trans("Parameter")."</td>";
print "<td>".$langs->trans("Value")."</td>";
print "<td>&nbsp;</td>";
print "<td></td>";
print "</tr>";
print '<tr class="impair">';
print '<tr class="oddeven">';
print '<td class="fieldrequired">'.$langs->trans("KeyForCronAccess").'</td>';
$disabled = '';
if (!empty($conf->global->CRON_DISABLE_KEY_CHANGE)) $disabled = ' disabled="disabled"';

View File

@@ -84,7 +84,7 @@ AddProductServiceIntoCategory=Add the following product/service
ShowCategory=Show tag/category
ByDefaultInList=By default in list
ChooseCategory=Choose category
StocksCategoriesArea=Warehouses Categories Area
ActionCommCategoriesArea=Events Categories Area
WebsitePagesCategoriesArea=Page-Container Categories Area
StocksCategoriesArea=Warehouses Categories
ActionCommCategoriesArea=Events Categories
WebsitePagesCategoriesArea=Page-Container Categories
UseOrOperatorForCategories=Use or operator for categories

View File

@@ -31,7 +31,7 @@ AddWebsite=Add website
Webpage=Web page/container
AddPage=Add page/container
HomePage=Home Page
PageContainer=Page/container
PageContainer=Page
PreviewOfSiteNotYetAvailable=Preview of your website <strong>%s</strong> not yet available. You must first '<strong>Import a full website template</strong>' or just '<strong>Add a page/container</strong>'.
RequestedPageHasNoContentYet=Requested page with id %s has no content yet, or cache file .tpl.php was removed. Edit content of the page to solve this.
SiteDeleted=Web site '%s' deleted
@@ -135,3 +135,4 @@ ReplacementDoneInXPages=Replacement done in %s pages or containers
RSSFeed=RSS Feed
RSSFeedDesc=You can get a RSS feed of latest articles with type 'blogpost' using this URL
PagesRegenerated=%s page(s)/container(s) regenerated
RegenerateWebsiteContent=Regenerate web site cache files

View File

@@ -313,8 +313,6 @@ if (empty($reshook))
* View
*/
$htmlother = new FormOther($db);
$title = $langs->trans("ProductsAndServices");
if ($search_type != '' && $search_type != '-1')

View File

@@ -118,7 +118,7 @@ body {
th a { font-weight: <?php echo ($useboldtitle ? 'bold' : 'normal'); ?> !important; }
a.tab { font-weight: 500 !important; }
a:link, a:visited, a:hover, a:active { color: var(--colortextlink); text-decoration: none; }
a:link, a:visited, a:hover, a:active, .classlink { color: var(--colortextlink); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--colortextlink); }
a.commonlink { color: var(--colortextlink) !important; text-decoration: none; }
th.liste_titre a div div:hover, th.liste_titre_sel a div div:hover { text-decoration: underline; }
@@ -1866,7 +1866,7 @@ div.attacharea {
}
div.attachareaformuserfileecm {
padding-top: 0;
padding-bottom: 0;
padding-bottom: 6px;
}
div.arearef {
@@ -4418,7 +4418,7 @@ span[phptag] {
border-bottom: 1px solid #ccc;
background: #e6e6e6;
display: inline-block;
padding: 4px 0 4px 0;
padding: 5px 0 5px 0;
z-index: 1000;
}
.websitebar .buttonDelete, .websitebar .button {

View File

@@ -108,7 +108,7 @@ $objectpage = new WebsitePage($db);
$object->fetchAll('ASC', 'position'); // Init $object->records with list of websites
// If website not defined, we take first found
if (!($websiteid > 0) && empty($websitekey))
if (!($websiteid > 0) && empty($websitekey) && $action != 'createsite')
{
foreach ($object->records as $key => $valwebsite)
{
@@ -2182,7 +2182,7 @@ $formadmin = new FormAdmin($db);
$formwebsite = new FormWebsite($db);
$formother = new FormOther($db);
$help_url = '';
$helpurl = 'EN:Module_Website|FR:Module_Website_FR|ES:M&oacute;dulo_Website';
$arrayofjs = array(
'/includes/ace/src/ace.js',
@@ -2204,7 +2204,7 @@ $moreheadjs .= '<script type="text/javascript">'."\n";
$moreheadjs .= 'var indicatorBlockUI = \''.DOL_URL_ROOT."/theme/".$conf->theme."/img/working.gif".'\';'."\n";
$moreheadjs .= '</script>'."\n";
llxHeader($moreheadcss.$moreheadjs, $langs->trans("WebsiteSetup"), $help_url, '', 0, 0, $arrayofjs, $arrayofcss, '', '', '<!-- Begin div class="fiche" -->'."\n".'<div class="fichebutwithotherclass">');
llxHeader($moreheadcss.$moreheadjs, $langs->trans("WebsiteSetup"), $helpurl, '', 0, 0, $arrayofjs, $arrayofcss, '', '', '<!-- Begin div class="fiche" -->'."\n".'<div class="fichebutwithotherclass">');
print "\n";
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" enctype="multipart/form-data">';
@@ -2276,45 +2276,6 @@ if (!GETPOST('hide_websitemenu'))
$disabled = '';
if (empty($user->rights->website->write)) $disabled = ' disabled="disabled"';
//var_dump($objectpage);exit;
print '<div class="centpercent websitebar">';
// ***** Part for web sites
print '<!-- Bar for website -->';
print '<span class="websiteselection hideonsmartphoneimp minwidth100 tdoverflowmax100">';
print $langs->trans("Website").' : ';
print '</span>';
print '<span class="websiteselection hideonsmartphoneimp">';
print '<a href="'.$_SERVER["PHP_SEFL"].'?action=createsite&website='.$website->ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("AddWebsite")).'"><span class="fa fa-plus-circle valignmiddle btnTitle-icon"><span></a>';
print '</span>';
// List of website
print '<span class="websiteselection">';
$out = '';
$out .= '<select name="website" class="minwidth100 maxwidth300 maxwidth150onsmartphone" id="website">';
if (empty($object->records)) $out .= '<option value="-1">&nbsp;</option>';
// Loop on each sites
$i = 0;
foreach ($object->records as $key => $valwebsite)
{
if (empty($websitekey)) $websitekey = $valwebsite->ref;
$out .= '<option value="'.$valwebsite->ref.'"';
if ($websitekey == $valwebsite->ref) $out .= ' selected'; // To preselect a value
$out .= '>';
$out .= $valwebsite->ref;
$out .= '</option>';
$i++;
}
$out .= '</select>';
$out .= ajax_combobox('website');
print $out;
//print '<input type="submit" class="button" name="refreshsite" value="'.$langs->trans("Load").'">';
print '<input type="image" class="valignmiddle" src="'.img_picto('', 'refresh', '', 0, 1).'" name="refreshsite" value="'.$langs->trans("Load").'">';
if ($websitekey)
{
$virtualurl = '';
@@ -2331,6 +2292,77 @@ if (!GETPOST('hide_websitemenu'))
if (!is_array($array) && $array < 0) dol_print_error('', $objectpage->error, $objectpage->errors);
$atleastonepage = (is_array($array) && count($array) > 0);
//var_dump($objectpage);exit;
print '<div class="centpercent websitebar">';
//
// Toolbar for websites
//
print '<!-- Bar for website -->';
if ($action != 'file_manager') {
print '<span class="websiteselection hideonsmartphoneimp minwidth100 tdoverflowmax100">';
print $langs->trans("Website").' : ';
print '</span>';
$urltocreatenewwebsite = $_SERVER["PHP_SEFL"].'?action=createsite';
if (empty($conf->use_javascript_ajax)) {
print '<span class="websiteselection hideonsmartphoneimp">';
print '<a href="'.$urltocreatenewwebsite.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("AddWebsite")).'"><span class="fa fa-plus-circle valignmiddle btnTitle-icon"><span></a>';
print '</span>';
}
// List of website
print '<span class="websiteselection">';
$out = '';
$out .= '<select name="website" class="minwidth100 width200 maxwidth150onsmartphone" id="website">';
if (empty($object->records)) $out .= '<option value="-1">&nbsp;</option>';
if (! empty($conf->use_javascript_ajax)) {
$valueoption = '<span class="classlink">'.img_picto('', 'add', 'class="paddingrightonly"').$langs->trans("AddWebsite").'</span>';
$out .= '<option value="-2" data-html="'.dol_escape_htmltag($valueoption).'">'.$valueoption.'</option>';
}
// Loop on each sites
$i = 0;
foreach ($object->records as $key => $valwebsite)
{
if (empty($websitekey)) {
if ($action != 'createsite') $websitekey = $valwebsite->ref;
}
$out .= '<option value="'.$valwebsite->ref.'"';
if ($websitekey == $valwebsite->ref) $out .= ' selected'; // To preselect a value
//$outoption = $valwebsite->getLibStatut(3).' '.$valwebsite->ref.' ';
$outoption = (($valwebsite->status == $valwebsite::STATUS_DRAFT)?'<span class="opacitymedium">':'').$valwebsite->ref.(($valwebsite->status == $valwebsite::STATUS_DRAFT)?'</span>':'');
$out .= ' data-html="'.dol_escape_htmltag($outoption).'"';
$out .= '>';
$out .= $valwebsite->ref;
$out .= '</option>';
$i++;
}
$out .= '</select>';
$out .= ajax_combobox('website');
if (!empty($conf->use_javascript_ajax)) {
$out .= '<script language="javascript">';
$out .= 'jQuery(document).ready(function () {';
$out .= ' jQuery("#website").change(function () {';
$out .= ' console.log("We select "+jQuery("#website option:selected").val());';
$out .= ' if (jQuery("#website option:selected").val() == \'-2\') {';
$out .= ' window.location.href = "'.$urltocreatenewwebsite.'";';
$out .= ' } else {';
$out .= ' window.location.href = "'.$_SERVER["PHP_SEFL"].'?website="+jQuery("#website option:selected").val();';
$out .= ' }';
$out .= ' });';
$out .= '});';
$out .= '</script>';
}
print $out;
if (empty($conf->use_javascript_ajax)) {
print '<input type="image" class="valignmiddle" src="'.img_picto('', 'refresh', '', 0, 1).'" name="refreshsite" value="'.$langs->trans("Load").'">';
}
if ($websitekey && $websitekey != '-1' && ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone' || $action == 'deletesite'))
{
print ' &nbsp; ';
@@ -2360,42 +2392,49 @@ if (!GETPOST('hide_websitemenu'))
print ' &nbsp; ';
print '<a href="'.$_SERVER["PHP_SEFL"].'?action=replacesite&website='.$website->ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("ReplaceWebsiteContent")).'"><span class="fa fa-search"><span></a>';
print '<a href="'.$_SERVER["PHP_SEFL"].'?action=regeneratesite&website='.$website->ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("RegenerateWebsiteContent")).'"><span class="fa fa-cogs"><span></a>';
}
print '</span>';
if ($websitekey && $websitekey != '-1' && ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone' || $action == 'deletesite'))
{
print '<span class="websiteselection">';
print '<a href="'.$_SERVER["PHP_SEFL"].'?action=file_manager&website='.$website->ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("MediaFiles")).'"><span class="fa fa-image"><span></a>';
if (! empty($conf->categorie->enabled)) {
//print '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=website&dol_hide_leftmenu=1&nosearch=1&type=website_page&website='.$website->ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("Categories")).'"><span class="fa fa-tags"><span></a>';
//print '<input type="submit" class="button bordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("MediaFiles")).'" name="file_manager">';
/*print '<a class="button button_file_manager"'.$disabled.'>'.dol_escape_htmltag($langs->trans("MediaFiles")).'</a>';
print '<a class="button bordertransp button_categories"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("Categories")).'"><span class="fa fa-tags"><span></a>';
print '<script language="javascript">
jQuery(document).ready(function () {
jQuery(".button_file_manager").click(function () {
var $dialog = $(\'<div></div>\').html(\'<iframe style="border: 0px;" src="'.DOL_URL_ROOT.'/website/index.php?hide_websitemenu=1&dol_hide_topmenu=1&dol_hide_leftmenu=1&file_manager=1&website='.$websitekey.'&pageid='.$pageid.'" width="100%" height="100%"></iframe>\')
jQuery(".button_categories").click(function () {
var $dialog = $(\'<div></div>\').html(\'<iframe class="iframedialog" style="border: 0px;" src="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=website&nosearch=1&type=website_page&website='.$website->ref.'" width="100%" height="98%"></iframe>\')
.dialog({
autoOpen: false,
modal: true,
height: 500,
height: (window.innerHeight - 150),
width: \'80%\',
title: "'.dol_escape_js($langs->trans("FileManager")).'"
title: "'.dol_escape_js($langs->transnoentitiesnoconv("Categories")).'"
});
$dialog.dialog(\'open\');
});
});
</script>';
*/
print '<a href="'.$_SERVER["PHP_SEFL"].'?action=replacesite&website='.$website->ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("ReplaceWebsiteContent")).'"><span class="fa fa-search"><span></a>';
if (! empty($conf->categorie->enabled)) {
print '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=website&type=website_page&website='.$website->ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("Categories")).'"><span class="fa fa-tags"><span></a>';
}
if (! empty($conf->global->WEBSITE_ADD_REGENERATE_BUTTON)) {
print '<a href="'.$_SERVER["PHP_SEFL"].'?action=regeneratesite&website='.$website->ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("RegenerateWebsiteContent")).'"><span class="fa fa-cogs"><span></a>';
}
}
print '</span>';
}
} else {
print '<input type="hidden" name="website" id="website" value='.$websitekey.'">';
}
// Toolbar for websites
print '<span class="websitetools websiteselection">';
if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone' || $action == 'deletesite')
@@ -2405,7 +2444,7 @@ if (!GETPOST('hide_websitemenu'))
print '<span class="websiteinputurl valignmiddle" id="websiteinputurl">';
$linktotestonwebserver = '<a href="'.($virtualurl ? $virtualurl : '#').'" class="valignmiddle">';
$linktotestonwebserver .= '<span class="hideonsmartphone">'.$langs->trans("TestDeployOnWeb", $virtualurl).' </span>'.img_picto('', 'globe');
$linktotestonwebserver .= '<span class="hideonsmartphone paddingrightonly">'.$langs->trans("TestDeployOnWeb", $virtualurl).'</span>'.img_picto('', 'globe');
$linktotestonwebserver .= '</a>';
$htmltext = '';
if (empty($object->fk_default_home))
@@ -2469,8 +2508,10 @@ if (!GETPOST('hide_websitemenu'))
print '</span>';
//
// Toolbar for pages
//
if ($websitekey && $websitekey != '-1' && !in_array($action, array('editcss', 'editmenu', 'importsite', 'file_manager', 'replacesite', 'replacesiteconfirm')) && !$file_manager)
{
print '</div>'; // Close current websitebar to open a new one
@@ -2483,7 +2524,6 @@ if (!GETPOST('hide_websitemenu'))
print '</span>';
print '<span class="websiteselection hideonsmartphoneimp">';
//print '<input type="submit"'.$disabled.' class="button" value="'.dol_escape_htmltag($langs->trans("Add")).'" name="createcontainer">';
print '<a href="'.$_SERVER["PHP_SEFL"].'?action=createcontainer&website='.$website->ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("AddPage")).'"><span class="fa fa-plus-circle valignmiddle btnTitle-icon"><span></a>';
print '</span>';
@@ -2491,7 +2531,28 @@ if (!GETPOST('hide_websitemenu'))
if ($action != 'addcontainer')
{
print '<span class="websiteselection">'.$formwebsite->selectContainer($website, 'pageid', $pageid, 0, $action, 'maxwidth200onsmartphone').'</span>';
print '<span class="websiteselection">';
print $formwebsite->selectContainer($website, 'pageid', $pageid, 0, $action, 'maxwidth200onsmartphone');
print '</span>';
$urltocreatenewpage = $_SERVER["PHP_SEFL"].'?action=createcontainer&website='.$website->ref;
$out = '';
if (!empty($conf->use_javascript_ajax)) {
$out .= '<script language="javascript">';
$out .= 'jQuery(document).ready(function () {';
$out .= ' jQuery("#pageid").change(function () {';
$out .= ' console.log("We select "+jQuery("#pageid option:selected").val());';
$out .= ' if (jQuery("#pgeid option:selected").val() == \'-2\') {';
$out .= ' window.location.href = "'.$urltocreatenewpage.'";';
$out .= ' } else {';
$out .= ' window.location.href = "'.$_SERVER["PHP_SEFL"].'?website='.$website->ref.'&pageid="+jQuery("#pageid option:selected").val();';
$out .= ' }';
$out .= ' });';
$out .= '});';
$out .= '</script>';
}
print $out;
}
else {
print $langs->trans("New");
@@ -3142,7 +3203,7 @@ if ($action == 'createsite')
if (GETPOST('WEBSITE_OTHERLANG')) $siteotherlang = GETPOST('WEBSITE_OTHERLANG', 'aZ09comma');
print '<tr><td class="titlefieldcreate fieldrequired">';
print $langs->trans('Ref');
print $form->textwithpicto($langs->trans('WebSite'), $langs->trans("Example").': www.mywebsite.com, myportal, ...');
print '</td><td>';
print '<input type="text" class="flat maxwidth300" name="WEBSITE_REF" value="'.dol_escape_htmltag($siteref).'" autofocus>';
print '</td></tr>';