ihm.php 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  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 <http://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. if ($action == 'removebackgroundlogin' && ! empty($conf->global->MAIN_LOGIN_BACKGROUND))
  50. {
  51. require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
  52. $logofile=$conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND;
  53. dol_delete_file($logofile);
  54. dolibarr_del_const($db, "MAIN_LOGIN_BACKGROUND",$conf->entity);
  55. $mysoc->logo='';
  56. /*$logosmallfile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small;
  57. dol_delete_file($logosmallfile);
  58. dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$conf->entity);
  59. $mysoc->logo_small='';
  60. $logominifile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini;
  61. dol_delete_file($logominifile);
  62. dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$conf->entity);
  63. $mysoc->logo_mini='';*/
  64. }
  65. if ($action == 'update')
  66. {
  67. dolibarr_set_const($db, "MAIN_LANG_DEFAULT", $_POST["MAIN_LANG_DEFAULT"],'chaine',0,'',$conf->entity);
  68. dolibarr_set_const($db, "MAIN_MULTILANGS", $_POST["MAIN_MULTILANGS"],'chaine',0,'',$conf->entity);
  69. dolibarr_set_const($db, "MAIN_THEME", $_POST["main_theme"],'chaine',0,'',$conf->entity);
  70. $val=GETPOST('THEME_TOPMENU_DISABLE_IMAGE');
  71. if (! $val) dolibarr_del_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', $conf->entity);
  72. else dolibarr_set_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', GETPOST('THEME_TOPMENU_DISABLE_IMAGE'),'chaine',0,'',$conf->entity);
  73. $val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_BACKBODY'),array()))));
  74. if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_BACKBODY', $conf->entity);
  75. else dolibarr_set_const($db, 'THEME_ELDY_BACKBODY', $val,'chaine',0,'',$conf->entity);
  76. $val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1'),array()))));
  77. if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TOPMENU_BACK1', $conf->entity);
  78. else dolibarr_set_const($db, 'THEME_ELDY_TOPMENU_BACK1', $val,'chaine',0,'',$conf->entity);
  79. $val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_VERMENU_BACK1'),array()))));
  80. if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_VERMENU_BACK1', $conf->entity);
  81. else dolibarr_set_const($db, 'THEME_ELDY_VERMENU_BACK1', $val,'chaine',0,'',$conf->entity);
  82. $val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLENOTAB'),array()))));
  83. if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLENOTAB', $conf->entity);
  84. else dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLENOTAB', $val,'chaine',0,'',$conf->entity);
  85. $val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'),array()))));
  86. if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_BACKTITLE1', $conf->entity);
  87. else dolibarr_set_const($db, 'THEME_ELDY_BACKTITLE1', $val,'chaine',0,'',$conf->entity);
  88. $val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLE'),array()))));
  89. if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLE', $conf->entity);
  90. else dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLE', $val,'chaine',0,'',$conf->entity);
  91. $val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'),array()))));
  92. if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR1', $conf->entity);
  93. else dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR1', $val,'chaine',0,'',$conf->entity);
  94. $val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'),array()))));
  95. if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR2', $conf->entity);
  96. else dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR2', $val,'chaine',0,'',$conf->entity);
  97. $val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'),array()))));
  98. if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR1', $conf->entity);
  99. else dolibarr_set_const($db, 'THEME_ELDY_LINEPAIR1', $val,'chaine',0,'',$conf->entity);
  100. $val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'),array()))));
  101. if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR2', $conf->entity);
  102. else dolibarr_set_const($db, 'THEME_ELDY_LINEPAIR2', $val,'chaine',0,'',$conf->entity);
  103. $val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_TEXTLINK'),array()))));
  104. if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TEXTLINK', $conf->entity);
  105. else dolibarr_set_const($db, 'THEME_ELDY_TEXTLINK', $val,'chaine',0,'',$conf->entity);
  106. if (GETPOST('THEME_ELDY_USE_HOVER') == '') dolibarr_set_const($db, "THEME_ELDY_USE_HOVER", '0', 'chaine', 0, '', $conf->entity); // If empty, we set to '0' ('000000' is for black)
  107. else dolibarr_set_const($db, "THEME_ELDY_USE_HOVER", $_POST["THEME_ELDY_USE_HOVER"], 'chaine', 0, '', $conf->entity);
  108. if (GETPOST('THEME_ELDY_USE_CHECKED') == '') dolibarr_set_const($db, "THEME_ELDY_USE_CHECKED", '0', 'chaine', 0, '', $conf->entity);
  109. else dolibarr_set_const($db, "THEME_ELDY_USE_CHECKED", $_POST["THEME_ELDY_USE_CHECKED"], 'chaine', 0, '', $conf->entity);
  110. dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", $_POST["main_size_liste_limit"],'chaine',0,'',$conf->entity);
  111. dolibarr_set_const($db, "MAIN_SIZE_SHORTLIST_LIMIT", $_POST["main_size_shortliste_limit"],'chaine',0,'',$conf->entity);
  112. dolibarr_set_const($db, "MAIN_DISABLE_JAVASCRIPT", $_POST["main_disable_javascript"],'chaine',0,'',$conf->entity);
  113. dolibarr_set_const($db, "MAIN_BUTTON_HIDE_UNAUTHORIZED", $_POST["MAIN_BUTTON_HIDE_UNAUTHORIZED"],'chaine',0,'',$conf->entity);
  114. dolibarr_set_const($db, "MAIN_START_WEEK", $_POST["MAIN_START_WEEK"],'chaine',0,'',$conf->entity);
  115. dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_DAYS", $_POST["MAIN_DEFAULT_WORKING_DAYS"],'chaine',0,'',$conf->entity);
  116. dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", $_POST["MAIN_DEFAULT_WORKING_HOURS"],'chaine',0,'',$conf->entity);
  117. dolibarr_set_const($db, "MAIN_SHOW_LOGO", $_POST["MAIN_SHOW_LOGO"],'chaine',0,'',$conf->entity);
  118. dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", $_POST["MAIN_FIRSTNAME_NAME_POSITION"],'chaine',0,'',$conf->entity);
  119. dolibarr_set_const($db, "MAIN_HELPCENTER_DISABLELINK", $_POST["MAIN_HELPCENTER_DISABLELINK"],'chaine',0,'',0); // Param for all entities
  120. dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr($_POST["main_motd"]),'chaine',0,'',$conf->entity);
  121. dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr($_POST["main_home"]),'chaine',0,'',$conf->entity);
  122. dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", $_POST["MAIN_HELP_DISABLELINK"],'chaine',0,'',0); // Param for all entities
  123. dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", $_POST["MAIN_BUGTRACK_ENABLELINK"],'chaine',0,'',$conf->entity);
  124. $varforimage='imagebackground'; $dirforimage=$conf->mycompany->dir_output.'/logos/';
  125. if ($_FILES[$varforimage]["tmp_name"])
  126. {
  127. if (preg_match('/([^\\/:]+)$/i',$_FILES[$varforimage]["name"],$reg))
  128. {
  129. $original_file=$reg[1];
  130. $isimage=image_format_supported($original_file);
  131. if ($isimage >= 0)
  132. {
  133. dol_syslog("Move file ".$_FILES[$varforimage]["tmp_name"]." to ".$dirforimage.$original_file);
  134. if (! is_dir($dirforimage))
  135. {
  136. dol_mkdir($dirforimage);
  137. }
  138. $result=dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"],$dirforimage.$original_file,1,0,$_FILES[$varforimage]['error']);
  139. if ($result > 0)
  140. {
  141. dolibarr_set_const($db, "MAIN_LOGIN_BACKGROUND",$original_file,'chaine',0,'',$conf->entity);
  142. }
  143. elseif (preg_match('/^ErrorFileIsInfectedWithAVirus/',$result))
  144. {
  145. $error++;
  146. $langs->load("errors");
  147. $tmparray=explode(':',$result);
  148. setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus',$tmparray[1]), null, 'errors');
  149. }
  150. else
  151. {
  152. $error++;
  153. setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors');
  154. }
  155. }
  156. else
  157. {
  158. $error++;
  159. $langs->load("errors");
  160. setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
  161. }
  162. }
  163. }
  164. $_SESSION["mainmenu"]=""; // Le gestionnaire de menu a pu changer
  165. header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
  166. exit;
  167. }
  168. /*
  169. * View
  170. */
  171. $wikihelp='EN:First_setup|FR:Premiers_param&eacute;trages|ES:Primeras_configuraciones';
  172. llxHeader('',$langs->trans("Setup"),$wikihelp);
  173. $form=new Form($db);
  174. $formother=new FormOther($db);
  175. $formadmin=new FormAdmin($db);
  176. print load_fiche_titre($langs->trans("GUISetup"),'','title_setup');
  177. print $langs->trans("DisplayDesc")."<br>\n";
  178. print "<br>\n";
  179. if ($action == 'edit') // Edit
  180. {
  181. //WYSIWYG Editor
  182. require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
  183. print '<form enctype="multipart/form-data" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
  184. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  185. print '<input type="hidden" name="action" value="update">';
  186. clearstatcache();
  187. print '<br>';
  188. print '<table summary="edit" class="noborder" width="100%">';
  189. print '<tr class="liste_titre"><td>'.$langs->trans("Language").'</td><td></td>';
  190. print '<td width="20">&nbsp;</td>';
  191. print '</tr>';
  192. // Default language
  193. print '<tr><td class="titlefield">'.$langs->trans("DefaultLanguage").'</td><td>';
  194. print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'MAIN_LANG_DEFAULT', 1, 0, 0, 0, 0, 'minwidth300', 2);
  195. print '</td>';
  196. print '<td width="20">&nbsp;</td>';
  197. print '</tr>';
  198. // Multilingual GUI
  199. print '<tr><td class="titlefield">'.$langs->trans("EnableMultilangInterface").'</td><td>';
  200. print $form->selectyesno('MAIN_MULTILANGS',$conf->global->MAIN_MULTILANGS,1);
  201. print '</td>';
  202. print '<td width="20">&nbsp;</td>';
  203. print '</tr>';
  204. print '</table><br>'."\n";
  205. // Themes and themes options
  206. show_theme(null,1);
  207. print '<br>';
  208. // Other
  209. print '<table summary="edit" class="noborder" width="100%">';
  210. print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td>';
  211. print '<td width="20">&nbsp;</td>';
  212. print '</tr>';
  213. // Max size of lists
  214. print '<tr><td>'.$langs->trans("DefaultMaxSizeList").'</td><td><input class="flat" name="main_size_liste_limit" size="4" value="' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '"></td>';
  215. print '<td width="20">&nbsp;</td>';
  216. print '</tr>';
  217. // Max size of short lists on customer card
  218. print '<tr><td>'.$langs->trans("DefaultMaxSizeShortList").'</td><td><input class="flat" name="main_size_shortliste_limit" size="4" value="' . $conf->global->MAIN_SIZE_SHORTLIST_LIMIT . '"></td>';
  219. print '<td width="20">&nbsp;</td>';
  220. print '</tr>';
  221. // show input border
  222. /*
  223. print '<tr><td>'.$langs->trans("showInputBorder").'</td><td>';
  224. print $form->selectyesno('main_showInputBorder',isset($conf->global->THEME_ELDY_SHOW_BORDER_INPUT)?$conf->global->THEME_ELDY_SHOW_BORDER_INPUT:0,1);
  225. print '</td>';
  226. print '<td width="20">&nbsp;</td>';
  227. print '</tr>';
  228. */
  229. // Disable javascript and ajax
  230. print '<tr><td>'.$langs->trans("DisableJavascript").'</td><td>';
  231. print $form->selectyesno('main_disable_javascript',isset($conf->global->MAIN_DISABLE_JAVASCRIPT)?$conf->global->MAIN_DISABLE_JAVASCRIPT:0,1);
  232. print '</td>';
  233. print '<td width="20">&nbsp;</td>';
  234. print '</tr>';
  235. // First day for weeks
  236. print '<tr><td class="titlefield">'.$langs->trans("WeekStartOnDay").'</td><td>';
  237. print $formother->select_dayofweek((isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:'1'),'MAIN_START_WEEK',0);
  238. print '</td>';
  239. print '<td width="20">&nbsp;</td>';
  240. print '</tr>';
  241. // DefaultWorkingDays
  242. print '<tr><td class="titlefield">'.$langs->trans("DefaultWorkingDays").'</td><td>';
  243. 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').'">';
  244. print '</td>';
  245. print '<td width="20">&nbsp;</td>';
  246. print '</tr>';
  247. // DefaultWorkingHours
  248. print '<tr><td class="titlefield">'.$langs->trans("DefaultWorkingHours").'</td><td>';
  249. 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').'">';
  250. print '</td>';
  251. print '<td width="20">&nbsp;</td>';
  252. print '</tr>';
  253. // Firstname/Name
  254. print '<tr><td class="titlefield">'.$langs->trans("FirstnameNamePosition").'</td><td>';
  255. $array=array(0=>$langs->trans("Firstname").' '.$langs->trans("Lastname"), 1=>$langs->trans("Lastname").' '.$langs->trans("Firstname"));
  256. print $form->selectarray('MAIN_FIRSTNAME_NAME_POSITION', $array, (isset($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?$conf->global->MAIN_FIRSTNAME_NAME_POSITION:0));
  257. print '</td>';
  258. print '<td width="20">&nbsp;</td>';
  259. print '</tr>';
  260. // Hide unauthorized button
  261. print '<tr><td class="titlefield">'.$langs->trans("ButtonHideUnauthorized").'</td><td>';
  262. print $form->selectyesno('MAIN_BUTTON_HIDE_UNAUTHORIZED',isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)?$conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED:0,1);
  263. print '</td>';
  264. print '<td width="20">&nbsp;</td>';
  265. print '</tr>';
  266. // Show logo
  267. print '<tr><td class="titlefield">'.$langs->trans("EnableShowLogo").'</td><td>';
  268. print $form->selectyesno('MAIN_SHOW_LOGO',$conf->global->MAIN_SHOW_LOGO,1);
  269. print '</td>';
  270. print '<td width="20">&nbsp;</td>';
  271. print '</tr>';
  272. // Hide version link
  273. /*
  274. print '<tr><td class="titlefield">'.$langs->trans("HideVersionLink").'</td><td>';
  275. print $form->selectyesno('MAIN_HIDE_VERSION',$conf->global->MAIN_HIDE_VERSION,1);
  276. print '</td>';
  277. print '<td width="20">&nbsp;</td>';
  278. print '</tr>';
  279. */
  280. // Show bugtrack link
  281. print '<tr><td class="titlefield">'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).'</td><td>';
  282. print $form->selectyesno('MAIN_BUGTRACK_ENABLELINK',$conf->global->MAIN_BUGTRACK_ENABLELINK,1);
  283. print '</td>';
  284. print '<td width="20">&nbsp;</td>';
  285. print '</tr>';
  286. // Hide wiki link on login page
  287. $pictohelp='<span class="fa fa-question-circle"></span>';
  288. print '<tr><td class="titlefield">'.$langs->trans("DisableLinkToHelp",$pictohelp).'</td><td>';
  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><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 '<table summary="edit" class="noborder" width="100%">';
  311. print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("LoginPage").'</td><td></td>';
  312. print '<td width="20">&nbsp;</td>';
  313. print '</tr>';
  314. // Message on login page
  315. $substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount','user'));
  316. complete_substitutions_array($substitutionarray, $langs);
  317. print '<tr><td>';
  318. $texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
  319. foreach($substitutionarray as $key => $val)
  320. {
  321. $texthelp.=$key.'<br>';
  322. }
  323. print $form->textwithpicto($langs->trans("MessageLogin"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessagelogin');
  324. print '</td><td colspan="2">';
  325. $doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME)?$conf->global->MAIN_HOME:''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
  326. $doleditor->Create();
  327. print '</td></tr>'."\n";
  328. // Hide helpcenter link on login page
  329. print '<tr><td class="titlefield">'.$langs->trans("DisableLinkToHelpCenter").'</td><td>';
  330. print $form->selectyesno('MAIN_HELPCENTER_DISABLELINK',isset($conf->global->MAIN_HELPCENTER_DISABLELINK)?$conf->global->MAIN_HELPCENTER_DISABLELINK:0,1);
  331. print '</td>';
  332. print '<td width="20">&nbsp;</td>';
  333. print '</tr>';
  334. // Background
  335. print '<tr><td><label for="imagebackground">'.$langs->trans("BackgroundImageLogin").' (png,jpg)</label></td><td colspan="2">';
  336. print '<div class="centpercent inline-block">';
  337. print '<input type="file" class="flat class=minwidth200" name="imagebackground" id="imagebackground">';
  338. if (! empty($conf->global->MAIN_LOGIN_BACKGROUND)) {
  339. print '<a href="'.$_SERVER["PHP_SELF"].'?action=removebackgroundlogin">'.img_delete($langs->trans("Delete")).'</a>';
  340. if (file_exists($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND)) {
  341. print ' &nbsp; ';
  342. print '<img class="paddingleft valignmiddle" width="100px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/'.$conf->global->MAIN_LOGIN_BACKGROUND).'">';
  343. }
  344. } else {
  345. print '<img class="paddingleft valignmiddle" width="100" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
  346. }
  347. print '</div>';
  348. print '</td></tr>';
  349. print '</table>'."\n";
  350. print '<br><div class="center">';
  351. print '<input class="button" type="submit" name="submit" value="'.$langs->trans("Save").'">';
  352. print ' &nbsp; ';
  353. print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
  354. print '</div>';
  355. print '</form>';
  356. }
  357. else // Show
  358. {
  359. // Language
  360. print '<table class="noborder" width="100%">';
  361. print '<tr class="liste_titre"><td>'.$langs->trans("Language").'</td><td>&nbsp;</td><td>&nbsp;</td></tr>';
  362. print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DefaultLanguage").'</td><td>';
  363. $s=picto_from_langcode($conf->global->MAIN_LANG_DEFAULT);
  364. print ($s?$s.' ':'');
  365. print ($conf->global->MAIN_LANG_DEFAULT=='auto'?$langs->trans("AutoDetectLang"):$langs->trans("Language_".$conf->global->MAIN_LANG_DEFAULT));
  366. print '</td>';
  367. print '<td width="20">';
  368. if ($user->admin && $conf->global->MAIN_LANG_DEFAULT!='auto') print info_admin($langs->trans("SubmitTranslation".($conf->global->MAIN_LANG_DEFAULT=='en_US'?'ENUS':''),$conf->global->MAIN_LANG_DEFAULT),1);
  369. print '</td>';
  370. print "</tr>";
  371. print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("EnableMultilangInterface").'</td><td>' . yn($conf->global->MAIN_MULTILANGS) . '</td>';
  372. print '<td width="20">&nbsp;</td>';
  373. print "</tr>";
  374. print '</table><br>'."\n";
  375. // Themes
  376. show_theme(null,0);
  377. print '<br>';
  378. // Other
  379. print '<table class="noborder" width="100%">';
  380. print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td></tr>';
  381. print '<tr class="oddeven"><td>'.$langs->trans("DefaultMaxSizeList").'</td><td>' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '</td>';
  382. print "</tr>";
  383. print '<tr class="oddeven"><td>'.$langs->trans("DefaultMaxSizeShortList").'</td><td>' . $conf->global->MAIN_SIZE_SHORTLIST_LIMIT . '</td>';
  384. print "</tr>";
  385. // Disable javascript/ajax
  386. print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DisableJavascript").'</td><td>';
  387. print yn($conf->global->MAIN_DISABLE_JAVASCRIPT)."</td>";
  388. print "</tr>";
  389. // First day for weeks
  390. print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("WeekStartOnDay").'</td><td>';
  391. print $langs->trans("Day".(isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:'1'));
  392. print '</td>';
  393. print '</tr>';
  394. // DefaultWorkingDays
  395. print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DefaultWorkingDays").'</td><td>';
  396. print isset($conf->global->MAIN_DEFAULT_WORKING_DAYS)?$conf->global->MAIN_DEFAULT_WORKING_DAYS:'1-5';
  397. print '</td>';
  398. print '</tr>';
  399. // DefaultWorkingHours
  400. print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DefaultWorkingHours").'</td><td>';
  401. print isset($conf->global->MAIN_DEFAULT_WORKING_HOURS)?$conf->global->MAIN_DEFAULT_WORKING_HOURS:'9-18';
  402. print '</td>';
  403. print '</tr>';
  404. // Firstname / Name position
  405. print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("FirstnameNamePosition").'</td><td>';
  406. if (empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) { print $langs->trans("Firstname").' '.$langs->trans("Lastname"); }
  407. else { print $langs->trans("Lastname").' '.$langs->trans("Firstname"); }
  408. print '</td>';
  409. print '</tr>';
  410. // Hide unauthorized button
  411. print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("ButtonHideUnauthorized").'</td><td>';
  412. print yn((isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)?$conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED:0),1);
  413. print '</td></tr>';
  414. // Show logo
  415. print '<tr class="oddeven"><td>'.$langs->trans("EnableShowLogo").'</td><td>' . yn($conf->global->MAIN_SHOW_LOGO) . '</td>';
  416. print "</tr>";
  417. // Hide version link
  418. /*
  419. print '<tr><td class="titlefield">'.$langs->trans("HideVersionLink").'</td><td>';
  420. print yn($conf->global->MAIN_HIDE_VERSION);
  421. print '</td>';
  422. print '</tr>';
  423. */
  424. // Show bugtrack link
  425. print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).'</td><td>';
  426. print yn($conf->global->MAIN_BUGTRACK_ENABLELINK)."</td>";
  427. print "</tr>";
  428. // Link to wiki help
  429. $pictohelp='<span class="fa fa-question-circle"></span>';
  430. print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DisableLinkToHelp",$pictohelp).'</td><td>';
  431. print yn((isset($conf->global->MAIN_HELP_DISABLELINK)?$conf->global->MAIN_HELP_DISABLELINK:0),1);
  432. print '</td></tr>';
  433. // Message of the day
  434. print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("MessageOfDay").'</td><td>';
  435. if (isset($conf->global->MAIN_MOTD)) print dol_htmlcleanlastbr($conf->global->MAIN_MOTD);
  436. else print '&nbsp;';
  437. print '</td></tr>'."\n";
  438. print '</table>'."\n";
  439. print '<br>';
  440. // Login page
  441. print '<div class="div-table-responsive">';
  442. print '<table class="noborder" width="100%">';
  443. print '<tr class="liste_titre"><td>'.$langs->trans("LoginPage").'</td><td></td></tr>';
  444. // Message login
  445. print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("MessageLogin").'</td><td>';
  446. if (isset($conf->global->MAIN_HOME)) print dol_htmlcleanlastbr($conf->global->MAIN_HOME);
  447. else print '&nbsp;';
  448. print '</td></tr>'."\n";
  449. // Link to help center
  450. print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DisableLinkToHelpCenter").'</td><td>';
  451. print yn((isset($conf->global->MAIN_HELPCENTER_DISABLELINK)?$conf->global->MAIN_HELPCENTER_DISABLELINK:0),1);
  452. print '</td></tr>';
  453. // Background login
  454. print '<tr class="oddeven"><td>'.$langs->trans("BackgroundImageLogin").'</td><td>';
  455. print '<div class="centpercent inline-block">';
  456. print $conf->global->MAIN_LOGIN_BACKGROUND;
  457. if ($conf->global->MAIN_LOGIN_BACKGROUND && is_file($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND))
  458. {
  459. print '<img class="img_logo paddingleft valignmiddle" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/'.$conf->global->MAIN_LOGIN_BACKGROUND).'">';
  460. }
  461. else
  462. {
  463. print '<img class="img_logo paddingleft valignmiddle" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
  464. }
  465. print '</div>';
  466. print '</td></tr>';
  467. print '</table>'."\n";
  468. print '</div>';
  469. print '<div class="tabsAction tabsActionNoBottom">';
  470. print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
  471. print '</div>';
  472. }
  473. // End of page
  474. llxFooter();
  475. $db->close();