NEW Can edit link to the translation page in website module

This commit is contained in:
Laurent Destailleur 2019-10-31 21:09:33 +01:00
parent 628018ca2b
commit f98df3c807
10 changed files with 253 additions and 179 deletions

View File

@ -421,7 +421,7 @@ $h++;
dol_fiche_head($head, 'website', '', -1);
print $langs->trans("WebsiteSetupDesc").'<br>';
print '<span class="opacitymedium">'.$langs->trans("WebsiteSetupDesc").'</span><br>';
print "<br>\n";

View File

@ -47,7 +47,7 @@ class FormWebsite
/**
* Return HTML select list of export models
* Return HTML select list of websites
*
* @param string $selected Id modele pre-selectionne
* @param string $htmlname Name of HTML select
@ -99,7 +99,7 @@ class FormWebsite
/**
* Return a HTML select list of a dictionary
* Return a HTML select list of type of containers from the dictionary
*
* @param string $htmlname Name of select zone
* @param string $selected Selected value
@ -162,7 +162,7 @@ class FormWebsite
/**
* Return a HTML select list of type of containers
* Return a HTML select list of samples of containers content
*
* @param string $htmlname Name of select zone
* @param string $selected Selected value
@ -217,4 +217,72 @@ class FormWebsite
return $out;
}
/**
* Return a HTML select list of containers of a website.
* Note: $website->lines must have been loaded.
*
* @param Website $website Object Website
* @param string $htmlname Name of select zone
* @param int $pageid Preselected container ID
* @param int $showempty Show empty record
* @param string $action Action on page that use this select list
* @return string HTML select component with list of type of containers
*/
public function selectContainer($website, $htmlname = 'pageid', $pageid = 0, $showempty = 0, $action = '')
{
global $langs;
$atleastonepage = (is_array($website->lines) && count($website->lines) > 0);
$out='';
if ($atleastonepage && $action != 'editsource')
{
$out.='<select name="'.$htmlname.'" id="'.$htmlname.'" class="minwidth200 maxwidth300">';
}
else
{
$out.='<select name="pageidbis" id="pageid" class="minwidth200 maxwidth300" disabled="disabled">';
}
if ($showempty || ! $atleastonepage) $out.='<option value="-1">&nbsp;</option>';
if ($atleastonepage)
{
if (empty($pageid) && $action != 'createcontainer') // Page id is not defined, we try to take one
{
$firstpageid=0;$homepageid=0;
foreach($website->lines as $key => $valpage)
{
if (empty($firstpageid)) $firstpageid=$valpage->id;
if ($website->fk_default_home && $key == $website->fk_default_home) $homepageid=$valpage->id;
}
$pageid=$homepageid?$homepageid:$firstpageid; // We choose home page and if not defined yet, we take first page
}
foreach($website->lines as $key => $valpage)
{
$out.='<option value="'.$key.'"';
if ($pageid > 0 && $pageid == $key) $out.=' selected'; // To preselect a value
$out.='>';
$out.='['.$valpage->type_container.' '.sprintf("%03d", $valpage->id).'] ';
$out.=$valpage->pageurl.' - '.$valpage->title;
if ($website->fk_default_home && $key == $website->fk_default_home) $out.=' ('.$langs->trans("HomePage").')';
$out.='</option>';
}
}
$out.='</select>';
if ($atleastonepage && $action != 'editsource')
{
$out.=ajax_combobox($htmlname);
}
else
{
$out.='<input type="hidden" name="'.$htmlname.'" value="'.$pageid.'">';
$out.=ajax_combobox($htmlname);
}
return $out;
}
}

View File

