ihm.php 31 KB

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