29require
'../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/doleditor.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
35$langs->loadLangs(array(
'admin',
'fckeditor',
'errors'));
37$action =
GETPOST(
'action',
'aZ09');
44$mode =
GETPOST(
'mode') ?
GETPOST(
'mode',
'alpha') :
'dolibarr_notes';
52 'NOTE_PUBLIC' =>
'FCKeditorForNotePublic',
53 'NOTE_PRIVATE' =>
'FCKeditorForNotePrivate',
54 'SOCIETE' =>
'FCKeditorForCompany',
56 'DETAILS' =>
'FCKeditorForProductDetails',
57 'USERSIGN' =>
'FCKeditorForUserSignature',
58 'MAILING' =>
'FCKeditorForMailing',
59 'MAIL' =>
'FCKeditorForMail',
60 'TICKET' =>
'FCKeditorForTicket',
61 'SPECIALCHAR' =>
'SpecialCharActivation',
68 'PRODUCTDESC' => (isModEnabled(
"product") || isModEnabled(
"service")),
69 'DETAILS' => (isModEnabled(
'invoice') || isModEnabled(
"propal") || isModEnabled(
'order') || isModEnabled(
'supplier_proposal') || isModEnabled(
"supplier_order") || isModEnabled(
"supplier_invoice")),
71 'MAILING' => isModEnabled(
'mailing'),
72 'MAIL' => (isModEnabled(
'invoice') || isModEnabled(
"propal") || isModEnabled(
'order')),
73 'TICKET' => isModEnabled(
'ticket'),
78 'NOTE_PUBLIC' =>
'generic',
79 'NOTE_PRIVATE' =>
'generic',
80 'SOCIETE' =>
'generic',
81 'PRODUCTDESC' =>
'product',
82 'DETAILS' =>
'product',
87 'SPECIALCHAR' =>
'generic'
96foreach ($modules as $const => $desc) {
97 if ($action ==
'enable_'.strtolower($const)) {
98 dolibarr_set_const($db,
"FCKEDITOR_ENABLE_".$const,
"1",
'chaine', 0,
'', $conf->entity);
101 if ($const ==
'PRODUCTDESC' &&
getDolGlobalInt(
'PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) {
102 dolibarr_set_const($db,
"FCKEDITOR_ENABLE_DETAILS",
"1",
'chaine', 0,
'', $conf->entity);
105 if ($action ==
'disable_'.strtolower($const)) {
106 dolibarr_set_const($db,
"FCKEDITOR_ENABLE_".$const,
"0",
'chaine', 0,
'', $conf->entity);
113 $fckeditor_skin =
GETPOST(
'fckeditor_skin',
'alpha');
114 if (!empty($fckeditor_skin)) {
115 $result =
dolibarr_set_const($db,
'FCKEDITOR_SKIN', $fckeditor_skin,
'chaine', 0,
'', $conf->entity);
123 $fckeditor_test =
GETPOST(
'formtestfield',
'restricthtml');
124 if (!empty($fckeditor_test)) {
125 $result =
dolibarr_set_const($db,
'FCKEDITOR_TEST', $fckeditor_test,
'chaine', 0,
'', $conf->entity);
135 } elseif ($error == -1) {
136 setEventMessages($langs->trans(
"EmptyMessageNotAllowedError"),
null,
'warnings');
138 setEventMessages($langs->trans(
"Error").
' '.$db->lasterror(),
null,
'errors');
147llxHeader(
'',
'',
'',
'', 0, 0,
'',
'',
'',
'mod-admin page-fckeditor');
149$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
150print
load_fiche_titre($langs->trans(
"AdvancedEditor"), $linkback,
'title_setup');
153if (empty($conf->use_javascript_ajax)) {
154 setEventMessages(array($langs->trans(
"NotAvailable"), $langs->trans(
"JavascriptDisabled")),
null,
'errors');
156 print
'<table class="noborder centpercent">';
157 print
'<tr class="liste_titre">';
158 print
'<td colspan="2">'.$langs->trans(
"ActivateFCKeditor").
'</td>';
159 print
'<td class="center" width="100">'.$langs->trans(
"Action").
'</td>';
163 foreach ($modules as $const => $desc) {
165 if (!$conditions[$const]) {
169 $constante =
'FCKEDITOR_ENABLE_'.$const;
170 print
'<!-- constant = '.$constante.
' -->'.
"\n";
171 print
'<tr class="oddeven">';
172 print
'<td class="width20">'.img_object(
"", $picto[$const]).
'</td>';
174 print $langs->trans($desc);
175 if ($const ==
'DETAILS') {
176 print
'<br><span class="warning">'.$langs->trans(
"FCKeditorForProductDetails2").
'</span>';
179 print
'<td class="center centpercent width100">';
182 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=enable_'.strtolower($const).
'&token='.
newToken().
'">'.
img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
183 } elseif ($value == 1) {
184 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=disable_'.strtolower($const).
'&token='.
newToken().
'">'.
img_picto($langs->trans(
"Enabled"),
'switch_on').
'</a>';
191 print
'</table>'.
"\n";
195 print
'<form name="formtest" method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
196 print
'<input type="hidden" name="token" value="'.newToken().
'">';
197 print
'<input type="hidden" name="page_y" value="">';
203 $listofmodes = array(
'dolibarr_mailings',
'dolibarr_notes',
'dolibarr_details',
'dolibarr_readonly',
'Full',
'Full_inline');
205 foreach ($listofmodes as $newmode) {
207 $linkstomode .=
' - ';
209 $linkstomode .=
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?mode='.$newmode.
'">';
210 if ($mode == $newmode) {
211 $linkstomode .=
'<strong>';
213 $linkstomode .= $newmode;
214 if ($mode == $newmode) {
215 $linkstomode .=
'</strong>';
217 $linkstomode .=
'</a>';
221 print
'<input type="hidden" name="mode" value="'.dol_escape_htmltag($mode).
'">';
222 if ($mode !=
'Full_inline') {
223 $uselocalbrowser =
true;
224 $readonly = ($mode ==
'dolibarr_readonly' ? 1 : 0);
225 $editor =
new DolEditor(
'formtestfield',
getDolGlobalString(
'FCKEDITOR_TEST',
'Test'),
'', 200, $mode,
'In',
true, $uselocalbrowser, 1, 120, 8, $readonly);
229 print
'<div style="border: 1px solid #888;" contenteditable="true">';
233 print $form->buttonsSaveCancel(
"Save",
'',
null, 0,
'reposition');
234 print
'<div id="divforlog"></div>';
235 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).
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage a WYSIWYG editor.
show_skin($fuser, $edit=0)
Show list of ckeditor's themes.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.