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 // Confirmation de la suppression de la ligne
if ($action == 'delete') 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); //var_dump($elementList);

View File

@@ -88,6 +88,10 @@ if ($action == 'add' && $user->rights->categorie->creer)
{ {
header("Location: ".$urlfrom); header("Location: ".$urlfrom);
exit; exit;
} elseif ($backtopage)
{
header("Location: ".$backtopage);
exit;
} elseif ($idProdOrigin) } elseif ($idProdOrigin)
{ {
header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProdOrigin.'&type='.$type); header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProdOrigin.'&type='.$type);
@@ -235,13 +239,13 @@ if ($user->rights->categorie->creer)
// Ref // Ref
print '<tr>'; 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>'; print'</td></tr>';
// Description // Description
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>'; print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; 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(); $doleditor->Create();
print '</td></tr>'; 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 int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param string $option Sur quoi pointe le lien ('', 'xyz') * @param string $option Sur quoi pointe le lien ('', 'xyz')
* @param int $maxlength Max length of text * @param int $maxlength Max length of text
* @param string $moreparam More param on URL link
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */
public function getNomUrl($withpicto = 0, $option = '', $maxlength = 0) public function getNomUrl($withpicto = 0, $option = '', $maxlength = 0, $moreparam = '')
{ {
global $langs; global $langs;
@@ -1632,7 +1633,7 @@ class Categorie extends CommonObject
if (colorIsLight($this->color)) $forced_color = 'categtextblack'; 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>'; $linkend = '</a>';
$picto = 'category'; $picto = 'category';

View File

@@ -39,6 +39,7 @@ if (!$user->rights->categorie->lire) accessforbidden();
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
$type = (GETPOST('type', 'aZ09') ? GETPOST('type', 'aZ09') : Categorie::TYPE_PRODUCT); $type = (GETPOST('type', 'aZ09') ? GETPOST('type', 'aZ09') : Categorie::TYPE_PRODUCT);
$catname = GETPOST('catname', 'alpha'); $catname = GETPOST('catname', 'alpha');
$nosearch = GETPOST('nosearch', 'int');
$categstatic = new Categorie($db); $categstatic = new Categorie($db);
if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility 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); $form = new Form($db);
$moreparam = ($nosearch ? '&nosearch=1' : '');
$typetext = $type; $typetext = $type;
if ($type == Categorie::TYPE_ACCOUNT) $title = $langs->trans('AccountsCategoriesArea'); if ($type == Categorie::TYPE_ACCOUNT) $title = $langs->trans('AccountsCategoriesArea');
elseif ($type == Categorie::TYPE_WAREHOUSE) $title = $langs->trans('StocksCategoriesArea'); elseif ($type == Categorie::TYPE_WAREHOUSE) $title = $langs->trans('StocksCategoriesArea');
@@ -67,67 +70,67 @@ llxHeader('', $title, '', '', 0, 0, $arrayofjs, $arrayofcss);
$newcardbutton = ''; $newcardbutton = '';
if (!empty($user->rights->categorie->creer)) { 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'); print load_fiche_titre($title, $newcardbutton, 'object_category');
print '<div class="fichecenter"><div class="fichethirdleft">'; // Search categories
if (empty($nosearch)) {
print '<div class="fichecenter"><div class="fichethirdleft">';
/* print '<form method="post" action="index.php?type='.$type.'">';
* Zone recherche produit/service print '<input type="hidden" name="token" value="'.newToken().'">';
*/ print '<input type="hidden" name="type" value="'.$type.'">';
print '<form method="post" action="index.php?type='.$type.'">'; print '<input type="hidden" name="nosearch" value="'.$nosearch.'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="type" value="'.$type.'">';
print '<table class="noborder nohover centpercent">'; print '<table class="noborder nohover centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("Search").'</td>'; print '<td colspan="3">'.$langs->trans("Search").'</td>';
print '</tr>'; print '</tr>';
print '<tr class="oddeven nohover"><td>'; print '<tr class="oddeven nohover"><td>';
print $langs->trans("Name").':</td><td><input class="flat inputsearch" type="text" name="catname" value="'.$catname.'"/></td><td><input type="submit" class="button" value="'.$langs->trans("Search").'"></td></tr>'; print $langs->trans("Name").':</td><td><input class="flat inputsearch" type="text" name="catname" value="'.$catname.'"/></td><td><input type="submit" class="button" value="'.$langs->trans("Search").'"></td></tr>';
print '</table></form>'; print '</table></form>';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">'; print '</div><div class="fichetwothirdright">';
/* /*
* Categories found * Categories found
*/ */
if ($catname || $id > 0) if ($catname || $id > 0)
{
$cats = $categstatic->rechercher($id, $catname, $typetext);
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("FoundCats").'</td></tr>';
foreach ($cats as $cat)
{ {
print "\t".'<tr class="oddeven">'."\n"; $cats = $categstatic->rechercher($id, $catname, $typetext);
print "\t\t<td>";
$categstatic->id = $cat->id;
$categstatic->ref = $cat->label;
$categstatic->label = $cat->label;
$categstatic->type = $cat->type;
$categstatic->color = $cat->color;
print '<span class="noborderoncategories" '.($categstatic->color ? ' style="background: #'.$categstatic->color.';"' : ' style="background: #aaa"').'>';
print $categstatic->getNomUrl(1, '');
print '</span>';
print "</td>\n";
print "\t\t<td>";
print dolGetFirstLineOfText($cat->description);
print "</td>\n";
print "\t</tr>\n";
}
print "</table>";
} else print '&nbsp;';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("FoundCats").'</td></tr>';
print '</div></div></div>'; foreach ($cats as $cat)
{
print "\t".'<tr class="oddeven">'."\n";
print "\t\t<td>";
$categstatic->id = $cat->id;
$categstatic->ref = $cat->label;
$categstatic->label = $cat->label;
$categstatic->type = $cat->type;
$categstatic->color = $cat->color;
print '<span class="noborderoncategories" '.($categstatic->color ? ' style="background: #'.$categstatic->color.';"' : ' style="background: #aaa"').'>';
print $categstatic->getNomUrl(1, '');
print '</span>';
print "</td>\n";
print "\t\t<td>";
print dolGetFirstLineOfText($cat->description);
print "</td>\n";
print "\t</tr>\n";
}
print "</table>";
} else print '&nbsp;';
print '</div></div>';
}
print '<div class="fichecenter"><br>'; print '<div class="fichecenter"><br>';
@@ -156,7 +159,7 @@ foreach ($fulltree as $key => $val)
$categstatic->ref = $val['label']; $categstatic->ref = $val['label'];
$categstatic->color = $val['color']; $categstatic->color = $val['color'];
$categstatic->type = $type; $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']); $desc = dol_htmlcleanlastbr($val['description']);
$counter = ''; $counter = '';
@@ -172,7 +175,7 @@ foreach ($fulltree as $key => $val)
'rowid'=>$val['rowid'], 'rowid'=>$val['rowid'],
'fk_menu'=>$val['fk_parent'], '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. '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 $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
// Load variable for pagination // Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma'); $sortfield = GETPOST('sortfield', 'aZ09comma');

View File

@@ -4038,7 +4038,7 @@ class Form
* type can be 'hidden', 'text', 'password', 'checkbox', 'radio', 'date', 'morecss', ... * type can be 'hidden', 'text', 'password', 'checkbox', 'radio', 'date', 'morecss', ...
* @param string $selectedchoice '' or 'no', or 'yes' or '1' or '0' * @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|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 $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. * @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 * @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 } ?> <?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 // End of lib_head.js.php

View File

@@ -103,15 +103,16 @@ function tree_showpad(&$fulltree, $key, $silent = 0)
* $arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css'); * $arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css');
* TODO Replace with jstree plugin instead of treeview plugin. * TODO Replace with jstree plugin instead of treeview plugin.
* *
* @param array $tab Array of all elements * @param array $tab Array of all elements
* @param array $pere Array with parent ids ('rowid'=>,'mainmenu'=>,'leftmenu'=>,'fk_mainmenu=>,'fk_leftmenu=>) * @param array $pere Array with parent ids ('rowid'=>,'mainmenu'=>,'leftmenu'=>,'fk_mainmenu=>,'fk_leftmenu=>)
* @param int $rang Level of element * @param int $rang Level of element
* @param string $iddivjstree Id to use for parent ul element * @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 $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 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 * @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; global $tree_recur_alreadyadded, $menu_handler_to_search;
@@ -197,7 +198,7 @@ function tree_recur($tab, $pere, $rang, $iddivjstree = 'iddivjstree', $donoreset
if ($showfk) if ($showfk)
{ {
print '<table class="nobordernopadding centpercent"><tr><td>'; 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 $tab[$x]['title'];
print '</a></strong>'; 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'].')'; 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 * View
*/ */
llxHeader(); $help_url = '';
llxHeader('', '', $help_url);
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; $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'); 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 '<tr class="liste_titre">';
print "<td>".$langs->trans("Parameter")."</td>"; print "<td>".$langs->trans("Parameter")."</td>";
print "<td>".$langs->trans("Value")."</td>"; print "<td>".$langs->trans("Value")."</td>";
print "<td>&nbsp;</td>"; print "<td></td>";
print "</tr>"; print "</tr>";
print '<tr class="impair">'; print '<tr class="oddeven">';
print '<td class="fieldrequired">'.$langs->trans("KeyForCronAccess").'</td>'; print '<td class="fieldrequired">'.$langs->trans("KeyForCronAccess").'</td>';
$disabled = ''; $disabled = '';
if (!empty($conf->global->CRON_DISABLE_KEY_CHANGE)) $disabled = ' disabled="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 ShowCategory=Show tag/category
ByDefaultInList=By default in list ByDefaultInList=By default in list
ChooseCategory=Choose category ChooseCategory=Choose category
StocksCategoriesArea=Warehouses Categories Area StocksCategoriesArea=Warehouses Categories
ActionCommCategoriesArea=Events Categories Area ActionCommCategoriesArea=Events Categories
WebsitePagesCategoriesArea=Page-Container Categories Area WebsitePagesCategoriesArea=Page-Container Categories
UseOrOperatorForCategories=Use or operator for categories UseOrOperatorForCategories=Use or operator for categories

View File

@@ -31,7 +31,7 @@ AddWebsite=Add website
Webpage=Web page/container Webpage=Web page/container
AddPage=Add page/container AddPage=Add page/container
HomePage=Home Page 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>'. 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. 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 SiteDeleted=Web site '%s' deleted
@@ -134,4 +134,5 @@ AvailableLanguagesAreDefinedIntoWebsiteProperties=Available languages are define
ReplacementDoneInXPages=Replacement done in %s pages or containers ReplacementDoneInXPages=Replacement done in %s pages or containers
RSSFeed=RSS Feed RSSFeed=RSS Feed
RSSFeedDesc=You can get a RSS feed of latest articles with type 'blogpost' using this URL RSSFeedDesc=You can get a RSS feed of latest articles with type 'blogpost' using this URL
PagesRegenerated=%s page(s)/container(s) regenerated PagesRegenerated=%s page(s)/container(s) regenerated
RegenerateWebsiteContent=Regenerate web site cache files

View File

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

View File

@@ -118,7 +118,7 @@ body {
th a { font-weight: <?php echo ($useboldtitle ? 'bold' : 'normal'); ?> !important; } th a { font-weight: <?php echo ($useboldtitle ? 'bold' : 'normal'); ?> !important; }
a.tab { font-weight: 500 !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:hover { text-decoration: underline; color: var(--colortextlink); }
a.commonlink { color: var(--colortextlink) !important; text-decoration: none; } 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; } 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 { div.attachareaformuserfileecm {
padding-top: 0; padding-top: 0;
padding-bottom: 0; padding-bottom: 6px;
} }
div.arearef { div.arearef {
@@ -4418,7 +4418,7 @@ span[phptag] {
border-bottom: 1px solid #ccc; border-bottom: 1px solid #ccc;
background: #e6e6e6; background: #e6e6e6;
display: inline-block; display: inline-block;
padding: 4px 0 4px 0; padding: 5px 0 5px 0;
z-index: 1000; z-index: 1000;
} }
.websitebar .buttonDelete, .websitebar .button { .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 $object->fetchAll('ASC', 'position'); // Init $object->records with list of websites
// If website not defined, we take first found // 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) foreach ($object->records as $key => $valwebsite)
{ {
@@ -2182,7 +2182,7 @@ $formadmin = new FormAdmin($db);
$formwebsite = new FormWebsite($db); $formwebsite = new FormWebsite($db);
$formother = new FormOther($db); $formother = new FormOther($db);
$help_url = ''; $helpurl = 'EN:Module_Website|FR:Module_Website_FR|ES:M&oacute;dulo_Website';
$arrayofjs = array( $arrayofjs = array(
'/includes/ace/src/ace.js', '/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 .= 'var indicatorBlockUI = \''.DOL_URL_ROOT."/theme/".$conf->theme."/img/working.gif".'\';'."\n";
$moreheadjs .= '</script>'."\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 "\n";
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" enctype="multipart/form-data">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" enctype="multipart/form-data">';
@@ -2276,45 +2276,6 @@ if (!GETPOST('hide_websitemenu'))
$disabled = ''; $disabled = '';
if (empty($user->rights->website->write)) $disabled = ' disabled="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) if ($websitekey)
{ {
$virtualurl = ''; $virtualurl = '';
@@ -2331,70 +2292,148 @@ if (!GETPOST('hide_websitemenu'))
if (!is_array($array) && $array < 0) dol_print_error('', $objectpage->error, $objectpage->errors); if (!is_array($array) && $array < 0) dol_print_error('', $objectpage->error, $objectpage->errors);
$atleastonepage = (is_array($array) && count($array) > 0); $atleastonepage = (is_array($array) && count($array) > 0);
if ($websitekey && $websitekey != '-1' && ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone' || $action == 'deletesite'))
{
print ' &nbsp; ';
print '<input type="submit" class="button bordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditCss")).'" name="editcss">'; //var_dump($objectpage);exit;
print '<div class="centpercent websitebar">';
$importlabel = $langs->trans("ImportSite"); //
$exportlabel = $langs->trans("ExportSite"); // Toolbar for websites
if (! empty($conf->dol_optimize_smallscreen)) { //
$importlabel = $langs->trans("Import");
$exportlabel = $langs->trans("Export"); 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>';
} }
if ($atleastonepage) // 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)
{ {
print '<input type="submit" class="button bordertransp" disabled="disabled" value="'.dol_escape_htmltag($importlabel).'" name="importsite">'; 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++;
} }
else { $out .= '</select>';
print '<input type="submit" class="button bordertransp"'.$disabled.' value="'.dol_escape_htmltag($importlabel).'" name="importsite">'; $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").'">';
} }
//print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditMenu")).'" name="editmenu">'; if ($websitekey && $websitekey != '-1' && ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone' || $action == 'deletesite'))
print '<input type="submit" class="button bordertransp"'.$disabled.' value="'.dol_escape_htmltag($exportlabel).'" name="exportsite">'; {
print '<input type="submit" class="button bordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("CloneSite")).'" name="createfromclone">'; print ' &nbsp; ';
print '<input type="submit" class="buttonDelete bordertransp" name="deletesite" value="'.$langs->trans("Delete").'"'.($atleastonepage ? ' disabled="disabled"' : '').'>'; print '<input type="submit" class="button bordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditCss")).'" name="editcss">';
print ' &nbsp; '; $importlabel = $langs->trans("ImportSite");
$exportlabel = $langs->trans("ExportSite");
if (! empty($conf->dol_optimize_smallscreen)) {
$importlabel = $langs->trans("Import");
$exportlabel = $langs->trans("Export");
}
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 ($atleastonepage)
//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 '<input type="submit" class="button bordertransp" disabled="disabled" value="'.dol_escape_htmltag($importlabel).'" name="importsite">';
print '<script language="javascript"> }
jQuery(document).ready(function () { else {
jQuery(".button_file_manager").click(function () { print '<input type="submit" class="button bordertransp"'.$disabled.' value="'.dol_escape_htmltag($importlabel).'" name="importsite">';
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>\') }
.dialog({
autoOpen: false,
modal: true,
height: 500,
width: \'80%\',
title: "'.dol_escape_js($langs->trans("FileManager")).'"
});
$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>'; //print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditMenu")).'" name="editmenu">';
print '<input type="submit" class="button bordertransp"'.$disabled.' value="'.dol_escape_htmltag($exportlabel).'" name="exportsite">';
print '<input type="submit" class="button bordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("CloneSite")).'" name="createfromclone">';
if (! empty($conf->categorie->enabled)) { print '<input type="submit" class="buttonDelete bordertransp" name="deletesite" value="'.$langs->trans("Delete").'"'.($atleastonepage ? ' disabled="disabled"' : '').'>';
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>';
} 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>';
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 '<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 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_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: (window.innerHeight - 150),
width: \'80%\',
title: "'.dol_escape_js($langs->transnoentitiesnoconv("Categories")).'"
});
$dialog.dialog(\'open\');
});
});
</script>';
}
print '</span>';
}
} else {
print '<input type="hidden" name="website" id="website" value='.$websitekey.'">';
} }
print '</span>';
// Toolbar for websites
print '<span class="websitetools websiteselection">'; print '<span class="websitetools websiteselection">';
@@ -2405,7 +2444,7 @@ if (!GETPOST('hide_websitemenu'))
print '<span class="websiteinputurl valignmiddle" id="websiteinputurl">'; print '<span class="websiteinputurl valignmiddle" id="websiteinputurl">';
$linktotestonwebserver = '<a href="'.($virtualurl ? $virtualurl : '#').'" class="valignmiddle">'; $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>'; $linktotestonwebserver .= '</a>';
$htmltext = ''; $htmltext = '';
if (empty($object->fk_default_home)) if (empty($object->fk_default_home))
@@ -2469,8 +2508,10 @@ if (!GETPOST('hide_websitemenu'))
print '</span>'; print '</span>';
//
// Toolbar for pages // Toolbar for pages
//
if ($websitekey && $websitekey != '-1' && !in_array($action, array('editcss', 'editmenu', 'importsite', 'file_manager', 'replacesite', 'replacesiteconfirm')) && !$file_manager) 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 print '</div>'; // Close current websitebar to open a new one
@@ -2483,7 +2524,6 @@ if (!GETPOST('hide_websitemenu'))
print '</span>'; print '</span>';
print '<span class="websiteselection hideonsmartphoneimp">'; 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 '<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>'; print '</span>';
@@ -2491,7 +2531,28 @@ if (!GETPOST('hide_websitemenu'))
if ($action != 'addcontainer') 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 { else {
print $langs->trans("New"); print $langs->trans("New");
@@ -3142,7 +3203,7 @@ if ($action == 'createsite')
if (GETPOST('WEBSITE_OTHERLANG')) $siteotherlang = GETPOST('WEBSITE_OTHERLANG', 'aZ09comma'); if (GETPOST('WEBSITE_OTHERLANG')) $siteotherlang = GETPOST('WEBSITE_OTHERLANG', 'aZ09comma');
print '<tr><td class="titlefieldcreate fieldrequired">'; 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 '</td><td>';
print '<input type="text" class="flat maxwidth300" name="WEBSITE_REF" value="'.dol_escape_htmltag($siteref).'" autofocus>'; print '<input type="text" class="flat maxwidth300" name="WEBSITE_REF" value="'.dol_escape_htmltag($siteref).'" autofocus>';
print '</td></tr>'; print '</td></tr>';