Go to the documentation of this file.
28 require
'../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/lib/doleditor.lib.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
34 $langs->loadLangs(array(
'admin',
'fckeditor'));
36 $action =
GETPOST(
'action',
'aZ09');
43 $mode =
GETPOST(
'mode') ?
GETPOST(
'mode',
'alpha') :
'dolibarr_notes';
51 'NOTE_PUBLIC' =>
'FCKeditorForNotePublic',
52 'NOTE_PRIVATE' =>
'FCKeditorForNotePrivate',
53 'SOCIETE' =>
'FCKeditorForCompany',
55 'DETAILS' =>
'FCKeditorForProductDetails',
56 'USERSIGN' =>
'FCKeditorForUserSignature',
57 'MAILING' =>
'FCKeditorForMailing',
58 'MAIL' =>
'FCKeditorForMail',
59 'TICKET' =>
'FCKeditorForTicket',
75 'NOTE_PUBLIC' =>
'generic',
76 'NOTE_PRIVATE' =>
'generic',
77 'SOCIETE' =>
'generic',
78 'PRODUCTDESC' =>
'product',
79 'DETAILS' =>
'product',
92 foreach ($modules as $const => $desc) {
93 if ($action ==
'enable_'.strtolower($const)) {
94 dolibarr_set_const($db,
"FCKEDITOR_ENABLE_".$const,
"1",
'chaine', 0,
'', $conf->entity);
96 if ($const ==
'PRODUCTDESC' &&
getDolGlobalInt(
'PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) {
97 dolibarr_set_const($db,
"FCKEDITOR_ENABLE_DETAILS",
"1",
'chaine', 0,
'', $conf->entity);
99 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
102 if ($action ==
'disable_'.strtolower($const)) {
103 dolibarr_set_const($db,
"FCKEDITOR_ENABLE_".$const,
"0",
'chaine', 0,
'', $conf->entity);
104 header(
"Location: ".$_SERVER[
"PHP_SELF"]);
109 if (
GETPOST(
'save',
'alpha')) {
112 $fckeditor_skin =
GETPOST(
'fckeditor_skin',
'alpha');
113 if (!empty($fckeditor_skin)) {
114 $result =
dolibarr_set_const($db,
'FCKEDITOR_SKIN', $fckeditor_skin,
'chaine', 0,
'', $conf->entity);
122 $fckeditor_test =
GETPOST(
'formtestfield',
'restricthtml');
123 if (!empty($fckeditor_test)) {
124 $result =
dolibarr_set_const($db,
'FCKEDITOR_TEST', $fckeditor_test,
'chaine', 0,
'', $conf->entity);
135 setEventMessages($langs->trans(
"Error").
' '.$db->lasterror(),
null,
'errors');
145 $linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
146 print
load_fiche_titre($langs->trans(
"AdvancedEditor"), $linkback,
'title_setup');
149 if (empty($conf->use_javascript_ajax)) {
150 setEventMessages(array($langs->trans(
"NotAvailable"), $langs->trans(
"JavascriptDisabled")),
null,
'errors');
152 print
'<table class="noborder centpercent">';
153 print
'<tr class="liste_titre">';
154 print
'<td colspan="2">'.$langs->trans(
"ActivateFCKeditor").
'</td>';
155 print
'<td class="center" width="100">'.$langs->trans(
"Action").
'</td>';
159 foreach ($modules as $const => $desc) {
161 if (!$conditions[$const]) {
165 $constante =
'FCKEDITOR_ENABLE_'.$const;
166 print
'<!-- constant = '.$constante.
' -->'.
"\n";
167 print
'<tr class="oddeven">';
168 print
'<td class="width20">'.img_object(
"", $picto[$const]).
'</td>';
170 print $langs->trans($desc);
171 if ($const ==
'DETAILS') {
172 print
'<br><span class="warning">'.$langs->trans(
"FCKeditorForProductDetails2").
'</span>';
175 print
'<td class="center centpercent width100">';
176 $value = (isset($conf->global->$constante) ? $conf->global->$constante : 0);
178 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=enable_'.strtolower($const).
'&token='.
newToken().
'">'.
img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
179 } elseif ($value == 1) {
180 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=disable_'.strtolower($const).
'&token='.
newToken().
'">'.
img_picto($langs->trans(
"Enabled"),
'switch_on').
'</a>';
187 print
'</table>'.
"\n";
191 print
'<form name="formtest" method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
192 print
'<input type="hidden" name="token" value="'.newToken().
'">';
193 print
'<input type="hidden" name="page_y" value="">';
199 $listofmodes = array(
'dolibarr_mailings',
'dolibarr_notes',
'dolibarr_details',
'dolibarr_readonly',
'Full',
'Full_inline');
201 foreach ($listofmodes as $newmode) {
203 $linkstomode .=
' - ';
205 $linkstomode .=
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?mode='.$newmode.
'">';
206 if ($mode == $newmode) {
207 $linkstomode .=
'<strong>';
209 $linkstomode .= $newmode;
210 if ($mode == $newmode) {
211 $linkstomode .=
'</strong>';
213 $linkstomode .=
'</a>';
217 print
'<input type="hidden" name="mode" value="'.dol_escape_htmltag($mode).
'">';
218 if ($mode !=
'Full_inline') {
219 $uselocalbrowser =
true;
220 $readonly = ($mode ==
'dolibarr_readonly' ? 1 : 0);
221 $editor =
new DolEditor(
'formtestfield', isset($conf->global->FCKEDITOR_TEST) ? $conf->global->FCKEDITOR_TEST :
'Test',
'', 200, $mode,
'In',
true, $uselocalbrowser, 1, 120, 8, $readonly);
224 print
'<div style="border: 1px solid #888;" contenteditable="true">';
225 print $conf->global->FCKEDITOR_TEST;
228 print
$form->buttonsSaveCancel(
"Save",
'',
null, 0,
'reposition');
229 print
'<div id="divforlog"></div>';
230 print
'</form>'.
"\n";
show_skin($fuser, $edit=0)
Show list of ckeditor's themes.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
isModEnabled($module)
Is Dolibarr module enabled.
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).
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
Class to manage a WYSIWYG editor.