dolibarr 21.0.0-alpha
ihm.php
Go to the documentation of this file.
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 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 3 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program. If not, see <https://www.gnu.org/licenses/>.
24 */
25
31// Load Dolibarr environment
32require '../main.inc.php';
33require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
34require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
35require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
36require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
37require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
38require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
39require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
40
41// Load translation files required by the page
42$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'projects', 'hrm', 'agenda'));
43
44if (!$user->admin) {
46}
47
48$action = GETPOST('action', 'aZ09');
49$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'adminihm'; // To manage different context of search
50
51$mode = GETPOST('mode', 'aZ09') ? GETPOST('mode', 'aZ09') : 'other'; // 'template', 'dashboard', 'login', 'other'
52
53if (!defined("MAIN_MOTD")) {
54 define("MAIN_MOTD", "");
55}
56
57/*
58 * Action
59 */
60
61$parameters = array();
62$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
63if ($reshook < 0) {
64 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
65}
66
67if (GETPOST('cancel', 'alpha')) {
68 $action = '';
69}
70
71// Convert action set_XXX and del_XXX to set var (this is used when no javascript on for ajax_constantonoff)
72$regs = array();
73if (preg_match('/^(set|del)_([A-Z_]+)$/', $action, $regs)) {
74 if ($regs[1] == 'set') {
75 dolibarr_set_const($db, $regs[2], 1, 'chaine', 0, '', $conf->entity);
76 } else {
77 dolibarr_del_const($db, $regs[2], $conf->entity);
78 }
79}
80
81if ($action == 'removebackgroundlogin' && getDolGlobalString('MAIN_LOGIN_BACKGROUND')) {
82 dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity);
83 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
84
85 $logofile = $conf->mycompany->dir_output.'/logos/' . getDolGlobalString('MAIN_LOGIN_BACKGROUND');
86 dol_delete_file($logofile);
87 dolibarr_del_const($db, "MAIN_LOGIN_BACKGROUND", $conf->entity);
88 $mysoc->logo = '';
89
90 /*$logosmallfile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small;
91 dol_delete_file($logosmallfile);
92 dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$conf->entity);
93 $mysoc->logo_small='';
94
95 $logominifile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini;
96 dol_delete_file($logominifile);
97 dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$conf->entity);
98 $mysoc->logo_mini='';*/
99}
100
101if ($action == 'update') {
102 $error = 0;
103
104 if ($mode == 'template') {
105 //dolibarr_del_const($db, "MAIN_THEME", 0); // To be sure we don't have this constant set for all entities
106
107 dolibarr_set_const($db, "MAIN_THEME", GETPOST("main_theme", 'aZ09'), 'chaine', 0, '', $conf->entity);
108 dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity);
109
110 if (GETPOSTISSET('THEME_ELDY_USECOMOACTROW')) {
111 dolibarr_set_const($db, "THEME_ELDY_USECOMOACTROW", GETPOST('THEME_ELDY_USECOMOACTROW'), 'chaine', 0, '', $conf->entity);
112 }
113
114 if (GETPOSTISSET('THEME_DARKMODEENABLED')) {
115 $val = GETPOST('THEME_DARKMODEENABLED');
116 if (!$val) {
117 dolibarr_del_const($db, "THEME_DARKMODEENABLED", $conf->entity);
118 }
119 if ($val) {
120 dolibarr_set_const($db, "THEME_DARKMODEENABLED", $val, 'chaine', 0, '', $conf->entity);
121 }
122 }
123
124 if (GETPOSTISSET('THEME_TOPMENU_DISABLE_IMAGE')) {
125 $val = GETPOST('THEME_TOPMENU_DISABLE_IMAGE');
126 if (!$val) {
127 dolibarr_del_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', $conf->entity);
128 } else {
129 dolibarr_set_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', GETPOST('THEME_TOPMENU_DISABLE_IMAGE'), 'chaine', 0, '', $conf->entity);
130 }
131 }
132
133 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKBODY'), array()))));
134 if ($val == '') {
135 dolibarr_del_const($db, 'THEME_ELDY_BACKBODY', $conf->entity);
136 } else {
137 dolibarr_set_const($db, 'THEME_ELDY_BACKBODY', $val, 'chaine', 0, '', $conf->entity);
138 }
139
140 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1'), array()))));
141 if ($val == '') {
142 dolibarr_del_const($db, 'THEME_ELDY_TOPMENU_BACK1', $conf->entity);
143 } else {
144 dolibarr_set_const($db, 'THEME_ELDY_TOPMENU_BACK1', $val, 'chaine', 0, '', $conf->entity);
145 }
146
147 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_VERMENU_BACK1'), array()))));
148 if ($val == '') {
149 dolibarr_del_const($db, 'THEME_ELDY_VERMENU_BACK1', $conf->entity);
150 } else {
151 dolibarr_set_const($db, 'THEME_ELDY_VERMENU_BACK1', $val, 'chaine', 0, '', $conf->entity);
152 }
153
154 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLENOTAB'), array()))));
155 if ($val == '') {
156 dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLENOTAB', $conf->entity);
157 } else {
158 dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLENOTAB', $val, 'chaine', 0, '', $conf->entity);
159 }
160
161 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'), array()))));
162 if ($val == '') {
163 dolibarr_del_const($db, 'THEME_ELDY_BACKTITLE1', $conf->entity);
164 } else {
165 dolibarr_set_const($db, 'THEME_ELDY_BACKTITLE1', $val, 'chaine', 0, '', $conf->entity);
166 }
167
168 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLE'), array()))));
169 if ($val == '') {
170 dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLE', $conf->entity);
171 } else {
172 dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLE', $val, 'chaine', 0, '', $conf->entity);
173 }
174
175 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLELINK'), array()))));
176 if ($val == '') {
177 dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLELINK', $conf->entity);
178 } else {
179 dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLELINK', $val, 'chaine', 0, '', $conf->entity);
180 }
181
182 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'), array()))));
183 if ($val == '') {
184 dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR1', $conf->entity);
185 } else {
186 dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR1', $val, 'chaine', 0, '', $conf->entity);
187 }
188 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'), array()))));
189 if ($val == '') {
190 dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR2', $conf->entity);
191 } else {
192 dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR2', $val, 'chaine', 0, '', $conf->entity);
193 }
194
195 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'), array()))));
196 if ($val == '') {
197 dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR1', $conf->entity);
198 } else {
199 dolibarr_set_const($db, 'THEME_ELDY_LINEPAIR1', $val, 'chaine', 0, '', $conf->entity);
200 }
201 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'), array()))));
202 if ($val == '') {
203 dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR2', $conf->entity);
204 } else {
205 dolibarr_set_const($db, 'THEME_ELDY_LINEPAIR2', $val, 'chaine', 0, '', $conf->entity);
206 }
207
208 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTLINK'), array()))));
209 if ($val == '') {
210 dolibarr_del_const($db, 'THEME_ELDY_TEXTLINK', $conf->entity);
211 } else {
212 dolibarr_set_const($db, 'THEME_ELDY_TEXTLINK', $val, 'chaine', 0, '', $conf->entity);
213 }
214
215 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_HOVER'), array()))));
216 if ($val == '') {
217 dolibarr_del_const($db, 'THEME_ELDY_USE_HOVER', $conf->entity);
218 } else {
219 dolibarr_set_const($db, "THEME_ELDY_USE_HOVER", $val, 'chaine', 0, '', $conf->entity);
220 }
221
222 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_CHECKED'), array()))));
223 if ($val == '') {
224 dolibarr_del_const($db, 'THEME_ELDY_USE_CHECKED', $conf->entity);
225 } else {
226 dolibarr_set_const($db, "THEME_ELDY_USE_CHECKED", $val, 'chaine', 0, '', $conf->entity);
227 }
228
229 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BTNACTION'), array()))));
230 if ($val == '') {
231 dolibarr_del_const($db, 'THEME_ELDY_BTNACTION', $conf->entity);
232 } else {
233 dolibarr_set_const($db, 'THEME_ELDY_BTNACTION', $val, 'chaine', 0, '', $conf->entity);
234 }
235
236 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTBTNACTION'), array()))));
237 if ($val == '') {
238 dolibarr_del_const($db, 'THEME_ELDY_TEXTBTNACTION', $conf->entity);
239 } else {
240 dolibarr_set_const($db, 'THEME_ELDY_TEXTBTNACTION', $val, 'chaine', 0, '', $conf->entity);
241 }
242 }
243
244 if ($mode == 'dashboard') {
245 dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr(GETPOST("main_motd", 'restricthtml')), 'chaine', 0, '', $conf->entity);
246 }
247
248 if ($mode == 'other') {
249 dolibarr_set_const($db, "MAIN_LANG_DEFAULT", GETPOST("MAIN_LANG_DEFAULT", 'aZ09'), 'chaine', 0, '', $conf->entity);
250 dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity);
251
252 dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", GETPOSTINT("MAIN_SIZE_LISTE_LIMIT"), 'chaine', 0, '', $conf->entity);
253 dolibarr_set_const($db, "MAIN_SIZE_SHORTLIST_LIMIT", GETPOSTINT("MAIN_SIZE_SHORTLIST_LIMIT"), 'chaine', 0, '', $conf->entity);
254
255 if (GETPOSTISSET("MAIN_CHECKBOX_LEFT_COLUMN")) {
256 dolibarr_set_const($db, "MAIN_CHECKBOX_LEFT_COLUMN", GETPOSTINT("MAIN_CHECKBOX_LEFT_COLUMN"), 'chaine', 0, '', $conf->entity);
257 }
258
259 //dolibarr_set_const($db, "MAIN_DISABLE_JAVASCRIPT", GETPOST("MAIN_DISABLE_JAVASCRIPT", 'aZ09'), 'chaine', 0, '', $conf->entity);
260 //dolibarr_set_const($db, "MAIN_BUTTON_HIDE_UNAUTHORIZED", GETPOST("MAIN_BUTTON_HIDE_UNAUTHORIZED", 'aZ09'), 'chaine', 0, '', $conf->entity);
261 //dolibarr_set_const($db, "MAIN_MENU_HIDE_UNAUTHORIZED", GETPOST("MAIN_MENU_HIDE_UNAUTHORIZED", 'aZ09'), 'chaine', 0, '', $conf->entity);
262 dolibarr_set_const($db, "MAIN_START_WEEK", GETPOSTINT("MAIN_START_WEEK"), 'chaine', 0, '', $conf->entity);
263
264 dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_DAYS", GETPOST("MAIN_DEFAULT_WORKING_DAYS", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
265 dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", GETPOST("MAIN_DEFAULT_WORKING_HOURS", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
266
267 dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", GETPOST("MAIN_BUGTRACK_ENABLELINK", 'alpha'), 'chaine', 0, '', $conf->entity);
268
269 dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", GETPOST("MAIN_FIRSTNAME_NAME_POSITION", 'aZ09'), 'chaine', 0, '', $conf->entity);
270 }
271
272 if ($mode == 'login') {
273 dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr(GETPOST("main_home", 'restricthtml')), 'chaine', 0, '', $conf->entity);
274 //dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", GETPOST("MAIN_HELP_DISABLELINK", 'aZ09'), 'chaine', 0, '', 0); // Param for all entities
275
276 $varforimage = 'imagebackground';
277 $dirforimage = $conf->mycompany->dir_output . '/logos/';
278 if ($_FILES[$varforimage]["tmp_name"]) {
279 $reg = array();
280 if (preg_match('/([^\\/:]+)$/i', $_FILES[$varforimage]["name"], $reg)) {
281 $original_file = $reg[1];
282
283 $isimage = image_format_supported($original_file);
284 if ($isimage >= 0) {
285 dol_syslog("Move file " . $_FILES[$varforimage]["tmp_name"] . " to " . $dirforimage . $original_file);
286 if (!is_dir($dirforimage)) {
287 dol_mkdir($dirforimage);
288 }
289 $result = dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage . $original_file, 1, 0, $_FILES[$varforimage]['error']);
290 if ($result > 0) {
291 dolibarr_set_const($db, "MAIN_LOGIN_BACKGROUND", $original_file, 'chaine', 0, '', $conf->entity);
292 } elseif (preg_match('/^ErrorFileIsInfectedWithAVirus/', $result)) {
293 $error++;
294 $langs->load("errors");
295 $tmparray = explode(':', $result);
296 setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus', $tmparray[1]), null, 'errors');
297 } else {
298 $error++;
299 setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors');
300 }
301 } else {
302 $error++;
303 $langs->load("errors");
304 setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
305 }
306 }
307 }
308 }
309
310 if ($mode == 'css') {
311 //file_put_contents(DOL_DATA_ROOT.'/admin/customcss.css', $data);
312 //dol_chmod(DOL_DATA_ROOT.'/admin/customcss.css');
313 dolibarr_set_const($db, "MAIN_IHM_CUSTOM_CSS", GETPOST('MAIN_IHM_CUSTOM_CSS', 'restricthtml'), 'chaine', 0, '', $conf->entity);
314 }
315
316 $_SESSION["mainmenu"] = ""; // The menu manager may have changed
317
318 if (GETPOST('dol_resetcache')) {
319 dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity);
320 }
321
322 header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup&mode=".$mode.(GETPOSTISSET('page_y') ? '&page_y='.GETPOSTINT('page_y') : ''));
323 exit;
324}
325
326
327/*
328 * View
329 */
330
331$wikihelp = 'EN:First_setup|FR:Premiers_param&eacute;trages|ES:Primeras_configuraciones';
332
334 '',
335 $langs->trans("Setup"),
336 $wikihelp,
337 '',
338 0,
339 0,
340 array(
341 '/includes/ace/src/ace.js',
342 '/includes/ace/src/ext-statusbar.js',
343 '/includes/ace/src/ext-language_tools.js',
344 ),
345 array(),
346 '',
347 'mod-admin page-ihm'
348);
349
350$form = new Form($db);
351$formother = new FormOther($db);
352$formadmin = new FormAdmin($db);
353
354print load_fiche_titre($langs->trans("GUISetup"), '', 'title_setup');
355
356print '<span class="opacitymedium">'.$langs->trans("DisplayDesc")."</span><br>\n";
357print "<br>\n";
358
359//WYSIWYG Editor
360require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
361
362print '<form enctype="multipart/form-data" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
363print '<input type="hidden" name="token" value="'.newToken().'">';
364print '<input type="hidden" name="action" value="update">';
365print '<input type="hidden" name="page_y" value="">';
366print '<input type="hidden" id="mode" name="mode" value="'.dol_escape_htmltag($mode).'">';
367print '<input type="hidden" name="dol_resetcache" value="1">';
368
369$head = ihm_prepare_head();
370
371print dol_get_fiche_head($head, $mode, '', -1, '');
372
373print '<br>';
374
375clearstatcache();
376
377if ($mode == 'other') {
378 print '<div class="div-table-responsive-no-min">';
379 print '<table summary="edit" class="noborder centpercent editmode tableforfield">';
380
381 print '<tr class="liste_titre"><td class="titlefieldmiddle">';
382 print $langs->trans("Language");
383 print '</td><td class="titlefieldmiddle">';
384 print '</td></tr>';
385
386 // Default language
387 print '<tr class="oddeven"><td>'.$langs->trans("DefaultLanguage").'</td><td>';
388 print img_picto('', 'language', 'class="pictofixedwidth"');
389 print $formadmin->select_language(getDolGlobalString('MAIN_LANG_DEFAULT'), 'MAIN_LANG_DEFAULT', 1, array(), '', 0, 0, 'minwidth300', 2);
390 //print '<input class="button button-save smallpaddingimp" type="submit" name="submit" value="'.$langs->trans("Save").'">';
391 print '</td>';
392 print '</tr>';
393
394 // Multilingual GUI
395 print '<tr class="oddeven"><td>' . $langs->trans("EnableMultilangInterface") . '</td><td>';
396 print ajax_constantonoff("MAIN_MULTILANGS", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'language');
397 print '</td>';
398 print '</tr>';
399
400 print '</table>' . "\n";
401 print '</div>';
402
403 print '<div class="center">';
404 print '<input class="button button-save reposition" type="submit" name="submit" value="' . $langs->trans("Save") . '">';
405 print '<input class="button button-cancel reposition" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">';
406 print '</div>';
407
408 print '<br>';
409 print '<br>';
410
411 // Other
412 print '<div class="div-table-responsive-no-min">';
413 print '<table summary="otherparameters" class="noborder centpercent editmode tableforfield">';
414
415 print '<tr class="liste_titre"><td class="titlefieldmiddle">';
416 print $langs->trans("Miscellaneous");
417 print '</td>';
418 print '<td class="titlefieldmiddle"></td>';
419 print '</tr>';
420
421 if (!empty($conf->use_javascript_ajax)) {
422 // Show Quick Add link
423 print '<tr class="oddeven"><td>' . $langs->trans("ShowQuickAddLink") . '</td><td>';
424 print ajax_constantonoff("MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
425 print '</td>';
426 print '</tr>';
427 }
428
429 // Hide wiki link on login page
430 $pictohelp = '<span class="fa fa-question-circle"></span>';
431 print '<tr class="oddeven"><td>' . str_replace('{picto}', $pictohelp, $langs->trans("DisableLinkToHelp", '{picto}')) . '</td><td>';
432 print ajax_constantonoff("MAIN_HELP_DISABLELINK", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
433 //print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK) ? $conf->global->MAIN_HELP_DISABLELINK : 0, 1);
434 print '</td>';
435 print '</tr>';
436
437 // Max size of lists
438 print '<tr class="oddeven"><td>' . $langs->trans("DefaultMaxSizeList") . '</td><td><input class="flat width50" name="MAIN_SIZE_LISTE_LIMIT" value="';
439 if (getDolGlobalInt('MAIN_SIZE_LISTE_LIMIT') > 0) {
440 print getDolGlobalString('MAIN_SIZE_LISTE_LIMIT');
441 }
442 print '">';
443 if (getDolGlobalInt('MAIN_SIZE_LISTE_LIMIT') <= 0) {
444 print ' &nbsp; <span class="opacitymedium">('.$langs->trans("Automatic").')</span>';
445 }
446 print '</td>';
447 print '</tr>';
448
449 // Max size of short lists on customer card
450 print '<tr class="oddeven"><td>' . $langs->trans("DefaultMaxSizeShortList") . '</td><td><input class="flat width50" name="MAIN_SIZE_SHORTLIST_LIMIT" value="' . getDolGlobalString('MAIN_SIZE_SHORTLIST_LIMIT') . '"></td>';
451 print '</tr>';
452
453 // Display checkboxes and fields menu left / right
454 print '<tr class="oddeven"><td>' . $langs->trans("MAIN_CHECKBOX_LEFT_COLUMN") . '</td><td>';
455 print ajax_constantonoff("MAIN_CHECKBOX_LEFT_COLUMN", array(), $conf->entity, 0, 0, 1, 0, 0, 1, '', 'other');
456 print '</td>';
457 print '</tr>';
458
459 // show input border
460 /*
461 print '<tr><td>'.$langs->trans("showInputBorder").'</td><td>';
462 print $form->selectyesno('main_showInputBorder',isset($conf->global->THEME_ELDY_SHOW_BORDER_INPUT)?$conf->global->THEME_ELDY_SHOW_BORDER_INPUT:0,1);
463 print '</td>';
464 print '</tr>';
465 */
466
467 // First day for weeks
468 print '<tr class="oddeven"><td>' . $langs->trans("WeekStartOnDay") . '</td><td>';
469 print $formother->select_dayofweek((isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : '1'), 'MAIN_START_WEEK', 0);
470 print '</td>';
471 print '</tr>';
472
473 // DefaultWorkingDays
474 print '<tr class="oddeven"><td>' . $langs->trans("DefaultWorkingDays") . '</td><td>';
475 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') . '">';
476 print '</td>';
477 print '</tr>';
478
479 // DefaultWorkingHours
480 print '<tr class="oddeven"><td>' . $langs->trans("DefaultWorkingHours") . '</td><td>';
481 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') . '">';
482 print '</td>';
483 print '</tr>';
484
485 // Firstname/Name
486 print '<tr class="oddeven"><td>' . $langs->trans("FirstnameNamePosition") . '</td><td>';
487 $array = array(0 => $langs->trans("Firstname") . ' ' . $langs->trans("Lastname"), 1 => $langs->trans("Lastname") . ' ' . $langs->trans("Firstname"));
488 print $form->selectarray('MAIN_FIRSTNAME_NAME_POSITION', $array, (isset($conf->global->MAIN_FIRSTNAME_NAME_POSITION) ? $conf->global->MAIN_FIRSTNAME_NAME_POSITION : 0));
489 print '</td>';
490 print '</tr>';
491
492 // Hide unauthorized menus
493 print '<tr class="oddeven"><td>' . $langs->trans("HideUnauthorizedMenu") . '</td><td>';
494 //print $form->selectyesno('MAIN_MENU_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) ? $conf->global->MAIN_MENU_HIDE_UNAUTHORIZED : 0, 1);
495 print ajax_constantonoff("MAIN_MENU_HIDE_UNAUTHORIZED", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
496 print '</td>';
497 print '</tr>';
498
499 // Hide unauthorized button
500 print '<tr class="oddeven"><td>' . $langs->trans("ButtonHideUnauthorized") . '</td><td>';
501 //print $form->selectyesno('MAIN_BUTTON_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED) ? $conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED : 0, 1);
502 print ajax_constantonoff("MAIN_BUTTON_HIDE_UNAUTHORIZED", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
503 print '</td>';
504 print '</tr>';
505
506 // Hide version link
507 /*
508
509 print '<tr><td>'.$langs->trans("HideVersionLink").'</td><td>';
510 print $form->selectyesno('MAIN_HIDE_VERSION',$conf->global->MAIN_HIDE_VERSION,1);
511 print '</td>';
512 print '</tr>';
513 */
514
515
516 // Show search area in top menu
517 print '<tr class="oddeven"><td>' . $langs->trans("ShowSearchAreaInTopMenu") . '</td><td>';
518 print ajax_constantonoff("MAIN_USE_TOP_MENU_SEARCH_DROPDOWN", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
519 print '</td>';
520 print '</tr>';
521
522 // Show bugtrack link
523 print '<tr class="oddeven"><td>';
524 print $form->textwithpicto($langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")), $langs->trans("ShowBugTrackLinkDesc"));
525 print '</td><td>';
526 print '<input type="text" name="MAIN_BUGTRACK_ENABLELINK" value="' . (!getDolGlobalString('MAIN_BUGTRACK_ENABLELINK') ? '' : $conf->global->MAIN_BUGTRACK_ENABLELINK) . '">';
527 print '</td>';
528 print '</tr>';
529
530 // Disable javascript and ajax
531 print '<tr class="oddeven"><td>' . $form->textwithpicto($langs->trans("DisableJavascript"), $langs->trans("DisableJavascriptNote")) . '</td><td>';
532 print ajax_constantonoff("MAIN_DISABLE_JAVASCRIPT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
533 print '</td>';
534 print '</tr>';
535
536 print '</table>' . "\n";
537 print '</div>';
538}
539
540
541if ($mode == 'template') {
542 // Themes and themes options
543 showSkins(null, 1);
544}
545
546
547if ($mode == 'dashboard') {
548 print '<div class="div-table-responsive-no-min">';
549 print '<table summary="blockdashboard" class="noborder centpercent editmode tableforfield">';
550
551 // Message of the day on home page
552 $substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount'));
553 complete_substitutions_array($substitutionarray, $langs);
554
555 print '<tr class="oddeven width25p"><td>';
556 $texthelp = $langs->trans("FollowingConstantsWillBeSubstituted") . '<br>';
557 foreach ($substitutionarray as $key => $val) {
558 $texthelp .= $key . '<br>';
559 }
560 print $form->textwithpicto($langs->trans("MessageOfDay"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessageofday');
561
562 print '</td><td>';
563
564 $doleditor = new DolEditor('main_motd', (isset($conf->global->MAIN_MOTD) ? $conf->global->MAIN_MOTD : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
565 $doleditor->Create();
566
567 print '</td></tr>' . "\n";
568
569 /* no more need for this option. It is now a widget already controlled by end user
570 print '<tr class="oddeven"><td>' . $langs->trans('BoxstatsDisableGlobal') . '</td><td>';
571 print ajax_constantonoff("MAIN_DISABLE_GLOBAL_BOXSTATS", array(), $conf->entity, 0, 0, 1, 0);
572 print '</td>';
573 print '</tr>';
574 */
575
576 print '</table>';
577 print '</div>';
578
579 print '<br>';
580
581 print '<div class="div-table-responsive-no-min">';
582 print '<table summary="blockdashboard" class="noborder centpercent editmode tableforfield">';
583
584 print '<tr class="liste_titre"><td class="titlefieldmiddle">';
585 print $langs->trans("DashboardDisableBlocks");
586 print '</td><td class="titlefieldmiddle">';
587 print '</td></tr>';
588
589 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableGlobal') . '</td><td>';
590 print ajax_constantonoff("MAIN_DISABLE_GLOBAL_WORKBOARD", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
591 print '</td>';
592 print '</tr>';
593
594 if (!getDolGlobalString('MAIN_DISABLE_GLOBAL_WORKBOARD')) {
595 // Block meteo
596 print '<tr class="oddeven"><td>' . $langs->trans('MAIN_DISABLE_METEO') . '</td><td>';
597 print ajax_constantonoff("MAIN_DISABLE_METEO", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
598 print '</td>';
599 print '</tr>';
600
601 // Block agenda
602 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockAgenda') . '</td><td>';
603 print ajax_constantonoff("MAIN_DISABLE_BLOCK_AGENDA", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
604 print '</td>';
605 print '</tr>';
606
607 // Block agenda
608 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockProject') . '</td><td>';
609 print ajax_constantonoff("MAIN_DISABLE_BLOCK_PROJECT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
610 print '</td>';
611 print '</tr>';
612
613 // Block customer
614 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockCustomer') . '</td><td>';
615 print ajax_constantonoff("MAIN_DISABLE_BLOCK_CUSTOMER", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
616 print '</td>';
617 print '</tr>';
618
619 // Block supplier
620 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockSupplier') . '</td><td>';
621 print ajax_constantonoff("MAIN_DISABLE_BLOCK_SUPPLIER", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
622 print '</td>';
623 print '</tr>';
624
625 // Block contract
626 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockContract') . '</td><td>';
627 print ajax_constantonoff("MAIN_DISABLE_BLOCK_CONTRACT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
628 print '</td>';
629 print '</tr>';
630
631 // Block ticket
632 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockTicket') . '</td><td>';
633 print ajax_constantonoff("MAIN_DISABLE_BLOCK_TICKET", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
634 print '</td>';
635 print '</tr>';
636
637 // Block bank
638 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockBank') . '</td><td>';
639 print ajax_constantonoff("MAIN_DISABLE_BLOCK_BANK", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
640 print '</td>';
641 print '</tr>';
642
643 // Block adherent
644 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockAdherent') . '</td><td>';
645 print ajax_constantonoff("MAIN_DISABLE_BLOCK_ADHERENT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
646 print '</td>';
647 print '</tr>';
648
649 // Block expense report
650 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockExpenseReport') . '</td><td>';
651 print ajax_constantonoff("MAIN_DISABLE_BLOCK_EXPENSEREPORT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
652 print '</td>';
653 print '</tr>';
654
655 // Block holiday
656 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockHoliday') . '</td><td>';
657 print ajax_constantonoff("MAIN_DISABLE_BLOCK_HOLIDAY", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
658 print '</td>';
659 print '</tr>';
660 }
661
662 print '</table>' . "\n";
663 print '</div>';
664}
665
666
667if ($mode == 'login') {
668 // Other
669 print '<div class="div-table-responsive-no-min">';
670 print '<table summary="edit" class="noborder centpercent editmode tableforfield">';
671
672 print '<tr class="liste_titre"><td class="titlefieldmax45">';
673 print $langs->trans("Parameter");
674 print '</td><td>';
675 print $langs->trans("Value");
676 print '</td></tr>';
677
678 // Hide helpcenter link on login page
679 print '<tr class="oddeven"><td>' . $langs->trans("DisableLinkToHelpCenter") . '</td><td>';
680 print ajax_constantonoff("MAIN_HELPCENTER_DISABLELINK", array(), $conf->entity, 0, 0, 0, 0, 0, 0, '', 'login');
681 print '</td>';
682 print '</tr>';
683
684 // Message on login page
685 $substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount', 'user'));
686 complete_substitutions_array($substitutionarray, $langs);
687 print '<tr class="oddeven"><td>';
688 $texthelp = $langs->trans("FollowingConstantsWillBeSubstituted") . '<br>';
689 foreach ($substitutionarray as $key => $val) {
690 $texthelp .= $key . '<br>';
691 }
692 print $form->textwithpicto($langs->trans("MessageLogin"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessagelogin');
693 print '</td><td>';
694 $doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME) ? $conf->global->MAIN_HOME : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
695 $doleditor->Create();
696 print '</td></tr>' . "\n";
697
698 // Background
699 print '<tr class="oddeven"><td><label for="imagebackground">' . $langs->trans("BackgroundImageLogin") . ' (png,jpg)</label></td><td>';
700 print '<div class="centpercent inline-block">';
701 $disabled = '';
702 if (getDolGlobalString('ADD_UNSPLASH_LOGIN_BACKGROUND')) {
703 $disabled = ' disabled="disabled"';
704 }
705 $maxfilesizearray = getMaxFileSizeArray();
706 $maxmin = $maxfilesizearray['maxmin'];
707 if ($maxmin > 0) {
708 print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
709 }
710 print '<input type="file" class="flat maxwidthinputfileonsmartphone" name="imagebackground" id="imagebackground"' . $disabled . '>';
711 if ($disabled) {
712 print '(' . $langs->trans("DisabledByOptionADD_UNSPLASH_LOGIN_BACKGROUND") . ') ';
713 }
714 if (getDolGlobalString('MAIN_LOGIN_BACKGROUND')) {
715 print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?action=removebackgroundlogin&token='.newToken().'&mode=login">' . img_delete($langs->trans("Delete")) . '</a>';
716 if (file_exists($conf->mycompany->dir_output . '/logos/' . getDolGlobalString('MAIN_LOGIN_BACKGROUND'))) {
717 print ' &nbsp; ';
718 print '<img class="marginleftonly boxshadow valignmiddle" width="100" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&amp;file=' . urlencode('logos/' . getDolGlobalString('MAIN_LOGIN_BACKGROUND')) . '">';
719 }
720 } else {
721 print '<img class="marginleftonly valignmiddle" width="100" src="' . DOL_URL_ROOT . '/public/theme/common/nophoto.png">';
722 }
723 print '</div>';
724 print '</td></tr>';
725
726 print '</table>' . "\n";
727 print '</div>';
728}
729
730if ($mode == 'css') {
731 print '<div class="div-table-responsive-no-min">';
732 print '<table summary="edit" class="noborder centpercent editmode tableforfield">';
733
734 print '<tr class="liste_titre">';
735 print '<td colspan="2">';
736
737 //$customcssValue = file_get_contents(DOL_DATA_ROOT.'/admin/customcss.css');
738 $customcssValue = getDolGlobalString('MAIN_IHM_CUSTOM_CSS');
739
740 $doleditor = new DolEditor('MAIN_IHM_CUSTOM_CSS', $customcssValue, '80%', 400, 'Basic', 'In', true, false, 'ace', 10, '90%');
741 $doleditor->Create(0, '', true, 'css', 'css');
742 print '</td></tr>'."\n";
743
744 print '</table>'."\n";
745 print '</div>';
746}
747
748
749print '<div class="center">';
750print '<input class="button button-save reposition buttonforacesave" type="submit" name="submit" value="' . $langs->trans("Save") . '">';
751print '<input class="button button-cancel reposition" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">';
752print '</div>';
753
754print '</form>';
755
756
757// End of page
758llxFooter();
759$db->close();
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
ihm_prepare_head()
Prepare array with list of tabs.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:70
Class to manage a WYSIWYG editor.
Class to generate html code for admin pages.
Class to manage generation of HTML components Only common components must be here.
Class permettant la generation de composants html autre Only common components are here.
llxFooter()
Footer empty.
Definition document.php:107
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $varfiles='addedfile', $upload_dir='')
Check validity of a file upload from an GUI page, and move it to its final destination.
colorStringToArray($stringcolor, $colorifnotfound=array(88, 88, 88))
Convert a string RGB value ('FFFFFF', '255,255,255') into an array RGB array(255,255,...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_htmlcleanlastbr($stringtodecode)
This function remove all ending and br at end.
complete_substitutions_array(&$substitutionarray, $outputlangs, $object=null, $parameters=null, $callfunc="completesubstitutionarray")
Complete the $substitutionarray with more entries coming from external module that had set the "subst...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null, $include=null)
Return array of possible common substitutions.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
image_format_supported($file, $acceptsvg=0)
Return if a filename is file name of a supported image format.
getMaxFileSizeArray()
Return the max allowed for file upload.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
showSkins($fuser, $edit=0, $foruserprofile=false)
Show list of themes.