ihm.php 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685
  1. <?php
  2. /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
  5. * Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
  6. * Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
  7. * Copyright (C) 2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
  8. * Copyright (C) 2021 Anthony Berton <bertonanthony@gmail.com>
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 3 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  22. */
  23. /**
  24. * \file htdocs/admin/ihm.php
  25. * \brief Page to setup GUI display options
  26. */
  27. // Load Dolibarr environment
  28. require '../main.inc.php';
  29. require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
  30. require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
  31. require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
  32. require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
  33. require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
  34. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
  35. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
  36. // Load translation files required by the page
  37. $langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'projects', 'hrm', 'agenda'));
  38. if (!$user->admin) {
  39. accessforbidden();
  40. }
  41. $action = GETPOST('action', 'aZ09');
  42. $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'adminihm'; // To manage different context of search
  43. $mode = GETPOST('mode', 'aZ09') ? GETPOST('mode', 'aZ09') : 'other'; // 'template', 'dashboard', 'login', 'other'
  44. if (!defined("MAIN_MOTD")) {
  45. define("MAIN_MOTD", "");
  46. }
  47. /*
  48. * Action
  49. */
  50. $parameters = array();
  51. $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
  52. if ($reshook < 0) {
  53. setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
  54. }
  55. if (GETPOST('cancel', 'alpha')) {
  56. $action = '';
  57. }
  58. // Convert action set_XXX and del_XXX to set var (this is used when no javascript on for ajax_constantonoff)
  59. $regs = array();
  60. if (preg_match('/^(set|del)_([A-Z_]+)$/', $action, $regs)) {
  61. if ($regs[1] == 'set') {
  62. dolibarr_set_const($db, $regs[2], 1, 'chaine', 0, '', $conf->entity);
  63. } else {
  64. dolibarr_del_const($db, $regs[2], $conf->entity);
  65. }
  66. }
  67. if ($action == 'removebackgroundlogin' && !empty($conf->global->MAIN_LOGIN_BACKGROUND)) {
  68. dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity);
  69. require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
  70. $logofile = $conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND;
  71. dol_delete_file($logofile);
  72. dolibarr_del_const($db, "MAIN_LOGIN_BACKGROUND", $conf->entity);
  73. $mysoc->logo = '';
  74. /*$logosmallfile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small;
  75. dol_delete_file($logosmallfile);
  76. dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$conf->entity);
  77. $mysoc->logo_small='';
  78. $logominifile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini;
  79. dol_delete_file($logominifile);
  80. dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$conf->entity);
  81. $mysoc->logo_mini='';*/
  82. }
  83. if ($action == 'update') {
  84. $error = 0;
  85. if ($mode == 'template') {
  86. //dolibarr_del_const($db, "MAIN_THEME", 0); // To be sure we don't have this constant set for all entities
  87. dolibarr_set_const($db, "MAIN_THEME", GETPOST("main_theme", 'aZ09'), 'chaine', 0, '', $conf->entity);
  88. dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity);
  89. if (GETPOSTISSET('THEME_DARKMODEENABLED')) {
  90. $val = GETPOST('THEME_DARKMODEENABLED');
  91. if (!$val) {
  92. dolibarr_del_const($db, "THEME_DARKMODEENABLED", $conf->entity);
  93. }
  94. if ($val) {
  95. dolibarr_set_const($db, "THEME_DARKMODEENABLED", $val, 'chaine', 0, '', $conf->entity);
  96. }
  97. }
  98. if (GETPOSTISSET('THEME_TOPMENU_DISABLE_IMAGE')) {
  99. $val=GETPOST('THEME_TOPMENU_DISABLE_IMAGE');
  100. if (!$val) {
  101. dolibarr_del_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', $conf->entity);
  102. } else {
  103. dolibarr_set_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', GETPOST('THEME_TOPMENU_DISABLE_IMAGE'), 'chaine', 0, '', $conf->entity);
  104. }
  105. }
  106. $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKBODY'), array()))));
  107. if ($val == '') {
  108. dolibarr_del_const($db, 'THEME_ELDY_BACKBODY', $conf->entity);
  109. } else {
  110. dolibarr_set_const($db, 'THEME_ELDY_BACKBODY', $val, 'chaine', 0, '', $conf->entity);
  111. }
  112. $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1'), array()))));
  113. if ($val == '') {
  114. dolibarr_del_const($db, 'THEME_ELDY_TOPMENU_BACK1', $conf->entity);
  115. } else {
  116. dolibarr_set_const($db, 'THEME_ELDY_TOPMENU_BACK1', $val, 'chaine', 0, '', $conf->entity);
  117. }
  118. $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_VERMENU_BACK1'), array()))));
  119. if ($val == '') {
  120. dolibarr_del_const($db, 'THEME_ELDY_VERMENU_BACK1', $conf->entity);
  121. } else {
  122. dolibarr_set_const($db, 'THEME_ELDY_VERMENU_BACK1', $val, 'chaine', 0, '', $conf->entity);
  123. }
  124. $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLENOTAB'), array()))));
  125. if ($val == '') {
  126. dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLENOTAB', $conf->entity);
  127. } else {
  128. dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLENOTAB', $val, 'chaine', 0, '', $conf->entity);
  129. }
  130. $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'), array()))));
  131. if ($val == '') {
  132. dolibarr_del_const($db, 'THEME_ELDY_BACKTITLE1', $conf->entity);
  133. } else {
  134. dolibarr_set_const($db, 'THEME_ELDY_BACKTITLE1', $val, 'chaine', 0, '', $conf->entity);
  135. }
  136. $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLE'), array()))));
  137. if ($val == '') {
  138. dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLE', $conf->entity);
  139. } else {
  140. dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLE', $val, 'chaine', 0, '', $conf->entity);
  141. }
  142. $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLELINK'), array()))));
  143. if ($val == '') {
  144. dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLELINK', $conf->entity);
  145. } else {
  146. dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLELINK', $val, 'chaine', 0, '', $conf->entity);
  147. }
  148. $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'), array()))));
  149. if ($val == '') {
  150. dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR1', $conf->entity);
  151. } else {
  152. dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR1', $val, 'chaine', 0, '', $conf->entity);
  153. }
  154. $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'), array()))));
  155. if ($val == '') {
  156. dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR2', $conf->entity);
  157. } else {
  158. dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR2', $val, 'chaine', 0, '', $conf->entity);
  159. }
  160. $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'), array()))));
  161. if ($val == '') {
  162. dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR1', $conf->entity);
  163. } else {
  164. dolibarr_set_const($db, 'THEME_ELDY_LINEPAIR1', $val, 'chaine', 0, '', $conf->entity);
  165. }
  166. $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'), array()))));
  167. if ($val == '') {
  168. dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR2', $conf->entity);
  169. } else {
  170. dolibarr_set_const($db, 'THEME_ELDY_LINEPAIR2', $val, 'chaine', 0, '', $conf->entity);
  171. }
  172. $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTLINK'), array()))));
  173. if ($val == '') {
  174. dolibarr_del_const($db, 'THEME_ELDY_TEXTLINK', $conf->entity);
  175. } else {
  176. dolibarr_set_const($db, 'THEME_ELDY_TEXTLINK', $val, 'chaine', 0, '', $conf->entity);
  177. }
  178. $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_HOVER'), array()))));
  179. if ($val == '') {
  180. dolibarr_del_const($db, 'THEME_ELDY_USE_HOVER', $conf->entity);
  181. } else {
  182. dolibarr_set_const($db, "THEME_ELDY_USE_HOVER", $val, 'chaine', 0, '', $conf->entity);
  183. }
  184. $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_CHECKED'), array()))));
  185. if ($val == '') {
  186. dolibarr_del_const($db, 'THEME_ELDY_USE_CHECKED', $conf->entity);
  187. } else {
  188. dolibarr_set_const($db, "THEME_ELDY_USE_CHECKED", $val, 'chaine', 0, '', $conf->entity);
  189. }
  190. $val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BTNACTION'), array()))));
  191. if ($val == '') {
  192. dolibarr_del_const($db, 'THEME_ELDY_BTNACTION', $conf->entity);
  193. } else {
  194. dolibarr_set_const($db, 'THEME_ELDY_BTNACTION', $val, 'chaine', 0, '', $conf->entity);
  195. }
  196. $val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTBTNACTION'), array()))));
  197. if ($val == '') {
  198. dolibarr_del_const($db, 'THEME_ELDY_TEXTBTNACTION', $conf->entity);
  199. } else {
  200. dolibarr_set_const($db, 'THEME_ELDY_TEXTBTNACTION', $val, 'chaine', 0, '', $conf->entity);
  201. }
  202. }
  203. if ($mode == 'dashboard') {
  204. dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr(GETPOST("main_motd", 'restricthtml')), 'chaine', 0, '', $conf->entity);
  205. }
  206. if ($mode == 'other') {
  207. dolibarr_set_const($db, "MAIN_LANG_DEFAULT", GETPOST("MAIN_LANG_DEFAULT", 'aZ09'), 'chaine', 0, '', $conf->entity);
  208. dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity);
  209. dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", GETPOST("main_size_liste_limit", 'int'), 'chaine', 0, '', $conf->entity);
  210. dolibarr_set_const($db, "MAIN_SIZE_SHORTLIST_LIMIT", GETPOST("main_size_shortliste_limit", 'int'), 'chaine', 0, '', $conf->entity);
  211. //dolibarr_set_const($db, "MAIN_DISABLE_JAVASCRIPT", GETPOST("MAIN_DISABLE_JAVASCRIPT", 'aZ09'), 'chaine', 0, '', $conf->entity);
  212. //dolibarr_set_const($db, "MAIN_BUTTON_HIDE_UNAUTHORIZED", GETPOST("MAIN_BUTTON_HIDE_UNAUTHORIZED", 'aZ09'), 'chaine', 0, '', $conf->entity);
  213. //dolibarr_set_const($db, "MAIN_MENU_HIDE_UNAUTHORIZED", GETPOST("MAIN_MENU_HIDE_UNAUTHORIZED", 'aZ09'), 'chaine', 0, '', $conf->entity);
  214. dolibarr_set_const($db, "MAIN_START_WEEK", GETPOST("MAIN_START_WEEK", 'int'), 'chaine', 0, '', $conf->entity);
  215. dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_DAYS", GETPOST("MAIN_DEFAULT_WORKING_DAYS", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
  216. dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", GETPOST("MAIN_DEFAULT_WORKING_HOURS", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
  217. dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", GETPOST("MAIN_BUGTRACK_ENABLELINK", 'alpha'), 'chaine', 0, '', $conf->entity);
  218. dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", GETPOST("MAIN_FIRSTNAME_NAME_POSITION", 'aZ09'), 'chaine', 0, '', $conf->entity);
  219. }
  220. if ($mode == 'login') {
  221. dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr(GETPOST("main_home", 'restricthtml')), 'chaine', 0, '', $conf->entity);
  222. //dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", GETPOST("MAIN_HELP_DISABLELINK", 'aZ09'), 'chaine', 0, '', 0); // Param for all entities
  223. $varforimage = 'imagebackground';
  224. $dirforimage = $conf->mycompany->dir_output . '/logos/';
  225. if ($_FILES[$varforimage]["tmp_name"]) {
  226. $reg = array();
  227. if (preg_match('/([^\\/:]+)$/i', $_FILES[$varforimage]["name"], $reg)) {
  228. $original_file = $reg[1];
  229. $isimage = image_format_supported($original_file);
  230. if ($isimage >= 0) {
  231. dol_syslog("Move file " . $_FILES[$varforimage]["tmp_name"] . " to " . $dirforimage . $original_file);
  232. if (!is_dir($dirforimage)) {
  233. dol_mkdir($dirforimage);
  234. }
  235. $result = dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage . $original_file, 1, 0, $_FILES[$varforimage]['error']);
  236. if ($result > 0) {
  237. dolibarr_set_const($db, "MAIN_LOGIN_BACKGROUND", $original_file, 'chaine', 0, '', $conf->entity);
  238. } elseif (preg_match('/^ErrorFileIsInfectedWithAVirus/', $result)) {
  239. $error++;
  240. $langs->load("errors");
  241. $tmparray = explode(':', $result);
  242. setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus', $tmparray[1]), null, 'errors');
  243. } else {
  244. $error++;
  245. setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors');
  246. }
  247. } else {
  248. $error++;
  249. $langs->load("errors");
  250. setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
  251. }
  252. }
  253. }
  254. }
  255. $_SESSION["mainmenu"] = ""; // The menu manager may have changed
  256. if (GETPOST('dol_resetcache')) {
  257. dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", ((int) $conf->global->MAIN_IHM_PARAMS_REV) + 1, 'chaine', 0, '', $conf->entity);
  258. }
  259. header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup".'&mode='.$mode.(GETPOSTISSET('page_y') ? '&page_y='.GETPOST('page_y', 'int') : ''));
  260. exit;
  261. }
  262. /*
  263. * View
  264. */
  265. $wikihelp = 'EN:First_setup|FR:Premiers_param&eacute;trages|ES:Primeras_configuraciones';
  266. llxHeader('', $langs->trans("Setup"), $wikihelp);
  267. $form = new Form($db);
  268. $formother = new FormOther($db);
  269. $formadmin = new FormAdmin($db);
  270. print load_fiche_titre($langs->trans("GUISetup"), '', 'title_setup');
  271. print '<span class="opacitymedium">'.$langs->trans("DisplayDesc")."</span><br>\n";
  272. print "<br>\n";
  273. //WYSIWYG Editor
  274. require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
  275. print '<form enctype="multipart/form-data" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
  276. print '<input type="hidden" name="token" value="'.newToken().'">';
  277. print '<input type="hidden" name="action" value="update">';
  278. print '<input type="hidden" name="page_y" value="">';
  279. print '<input type="hidden" id="mode" name="mode" value="'.dol_escape_htmltag($mode).'">';
  280. print '<input type="hidden" name="dol_resetcache" value="1">';
  281. $head = ihm_prepare_head();
  282. print dol_get_fiche_head($head, $mode, '', -1, '');
  283. print '<br>';
  284. clearstatcache();
  285. if ($mode == 'other') {
  286. print '<div class="div-table-responsive-no-min">';
  287. print '<table summary="edit" class="noborder centpercent editmode tableforfield">';
  288. print '<tr class="liste_titre"><td class="titlefieldmiddle">';
  289. print $langs->trans("Language");
  290. print '</td><td class="titlefieldmiddle">';
  291. print '</td></tr>';
  292. // Default language
  293. print '<tr class="oddeven"><td>'.$langs->trans("DefaultLanguage").'</td><td>';
  294. print img_picto('', 'language', 'class="pictofixedwidth"');
  295. print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'MAIN_LANG_DEFAULT', 1, null, '', 0, 0, 'minwidth300', 2);
  296. //print '<input class="button button-save smallpaddingimp" type="submit" name="submit" value="'.$langs->trans("Save").'">';
  297. print '</td>';
  298. print '</tr>';
  299. // Multilingual GUI
  300. print '<tr class="oddeven"><td>' . $langs->trans("EnableMultilangInterface") . '</td><td>';
  301. print ajax_constantonoff("MAIN_MULTILANGS", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'language');
  302. print '</td>';
  303. print '</tr>';
  304. print '</table>' . "\n";
  305. print '</div>';
  306. print '<div class="center">';
  307. print '<input class="button button-save reposition" type="submit" name="submit" value="' . $langs->trans("Save") . '">';
  308. print '<input class="button button-cancel reposition" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">';
  309. print '</div>';
  310. print '<br>';
  311. print '<br>';
  312. // Other
  313. print '<div class="div-table-responsive-no-min">';
  314. print '<table summary="otherparameters" class="noborder centpercent editmode tableforfield">';
  315. print '<tr class="liste_titre"><td class="titlefieldmiddle">';
  316. print $langs->trans("Miscellaneous");
  317. print '</td>';
  318. print '<td class="titlefieldmiddle"></td>';
  319. print '</tr>';
  320. // Show Quick Add link
  321. print '<tr class="oddeven"><td>' . $langs->trans("ShowQuickAddLink") . '</td><td>';
  322. print ajax_constantonoff("MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
  323. print '</td>';
  324. print '</tr>';
  325. // Hide wiki link on login page
  326. $pictohelp = '<span class="fa fa-question-circle"></span>';
  327. print '<tr class="oddeven"><td>' . str_replace('{picto}', $pictohelp, $langs->trans("DisableLinkToHelp", '{picto}')) . '</td><td>';
  328. print ajax_constantonoff("MAIN_HELP_DISABLELINK", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
  329. //print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK) ? $conf->global->MAIN_HELP_DISABLELINK : 0, 1);
  330. print '</td>';
  331. print '</tr>';
  332. // Max size of lists
  333. print '<tr class="oddeven"><td>' . $langs->trans("DefaultMaxSizeList") . '</td><td><input class="flat" name="main_size_liste_limit" size="4" value="' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '"></td>';
  334. print '</tr>';
  335. // Max size of short lists on customer card
  336. print '<tr class="oddeven"><td>' . $langs->trans("DefaultMaxSizeShortList") . '</td><td><input class="flat" name="main_size_shortliste_limit" size="4" value="' . $conf->global->MAIN_SIZE_SHORTLIST_LIMIT . '"></td>';
  337. print '</tr>';
  338. // show input border
  339. /*
  340. print '<tr><td>'.$langs->trans("showInputBorder").'</td><td>';
  341. print $form->selectyesno('main_showInputBorder',isset($conf->global->THEME_ELDY_SHOW_BORDER_INPUT)?$conf->global->THEME_ELDY_SHOW_BORDER_INPUT:0,1);
  342. print '</td>';
  343. print '</tr>';
  344. */
  345. // First day for weeks
  346. print '<tr class="oddeven"><td>' . $langs->trans("WeekStartOnDay") . '</td><td>';
  347. print $formother->select_dayofweek((isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : '1'), 'MAIN_START_WEEK', 0);
  348. print '</td>';
  349. print '</tr>';
  350. // DefaultWorkingDays
  351. print '<tr class="oddeven"><td>' . $langs->trans("DefaultWorkingDays") . '</td><td>';
  352. print '<input type="text" name="MAIN_DEFAULT_WORKING_DAYS" size="5" value="' . (isset($conf->global->MAIN_DEFAULT_WORKING_DAYS) ? $conf->global->MAIN_DEFAULT_WORKING_DAYS : '1-5') . '">';
  353. print '</td>';
  354. print '</tr>';
  355. // DefaultWorkingHours
  356. print '<tr class="oddeven"><td>' . $langs->trans("DefaultWorkingHours") . '</td><td>';
  357. print '<input type="text" name="MAIN_DEFAULT_WORKING_HOURS" size="5" value="' . (isset($conf->global->MAIN_DEFAULT_WORKING_HOURS) ? $conf->global->MAIN_DEFAULT_WORKING_HOURS : '9-18') . '">';
  358. print '</td>';
  359. print '</tr>';
  360. // Firstname/Name
  361. print '<tr class="oddeven"><td>' . $langs->trans("FirstnameNamePosition") . '</td><td>';
  362. $array = array(0 => $langs->trans("Firstname") . ' ' . $langs->trans("Lastname"), 1 => $langs->trans("Lastname") . ' ' . $langs->trans("Firstname"));
  363. print $form->selectarray('MAIN_FIRSTNAME_NAME_POSITION', $array, (isset($conf->global->MAIN_FIRSTNAME_NAME_POSITION) ? $conf->global->MAIN_FIRSTNAME_NAME_POSITION : 0));
  364. print '</td>';
  365. print '</tr>';
  366. // Hide unauthorized menus
  367. print '<tr class="oddeven"><td>' . $langs->trans("HideUnauthorizedMenu") . '</td><td>';
  368. //print $form->selectyesno('MAIN_MENU_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) ? $conf->global->MAIN_MENU_HIDE_UNAUTHORIZED : 0, 1);
  369. print ajax_constantonoff("MAIN_MENU_HIDE_UNAUTHORIZED", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
  370. print '</td>';
  371. print '</tr>';
  372. // Hide unauthorized button
  373. print '<tr class="oddeven"><td>' . $langs->trans("ButtonHideUnauthorized") . '</td><td>';
  374. //print $form->selectyesno('MAIN_BUTTON_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED) ? $conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED : 0, 1);
  375. print ajax_constantonoff("MAIN_BUTTON_HIDE_UNAUTHORIZED", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
  376. print '</td>';
  377. print '</tr>';
  378. // Hide version link
  379. /*
  380. print '<tr><td>'.$langs->trans("HideVersionLink").'</td><td>';
  381. print $form->selectyesno('MAIN_HIDE_VERSION',$conf->global->MAIN_HIDE_VERSION,1);
  382. print '</td>';
  383. print '</tr>';
  384. */
  385. // Show bugtrack link
  386. print '<tr class="oddeven"><td>';
  387. print $form->textwithpicto($langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")), $langs->trans("ShowBugTrackLinkDesc"));
  388. print '</td><td>';
  389. print '<input type="text" name="MAIN_BUGTRACK_ENABLELINK" value="' . (empty($conf->global->MAIN_BUGTRACK_ENABLELINK) ? '' : $conf->global->MAIN_BUGTRACK_ENABLELINK) . '">';
  390. print '</td>';
  391. print '</tr>';
  392. // Disable javascript and ajax
  393. print '<tr class="oddeven"><td>' . $form->textwithpicto($langs->trans("DisableJavascript"), $langs->trans("DisableJavascriptNote")) . '</td><td>';
  394. print ajax_constantonoff("MAIN_DISABLE_JAVASCRIPT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
  395. print '</td>';
  396. print '</tr>';
  397. print '</table>' . "\n";
  398. print '</div>';
  399. }
  400. if ($mode == 'template') {
  401. // Themes and themes options
  402. showSkins(null, 1);
  403. }
  404. if ($mode == 'dashboard') {
  405. print '<div class="div-table-responsive-no-min">';
  406. print '<table summary="blockdashboard" class="noborder centpercent editmode tableforfield">';
  407. // Message of the day on home page
  408. $substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount'));
  409. complete_substitutions_array($substitutionarray, $langs);
  410. print '<tr class="oddeven width25p"><td>';
  411. $texthelp = $langs->trans("FollowingConstantsWillBeSubstituted") . '<br>';
  412. foreach ($substitutionarray as $key => $val) {
  413. $texthelp .= $key . '<br>';
  414. }
  415. print $form->textwithpicto($langs->trans("MessageOfDay"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessageofday');
  416. print '</td><td>';
  417. $doleditor = new DolEditor('main_motd', (isset($conf->global->MAIN_MOTD) ? $conf->global->MAIN_MOTD : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
  418. $doleditor->Create();
  419. print '</td></tr>' . "\n";
  420. /* no more need for this option. It is now a widget already controlled by end user
  421. print '<tr class="oddeven"><td>' . $langs->trans('BoxstatsDisableGlobal') . '</td><td>';
  422. print ajax_constantonoff("MAIN_DISABLE_GLOBAL_BOXSTATS", array(), $conf->entity, 0, 0, 1, 0);
  423. print '</td>';
  424. print '</tr>';
  425. */
  426. print '</table>';
  427. print '</div>';
  428. print '<br>';
  429. print '<div class="div-table-responsive-no-min">';
  430. print '<table summary="blockdashboard" class="noborder centpercent editmode tableforfield">';
  431. print '<tr class="liste_titre"><td class="titlefieldmiddle">';
  432. print $langs->trans("DashboardDisableBlocks");
  433. print '</td><td class="titlefieldmiddle">';
  434. print '</td></tr>';
  435. print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableGlobal') . '</td><td>';
  436. print ajax_constantonoff("MAIN_DISABLE_GLOBAL_WORKBOARD", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
  437. print '</td>';
  438. print '</tr>';
  439. if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
  440. // Block meteo
  441. print '<tr class="oddeven"><td>' . $langs->trans('MAIN_DISABLE_METEO') . '</td><td>';
  442. print ajax_constantonoff("MAIN_DISABLE_METEO", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
  443. print '</td>';
  444. print '</tr>';
  445. // Block agenda
  446. print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockAgenda') . '</td><td>';
  447. print ajax_constantonoff("MAIN_DISABLE_BLOCK_AGENDA", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
  448. print '</td>';
  449. print '</tr>';
  450. // Block agenda
  451. print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockProject') . '</td><td>';
  452. print ajax_constantonoff("MAIN_DISABLE_BLOCK_PROJECT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
  453. print '</td>';
  454. print '</tr>';
  455. // Block customer
  456. print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockCustomer') . '</td><td>';
  457. print ajax_constantonoff("MAIN_DISABLE_BLOCK_CUSTOMER", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
  458. print '</td>';
  459. print '</tr>';
  460. // Block supplier
  461. print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockSupplier') . '</td><td>';
  462. print ajax_constantonoff("MAIN_DISABLE_BLOCK_SUPPLIER", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
  463. print '</td>';
  464. print '</tr>';
  465. // Block contract
  466. print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockContract') . '</td><td>';
  467. print ajax_constantonoff("MAIN_DISABLE_BLOCK_CONTRACT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
  468. print '</td>';
  469. print '</tr>';
  470. // Block ticket
  471. print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockTicket') . '</td><td>';
  472. print ajax_constantonoff("MAIN_DISABLE_BLOCK_TICKET", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
  473. print '</td>';
  474. print '</tr>';
  475. // Block bank
  476. print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockBank') . '</td><td>';
  477. print ajax_constantonoff("MAIN_DISABLE_BLOCK_BANK", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
  478. print '</td>';
  479. print '</tr>';
  480. // Block adherent
  481. print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockAdherent') . '</td><td>';
  482. print ajax_constantonoff("MAIN_DISABLE_BLOCK_ADHERENT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
  483. print '</td>';
  484. print '</tr>';
  485. // Block expense report
  486. print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockExpenseReport') . '</td><td>';
  487. print ajax_constantonoff("MAIN_DISABLE_BLOCK_EXPENSEREPORT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
  488. print '</td>';
  489. print '</tr>';
  490. // Block holiday
  491. print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockHoliday') . '</td><td>';
  492. print ajax_constantonoff("MAIN_DISABLE_BLOCK_HOLIDAY", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
  493. print '</td>';
  494. print '</tr>';
  495. }
  496. print '</table>' . "\n";
  497. print '</div>';
  498. }
  499. if ($mode == 'login') {
  500. // Other
  501. print '<div class="div-table-responsive-no-min">';
  502. print '<table summary="edit" class="noborder centpercent editmode tableforfield">';
  503. print '<tr class="liste_titre"><td class="titlefieldmax45">';
  504. print $langs->trans("Parameter");
  505. print '</td><td>';
  506. print $langs->trans("Value");
  507. print '</td></tr>';
  508. // Hide helpcenter link on login page
  509. print '<tr class="oddeven"><td>' . $langs->trans("DisableLinkToHelpCenter") . '</td><td>';
  510. print ajax_constantonoff("MAIN_HELPCENTER_DISABLELINK", array(), $conf->entity, 0, 0, 0, 0, 0, 0, '', 'login');
  511. print '</td>';
  512. print '</tr>';
  513. // Message on login page
  514. $substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount', 'user'));
  515. complete_substitutions_array($substitutionarray, $langs);
  516. print '<tr class="oddeven"><td>';
  517. $texthelp = $langs->trans("FollowingConstantsWillBeSubstituted") . '<br>';
  518. foreach ($substitutionarray as $key => $val) {
  519. $texthelp .= $key . '<br>';
  520. }
  521. print $form->textwithpicto($langs->trans("MessageLogin"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessagelogin');
  522. print '</td><td>';
  523. $doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME) ? $conf->global->MAIN_HOME : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
  524. $doleditor->Create();
  525. print '</td></tr>' . "\n";
  526. // Background
  527. print '<tr class="oddeven"><td><label for="imagebackground">' . $langs->trans("BackgroundImageLogin") . ' (png,jpg)</label></td><td>';
  528. print '<div class="centpercent inline-block">';
  529. $disabled = '';
  530. if (!empty($conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND)) {
  531. $disabled = ' disabled="disabled"';
  532. }
  533. $maxfilesizearray = getMaxFileSizeArray();
  534. $maxmin = $maxfilesizearray['maxmin'];
  535. if ($maxmin > 0) {
  536. print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
  537. }
  538. print '<input type="file" class="flat maxwidthinputfileonsmartphone" name="imagebackground" id="imagebackground"' . $disabled . '>';
  539. if ($disabled) {
  540. print '(' . $langs->trans("DisabledByOptionADD_UNSPLASH_LOGIN_BACKGROUND") . ') ';
  541. }
  542. if (!empty($conf->global->MAIN_LOGIN_BACKGROUND)) {
  543. print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?action=removebackgroundlogin&token='.newToken().'&mode=login">' . img_delete($langs->trans("Delete")) . '</a>';
  544. if (file_exists($conf->mycompany->dir_output . '/logos/' . $conf->global->MAIN_LOGIN_BACKGROUND)) {
  545. print ' &nbsp; ';
  546. print '<img class="paddingleft valignmiddle" width="100" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&amp;file=' . urlencode('logos/' . $conf->global->MAIN_LOGIN_BACKGROUND) . '">';
  547. }
  548. } else {
  549. print '<img class="paddingleft valignmiddle" width="100" src="' . DOL_URL_ROOT . '/public/theme/common/nophoto.png">';
  550. }
  551. print '</div>';
  552. print '</td></tr>';
  553. print '</table>' . "\n";
  554. print '</div>';
  555. }
  556. print '<div class="center">';
  557. print '<input class="button button-save reposition" type="submit" name="submit" value="' . $langs->trans("Save") . '">';
  558. print '<input class="button button-cancel reposition" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">';
  559. print '</div>';
  560. print '</form>';
  561. // End of page
  562. llxFooter();
  563. $db->close();