dolibarr 21.0.0-beta
configcss.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2023-2024 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2023-2024 Lionel Vessiller <lvessiller@easya.solutions>
4 * Copyright (C) 2023-2024 Patrice Andreani <pandreani@easya.solutions>
5 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
27// Load Dolibarr environment
28require_once "../../main.inc.php";
29require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php";
30require_once DOL_DOCUMENT_ROOT . "/webportal/lib/webportal.lib.php";
31
40// Translations
41$langs->loadLangs(array("admin", "hrm", "other", "website"));
42
43// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
44$hookmanager->initHooks(array('webportalsetup', 'globalsetup'));
45
46// Parameters
47$action = GETPOST('action', 'aZ09');
48$backtopage = GETPOST('backtopage', 'alpha');
49
50if (empty($action)) {
51 $action = 'edit';
52}
53
54// Access control
55if (!$user->admin) {
57}
58
59
60/*
61 * Actions
62 */
63
64$parameters = array();
65$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
66if ($reshook < 0) {
67 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
68}
69
70// Convert action set_XXX and del_XXX to set var (this is used when no javascript on for ajax_constantonoff)
71$regs = array();
72if (preg_match('/^(set|del)_([A-Z_]+)$/', $action, $regs)) {
73 if ($regs[1] == 'set') {
74 dolibarr_set_const($db, $regs[2], 1, 'chaine', 0, '', $conf->entity);
75 } else {
76 dolibarr_del_const($db, $regs[2], $conf->entity);
77 }
78}
79
80if ($action == 'updatecss') {
81 dolibarr_set_const($db, "WEBPORTAL_CUSTOM_CSS", GETPOST('WEBPORTAL_CUSTOM_CSS', 'restricthtml'), 'chaine', 0, '', $conf->entity);
82 dolibarr_set_const($db, "WEBPORTAL_PARAMS_REV", ((int) $conf->global->WEBPORTAL_PARAMS_REV) + 1, 'chaine', 0, '', $conf->entity);
83}
84
85
86/*
87 * View
88 */
89
90$title = "WebPortalSetup";
91
92$wikihelp = 'EN:First_setup|FR:Premiers_param&eacute;trages|ES:Primeras_configuraciones';
93
95 '',
96 $langs->trans($title),
97 $wikihelp,
98 '',
99 0,
100 0,
101 array(
102 '/includes/ace/src/ace.js',
103 '/includes/ace/src/ext-statusbar.js',
104 '/includes/ace/src/ext-language_tools.js',
105 ),
106 array()
107);
108
109// Subheader
110$linkback = '<a href="' . ($backtopage ? $backtopage : DOL_URL_ROOT . '/admin/modules.php?restore_lastsearch_values=1') . '">' . $langs->trans("BackToModuleList") . '</a>';
111
112print load_fiche_titre($langs->trans($title), $linkback, 'title_setup');
113
114// Configuration header
116print dol_get_fiche_head($head, 'css', $langs->trans($title), -1, "webportal");
117
118// Setup page goes here
119echo '<span class="opacitymedium">' . $langs->trans("WebPortalCSS") . '</span><br><br>';
120
121//WYSIWYG Editor
122require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
123
124print '<form enctype="multipart/form-data" method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
125
126print '<input type="hidden" name="token" value="' . newToken() . '">';
127print '<input type="hidden" name="action" value="updatecss">';
128
129clearstatcache();
130
131// editeur CSS
132print '<div class="div-table-responsive-no-min">';
133print '<table summary="edit" class="noborder centpercent editmode tableforfield">';
134
135print '<tr class="liste_titre">';
136print '<td colspan="2">';
137
138$customcssValue = getDolGlobalString('WEBPORTAL_CUSTOM_CSS');
139
140$doleditor = new DolEditor('WEBPORTAL_CUSTOM_CSS', $customcssValue, '80%', 400, 'Basic', 'In', true, false, 'ace', 10, '90%');
141$doleditor->Create(0, '', true, 'css', 'css');
142print '</td></tr>' . "\n";
143
144print '</table>' . "\n";
145print '</div>';
146
147print '<div class="center">';
148print '<input class="button button-save reposition buttonforacesave" type="submit" name="submit" value="' . $langs->trans("Save") . '">';
149//print '<input class="button button-cancel reposition" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">';
150print '</div>';
151
152print '</form>';
153
154// Page end
155print dol_get_fiche_end();
156
157// End of page
158llxFooter();
159$db->close();
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:66
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.
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:71
Class to manage a WYSIWYG editor.
llxFooter()
Footer empty.
Definition document.php:107
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.
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.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
webportalAdminPrepareHead()
Prepare admin pages header.