diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 762e0f10f78..3076b9ecacd 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -655,10 +655,10 @@ class Categorie extends CommonObject * Link an object to the category * * @param CommonObject $obj Object to link to category - * @param string $type Type of category ('product', ...) + * @param string $type Type of category ('product', ...). Use '' to take $obj->element. * @return int 1 : OK, -1 : erreur SQL, -2 : id not defined, -3 : Already linked */ - public function add_type($obj, $type) + public function add_type($obj, $type = '') { // phpcs:enable global $user, $langs, $conf; @@ -667,6 +667,8 @@ class Categorie extends CommonObject if ($this->id == -1) return -2; + if (empty($type)) $type = $obj->element; + $this->db->begin(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie_".(empty($this->MAP_CAT_TABLE[$type]) ? $type : $this->MAP_CAT_TABLE[$type]); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 108fd211865..c7e39077fd3 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -647,7 +647,7 @@ class Form $disabled = 0; $ret = '
'; - $ret .= ''; // Complete list with data from external modules. THe module can use $_SERVER['PHP_SELF'] to know on which page we are, or use the $parameters['currentcontext'] completed by executeHooks. $parameters = array(); @@ -713,17 +713,18 @@ class Form urlform = urlform + "#show_files"; } $( this ).closest("form").attr("action", urlform); - console.log("we select a mass action "+massaction+" - "+urlform); + console.log("we select a mass action name='.$name.' massaction="+massaction+" - "+urlform); /* Warning: if you set submit button to disabled, post using Enter will no more work if there is no other button */ if ($(this).val() != \'0\') { jQuery(".' . $name . 'confirmed").prop(\'disabled\', false); - jQuery(".' . $name . 'other").show(); + jQuery(".' . $name . 'other").hide(); /* To disable if another div was open */ + jQuery(".' . $name . '"+massaction).show(); } else { jQuery(".' . $name . 'confirmed").prop(\'disabled\', true); - jQuery(".' . $name . 'other").hide(); + jQuery(".' . $name . 'other").hide(); /* To disable any div open */ } }); }); diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 57e5a421208..71835beaefa 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1239,7 +1239,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr if (GETPOSTISSET('dol_optimize_smallscreen')) { $themeparam .= '&dol_optimize_smallscreen='.GETPOST('dol_optimize_smallscreen', 'int'); } if (GETPOSTISSET('dol_no_mouse_hover')) { $themeparam .= '&dol_no_mouse_hover='.GETPOST('dol_no_mouse_hover', 'int'); } if (GETPOSTISSET('dol_use_jmobile')) { $themeparam .= '&dol_use_jmobile='.GETPOST('dol_use_jmobile', 'int'); $conf->dol_use_jmobile = GETPOST('dol_use_jmobile', 'int'); } - if (GETPOSTISSET('THEME_AGRESSIVENESS_RATIO')) { $themeparam .= '&THEME_AGRESSIVENESS_RATIO='.GETPOST('THEME_AGRESSIVENESS_RATIO', 'int'); } + if (GETPOSTISSET('THEME_SATURATE_RATIO')) { $themeparam .= '&THEME_SATURATE_RATIO='.GETPOST('THEME_SATURATE_RATIO', 'int'); } if (!defined('DISABLE_JQUERY') && !$disablejs && $conf->use_javascript_ajax) { diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index fa423f676f2..9f2e022825c 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -552,6 +552,9 @@ textarea.centpercent { text-align: center; margin: 0px auto; } +.alignstart { + text-align: start; +} .left { text-align: ; } diff --git a/htdocs/website/index.php b/htdocs/website/index.php index bd19975ba47..be1ea0eb4cb 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -292,6 +292,8 @@ if ($action == 'replacesiteconfirm') { $listofpages = getPagesFromSearchCriterias($containertype, $algo, $searchkey, 1000, $sortfield, $sortorder, $langcode, $otherfilters); } +$usercanedit = $user->rights->website->write; + /* @@ -380,6 +382,46 @@ if ($massaction == 'replace' && GETPOST('confirmmassaction', 'alpha') && !$searc $massaction = ''; } +// Set categoery +if ($massaction == 'setcategory' && GETPOST('confirmmassaction', 'alpha') && $usercanedit) +{ + $error = 0; + + $db->begin(); + + $categoryid = GETPOST('setcategory', 'none'); + if ($categoryid > 0) { + $nbupdate = 0; + $tmpwebsitepage = new WebsitePage($db); + $category = new Categorie($db); + $category->fetch($categoryid); + + foreach($toselect as $tmpid) { + $tmpwebsitepage->id = $tmpid; + $result = $category->add_type($tmpwebsitepage, 'website_page'); + if ($result < 0 && $result != -3) { + $error++; + setEventMessages($category->error, $category->errors, 'errors'); + break; + } else { + $nbupdate++; + } + } + } + + if ($error) { + $db->rollback(); + } else { + if ($nbupdate) { + setEventMessages($langs->trans("RecordsModified", $nbupdate), null, 'mesgs'); + } + + $db->commit(); + } + // Now we reload list + $listofpages = getPagesFromSearchCriterias($containertype, $algo, $searchkey, 1000, $sortfield, $sortorder, $langcode, $otherfilters); +} + // Replacement of string into pages if ($massaction == 'replace' && GETPOST('confirmmassaction', 'alpha')) { @@ -3558,7 +3600,7 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm' || $massaction = print ''; - print ''."\n"; + print ''."\n"; print '

'; print load_fiche_titre($langs->trans("ReplaceWebsiteContent"), '', 'search'); @@ -3652,20 +3694,27 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm' || $massaction = // List of mass actions available $arrayofmassactions = array(); if ($user->rights->website->writephp && $searchkey) $arrayofmassactions['replace'] = $langs->trans("Replace"); + if ($user->rights->website->write) $arrayofmassactions['setcategory'] = $langs->trans("ClassifyInCategory"); if ($permissiontodelete) $arrayofmassactions['predelete'] = ''.$langs->trans("Delete"); if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array(); $massactionbutton = $form->selectMassAction('', $arrayofmassactions); - $massactionbutton .= '