diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index cf4c250a678..5b9a11dcf5f 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -43,12 +43,12 @@ if (!$user->admin) { $action = GETPOST('action', 'aZ09'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'adminihm'; // To manage different context of search +$mode = GETPOST('mode', 'aZ09') ? GETPOST('mode', 'aZ09') : 'language'; // 'language', 'template', 'login', 'other' + if (!defined("MAIN_MOTD")) { define("MAIN_MOTD", ""); } - - /* * Action */ @@ -94,168 +94,178 @@ if ($action == 'removebackgroundlogin' && !empty($conf->global->MAIN_LOGIN_BACKG } if ($action == 'update') { - dolibarr_set_const($db, "MAIN_LANG_DEFAULT", GETPOST("MAIN_LANG_DEFAULT", 'aZ09'), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity); - //dolibarr_set_const($db, "MAIN_MULTILANGS", GETPOST("MAIN_MULTILANGS"), 'chaine', 0, '', $conf->entity); + $error = 0; - dolibarr_set_const($db, "MAIN_THEME", GETPOST("main_theme", 'aZ09'), 'chaine', 0, '', $conf->entity); - - /*$val=GETPOST('THEME_TOPMENU_DISABLE_IMAGE'); - if (! $val) dolibarr_del_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', $conf->entity); - else dolibarr_set_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', GETPOST('THEME_TOPMENU_DISABLE_IMAGE'), 'chaine', 0, '', $conf->entity);*/ - - $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKBODY'), array())))); - if ($val == '') { - dolibarr_del_const($db, 'THEME_ELDY_BACKBODY', $conf->entity); - } else { - dolibarr_set_const($db, 'THEME_ELDY_BACKBODY', $val, 'chaine', 0, '', $conf->entity); + if ($mode == 'language') { + dolibarr_set_const($db, "MAIN_LANG_DEFAULT", GETPOST("MAIN_LANG_DEFAULT", 'aZ09'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity); + //dolibarr_set_const($db, "MAIN_MULTILANGS", GETPOST("MAIN_MULTILANGS"), 'chaine', 0, '', $conf->entity); } - $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1'), array())))); - if ($val == '') { - dolibarr_del_const($db, 'THEME_ELDY_TOPMENU_BACK1', $conf->entity); - } else { - dolibarr_set_const($db, 'THEME_ELDY_TOPMENU_BACK1', $val, 'chaine', 0, '', $conf->entity); + if ($mode == 'template') { + dolibarr_set_const($db, "MAIN_THEME", GETPOST("main_theme", 'aZ09'), 'chaine', 0, '', $conf->entity); + + /*$val=GETPOST('THEME_TOPMENU_DISABLE_IMAGE'); + if (! $val) dolibarr_del_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', $conf->entity); + else dolibarr_set_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', GETPOST('THEME_TOPMENU_DISABLE_IMAGE'), 'chaine', 0, '', $conf->entity);*/ + + $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKBODY'), array())))); + if ($val == '') { + dolibarr_del_const($db, 'THEME_ELDY_BACKBODY', $conf->entity); + } else { + dolibarr_set_const($db, 'THEME_ELDY_BACKBODY', $val, 'chaine', 0, '', $conf->entity); + } + + $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1'), array())))); + if ($val == '') { + dolibarr_del_const($db, 'THEME_ELDY_TOPMENU_BACK1', $conf->entity); + } else { + dolibarr_set_const($db, 'THEME_ELDY_TOPMENU_BACK1', $val, 'chaine', 0, '', $conf->entity); + } + + $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_VERMENU_BACK1'), array())))); + if ($val == '') { + dolibarr_del_const($db, 'THEME_ELDY_VERMENU_BACK1', $conf->entity); + } else { + dolibarr_set_const($db, 'THEME_ELDY_VERMENU_BACK1', $val, 'chaine', 0, '', $conf->entity); + } + + $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLENOTAB'), array())))); + if ($val == '') { + dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLENOTAB', $conf->entity); + } else { + dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLENOTAB', $val, 'chaine', 0, '', $conf->entity); + } + + $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'), array())))); + if ($val == '') { + dolibarr_del_const($db, 'THEME_ELDY_BACKTITLE1', $conf->entity); + } else { + dolibarr_set_const($db, 'THEME_ELDY_BACKTITLE1', $val, 'chaine', 0, '', $conf->entity); + } + + $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLE'), array())))); + if ($val == '') { + dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLE', $conf->entity); + } else { + dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLE', $val, 'chaine', 0, '', $conf->entity); + } + + $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLELINK'), array())))); + if ($val == '') { + dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLELINK', $conf->entity); + } else { + dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLELINK', $val, 'chaine', 0, '', $conf->entity); + } + + $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'), array())))); + if ($val == '') { + dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR1', $conf->entity); + } else { + dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR1', $val, 'chaine', 0, '', $conf->entity); + } + $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'), array())))); + if ($val == '') { + dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR2', $conf->entity); + } else { + dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR2', $val, 'chaine', 0, '', $conf->entity); + } + + $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'), array())))); + if ($val == '') { + dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR1', $conf->entity); + } else { + dolibarr_set_const($db, 'THEME_ELDY_LINEPAIR1', $val, 'chaine', 0, '', $conf->entity); + } + $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'), array())))); + if ($val == '') { + dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR2', $conf->entity); + } else { + dolibarr_set_const($db, 'THEME_ELDY_LINEPAIR2', $val, 'chaine', 0, '', $conf->entity); + } + + $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTLINK'), array())))); + if ($val == '') { + dolibarr_del_const($db, 'THEME_ELDY_TEXTLINK', $conf->entity); + } else { + dolibarr_set_const($db, 'THEME_ELDY_TEXTLINK', $val, 'chaine', 0, '', $conf->entity); + } + + $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_HOVER'), array())))); + if ($val == '') { + dolibarr_del_const($db, 'THEME_ELDY_USE_HOVER', $conf->entity); + } else { + dolibarr_set_const($db, "THEME_ELDY_USE_HOVER", $val, 'chaine', 0, '', $conf->entity); + } + + $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_CHECKED'), array())))); + if ($val == '') { + dolibarr_del_const($db, 'THEME_ELDY_USE_CHECKED', $conf->entity); + } else { + dolibarr_set_const($db, "THEME_ELDY_USE_CHECKED", $val, 'chaine', 0, '', $conf->entity); + } } - $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_VERMENU_BACK1'), array())))); - if ($val == '') { - dolibarr_del_const($db, 'THEME_ELDY_VERMENU_BACK1', $conf->entity); - } else { - dolibarr_set_const($db, 'THEME_ELDY_VERMENU_BACK1', $val, 'chaine', 0, '', $conf->entity); + if ($mode == 'other') { + dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", GETPOST("main_size_liste_limit", 'int'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_SIZE_SHORTLIST_LIMIT", GETPOST("main_size_shortliste_limit", 'int'), 'chaine', 0, '', $conf->entity); + + //dolibarr_set_const($db, "MAIN_DISABLE_JAVASCRIPT", GETPOST("MAIN_DISABLE_JAVASCRIPT", 'aZ09'), 'chaine', 0, '', $conf->entity); + //dolibarr_set_const($db, "MAIN_BUTTON_HIDE_UNAUTHORIZED", GETPOST("MAIN_BUTTON_HIDE_UNAUTHORIZED", 'aZ09'), 'chaine', 0, '', $conf->entity); + //dolibarr_set_const($db, "MAIN_MENU_HIDE_UNAUTHORIZED", GETPOST("MAIN_MENU_HIDE_UNAUTHORIZED", 'aZ09'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_START_WEEK", GETPOST("MAIN_START_WEEK", 'int'), 'chaine', 0, '', $conf->entity); + + dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_DAYS", GETPOST("MAIN_DEFAULT_WORKING_DAYS", 'alphanohtml'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", GETPOST("MAIN_DEFAULT_WORKING_HOURS", 'alphanohtml'), 'chaine', 0, '', $conf->entity); + + dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", GETPOST("MAIN_BUGTRACK_ENABLELINK", 'alpha'), 'chaine', 0, '', $conf->entity); + + dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", GETPOST("MAIN_FIRSTNAME_NAME_POSITION", 'aZ09'), 'chaine', 0, '', $conf->entity); + + dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr(GETPOST("main_motd", 'restricthtml')), 'chaine', 0, '', $conf->entity); } - $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLENOTAB'), array())))); - if ($val == '') { - dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLENOTAB', $conf->entity); - } else { - dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLENOTAB', $val, 'chaine', 0, '', $conf->entity); - } + if ($mode == 'login') { + dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr(GETPOST("main_home", 'restricthtml')), 'chaine', 0, '', $conf->entity); + //dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", GETPOST("MAIN_HELP_DISABLELINK", 'aZ09'), 'chaine', 0, '', 0); // Param for all entities - $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'), array())))); - if ($val == '') { - dolibarr_del_const($db, 'THEME_ELDY_BACKTITLE1', $conf->entity); - } else { - dolibarr_set_const($db, 'THEME_ELDY_BACKTITLE1', $val, 'chaine', 0, '', $conf->entity); - } + $varforimage = 'imagebackground'; + $dirforimage = $conf->mycompany->dir_output . '/logos/'; + if ($_FILES[$varforimage]["tmp_name"]) { + $reg = array(); + if (preg_match('/([^\\/:]+)$/i', $_FILES[$varforimage]["name"], $reg)) { + $original_file = $reg[1]; - $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLE'), array())))); - if ($val == '') { - dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLE', $conf->entity); - } else { - dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLE', $val, 'chaine', 0, '', $conf->entity); - } - - $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLELINK'), array())))); - if ($val == '') { - dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLELINK', $conf->entity); - } else { - dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLELINK', $val, 'chaine', 0, '', $conf->entity); - } - - $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'), array())))); - if ($val == '') { - dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR1', $conf->entity); - } else { - dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR1', $val, 'chaine', 0, '', $conf->entity); - } - $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'), array())))); - if ($val == '') { - dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR2', $conf->entity); - } else { - dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR2', $val, 'chaine', 0, '', $conf->entity); - } - - $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'), array())))); - if ($val == '') { - dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR1', $conf->entity); - } else { - dolibarr_set_const($db, 'THEME_ELDY_LINEPAIR1', $val, 'chaine', 0, '', $conf->entity); - } - $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'), array())))); - if ($val == '') { - dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR2', $conf->entity); - } else { - dolibarr_set_const($db, 'THEME_ELDY_LINEPAIR2', $val, 'chaine', 0, '', $conf->entity); - } - - $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTLINK'), array())))); - if ($val == '') { - dolibarr_del_const($db, 'THEME_ELDY_TEXTLINK', $conf->entity); - } else { - dolibarr_set_const($db, 'THEME_ELDY_TEXTLINK', $val, 'chaine', 0, '', $conf->entity); - } - - $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_HOVER'), array())))); - if ($val == '') { - dolibarr_del_const($db, 'THEME_ELDY_USE_HOVER', $conf->entity); - } else { - dolibarr_set_const($db, "THEME_ELDY_USE_HOVER", $val, 'chaine', 0, '', $conf->entity); - } - - $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_CHECKED'), array())))); - if ($val == '') { - dolibarr_del_const($db, 'THEME_ELDY_USE_CHECKED', $conf->entity); - } else { - dolibarr_set_const($db, "THEME_ELDY_USE_CHECKED", $val, 'chaine', 0, '', $conf->entity); - } - - dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", GETPOST("main_size_liste_limit", 'int'), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_SIZE_SHORTLIST_LIMIT", GETPOST("main_size_shortliste_limit", 'int'), 'chaine', 0, '', $conf->entity); - - //dolibarr_set_const($db, "MAIN_DISABLE_JAVASCRIPT", GETPOST("MAIN_DISABLE_JAVASCRIPT", 'aZ09'), 'chaine', 0, '', $conf->entity); - //dolibarr_set_const($db, "MAIN_BUTTON_HIDE_UNAUTHORIZED", GETPOST("MAIN_BUTTON_HIDE_UNAUTHORIZED", 'aZ09'), 'chaine', 0, '', $conf->entity); - //dolibarr_set_const($db, "MAIN_MENU_HIDE_UNAUTHORIZED", GETPOST("MAIN_MENU_HIDE_UNAUTHORIZED", 'aZ09'), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_START_WEEK", GETPOST("MAIN_START_WEEK", 'int'), 'chaine', 0, '', $conf->entity); - - dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_DAYS", GETPOST("MAIN_DEFAULT_WORKING_DAYS", 'alphanohtml'), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", GETPOST("MAIN_DEFAULT_WORKING_HOURS", 'alphanohtml'), 'chaine', 0, '', $conf->entity); - - dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", GETPOST("MAIN_BUGTRACK_ENABLELINK", 'alpha'), 'chaine', 0, '', $conf->entity); - - dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", GETPOST("MAIN_FIRSTNAME_NAME_POSITION", 'aZ09'), 'chaine', 0, '', $conf->entity); - - dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr(GETPOST("main_motd", 'restricthtml')), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr(GETPOST("main_home", 'restricthtml')), 'chaine', 0, '', $conf->entity); - //dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", GETPOST("MAIN_HELP_DISABLELINK", 'aZ09'), 'chaine', 0, '', 0); // Param for all entities - - $varforimage = 'imagebackground'; $dirforimage = $conf->mycompany->dir_output.'/logos/'; - if ($_FILES[$varforimage]["tmp_name"]) { - $reg = array(); - if (preg_match('/([^\\/:]+)$/i', $_FILES[$varforimage]["name"], $reg)) { - $original_file = $reg[1]; - - $isimage = image_format_supported($original_file); - if ($isimage >= 0) { - dol_syslog("Move file ".$_FILES[$varforimage]["tmp_name"]." to ".$dirforimage.$original_file); - if (!is_dir($dirforimage)) { - dol_mkdir($dirforimage); - } - $result = dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage.$original_file, 1, 0, $_FILES[$varforimage]['error']); - if ($result > 0) { - dolibarr_set_const($db, "MAIN_LOGIN_BACKGROUND", $original_file, 'chaine', 0, '', $conf->entity); - } elseif (preg_match('/^ErrorFileIsInfectedWithAVirus/', $result)) { - $error++; - $langs->load("errors"); - $tmparray = explode(':', $result); - setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus', $tmparray[1]), null, 'errors'); + $isimage = image_format_supported($original_file); + if ($isimage >= 0) { + dol_syslog("Move file " . $_FILES[$varforimage]["tmp_name"] . " to " . $dirforimage . $original_file); + if (!is_dir($dirforimage)) { + dol_mkdir($dirforimage); + } + $result = dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage . $original_file, 1, 0, $_FILES[$varforimage]['error']); + if ($result > 0) { + dolibarr_set_const($db, "MAIN_LOGIN_BACKGROUND", $original_file, 'chaine', 0, '', $conf->entity); + } elseif (preg_match('/^ErrorFileIsInfectedWithAVirus/', $result)) { + $error++; + $langs->load("errors"); + $tmparray = explode(':', $result); + setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus', $tmparray[1]), null, 'errors'); + } else { + $error++; + setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors'); + } } else { $error++; - setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors'); + $langs->load("errors"); + setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors'); } - } else { - $error++; - $langs->load("errors"); - setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors'); } } } + $_SESSION["mainmenu"] = ""; // The menu manager may have changed - - $_SESSION["mainmenu"] = ""; // Le gestionnaire de menu a pu changer - - header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup".(GETPOSTISSET('page_y', 'int') ? '&page_y='.GETPOST('page_y', 'int') : '')); + header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup".'&mode='.$mode.(GETPOSTISSET('page_y', 'int') ? '&page_y='.GETPOST('page_y', 'int') : '')); exit; } @@ -274,6 +284,7 @@ $formadmin = new FormAdmin($db); print load_fiche_titre($langs->trans("GUISetup"), '', 'title_setup'); print ''.$langs->trans("DisplayDesc")."
\n"; +print "
\n"; //WYSIWYG Editor require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; @@ -282,242 +293,223 @@ print '
'; print ''; print ''; +print ''; + +$head = ihm_prepare_head(); + +print dol_get_fiche_head($head, $mode, '', -1, ''); clearstatcache(); -print '
'; -print '
'; -print ''; -print ''; -print ''; +if ($mode == 'language') { + print '
'; + print '
'.img_picto('', 'language').' '.$langs->trans("Language").'
'; -// Default language -print ''; -print ''; + // Default language + print ''; + print ''; -// Multilingual GUI -print ''; -print ''; + // Multilingual GUI + print ''; + print ''; -print '
'.$langs->trans("DefaultLanguage").''; -print img_picto('', 'language', 'class="pictofixedwidth"'); -print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'MAIN_LANG_DEFAULT', 1, null, '', 0, 0, 'minwidth300', 2); -//print ''; -print '
'.$langs->trans("DefaultLanguage").''; + print img_picto('', 'language', 'class="pictofixedwidth"'); + print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'MAIN_LANG_DEFAULT', 1, null, '', 0, 0, 'minwidth300', 2); + //print ''; + print '
'.$langs->trans("EnableMultilangInterface").''; -print ajax_constantonoff("MAIN_MULTILANGS", array(), $conf->entity, 0, 0, 1, 0); -print '
' . $langs->trans("EnableMultilangInterface") . ''; + print ajax_constantonoff("MAIN_MULTILANGS", array(), $conf->entity, 0, 0, 1, 0); + print '
'."\n"; -print '
'; - -print '
'; -print '
'; -print ''; -print '
'; - -print '

'; - -// Themes and themes options -showSkins(null, 1); -print '
'; -print '
'; -print ''; -print '
'; - -print '

'; - -// Other -print '
'; -print ''; -print ''; -print ''; -print ''; - -// Disable javascript and ajax -print ''; -print ''; -print ''; - -// Max size of lists -print ''; -print ''; -print ''; - -// Max size of short lists on customer card -print ''; -print ''; -print ''; - -// show input border -/* - print ''; - print ''; - print ''; - */ - -// First day for weeks -print ''; -print ''; -print ''; - -// DefaultWorkingDays -print ''; -print ''; -print ''; - -// DefaultWorkingHours -print ''; -print ''; -print ''; - -// Firstname/Name -print ''; -print ''; -print ''; - -// Hide unauthorized menus -print ''; -print ''; -print ''; - -// Hide unauthorized button -print ''; -print ''; -print ''; - -// Hide version link -/* - -print ''; -print ''; -print ''; -*/ - -// Show bugtrack link -print ''; -print ''; -print ''; - -// Hide wiki link on login page -$pictohelp = ''; -print ''; -print ''; -print ''; - -// Message of the day on home page -$substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount')); -complete_substitutions_array($substitutionarray, $langs); - -print '
'.$langs->trans("Miscellaneous").' '; -print '
'.$langs->trans("DisableJavascript").''; -print ajax_constantonoff("MAIN_DISABLE_JAVASCRIPT", array(), $conf->entity, 0, 0, 1, 0); -print '     '.$langs->trans("DisableJavascriptNote").''; -print ''; -print '
'.$langs->trans("DefaultMaxSizeList").' 
'.$langs->trans("DefaultMaxSizeShortList").' 
'.$langs->trans("showInputBorder").''; - print $form->selectyesno('main_showInputBorder',isset($conf->global->THEME_ELDY_SHOW_BORDER_INPUT)?$conf->global->THEME_ELDY_SHOW_BORDER_INPUT:0,1); - print ' 
'.$langs->trans("WeekStartOnDay").''; -print $formother->select_dayofweek((isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : '1'), 'MAIN_START_WEEK', 0); -print ' 
'.$langs->trans("DefaultWorkingDays").''; -print ''; -print ' 
'.$langs->trans("DefaultWorkingHours").''; -print ''; -print ' 
'.$langs->trans("FirstnameNamePosition").''; -$array = array(0=>$langs->trans("Firstname").' '.$langs->trans("Lastname"), 1=>$langs->trans("Lastname").' '.$langs->trans("Firstname")); -print $form->selectarray('MAIN_FIRSTNAME_NAME_POSITION', $array, (isset($conf->global->MAIN_FIRSTNAME_NAME_POSITION) ? $conf->global->MAIN_FIRSTNAME_NAME_POSITION : 0)); -print ' 
'.$langs->trans("HideUnauthorizedMenu").''; -//print $form->selectyesno('MAIN_MENU_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) ? $conf->global->MAIN_MENU_HIDE_UNAUTHORIZED : 0, 1); -print ajax_constantonoff("MAIN_MENU_HIDE_UNAUTHORIZED", array(), $conf->entity, 0, 0, 1, 0); -print ' 
'.$langs->trans("ButtonHideUnauthorized").''; -//print $form->selectyesno('MAIN_BUTTON_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED) ? $conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED : 0, 1); -print ajax_constantonoff("MAIN_BUTTON_HIDE_UNAUTHORIZED", array(), $conf->entity, 0, 0, 1, 0); -print ' 
'.$langs->trans("HideVersionLink").''; -print $form->selectyesno('MAIN_HIDE_VERSION',$conf->global->MAIN_HIDE_VERSION,1); -print ' 
'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).''; -print ''; -print ' 
'.str_replace('{picto}', $pictohelp, $langs->trans("DisableLinkToHelp", '{picto}')).''; -print ajax_constantonoff("MAIN_HELP_DISABLELINK", array(), $conf->entity, 0, 0, 1, 0); -//print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK) ? $conf->global->MAIN_HELP_DISABLELINK : 0, 1); -print ' 
'; -$texthelp = $langs->trans("FollowingConstantsWillBeSubstituted").'
'; -foreach ($substitutionarray as $key => $val) { - $texthelp .= $key.'
'; + print '
' . "\n"; + print '
'; } -print $form->textwithpicto($langs->trans("MessageOfDay"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessageofday'); -print ''; - -$doleditor = new DolEditor('main_motd', (isset($conf->global->MAIN_MOTD) ? $conf->global->MAIN_MOTD : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%'); -$doleditor->Create(); - -print ''."\n"; - -print ''."\n"; -print ''; - -print '
'; - -print '
'; -print ''; -print '
'; - -print '

'; - -// Other -print '
'; -print ''; -print ''; -print ''; -print ''; -print ''; - -// Hide helpcenter link on login page -print ''; -print ''; -print ''; - -// Message on login page -$substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount', 'user')); -complete_substitutions_array($substitutionarray, $langs); -print ''."\n"; -// Background -print '' . "\n"; + + print '
'.$langs->trans("LoginPage").' 
'.$langs->trans("DisableLinkToHelpCenter").''; -print ajax_constantonoff("MAIN_HELPCENTER_DISABLELINK", array(), $conf->entity, 0, 0, 0, 0); -print ' 
'; -$texthelp = $langs->trans("FollowingConstantsWillBeSubstituted").'
'; -foreach ($substitutionarray as $key => $val) { - $texthelp .= $key.'
'; +if ($mode == 'template') { + // Themes and themes options + showSkins(null, 1); } -print $form->textwithpicto($langs->trans("MessageLogin"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessagelogin'); -print '
'; -$doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME) ? $conf->global->MAIN_HOME : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%'); -$doleditor->Create(); -print '
'; -print '
'; -$disabled = ''; -if (!empty($conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND)) { - $disabled = ' disabled="disabled"'; -} -print ''; -if ($disabled) { - print '('.$langs->trans("DisabledByOptionADD_UNSPLASH_LOGIN_BACKGROUND").') '; -} -if (!empty($conf->global->MAIN_LOGIN_BACKGROUND)) { - print ''.img_delete($langs->trans("Delete")).''; - if (file_exists($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND)) { - print '   '; - print ''; +if ($mode == 'other') { + // Other + print '
'; + print ''; + + // Disable javascript and ajax + print ''; + print ''; + print ''; + + // Max size of lists + print ''; + print ''; + print ''; + + // Max size of short lists on customer card + print ''; + print ''; + print ''; + + // show input border + /* + print ''; + print ''; + print ''; + */ + + // First day for weeks + print ''; + print ''; + print ''; + + // DefaultWorkingDays + print ''; + print ''; + print ''; + + // DefaultWorkingHours + print ''; + print ''; + print ''; + + // Firstname/Name + print ''; + print ''; + print ''; + + // Hide unauthorized menus + print ''; + print ''; + print ''; + + // Hide unauthorized button + print ''; + print ''; + print ''; + + // Hide version link + /* + + print ''; + print ''; + print ''; + */ + + // Show bugtrack link + print ''; + print ''; + print ''; + + // Hide wiki link on login page + $pictohelp = ''; + print ''; + print ''; + print ''; + + // Message of the day on home page + $substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount')); + complete_substitutions_array($substitutionarray, $langs); + + print ''; + print $form->textwithpicto($langs->trans("MessageOfDay"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessageofday'); -print '
' . $langs->trans("DisableJavascript") . ''; + print ajax_constantonoff("MAIN_DISABLE_JAVASCRIPT", array(), $conf->entity, 0, 0, 1, 0); + print '     ' . $langs->trans("DisableJavascriptNote") . ''; + print ''; + print '
' . $langs->trans("DefaultMaxSizeList") . ' 
' . $langs->trans("DefaultMaxSizeShortList") . ' 
'.$langs->trans("showInputBorder").''; + print $form->selectyesno('main_showInputBorder',isset($conf->global->THEME_ELDY_SHOW_BORDER_INPUT)?$conf->global->THEME_ELDY_SHOW_BORDER_INPUT:0,1); + print ' 
' . $langs->trans("WeekStartOnDay") . ''; + print $formother->select_dayofweek((isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : '1'), 'MAIN_START_WEEK', 0); + print ' 
' . $langs->trans("DefaultWorkingDays") . ''; + print ''; + print ' 
' . $langs->trans("DefaultWorkingHours") . ''; + print ''; + print ' 
' . $langs->trans("FirstnameNamePosition") . ''; + $array = array(0 => $langs->trans("Firstname") . ' ' . $langs->trans("Lastname"), 1 => $langs->trans("Lastname") . ' ' . $langs->trans("Firstname")); + print $form->selectarray('MAIN_FIRSTNAME_NAME_POSITION', $array, (isset($conf->global->MAIN_FIRSTNAME_NAME_POSITION) ? $conf->global->MAIN_FIRSTNAME_NAME_POSITION : 0)); + print ' 
' . $langs->trans("HideUnauthorizedMenu") . ''; + //print $form->selectyesno('MAIN_MENU_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) ? $conf->global->MAIN_MENU_HIDE_UNAUTHORIZED : 0, 1); + print ajax_constantonoff("MAIN_MENU_HIDE_UNAUTHORIZED", array(), $conf->entity, 0, 0, 1, 0); + print ' 
' . $langs->trans("ButtonHideUnauthorized") . ''; + //print $form->selectyesno('MAIN_BUTTON_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED) ? $conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED : 0, 1); + print ajax_constantonoff("MAIN_BUTTON_HIDE_UNAUTHORIZED", array(), $conf->entity, 0, 0, 1, 0); + print ' 
'.$langs->trans("HideVersionLink").''; + print $form->selectyesno('MAIN_HIDE_VERSION',$conf->global->MAIN_HIDE_VERSION,1); + print ' 
' . $langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")) . ''; + print ''; + print ' 
' . str_replace('{picto}', $pictohelp, $langs->trans("DisableLinkToHelp", '{picto}')) . ''; + print ajax_constantonoff("MAIN_HELP_DISABLELINK", array(), $conf->entity, 0, 0, 1, 0); + //print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK) ? $conf->global->MAIN_HELP_DISABLELINK : 0, 1); + print ' 
'; + $texthelp = $langs->trans("FollowingConstantsWillBeSubstituted") . '
'; + foreach ($substitutionarray as $key => $val) { + $texthelp .= $key . '
'; } -} else { - print ''; -} -print ''; -print '
'."\n"; -print '
'; + print '
'; + + $doleditor = new DolEditor('main_motd', (isset($conf->global->MAIN_MOTD) ? $conf->global->MAIN_MOTD : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%'); + $doleditor->Create(); + + print '
' . "\n"; + print '
'; +} + +if ($mode == 'login') { + // Other + print '
'; + print ''; + + // Hide helpcenter link on login page + print ''; + print ''; + print ''; + + // Message on login page + $substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount', 'user')); + complete_substitutions_array($substitutionarray, $langs); + print '' . "\n"; + + // Background + print ''; + + print '
' . $langs->trans("DisableLinkToHelpCenter") . ''; + print ajax_constantonoff("MAIN_HELPCENTER_DISABLELINK", array(), $conf->entity, 0, 0, 0, 0); + print ' 
'; + $texthelp = $langs->trans("FollowingConstantsWillBeSubstituted") . '
'; + foreach ($substitutionarray as $key => $val) { + $texthelp .= $key . '
'; + } + print $form->textwithpicto($langs->trans("MessageLogin"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessagelogin'); + print '
'; + $doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME) ? $conf->global->MAIN_HOME : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%'); + $doleditor->Create(); + print '
'; + print '
'; + $disabled = ''; + if (!empty($conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND)) { + $disabled = ' disabled="disabled"'; + } + print ''; + if ($disabled) { + print '(' . $langs->trans("DisabledByOptionADD_UNSPLASH_LOGIN_BACKGROUND") . ') '; + } + if (!empty($conf->global->MAIN_LOGIN_BACKGROUND)) { + print '' . img_delete($langs->trans("Delete")) . ''; + if (file_exists($conf->mycompany->dir_output . '/logos/' . $conf->global->MAIN_LOGIN_BACKGROUND)) { + print '   '; + print ''; + } + } else { + print ''; + } + print '
'; + print '
' . "\n"; + print '
'; +} print '
'; print '
'; -print ''; +print ''; print '
'; print '
'; diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 8cc3fc28c9e..ec12e397052 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -621,7 +621,7 @@ function dolibarr_set_const($db, $name, $value, $type = 'chaine', $visible = 0, /** * Prepare array with list of tabs * - * @param int $nbofactivatedmodules Number f oactivated modules + * @param int $nbofactivatedmodules Number if activated modules * @param int $nboftotalmodules Nb of total modules * @return array Array of tabs to show */ @@ -664,6 +664,45 @@ function modules_prepare_head($nbofactivatedmodules, $nboftotalmodules) return $head; } +/** + * Prepare array with list of tabs + * + * @return array Array of tabs to show + */ +function ihm_prepare_head() +{ + global $langs, $conf, $user; + $h = 0; + $head = array(); + + $head[$h][0] = DOL_URL_ROOT."/admin/ihm.php?mode=language"; + $head[$h][1] = $langs->trans("DefaultLanguage"); + $head[$h][2] = 'language'; + $h++; + + $head[$h][0] = DOL_URL_ROOT."/admin/ihm.php?mode=template"; + $head[$h][1] = $langs->trans("DefaultSkin"); + $head[$h][2] = 'template'; + $h++; + + $head[$h][0] = DOL_URL_ROOT."/admin/ihm.php?mode=login"; + $head[$h][1] = $langs->trans("LoginPage"); + $head[$h][2] = 'login'; + $h++; + + $head[$h][0] = DOL_URL_ROOT."/admin/ihm.php?mode=other"; + $head[$h][1] = $langs->trans("Miscellaneous"); + $head[$h][2] = 'other'; + $h++; + + complete_head_from_modules($conf, $langs, null, $head, $h, 'ihm_admin'); + + complete_head_from_modules($conf, $langs, null, $head, $h, 'ihm_admin', 'remove'); + + + return $head; +} + /** * Prepare array with list of tabs