diff --git a/htdocs/admin/website.php b/htdocs/admin/website.php index 0343fecf69d..5ea6ee66dd9 100644 --- a/htdocs/admin/website.php +++ b/htdocs/admin/website.php @@ -421,7 +421,7 @@ $h++; dol_fiche_head($head, 'website', '', -1); -print $langs->trans("WebsiteSetupDesc").'
'; +print ''.$langs->trans("WebsiteSetupDesc").'
'; print "
\n"; diff --git a/htdocs/core/class/html.formwebsite.class.php b/htdocs/core/class/html.formwebsite.class.php index 6fc00605d77..12ec3e7f5ad 100644 --- a/htdocs/core/class/html.formwebsite.class.php +++ b/htdocs/core/class/html.formwebsite.class.php @@ -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.=''; + } + + if ($showempty || ! $atleastonepage) $out.=''; + + 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.=''; + } + } + $out.=''; + + if ($atleastonepage && $action != 'editsource') + { + $out.=ajax_combobox($htmlname); + } + else + { + $out.=''; + $out.=ajax_combobox($htmlname); + } + return $out; + } } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index ca6a4a93e4e..4d4a20f3a5c 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -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') { diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index be758c04890..62ce5a23531 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -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... \ No newline at end of file +BackToHomePage=Back to home page... +TranslationLinks=Translation links \ No newline at end of file diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index aeb1cbf70c9..c3bbc92af9c 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -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() !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 */ diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index d1a1c2025c0..320a03c2775 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -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() !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 */ diff --git a/htdocs/ticket/css/styles.css.php b/htdocs/ticket/css/styles.css.php index 1d0626d190b..906d50602a1 100644 --- a/htdocs/ticket/css/styles.css.php +++ b/htdocs/ticket/css/styles.css.php @@ -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'; diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index bd54b93438f..ac99001bf4b 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -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 = '' . $langs->trans("WebSite") . ''; - $label.= '
'; - $label.= '' . $langs->trans('Nom') . ': ' . $this->ref; + $label.= '
'; + $label.= '' . $langs->trans('Ref') . ': ' . $this->ref; $linkstart = '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); } diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index 870e300e650..e85af6244e3 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -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 = '' . $langs->trans("Page") . ''; - $label.= '
'; - $label.= '' . $langs->trans('Ref') . ': ' . $this->ref; + $label.= '
'; + $label.= '' . $langs->trans('Ref') . ': ' . $this->ref.'
'; + $label.= '' . $langs->trans('ID') . ': ' . $this->id.'
'; + $label.= '' . $langs->trans('Title') . ': ' . $this->title; - $linkstart = '
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 = ''; $linkend=''; - $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); } diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 56b3a0c8cb3..afc85a9c213 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -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 ''; - if (! $atleastonepage) + if ($atleastonepage) { - print ''; + print ''; } else { - print ''; + print ''; } //print ''; @@ -2137,55 +2149,11 @@ if (! GETPOST('hide_websitemenu')) print ''; print ''; - print ''; + //print ''; if ($action != 'addcontainer') { - $out=''; - if ($atleastonepage && $action != 'editsource') - { - $out.=''; - } - 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.=''; - } - } - else $out.=''; - $out.=''; - if ($atleastonepage && $action != 'editsource') - { - $out.=ajax_combobox('pageid'); - } - else - { - $out.=''; - $out.=ajax_combobox('pageid'); - } - print $out; + print $formwebsite->selectContainer($website, 'pageid', $pageid, 0, $action); } else { @@ -2298,7 +2266,7 @@ if (! GETPOST('hide_websitemenu')) print ''."\n"; print '
'; - print '
'; + print ''; - print '
'; + print ''; @@ -2405,7 +2373,7 @@ if (! GETPOST('hide_websitemenu')) } } - print ''; // end website selection + //print ''; // end website selection print ''; @@ -2888,12 +2856,24 @@ if ($action == 'editmeta' || $action == 'createcontainer') print ''."\n"; //print '
'; + $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 '
'; - print ' * '.$langs->trans("CreateByFetchingExternalPage").'

'; - print ''; + if (! empty($conf->use_javascript_ajax)) print ' '; + print '
'; + print '
'; + print '
'; print ''; print ''; print ''; print '';
'; print $langs->trans("URL"); print ''; @@ -2911,10 +2891,12 @@ if ($action == 'editmeta' || $action == 'createcontainer') print '
'; - print ' * '.$langs->trans("OrEnterPageInfoManually").'

'; + if (! empty($conf->use_javascript_ajax)) print ' '; + print '
'; + print '
'; } - print ''; + print '
'; if ($action != 'createcontainer') { @@ -2928,16 +2910,9 @@ if ($action == 'editmeta' || $action == 'createcontainer') print $langs->trans('InternalURLOfPage'); print ''; - /* - print ''; - */ - $type_container=$objectpage->type_container; $pageurl=$objectpage->pageurl; $pagealiasalt=$objectpage->aliasalt; @@ -2972,7 +2947,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') print ''; // Alias @@ -3023,26 +2998,28 @@ if ($action == 'editmeta' || $action == 'createcontainer') print $formadmin->select_language($pagelang?$pagelang:$langs->defaultlang, 'WEBSITE_LANG', 0, null, '1'); print ''; + // Translation of + $translationof=0; + print ''; - } - // 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 ''; } } else dol_print_error($db); } + print ''; print '
'; print '/public/website/index.php?website='.urlencode($websitekey).'&pageid='.urlencode($pageid); + //if ($objectpage->grabbed_from) print ' - '.$langs->trans('InitiallyGrabbedFrom').' '.$objectpage->grabbed_from.''; print '
'; - print $langs->trans('InitiallyGrabbedFrom'); - print ''; - print $objectpage->grabbed_from; - print '
'; print $langs->trans('WEBSITE_TITLE'); print ''; - print ''; + print ''; print '
'; + print $langs->trans('TranslationLinks'); + print ''; + 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 ''.$langs->trans('ThisPageIsTranslationOf').' '; + print $formwebsite->selectContainer($website, 'pageidfortranslation', $sourcepage->id, 1, $action); + } + } if ($action != 'createcontainer') { - // Translation of - if ($objectpage->fk_page > 0) - { - print '
'; - print $langs->trans('ThisPageIsTranslationOf'); - print ''; - $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 '
'; - print $langs->trans('ThisPageHasTranslationPages'); - print ''; + if ($translationof) print '
'; + print ''.$langs->trans('ThisPageHasTranslationPages').':
'; $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 '
'; $htmlhelp=$langs->trans("WEBSITE_ALIASALTDesc"); @@ -3127,7 +3103,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') print '
'; if ($action == 'createcontainer') { - print '
'; + print '
'; print ''; print ''; @@ -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(); + } + }); }); '; } @@ -3286,6 +3276,7 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm') if ($listofpages['code'] == 'OK') { + print ''."\n"; print '
'; if ($action == 'replacesiteconfirm') @@ -3317,7 +3308,8 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm') print '
'.$langs->trans("Container").''; - print ''.($answerrecord->title ? $answerrecord->title : $langs->trans("NoTitle")).''; + print $answerrecord->getNomUrl(1); + print ' ('.($answerrecord->title ? $answerrecord->title : $langs->trans("NoTitle")).')'; print ''.$answerrecord->description; print '