ihm.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  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. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. */
  21. /**
  22. * \file htdocs/admin/ihm.php
  23. * \brief Page to setup GUI display options
  24. */
  25. require '../main.inc.php';
  26. require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
  27. require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
  28. require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
  29. require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
  30. require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
  31. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
  32. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
  33. // Load translation files required by the page
  34. $langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'projects', 'hrm', 'agenda'));
  35. if (!$user->admin) accessforbidden();
  36. $action = GETPOST('action', 'aZ09');
  37. $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'adminihm'; // To manage different context of search
  38. if (!defined("MAIN_MOTD")) define("MAIN_MOTD", "");
  39. /*
  40. * Action
  41. */
  42. $parameters = array();
  43. $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
  44. if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
  45. if (GETPOST('cancel', 'alpha'))
  46. {
  47. $action = '';
  48. }
  49. // Convert action set_XXX and del_XXX to set var (this is used when no javascript on for ajax_constantonoff)
  50. $regs = array();
  51. if (preg_match('/^(set|del)_([A-Z_]+)$/', $action, $regs)) {
  52. if ($regs[1] == 'set') dolibarr_set_const($db, $regs[2], 1, 'chaine', 0, '', $conf->entity);
  53. else dolibarr_del_const($db, $regs[2], $conf->entity);
  54. }
  55. if ($action == 'removebackgroundlogin' && !empty($conf->global->MAIN_LOGIN_BACKGROUND))
  56. {
  57. dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity);
  58. require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
  59. $logofile = $conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND;
  60. dol_delete_file($logofile);
  61. dolibarr_del_const($db, "MAIN_LOGIN_BACKGROUND", $conf->entity);
  62. $mysoc->logo = '';
  63. /*$logosmallfile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small;
  64. dol_delete_file($logosmallfile);
  65. dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$conf->entity);
  66. $mysoc->logo_small='';
  67. $logominifile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini;
  68. dol_delete_file($logominifile);
  69. dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$conf->entity);
  70. $mysoc->logo_mini='';*/
  71. }
  72. if ($action == 'update')
  73. {
  74. dolibarr_set_const($db, "MAIN_LANG_DEFAULT", GETPOST("MAIN_LANG_DEFAULT", 'aZ09'), 'chaine', 0, '', $conf->entity);
  75. dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity);
  76. //dolibarr_set_const($db, "MAIN_MULTILANGS", $_POST["MAIN_MULTILANGS"], 'chaine', 0, '', $conf->entity);
  77. dolibarr_set_const($db, "MAIN_THEME", GETPOST("main_theme", 'aZ09'), 'chaine', 0, '', $conf->entity);
  78. /*$val=GETPOST('THEME_TOPMENU_DISABLE_IMAGE');
  79. if (! $val) dolibarr_del_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', $conf->entity);
  80. else dolibarr_set_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', GETPOST('THEME_TOPMENU_DISABLE_IMAGE'), 'chaine', 0, '', $conf->entity);*/
  81. $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKBODY'), array()))));
  82. if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_BACKBODY', $conf->entity);
  83. else dolibarr_set_const($db, 'THEME_ELDY_BACKBODY', $val, 'chaine', 0, '', $conf->entity);
  84. $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1'), array()))));
  85. if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TOPMENU_BACK1', $conf->entity);
  86. else dolibarr_set_const($db, 'THEME_ELDY_TOPMENU_BACK1', $val, 'chaine', 0, '', $conf->entity);
  87. $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_VERMENU_BACK1'), array()))));
  88. if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_VERMENU_BACK1', $conf->entity);
  89. else dolibarr_set_const($db, 'THEME_ELDY_VERMENU_BACK1', $val, 'chaine', 0, '', $conf->entity);
  90. $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLENOTAB'), array()))));
  91. if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLENOTAB', $conf->entity);
  92. else dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLENOTAB', $val, 'chaine', 0, '', $conf->entity);
  93. $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'), array()))));
  94. if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_BACKTITLE1', $conf->entity);
  95. else dolibarr_set_const($db, 'THEME_ELDY_BACKTITLE1', $val, 'chaine', 0, '', $conf->entity);
  96. $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLE'), array()))));
  97. if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLE', $conf->entity);
  98. else dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLE', $val, 'chaine', 0, '', $conf->entity);
  99. $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLELINK'), array()))));
  100. if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLELINK', $conf->entity);
  101. else dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLELINK', $val, 'chaine', 0, '', $conf->entity);
  102. $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'), array()))));
  103. if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR1', $conf->entity);
  104. else dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR1', $val, 'chaine', 0, '', $conf->entity);
  105. $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'), array()))));
  106. if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR2', $conf->entity);
  107. else dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR2', $val, 'chaine', 0, '', $conf->entity);
  108. $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'), array()))));
  109. if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR1', $conf->entity);
  110. else dolibarr_set_const($db, 'THEME_ELDY_LINEPAIR1', $val, 'chaine', 0, '', $conf->entity);
  111. $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'), array()))));
  112. if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR2', $conf->entity);
  113. else dolibarr_set_const($db, 'THEME_ELDY_LINEPAIR2', $val, 'chaine', 0, '', $conf->entity);
  114. $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTLINK'), array()))));
  115. if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TEXTLINK', $conf->entity);
  116. else dolibarr_set_const($db, 'THEME_ELDY_TEXTLINK', $val, 'chaine', 0, '', $conf->entity);
  117. $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_HOVER'), array()))));
  118. if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_USE_HOVER', $conf->entity);
  119. else dolibarr_set_const($db, "THEME_ELDY_USE_HOVER", $val, 'chaine', 0, '', $conf->entity);
  120. $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_CHECKED'), array()))));
  121. if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_USE_CHECKED', $conf->entity);
  122. else dolibarr_set_const($db, "THEME_ELDY_USE_CHECKED", $val, 'chaine', 0, '', $conf->entity);
  123. dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", GETPOST("main_size_liste_limit", 'int'), 'chaine', 0, '', $conf->entity);
  124. dolibarr_set_const($db, "MAIN_SIZE_SHORTLIST_LIMIT", GETPOST("main_size_shortliste_limit", 'int'), 'chaine', 0, '', $conf->entity);
  125. //dolibarr_set_const($db, "MAIN_DISABLE_JAVASCRIPT", GETPOST("MAIN_DISABLE_JAVASCRIPT", 'aZ09'), 'chaine', 0, '', $conf->entity);
  126. dolibarr_set_const($db, "MAIN_BUTTON_HIDE_UNAUTHORIZED", GETPOST("MAIN_BUTTON_HIDE_UNAUTHORIZED", 'aZ09'), 'chaine', 0, '', $conf->entity);
  127. dolibarr_set_const($db, "MAIN_START_WEEK", GETPOST("MAIN_START_WEEK", 'int'), 'chaine', 0, '', $conf->entity);
  128. dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_DAYS", GETPOST("MAIN_DEFAULT_WORKING_DAYS", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
  129. dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", GETPOST("MAIN_DEFAULT_WORKING_HOURS", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
  130. dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", GETPOST("MAIN_FIRSTNAME_NAME_POSITION", 'aZ09'), 'chaine', 0, '', $conf->entity);
  131. dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr(GETPOST("main_motd", 'restricthtml')), 'chaine', 0, '', $conf->entity);
  132. dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr(GETPOST("main_home", 'restricthtml')), 'chaine', 0, '', $conf->entity);
  133. //dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", GETPOST('MAIN_BUGTRACK_ENABLELINK', 'aZ09'), 'chaine', 0, '', $conf->entity);
  134. //dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", GETPOST("MAIN_HELP_DISABLELINK", 'aZ09'), 'chaine', 0, '', 0); // Param for all entities
  135. $varforimage = 'imagebackground'; $dirforimage = $conf->mycompany->dir_output.'/logos/';
  136. if ($_FILES[$varforimage]["tmp_name"])
  137. {
  138. $reg = array();
  139. if (preg_match('/([^\\/:]+)$/i', $_FILES[$varforimage]["name"], $reg))
  140. {
  141. $original_file = $reg[1];
  142. $isimage = image_format_supported($original_file);
  143. if ($isimage >= 0)
  144. {
  145. dol_syslog("Move file ".$_FILES[$varforimage]["tmp_name"]." to ".$dirforimage.$original_file);
  146. if (!is_dir($dirforimage))
  147. {
  148. dol_mkdir($dirforimage);
  149. }
  150. $result = dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage.$original_file, 1, 0, $_FILES[$varforimage]['error']);
  151. if ($result > 0)
  152. {
  153. dolibarr_set_const($db, "MAIN_LOGIN_BACKGROUND", $original_file, 'chaine', 0, '', $conf->entity);
  154. } elseif (preg_match('/^ErrorFileIsInfectedWithAVirus/', $result))
  155. {
  156. $error++;
  157. $langs->load("errors");
  158. $tmparray = explode(':', $result);
  159. setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus', $tmparray[1]), null, 'errors');
  160. } else {
  161. $error++;
  162. setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors');
  163. }
  164. } else {
  165. $error++;
  166. $langs->load("errors");
  167. setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
  168. }
  169. }
  170. }
  171. $_SESSION["mainmenu"] = ""; // Le gestionnaire de menu a pu changer
  172. header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
  173. exit;
  174. }
  175. /*
  176. * View
  177. */
  178. $wikihelp = 'EN:First_setup|FR:Premiers_param&eacute;trages|ES:Primeras_configuraciones';
  179. llxHeader('', $langs->trans("Setup"), $wikihelp);
  180. $form = new Form($db);
  181. $formother = new FormOther($db);
  182. $formadmin = new FormAdmin($db);
  183. print load_fiche_titre($langs->trans("GUISetup"), '', 'title_setup');
  184. print '<span class="opacitymedium">'.$langs->trans("DisplayDesc")."</span><br>\n";
  185. //WYSIWYG Editor
  186. require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
  187. print '<form enctype="multipart/form-data" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
  188. print '<input type="hidden" name="token" value="'.newToken().'">';
  189. print '<input type="hidden" name="action" value="update">';
  190. clearstatcache();
  191. print '<br>';
  192. print '<table summary="edit" class="noborder centpercent editmode tableforfield">';
  193. print '<tr class="liste_titre"><th>'.img_picto('', 'language').' '.$langs->trans("Language").'</th><th></th>';
  194. print '</tr>';
  195. // Default language
  196. print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DefaultLanguage").'</td><td>';
  197. print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'MAIN_LANG_DEFAULT', 1, null, '', 0, 0, 'minwidth300', 2);
  198. print '<input class="button button-save" type="submit" name="submit" value="'.$langs->trans("Save").'">';
  199. print '</td>';
  200. print '</tr>';
  201. // Multilingual GUI
  202. print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("EnableMultilangInterface").'</td><td>';
  203. print ajax_constantonoff("MAIN_MULTILANGS", array(), $conf->entity, 0, 0, 1, 0);
  204. print '</td>';
  205. print '</tr>';
  206. print '</table><br>'."\n";
  207. // Themes and themes options
  208. showSkins(null, 1);
  209. print '<br>';
  210. // Other
  211. print '<table summary="otherparameters" class="noborder centpercent editmode">';
  212. print '<tr class="liste_titre"><th>'.$langs->trans("Miscellaneous").'</th><th></th>';
  213. print '<th width="20">&nbsp;</tg>';
  214. print '</tr>';
  215. // Disable javascript and ajax
  216. print '<tr class="oddeven"><td>'.$langs->trans("DisableJavascript").'</td><td>';
  217. print ajax_constantonoff("MAIN_DISABLE_JAVASCRIPT", array(), $conf->entity, 0, 0, 1, 0);
  218. print ' <span class="opacitymedium"> &nbsp; &nbsp; '.$langs->trans("DisableJavascriptNote").'</span>';
  219. print '</td>';
  220. print '<td>';
  221. print '</td>';
  222. print '</tr>';
  223. // Max size of lists
  224. 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>';
  225. print '<td width="20">&nbsp;</td>';
  226. print '</tr>';
  227. // Max size of short lists on customer card
  228. 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>';
  229. print '<td width="20">&nbsp;</td>';
  230. print '</tr>';
  231. // show input border
  232. /*
  233. print '<tr><td>'.$langs->trans("showInputBorder").'</td><td>';
  234. print $form->selectyesno('main_showInputBorder',isset($conf->global->THEME_ELDY_SHOW_BORDER_INPUT)?$conf->global->THEME_ELDY_SHOW_BORDER_INPUT:0,1);
  235. print '</td>';
  236. print '<td width="20">&nbsp;</td>';
  237. print '</tr>';
  238. */
  239. // First day for weeks
  240. print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("WeekStartOnDay").'</td><td>';
  241. print $formother->select_dayofweek((isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : '1'), 'MAIN_START_WEEK', 0);
  242. print '</td>';
  243. print '<td width="20">&nbsp;</td>';
  244. print '</tr>';
  245. // DefaultWorkingDays
  246. print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DefaultWorkingDays").'</td><td>';
  247. 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').'">';
  248. print '</td>';
  249. print '<td width="20">&nbsp;</td>';
  250. print '</tr>';
  251. // DefaultWorkingHours
  252. print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DefaultWorkingHours").'</td><td>';
  253. 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').'">';
  254. print '</td>';
  255. print '<td width="20">&nbsp;</td>';
  256. print '</tr>';
  257. // Firstname/Name
  258. print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("FirstnameNamePosition").'</td><td>';
  259. $array = array(0=>$langs->trans("Firstname").' '.$langs->trans("Lastname"), 1=>$langs->trans("Lastname").' '.$langs->trans("Firstname"));
  260. print $form->selectarray('MAIN_FIRSTNAME_NAME_POSITION', $array, (isset($conf->global->MAIN_FIRSTNAME_NAME_POSITION) ? $conf->global->MAIN_FIRSTNAME_NAME_POSITION : 0));
  261. print '</td>';
  262. print '<td width="20">&nbsp;</td>';
  263. print '</tr>';
  264. // Hide unauthorized button
  265. print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("ButtonHideUnauthorized").'</td><td>';
  266. print $form->selectyesno('MAIN_BUTTON_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED) ? $conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED : 0, 1);
  267. print '</td>';
  268. print '<td width="20">&nbsp;</td>';
  269. print '</tr>';
  270. // Hide version link
  271. /*
  272. print '<tr><td class="titlefield">'.$langs->trans("HideVersionLink").'</td><td>';
  273. print $form->selectyesno('MAIN_HIDE_VERSION',$conf->global->MAIN_HIDE_VERSION,1);
  274. print '</td>';
  275. print '<td width="20">&nbsp;</td>';
  276. print '</tr>';
  277. */
  278. // Show bugtrack link
  279. print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).'</td><td>';
  280. print ajax_constantonoff("MAIN_BUGTRACK_ENABLELINK", array(), $conf->entity, 0, 0, 1, 0);
  281. //print $form->selectyesno('MAIN_BUGTRACK_ENABLELINK', $conf->global->MAIN_BUGTRACK_ENABLELINK, 1);
  282. print '</td>';
  283. print '<td width="20">&nbsp;</td>';
  284. print '</tr>';
  285. // Hide wiki link on login page
  286. $pictohelp = '<span class="fa fa-question-circle"></span>';
  287. print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DisableLinkToHelp", $pictohelp).'</td><td>';
  288. print ajax_constantonoff("MAIN_HELP_DISABLELINK", array(), $conf->entity, 0, 0, 1, 0);
  289. //print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK) ? $conf->global->MAIN_HELP_DISABLELINK : 0, 1);
  290. print '</td>';
  291. print '<td width="20">&nbsp;</td>';
  292. print '</tr>';
  293. // Message of the day on home page
  294. $substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount'));
  295. complete_substitutions_array($substitutionarray, $langs);
  296. print '<tr class="oddeven"><td class="titlefield">';
  297. $texthelp = $langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
  298. foreach ($substitutionarray as $key => $val)
  299. {
  300. $texthelp .= $key.'<br>';
  301. }
  302. print $form->textwithpicto($langs->trans("MessageOfDay"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessageofday');
  303. print '</td><td colspan="2">';
  304. $doleditor = new DolEditor('main_motd', (isset($conf->global->MAIN_MOTD) ? $conf->global->MAIN_MOTD : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
  305. $doleditor->Create();
  306. print '</td></tr>'."\n";
  307. print '</table>'."\n";
  308. print '<br>';
  309. // Other
  310. print '<div class="div-table-responsive-no-min">';
  311. print '<table summary="edit" class="noborder centpercent editmode">';
  312. print '<tr class="liste_titre"><th class="titlefield">'.$langs->trans("LoginPage").'</th><th></th>';
  313. print '<th width="20">&nbsp;</th>';
  314. print '</tr>';
  315. // Hide helpcenter link on login page
  316. print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DisableLinkToHelpCenter").'</td><td>';
  317. print ajax_constantonoff("MAIN_HELPCENTER_DISABLELINK", array(), $conf->entity, 0, 0, 0, 0);
  318. print '</td>';
  319. print '<td width="20">&nbsp;</td>';
  320. print '</tr>';
  321. // Message on login page
  322. $substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount', 'user'));
  323. complete_substitutions_array($substitutionarray, $langs);
  324. print '<tr class="oddeven"><td>';
  325. $texthelp = $langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
  326. foreach ($substitutionarray as $key => $val)
  327. {
  328. $texthelp .= $key.'<br>';
  329. }
  330. print $form->textwithpicto($langs->trans("MessageLogin"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessagelogin');
  331. print '</td><td colspan="2">';
  332. $doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME) ? $conf->global->MAIN_HOME : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
  333. $doleditor->Create();
  334. print '</td></tr>'."\n";
  335. // Background
  336. print '<tr class="oddeven"><td><label for="imagebackground">'.$langs->trans("BackgroundImageLogin").' (png,jpg)</label></td><td colspan="2">';
  337. print '<div class="centpercent inline-block">';
  338. $disabled = '';
  339. if (!empty($conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND)) $disabled = ' disabled="disabled"';
  340. print '<input type="file" class="flat class=minwidth200" name="imagebackground" id="imagebackground"'.$disabled.'>';
  341. if ($disabled)
  342. {
  343. print '('.$langs->trans("DisabledByOptionADD_UNSPLASH_LOGIN_BACKGROUND").') ';
  344. }
  345. if (!empty($conf->global->MAIN_LOGIN_BACKGROUND)) {
  346. print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removebackgroundlogin">'.img_delete($langs->trans("Delete")).'</a>';
  347. if (file_exists($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND)) {
  348. print ' &nbsp; ';
  349. print '<img class="paddingleft valignmiddle" width="100px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/'.$conf->global->MAIN_LOGIN_BACKGROUND).'">';
  350. }
  351. } else {
  352. print '<img class="paddingleft valignmiddle" width="100" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
  353. }
  354. print '</div>';
  355. print '</td></tr>';
  356. print '</table>'."\n";
  357. print '</div>';
  358. print '<br>';
  359. print '<div class="center">';
  360. print '<input class="button button-save" type="submit" name="submit" value="'.$langs->trans("Save").'">';
  361. print '</div>';
  362. print '</form>';
  363. // End of page
  364. llxFooter();
  365. $db->close();