@ -3028,7 +3028,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
//if (in_array($picto, array('switch_off', 'switch_on', 'off', 'on')))
if (empty($srconly) && in_array($pictowithouttext, array(
'1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected',
'address', 'bank', 'building', 'cash-register', 'close_title', 'cubes', 'delete', 'dolly', 'edit', 'ellipsis-h', 'bookmark', 'filter', 'grip', 'grip_title', 'list', 'listlight', 'note',
'address', 'bank', 'bookmark', 'building', 'cash-register', 'close_title', 'cubes', 'delete', 'dolly', 'edit', 'ellipsis-h',
'filter', 'file-code', 'grip', 'grip_title', 'list', 'listlight', 'note',
'object_list','object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser',
'off', 'on', 'play', 'playdisabled', 'printer', 'resize', 'stats',
'note', 'setup', 'sign-out', 'split', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'wrench', 'globe',
@ -3058,12 +3059,10 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
$morecss .= ($morecss ? ' ' : '').('picto'.$pictowithouttext);
} elseif ($pictowithouttext == 'switch_off') {
$facolor = '#999';
$fasize = '2em';
$fakey = 'fa-'.$arrayconvpictotofa[$pictowithouttext];
}
elseif ($pictowithouttext == 'switch_on') {
$facolor = '#227722';
$fasize = '2em';
$fakey = 'fa-'.$arrayconvpictotofa[$pictowithouttext];
}
elseif ($pictowithouttext == 'off') {

View File

@ -117,4 +117,5 @@ ImportSite=Import site
EditInLineOnOff=Mode 'Edit inline' is %s
ShowSubContainersOnOff=Mode to execute 'dynamic content' is %s
GlobalCSSorJS=Global CSS/JS/Header file of web site
BackToHomePage=Back to home page...
BackToHomePage=Back to home page...
TranslationLinks=Translation links

View File

@ -488,6 +488,9 @@ textarea.centpercent {
.backgroundblank {
background-color: #fff;
}
.nobackground, .nobackground tr {
background: unset !important;
}
.checkboxattachfilelabel {
font-size: 0.85em;
opacity: 0.7;
@ -517,6 +520,8 @@ body[class*="colorblind-"] .text-success{
color: rgb(<?php echo $colortexttitle; ?>) !important;
}
.fa-toggle-on, .fa-toggle-off { font-size: 2em; }
.websiteselectionsection .fa-toggle-on, .websiteselectionsection .fa-toggle-off { font-size: 1.5em; vertical-align: text-bottom; }
/* Themes for badges */
<?php include dol_buildpath($path.'/theme/'.$theme.'/badges.inc.php', 0); ?>

View File

@ -691,6 +691,9 @@ textarea.centpercent {
.backgroundblank {
background-color: #fff;
}
.nobackground, .nobackground tr {
background: unset !important;
}
.checkboxattachfilelabel {
font-size: 0.85em;
opacity: 0.7;
@ -720,6 +723,9 @@ body[class*="colorblind-"] .text-success{
color: rgb(<?php echo $colortexttitle; ?>) !important;
}
.fa-toggle-on, .fa-toggle-off { font-size: 2em; }
.websiteselectionsection .fa-toggle-on, .websiteselectionsection .fa-toggle-off { font-size: 1.5em; vertical-align: text-bottom; }
/* Themes for badges */
<?php include dol_buildpath($path.'/theme/'.$theme.'/badges.inc.php', 0); ?>

View File

@ -31,7 +31,7 @@ if (! defined('NOLOGIN')) define('NOLOGIN', 1); // File must be
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1);
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
session_cache_limiter(false);
session_cache_limiter('public');
require_once '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';

View File

@ -92,6 +92,17 @@ class Website extends CommonObject
*/
public $virtualhost;
/**
* List of containers
*
* @var array
*/
public $lines;
const STATUS_DRAFT = 0;
const STATUS_VALIDATED = 1;
/**
* Constructor
@ -229,10 +240,10 @@ class Website extends CommonObject
$sql .= " t.tms as date_modification";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
$sql .= ' WHERE t.entity IN ('.getEntity('website').')';
if (null !== $ref) {
if (! empty($ref)) {
$sql .= " AND t.ref = '" . $this->db->escape($ref) . "'";
} else {
$sql .= ' AND t.rowid = ' . $id;
$sql .= ' AND t.rowid = ' . (int) $id;
}
$resql = $this->db->query($sql);
@ -691,8 +702,8 @@ class Website extends CommonObject
$companylink = '';
$label = '<u>' . $langs->trans("WebSite") . '</u>';
$label.= '<div width="100%">';
$label.= '<b>' . $langs->trans('Nom') . ':</b> ' . $this->ref;
$label.= '<br>';
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
$linkstart = '<a href="'.DOL_URL_ROOT.'/website/card.php?id='.$this->id.'"';
$linkstart.= ($notooltip?'':' title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip'.($morecss?' '.$morecss:'').'"');
@ -734,31 +745,20 @@ class Website extends CommonObject
// phpcs:enable
global $langs;
if ($mode == 0 || $mode == 1)
if (empty($this->labelstatus) || empty($this->labelstatusshort))
{
if ($status == 1) return $langs->trans('Enabled');
elseif ($status == 0) return $langs->trans('Disabled');
}
elseif ($mode == 2)
{
if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled');
elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
}
elseif ($mode == 3)
{
if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4');
elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5');
}
elseif ($mode == 4)
{
if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled');
elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
}
elseif ($mode == 5)
{
if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4');
elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5');
global $langs;
//$langs->load("mymodule");
$this->labelstatus[self::STATUS_DRAFT] = $langs->trans('Disabled');
$this->labelstatus[self::STATUS_VALIDATED] = $langs->trans('Enabled');
$this->labelstatusshort[self::STATUS_DRAFT] = $langs->trans('Disabled');
$this->labelstatusshort[self::STATUS_VALIDATED] = $langs->trans('Enabled');
}
$statusType = 'status5';
if ($status == self::STATUS_VALIDATED) $statusType = 'status4';
return dolGetStatus($this->labelstatus[$status], $this->labelstatusshort[$status], '', $statusType, $mode);
}

View File

@ -47,7 +47,7 @@ class WebsitePage extends CommonObject
/**
* @var string String with name of icon for websitepage. Must be the part after the 'object_' into object_myobject.png
*/
public $picto = 'label';
public $picto = 'file-code';
/**
* @var int ID
@ -88,6 +88,11 @@ class WebsitePage extends CommonObject
public $date_modification;
const STATUS_DRAFT = 0;
const STATUS_VALIDATED = 1;
// BEGIN MODULEBUILDER PROPERTIES
/**
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
@ -480,25 +485,39 @@ class WebsitePage extends CommonObject
global $menumanager;
$result = '';
$companylink = '';
$label = '<u>' . $langs->trans("Page") . '</u>';
$label.= '<div width="100%">';
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
$label.= '<br>';
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref.'<br>';
$label.= '<b>' . $langs->trans('ID') . ':</b> ' . $this->id.'<br>';
$label.= '<b>' . $langs->trans('Title') . ':</b> ' . $this->title;
$linkstart = '<a href="'.DOL_URL_ROOT.'/website/card.php?id='.$this->id.'"';
$linkstart.= ($notooltip?'':' title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip'.($morecss?' '.$morecss:'').'"');
$linkstart.= '>';
$url = DOL_URL_ROOT.'/website/index.php?websiteid='.$this->fk_website.'&pageid='.$this->id;
$linkclose='';
if (empty($notooltip))
{
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
$label=$langs->trans("ShowMyObject");
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose.=' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
}
else $linkclose = ($morecss?' class="'.$morecss.'"':'');
$linkstart = '<a href="'.$url.'"';
$linkstart.=$linkclose.'>';
$linkend='</a>';
$linkstart = $linkend = '';
//$linkstart = $linkend = '';
$result .= $linkstart;
if ($withpicto) $result.=img_picto(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
if ($withpicto != 2) $result.= $this->ref;
$result .= $linkend;
if ($withpicto)
{
$result.=($linkstart.img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?'':'class="classfortooltip"')).$linkend);
if ($withpicto != 2) $result.=' ';
}
$result.= $linkstart . $this->ref . $linkend;
return $result;
}
@ -526,36 +545,20 @@ class WebsitePage extends CommonObject
// phpcs:enable
global $langs;
if ($mode == 0)
if (empty($this->labelstatus) || empty($this->labelstatusshort))
{
if ($status == 1) return $langs->trans('Enabled');
elseif ($status == 0) return $langs->trans('Disabled');
}
elseif ($mode == 1)
{
if ($status == 1) return $langs->trans('Enabled');
elseif ($status == 0) return $langs->trans('Disabled');
}
elseif ($mode == 2)
{
if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled');
elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
}
elseif ($mode == 3)
{
if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4');
elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5');
}
elseif ($mode == 4)
{
if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled');
elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
}
elseif ($mode == 5)
{
if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4');
elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5');
global $langs;
//$langs->load("mymodule");
$this->labelstatus[self::STATUS_DRAFT] = $langs->trans('Disabled');
$this->labelstatus[self::STATUS_VALIDATED] = $langs->trans('Enabled');
$this->labelstatusshort[self::STATUS_DRAFT] = $langs->trans('Disabled');
$this->labelstatusshort[self::STATUS_VALIDATED] = $langs->trans('Enabled');
}
$statusType = 'status5';
if ($status == self::STATUS_VALIDATED) $statusType = 'status4';
return dolGetStatus($this->labelstatus[$status], $this->labelstatusshort[$status], '', $statusType, $mode);
}

View File

@ -46,6 +46,7 @@ if (! $user->rights->website->read) accessforbidden();
$conf->dol_hide_leftmenu = 1; // Force hide of left menu.
$error=0;
$websiteid=GETPOST('websiteid', 'int');
$websitekey=GETPOST('website', 'alpha');
$page=GETPOST('page', 'alpha');
$pageid=GETPOST('pageid', 'int');
@ -101,7 +102,7 @@ $objectpage=new WebsitePage($db);
$object->fetchAll(); // Init $object->records with list of websites
// If website not defined, we take first found
if (empty($websitekey))
if (! ($websiteid > 0) && empty($websitekey))
{
foreach($object->records as $key => $valwebsite)
{
@ -109,10 +110,12 @@ if (empty($websitekey))
break;
}
}
if ($websitekey)
if ($websiteid > 0 || $websitekey)
{
$res = $object->fetch(0, $websitekey);
$res = $object->fetch($websiteid, $websitekey);
$websitekey = $object->ref;
}
$website = $object;
// Check pageid received as aprameter
@ -418,7 +421,7 @@ if ($action == 'addcontainer')
$db->begin();
$objectpage->fk_website = $object->id;
if (GETPOST('fetchexternalurl', 'alpha'))
if (GETPOSTISSET('fetchexternalurl'))
{
$urltograb=GETPOST('externalurl', 'alpha');
$grabimages=GETPOST('grabimages', 'alpha');
@ -426,12 +429,18 @@ if ($action == 'addcontainer')
//var_dump($grabimages);exit;
}
if ($urltograb)
if (GETPOSTISSET('fetchexternalurl'))
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
//if (! preg_match('/^http/', $urltograb) && ! preg_match('/^file/', $urltograb))
if (! preg_match('/^http/', $urltograb))
if (empty($urltograb))
{
$error++;
$langs->load("errors");
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("URL")), null, 'errors');
$action = 'createcontainer';
}
elseif (! preg_match('/^http/', $urltograb))
{
$error++;
$langs->load("errors");
@ -1372,6 +1381,8 @@ if ($action == 'updatemeta')
$objectpage->keywords = GETPOST('WEBSITE_KEYWORDS', 'alpha');
$objectpage->lang = GETPOST('WEBSITE_LANG', 'aZ09');
$objectpage->htmlheader = trim(GETPOST('htmlheader', 'none'));
$objectpage->fk_page = GETPOST('pageidfortranslation', 'int');
$newdatecreation=dol_mktime(GETPOST('datecreationhour', 'int'), GETPOST('datecreationmin', 'int'), GETPOST('datecreationsec', 'int'), GETPOST('datecreationmonth', 'int'), GETPOST('datecreationday', 'int'), GETPOST('datecreationyear', 'int'));
if ($newdatecreation) $objectpage->date_creation = $newdatecreation;
@ -2006,6 +2017,7 @@ if (! GETPOST('hide_websitemenu'))
if ($object->id > 0)
{
$array=$objectpage->fetchAll($object->id, 'ASC,ASC', 'type_container,pageurl');
$object->lines = $array;
}
if (! is_array($array) && $array < 0) dol_print_error('', $objectpage->error, $objectpage->errors);
$atleastonepage=(is_array($array) && count($array) > 0);
@ -2019,13 +2031,13 @@ if (! GETPOST('hide_websitemenu'))
print '<input type="submit" class="button bordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditCss")).'" name="editcss">';
if (! $atleastonepage)
if ($atleastonepage)
{
print '<input type="submit" class="button bordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("ImportSite")).'" name="importsite">';
print '<input type="submit" class="button bordertransp" disabled="disabled" value="'.dol_escape_htmltag($langs->trans("ImportSite")).'" name="importsite">';
}
else
{
print '<input type="submit" class="button bordertransp" disabled="disabled" value="'.dol_escape_htmltag($langs->trans("ImportSite")).'" name="importsite">';
print '<input type="submit" class="button bordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("ImportSite")).'" name="importsite">';
}
//print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditMenu")).'" name="editmenu">';
@ -2137,55 +2149,11 @@ if (! GETPOST('hide_websitemenu'))
print '<input type="submit"'.$disabled.' class="button" value="'.dol_escape_htmltag($langs->trans("Add")).'" name="createcontainer">';
print '</span>';
print '<span class="websiteselection">';
//print '<span class="websiteselection">';
if ($action != 'addcontainer')
{
$out='';
if ($atleastonepage && $action != 'editsource')
{
$out.='<select name="pageid" id="pageid" class="minwidth200 maxwidth300">';
}
else
{
$out.='<select name="pageidbis" id="pageid" class="minwidth200 maxwidth300" disabled="disabled">';
}
if ($atleastonepage)
{
if (empty($pageid) && $action != 'createcontainer') // Page id is not defined, we try to take one
{
$firstpageid=0;$homepageid=0;
foreach($array as $key => $valpage)
{
if (empty($firstpageid)) $firstpageid=$valpage->id;
if ($object->fk_default_home && $key == $object->fk_default_home) $homepageid=$valpage->id;
}
$pageid=$homepageid?$homepageid:$firstpageid; // We choose home page and if not defined yet, we take first page
}
foreach($array as $key => $valpage)
{
$out.='<option value="'.$key.'"';
if ($pageid > 0 && $pageid == $key) $out.=' selected'; // To preselect a value
$out.='>';
$out.='['.$valpage->type_container.' '.sprintf("%03d", $valpage->id).'] ';
$out.=$valpage->pageurl.' - '.$valpage->title;
if ($object->fk_default_home && $key == $object->fk_default_home) $out.=' ('.$langs->trans("HomePage").')';
$out.='</option>';
}
}
else $out.='<option value="-1">&nbsp;</option>';
$out.='</select>';
if ($atleastonepage && $action != 'editsource')
{
$out.=ajax_combobox('pageid');
}
else
{
$out.='<input type="hidden" name="pageid" value="'.$pageid.'">';
$out.=ajax_combobox('pageid');
}
print $out;
print $formwebsite->selectContainer($website, 'pageid', $pageid, 0, $action);
}
else
{
@ -2298,7 +2266,7 @@ if (! GETPOST('hide_websitemenu'))
print '<!-- button EditInLine and ShowSubcontainers -->'."\n";
print '<div class="websiteselectionsection inline-block">';
print '<div class="inline-block">';
print '<div class="inline-block marginrightonly">';
print '<span id="switchckeditorinline">'."\n";
print '<!-- Code to enabled edit inline ckeditor -->'."\n";
@ -2351,23 +2319,23 @@ if (! GETPOST('hide_websitemenu'))
if ($websitepage->grabbed_from)
{
//print '<input type="submit" class="button bordertransp" disabled="disabled" title="'.dol_escape_htmltag($langs->trans("OnlyEditionOfSourceForGrabbedContent")).'" value="'.dol_escape_htmltag($langs->trans("EditWithEditor")).'" name="editcontent">';
print '<a class="button nobordertransp opacitymedium nohoverborder"'.$disabled.' href="#" disabled="disabled" title="'.dol_escape_htmltag($langs->trans("OnlyEditionOfSourceForGrabbedContent")).'">'.img_picto($langs->trans("OnlyEditionOfSourceForGrabbedContent"), 'switch_off', '', false, 0, 0, '', 'nomarginleft').'</a>';
print '<a class="nobordertransp opacitymedium nohoverborder marginleftonlyshort"'.$disabled.' href="#" disabled="disabled" title="'.dol_escape_htmltag($langs->trans("OnlyEditionOfSourceForGrabbedContent")).'">'.img_picto($langs->trans("OnlyEditionOfSourceForGrabbedContent"), 'switch_off', '', false, 0, 0, '', 'nomarginleft').'</a>';
}
else
{
//print '<input type="submit" class="button nobordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditWithEditor")).'" name="editcontent">';
if (empty($conf->global->WEBSITE_EDITINLINE))
{
print '<a class="button nobordertransp nohoverborder"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=seteditinline">'.img_picto($langs->trans("EditInLineOnOff", $langs->transnoentitiesnoconv("Off")), 'switch_off', '', false, 0, 0, '', 'nomarginleft').'</a>';
print '<a class="nobordertransp nohoverborder marginleftonlyshort"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=seteditinline">'.img_picto($langs->trans("EditInLineOnOff", $langs->transnoentitiesnoconv("Off")), 'switch_off', '', false, 0, 0, '', 'nomarginleft').'</a>';
}
else
{
print '<a class="button nobordertransp nohoverborder"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=unseteditinline">'.img_picto($langs->trans("EditInLineOnOff", $langs->transnoentitiesnoconv("On")), 'switch_on', '', false, 0, 0, '', 'nomarginleft').'</a>';
print '<a class="nobordertransp nohoverborder marginleftonlyshort"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=unseteditinline">'.img_picto($langs->trans("EditInLineOnOff", $langs->transnoentitiesnoconv("On")), 'switch_on', '', false, 0, 0, '', 'nomarginleft').'</a>';
}
}
print '</div>';
print '<div class="inline-block">';
print '<div class="inline-block marginrightonly">';
print $langs->trans("ShowSubcontainers");
/*if ($websitepage->grabbed_from)
{
@ -2377,11 +2345,11 @@ if (! GETPOST('hide_websitemenu'))
{*/
if (empty($conf->global->WEBSITE_SUBCONTAINERSINLINE))
{
print '<a class="button nobordertransp nohoverborder"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=setshowsubcontainers">'.img_picto($langs->trans("ShowSubContainersOnOff", $langs->transnoentitiesnoconv("Off")), 'switch_off', '', false, 0, 0, '', 'nomarginleft').'</a>';
print '<a class="nobordertransp nohoverborder marginleftonlyshort"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=setshowsubcontainers">'.img_picto($langs->trans("ShowSubContainersOnOff", $langs->transnoentitiesnoconv("Off")), 'switch_off', '', false, 0, 0, '', 'nomarginleft').'</a>';
}
else
{
print '<a class="button nobordertransp nohoverborder"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=unsetshowsubcontainers">'.img_picto($langs->trans("ShowSubContainersOnOff", $langs->transnoentitiesnoconv("On")), 'switch_on', '', false, 0, 0, '', 'nomarginleft').'</a>';
print '<a class="nobordertransp nohoverborder marginleftonlyshort"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=unsetshowsubcontainers">'.img_picto($langs->trans("ShowSubContainersOnOff", $langs->transnoentitiesnoconv("On")), 'switch_on', '', false, 0, 0, '', 'nomarginleft').'</a>';
}
/*}*/
print '</div>';
@ -2405,7 +2373,7 @@ if (! GETPOST('hide_websitemenu'))
}
}
print '</span>'; // end website selection
//print '</span>'; // end website selection
print '<span class="websitetools">';
@ -2888,12 +2856,24 @@ if ($action == 'editmeta' || $action == 'createcontainer')
print '<!-- Edit or create page/container -->'."\n";
//print '<div class="fichecenter">';
$hiddenfromfetchingafterload = ' hideobject';
$hiddenmanuallyafterload = ' hideobject';
if (GETPOST('radiocreatefrom') == 'checkboxcreatefromfetching') $hiddenfromfetchingafterload = '';
if (GETPOST('radiocreatefrom') == 'checkboxcreatemanually') $hiddenmanuallyafterload = '';
if ($action == 'editmeta' || empty($conf->use_javascript_ajax)) { // No autohide/show in such case
$hiddenfromfetchingafterload='';
$hiddenmanuallyafterload='';
}
if ($action == 'createcontainer')
{
print '<br>';
print ' * '.$langs->trans("CreateByFetchingExternalPage").'<br><hr>';
print '<table class="border" width="100%">';
if (! empty($conf->use_javascript_ajax)) print '<input type="radio" name="radiocreatefrom" id="checkboxcreatefromfetching" value="checkboxcreatefromfetching"'.(GETPOST('radiocreatefrom') == 'checkboxcreatefromfetching' ? ' checked' : '').'> ';
print '<label for="checkboxcreatefromfetching"><span class="opacitymedium">'.$langs->trans("CreateByFetchingExternalPage").'</span></label><br>';
print '<hr class="tablecheckboxcreatefromfetching'.$hiddenfromfetchingafterload.'">';
print '<table class="tableforfield centpercent tablecheckboxcreatefromfetching'.$hiddenfromfetchingafterload.'">';
print '<tr><td class="titlefield">';
print $langs->trans("URL");
print '</td><td>';
@ -2911,10 +2891,12 @@ if ($action == 'editmeta' || $action == 'createcontainer')
print '<br>';
print ' * '.$langs->trans("OrEnterPageInfoManually").'<br><hr>';
if (! empty($conf->use_javascript_ajax)) print '<input type="radio" name="radiocreatefrom" id="checkboxcreatemanually" value="checkboxcreatemanually"'.(GETPOST('radiocreatefrom') == 'checkboxcreatemanually' ? ' checked' : '').'> ';
print '<label for="checkboxcreatemanually"><span class="opacitymedium">'.$langs->trans("OrEnterPageInfoManually").'</span></label><br>';
print '<hr class="tablecheckboxcreatemanually'.$hiddenmanuallyafterload.'">';
}
print '<table class="border" width="100%">';
print '<table class="border tableforfield nobackground centpercent tablecheckboxcreatemanually'.$hiddenmanuallyafterload.'">';
if ($action != 'createcontainer')
{
@ -2928,16 +2910,9 @@ if ($action == 'editmeta' || $action == 'createcontainer')
print $langs->trans('InternalURLOfPage');
print '</td><td>';
print '/public/website/index.php?website='.urlencode($websitekey).'&pageid='.urlencode($pageid);
//if ($objectpage->grabbed_from) print ' - <span class="opacitymedium">'.$langs->trans('InitiallyGrabbedFrom').' '.$objectpage->grabbed_from.'</span>';
print '</td></tr>';
/*
print '<tr><td class="titlefield">';
print $langs->trans('InitiallyGrabbedFrom');
print '</td><td>';
print $objectpage->grabbed_from;
print '</td></tr>';
*/
$type_container=$objectpage->type_container;
$pageurl=$objectpage->pageurl;
$pagealiasalt=$objectpage->aliasalt;
@ -2972,7 +2947,7 @@ if ($action == 'editmeta' || $action == 'createcontainer')
print '<tr><td class="fieldrequired">';
print $langs->trans('WEBSITE_TITLE');
print '</td><td>';
print '<input type="text" class="flat quatrevingtpercent" name="WEBSITE_TITLE" id="WEBSITE_TITLE" value="'.dol_escape_htmltag($pagetitle).'">';
print '<input type="text" class="flat quatrevingtpercent" name="WEBSITE_TITLE" id="WEBSITE_TITLE" value="'.dol_escape_htmltag($pagetitle).'" autofocus>';
print '</td></tr>';
// Alias
@ -3023,26 +2998,28 @@ if ($action == 'editmeta' || $action == 'createcontainer')
print $formadmin->select_language($pagelang?$pagelang:$langs->defaultlang, 'WEBSITE_LANG', 0, null, '1');
print '</td></tr>';
// Translation of
$translationof=0;
print '<!-- Translation of --><tr><td>';
print $langs->trans('TranslationLinks');
print '</td><td>';
if ($action == 'editmeta' || $action == 'createcontainer' || $objectpage->fk_page > 0)
{
$sourcepage=new WebsitePage($db);
$result = $sourcepage->fetch($objectpage->fk_page);
if ($result == 0)
{
// not found, we can reset value to clean database
}
elseif ($result > 0)
{
$translationof = $sourcepage->id;
print '<span class="opacitymedium">'.$langs->trans('ThisPageIsTranslationOf').'</span> ';
print $formwebsite->selectContainer($website, 'pageidfortranslation', $sourcepage->id, 1, $action);
}
}
if ($action != 'createcontainer')
{
// Translation of
if ($objectpage->fk_page > 0)
{
print '<tr><td>';
print $langs->trans('ThisPageIsTranslationOf');
print '</td><td>';
$sourcepage=new WebsitePage($db);
$result = $sourcepage->fetch($objectpage->fk_page);
if ($result == 0) // not found, we can reset value
{
}
elseif ($result > 0)
{
print $sourcepage->getNomUrl(1);
}
print '</td></tr>';
}
// Has translation pages
$sql='SELECT rowid, lang from '.MAIN_DB_PREFIX.'website_page where fk_page = '.$objectpage->id;
$resql = $db->query($sql);
@ -3051,9 +3028,8 @@ if ($action == 'editmeta' || $action == 'createcontainer')
$num_rows = $db->num_rows($resql);
if ($num_rows > 0)
{
print '<tr><td>';
print $langs->trans('ThisPageHasTranslationPages');
print '</td><td>';
if ($translationof) print '<br>';
print '<span class="opacitymedium">'.$langs->trans('ThisPageHasTranslationPages').':</span><br>';
$i=0;
while ($obj = $db->fetch_object($resql))
{
@ -3063,11 +3039,11 @@ if ($action == 'editmeta' || $action == 'createcontainer')
print $tmppage->getNomUrl(1).' ('.$tmppage->lang.')';
$i++;
}
print '</td></tr>';
}
}
else dol_print_error($db);
}
print '</td></tr>';
print '<tr><td class="titlefieldcreate">';
$htmlhelp=$langs->trans("WEBSITE_ALIASALTDesc");
@ -3127,7 +3103,7 @@ if ($action == 'editmeta' || $action == 'createcontainer')
print '</table>';
if ($action == 'createcontainer')
{
print '<div class="center">';
print '<div class="center tablecheckboxcreatemanually'.$hiddenmanuallyafterload.'">';
print '<input class="button" type="submit" name="addcontainer" value="'.$langs->trans("Create").'">';
print '<input class="button" type="submit" name="preview" value="'.$langs->trans("Cancel").'">';
@ -3155,6 +3131,20 @@ if ($action == 'editmeta' || $action == 'createcontainer')
jQuery("#WEBSITE_PAGENAME").keyup(function() {
disableautofillofalias = 1;
});
jQuery("#checkboxcreatefromfetching,#checkboxcreatemanually").change(function() {
console.log("we select a method to create a new container"+jQuery("#checkboxcreatefromfetching:checked").val())
if (typeof(jQuery("#checkboxcreatefromfetching:checked").val()) != \'undefined\')
{
jQuery(".tablecheckboxcreatefromfetching").show();
jQuery(".tablecheckboxcreatemanually").hide();
}
if (typeof(jQuery("#checkboxcreatemanually:checked").val()) != \'undefined\')
{
jQuery(".tablecheckboxcreatefromfetching").hide();
jQuery(".tablecheckboxcreatemanually").show();
}
});
});
</script>';
}
@ -3286,6 +3276,7 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm')
if ($listofpages['code'] == 'OK')
{
print '<!-- List of search result -->'."\n";
print '<div class="rowsearchresult">';
if ($action == 'replacesiteconfirm')
@ -3317,7 +3308,8 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm')
print '<tr>';
print '<td>'.$langs->trans("Container").'</td>';
print '<td>';
print '<a href="'.$_SERVER["PHP_SELF"].'?website='.$website->ref.'&pageid='.$answerrecord->id.'">'.($answerrecord->title ? $answerrecord->title : $langs->trans("NoTitle")).'</a>';
print $answerrecord->getNomUrl(1);
print ' <span class="opacitymedium">('.($answerrecord->title ? $answerrecord->title : $langs->trans("NoTitle")).')</span>';
print '</td>';
print '<td class="tdoverflow100">'.$answerrecord->description;
print '</td>';