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',
'errors',
'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',
86 'NOTE_PUBLIC' =>
'generic',
87 'NOTE_PRIVATE' =>
'generic',
88 'SOCIETE' =>
'generic',
89 'PRODUCTDESC' =>
'product',
90 'DETAILS' =>
'product',
104foreach ($modules as $const => $desc) {
105 if ($action ==
'enable_'.strtolower($const)) {
109 if ($const ==
'PRODUCTDESC' &&
getDolGlobalInt(
'PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) {
113 if ($action ==
'disable_'.strtolower($const)) {
118if (
GETPOST(
'action') ==
'enable_specialchar') {
121if (
GETPOST(
'action') ==
'disable_specialchar') {
125if (
GETPOST(
'action',
'aZ09') ==
'setbackend') {
126 $newbackend =
GETPOST(
'editorbackend',
'aZ09');
127 if (in_array($newbackend, array(
'ckeditor',
'tinymce'),
true)) {
132 dol_syslog(
"admin/fckeditor.php: failed to save FCKEDITOR_EDITORNAME=".$newbackend.
": ".
$db->lasterror(), LOG_ERR);
136 dol_syslog(
"admin/fckeditor.php: invalid editor backend value: ".$newbackend, LOG_WARNING);
144 $fckeditor_test =
GETPOST(
'formtestfield',
'restricthtml');
145 if (!empty($fckeditor_test)) {
156 } elseif ($error == -1) {
157 setEventMessages($langs->trans(
"EmptyMessageNotAllowedError"),
null,
'warnings');
168llxHeader(
'',
'',
'',
'', 0, 0,
'',
'',
'',
'mod-admin page-fckeditor');
170$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>';
172print
load_fiche_titre($langs->trans(
"AdvancedEditor"), $linkback,
'title_setup');
175if (empty(
$conf->use_javascript_ajax)) {
176 setEventMessages(
null, array($langs->trans(
"NotAvailable"), $langs->trans(
"JavascriptDisabled")),
'errors');
180 if (!in_array($currentbackend, array(
'ckeditor',
'tinymce'),
true)) {
181 $currentbackend =
'ckeditor';
184 print
'<table class="noborder centpercent">';
185 print
'<tr class="liste_titre">';
186 print
'<td colspan="2">'.$langs->trans(
"ActivateFCKeditor").
'</td>';
187 print
'<td class="center width100"></td>';
191 foreach ($modules as $const => $desc) {
193 if (!$conditions[$const]) {
197 $constante =
'FCKEDITOR_ENABLE_'.$const;
198 print
'<!-- constant = '.$constante.
' -->'.
"\n";
199 print
'<tr class="oddeven">';
200 print
'<td class="width20">'.img_object(
"", $picto[$const]).
'</td>';
202 print $langs->trans($desc);
203 if ($const ==
'DETAILS') {
204 print $form->textwithpicto(
'',
'<span class="warning">'.$langs->trans(
"FCKeditorForProductDetails2").
'</span>');
207 print
'<td class="center centpercent width100">';
210 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=enable_'.strtolower($const).
'&token='.newToken().
'">'.
img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
211 } elseif ($value == 1) {
212 if ($const ==
'DETAILS') {
213 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>';
215 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=disable_'.strtolower($const).
'&token='.newToken().
'">'.
img_picto($langs->trans(
"Enabled"),
'switch_on').
'</a>';
223 print
'</table>'.
"\n";
230 print
'<form name="formeditorbackend" method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
231 print
'<input type="hidden" name="token" value="'.newToken().
'">';
232 print
'<input type="hidden" name="action" value="setbackend">';
233 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
234 print
'<input type="hidden" name="page_y" value="">';
236 print
'<table class="noborder centpercent">';
237 print
'<tr class="liste_titre">';
238 print
'<td>'.$langs->trans(
"Other").
'</td>';
244 print
'<tr class="oddeven">';
246 print $langs->trans(
"EditorBackend");
248 print
'<td class="right">';
249 $arrayofeditor = array(
250 'ckeditor' => array(
'label' =>
'CKEditor 4'),
251 'tinymce' => array(
'label' =>
'TinyMCE ('.$langs->trans(
"Experimental").
')',
'data-html' =>
'TinyMCE <span class="opacitymedium">('.$langs->trans(
"Experimental").
')</span>')
253 print $form->selectarray(
"editorbackend", $arrayofeditor, $currentbackend);
254 print
' '.$form->textwithpicto(
'', $langs->trans(
"EditorBackendHelp"));
256 print
'<td class="center width100"><input type="submit" class="button smallpaddingimp reposition" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'"></td>';
260 $constante =
'FCKEDITOR_ENABLE_SPECIALCHAR';
261 print
'<!-- constant = '.$constante.
' -->'.
"\n";
262 print
'<tr class="oddeven">';
264 print $langs->trans(
'SpecialCharActivation');
266 print
'<td class="center width100" colspan="2">';
269 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=enable_specialchar&token='.newToken().
'">'.
img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
270 } elseif ($value == 1) {
271 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=disable_specialchar&token='.newToken().
'">'.
img_picto($langs->trans(
"Enabled"),
'switch_on').
'</a>';
277 print
'</table>'.
"\n";
279 print
'</form>'.
"\n";
281 print
'<br><br><br>'.
"\n";
284 print
'<form name="formtest" method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
285 print
'<input type="hidden" name="token" value="'.newToken().
'">';
286 print
'<input type="hidden" name="page_y" value="">';
292 $listofmodes = array(
'dolibarr_readonly' =>
'ReadOnly',
'dolibarr_details' =>
'DetailOfLines',
'dolibarr_notes' =>
'Notes',
'dolibarr_mailings' =>
'Emails',
'Full' =>
'AllFeatures',
'Full_inline' =>
'EditInLine');
294 foreach ($listofmodes as $newmode => $newmodelabel) {
296 $linkstomode =
'<span class="opacitymedium">'.$langs->trans(
"Mode").
': </span>';
298 $linkstomode .=
'<a class="a-selection'.($mode != $newmode ?
'-disabled' :
'').
' marginleftonly marginrightonly reposition nounderline" href="'.$_SERVER[
"PHP_SELF"].
'?mode='.$newmode.
'">';
299 $linkstomode .= $langs->trans($newmodelabel);
300 $linkstomode .=
'</a>';
303 print
'<input type="hidden" name="mode" value="'.dol_escape_htmltag($mode).
'">';
304 if ($mode !=
'Full_inline') {
305 $uselocalbrowser =
true;
306 $readonly = ($mode ==
'dolibarr_readonly' ? 1 : 0);
307 $editor =
new DolEditor(
'formtestfield',
getDolGlobalString(
'FCKEDITOR_TEST',
'Test'),
'', 200, $mode,
'In',
true, $uselocalbrowser, 1, 120,
'8', $readonly);
311 print
'<div style="border: 1px solid #888;" contenteditable="true">';
315 print $form->buttonsSaveCancel(
"Save",
'', array(), 0,
'reposition');
316 print
'<div id="divforlog"></div>';
317 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.
Class to manage a WYSIWYG editor.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.