30require
'../main.inc.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/doleditor.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
44$langs->loadLangs(array(
'admin',
'fckeditor',
'website'));
46$action =
GETPOST(
'action',
'aZ09');
53$mode =
GETPOST(
'mode') ?
GETPOST(
'mode',
'alpha') :
'dolibarr_notes';
61 'NOTE_PUBLIC' =>
'FCKeditorForNotePublic',
62 'NOTE_PRIVATE' =>
'FCKeditorForNotePrivate',
63 'SOCIETE' =>
'FCKeditorForCompany',
64 'DETAILS' =>
'FCKeditorForProductDetails',
65 'USERSIGN' =>
'FCKeditorForUserSignature',
66 'MAILING' =>
'FCKeditorForMailing',
67 'MAIL' =>
'FCKeditorForMail',
68 'TICKET' =>
'FCKeditorForTicket',
85 'NOTE_PUBLIC' =>
'generic',
86 'NOTE_PRIVATE' =>
'generic',
87 'SOCIETE' =>
'generic',
88 'DETAILS' =>
'product',
102foreach ($modules as $const => $desc) {
103 if ($action ==
'enable_'.strtolower($const)) {
106 if ($action ==
'disable_'.strtolower($const)) {
111if (
GETPOST(
'action') ==
'enable_specialchar') {
114if (
GETPOST(
'action') ==
'disable_specialchar') {
118if (
GETPOST(
'action',
'aZ09') ==
'setbackend') {
119 $newbackend =
GETPOST(
'editorbackend',
'aZ09');
120 if (in_array($newbackend, array(
'ckeditor',
'tinymce'),
true)) {
123 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
125 dol_syslog(
"admin/fckeditor.php: failed to save FCKEDITOR_EDITORNAME=".$newbackend.
": ".$db->lasterror(), LOG_ERR);
126 setEventMessages($langs->trans(
"Error").
' '.$db->lasterror(),
null,
'errors');
129 dol_syslog(
"admin/fckeditor.php: invalid editor backend value: ".$newbackend, LOG_WARNING);
130 setEventMessages($langs->trans(
"ErrorBadValue"),
null,
'errors');
137 $fckeditor_test =
GETPOST(
'formtestfield',
'restricthtml');
138 if (!empty($fckeditor_test)) {
148 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
149 } elseif ($error == -1) {
150 $langs->load(
'errors');
151 setEventMessages($langs->trans(
"EmptyMessageNotAllowedError"),
null,
'warnings');
153 setEventMessages($langs->trans(
"Error").
' '.$db->lasterror(),
null,
'errors');
162llxHeader(
'',
'',
'',
'', 0, 0,
'',
'',
'',
'mod-admin page-fckeditor');
164$linkback =
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/admin/modules.php', [
'restore_lastsearch_values' => 1]).
'">'.img_picto($langs->trans(
"BackToModuleList"),
'back',
'class="pictofixedwidth"').
'<span class="hideonsmartphone">'.$langs->trans(
"BackToModuleList").
'</span></a>';
166print
load_fiche_titre($langs->trans(
"AdvancedEditor"), $linkback,
'title_setup');
169if (empty(
$conf->use_javascript_ajax)) {
170 setEventMessages(
null, array($langs->trans(
"NotAvailable"), $langs->trans(
"JavascriptDisabled")),
'errors');
174 if (!in_array($currentbackend, array(
'ckeditor',
'tinymce'),
true)) {
175 $currentbackend =
'ckeditor';
178 print
'<table class="noborder centpercent">';
179 print
'<tr class="liste_titre">';
180 print
'<td colspan="2">'.$langs->trans(
"ActivateFCKeditor").
'</td>';
181 print
'<td class="center width100"></td>';
185 foreach ($modules as $const => $desc) {
187 if (!$conditions[$const]) {
191 $constante =
'FCKEDITOR_ENABLE_'.$const;
192 print
'<!-- constant = '.$constante.
' -->'.
"\n";
193 print
'<tr class="oddeven">';
194 print
'<td class="width20">'.img_object(
"", $picto[$const]).
'</td>';
196 print $langs->trans($desc);
197 if ($const ==
'DETAILS') {
198 print $form->textwithpicto(
'',
'<span class="warning">'.$langs->trans(
"FCKeditorForProductDetails2").
'</span>');
201 print
'<td class="center centpercent width100">';
204 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=enable_'.strtolower($const).
'&token='.
newToken().
'">'.img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
205 } elseif ($value == 1) {
206 if ($const ==
'DETAILS') {
207 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=disable_'.strtolower($const).
'&token='.
newToken().
'">'.img_picto($langs->trans(
"Enabled").
' - '.$langs->trans(
"FCKeditorForProductDetails2"),
'switch_on',
'', 0, 0, 0,
'',
'warning').
'</a>';
209 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=disable_'.strtolower($const).
'&token='.
newToken().
'">'.img_picto($langs->trans(
"Enabled"),
'switch_on').
'</a>';
217 print
'</table>'.
"\n";
224 print
'<form name="formeditorbackend" method="POST" action="'.$_SERVER[
"PHP_SELF"].
'" spellcheck="false">'.
"\n";
225 print
'<input type="hidden" name="token" value="'.newToken().
'">';
226 print
'<input type="hidden" name="action" value="setbackend">';
227 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
228 print
'<input type="hidden" name="page_y" value="">';
230 print
'<table class="noborder centpercent">';
231 print
'<tr class="liste_titre">';
232 print
'<td>'.$langs->trans(
"Other").
'</td>';
238 print
'<tr class="oddeven">';
240 print $langs->trans(
"EditorBackend");
242 print
'<td class="right">';
243 $arrayofeditor = array(
244 'ckeditor' => array(
'label' =>
'CKEditor 4'),
245 'tinymce' => array(
'label' =>
'TinyMCE ('.$langs->trans(
"Experimental").
')',
'data-html' =>
'TinyMCE <span class="opacitymedium">('.$langs->trans(
"Experimental").
')</span>')
247 print $form->selectarray(
"editorbackend", $arrayofeditor, $currentbackend);
248 print
' '.$form->textwithpicto(
'', $langs->trans(
"EditorBackendHelp"));
250 print
'<td class="center width100"><input type="submit" class="button smallpaddingimp reposition" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'"></td>';
254 $constante =
'FCKEDITOR_ENABLE_SPECIALCHAR';
255 print
'<!-- constant = '.$constante.
' -->'.
"\n";
256 print
'<tr class="oddeven">';
258 print $langs->trans(
'SpecialCharActivation');
260 print
'<td class="center width100" colspan="2">';
263 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=enable_specialchar&token='.
newToken().
'">'.img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
264 } elseif ($value == 1) {
265 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=disable_specialchar&token='.
newToken().
'">'.img_picto($langs->trans(
"Enabled"),
'switch_on').
'</a>';
271 print
'</table>'.
"\n";
273 print
'</form>'.
"\n";
275 print
'<br><br><br>'.
"\n";
278 print
'<form name="formtest" method="POST" action="'.$_SERVER[
"PHP_SELF"].
'" spellcheck="false">'.
"\n";
279 print
'<input type="hidden" name="token" value="'.newToken().
'">';
280 print
'<input type="hidden" name="page_y" value="">';
286 $listofmodes = array(
'dolibarr_readonly' =>
'ReadOnly',
'dolibarr_details' =>
'DetailOfLines',
'dolibarr_notes' =>
'Notes',
'dolibarr_mailings' =>
'Emails',
'Full' =>
'AllFeatures',
'Full_inline' =>
'EditInLine');
288 foreach ($listofmodes as $newmode => $newmodelabel) {
290 $linkstomode =
'<span class="opacitymedium">'.$langs->trans(
"Mode").
': </span>';
292 $linkstomode .=
'<a class="a-selection'.($mode != $newmode ?
'-disabled' :
'').
' marginleftonly marginrightonly reposition nounderline" href="'.$_SERVER[
"PHP_SELF"].
'?mode='.$newmode.
'">';
293 $linkstomode .= $langs->trans($newmodelabel);
294 $linkstomode .=
'</a>';
297 print
'<input type="hidden" name="mode" value="'.dol_escape_htmltag($mode).
'">';
298 if ($mode !=
'Full_inline') {
299 $uselocalbrowser =
true;
300 $readonly = ($mode ==
'dolibarr_readonly' ? 1 : 0);
301 $editor =
new DolEditor(
'formtestfield',
getDolGlobalString(
'FCKEDITOR_TEST',
'Test'),
'', 200, $mode,
'In',
true, $uselocalbrowser, 1, 120,
'8', $readonly);
305 print
'<div style="border: 1px solid #888;" contenteditable="true">';
309 print $form->buttonsSaveCancel(
"Save",
'', array(), 0,
'reposition');
310 print
'<div id="divforlog"></div>';
311 print
'</form>'.
"\n";
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.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
Class to manage a WYSIWYG editor.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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, $nodefault=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.