diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index 95a8e8fed386473dd7ed7dba781521eb6b4fdfef..62f70d0d824c10a27ce0627fbf723d2ac520ab4d 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -26,6 +26,8 @@ * \version $Revision$ */ +if (! defined('REQUIRE_CKEDITOR')) define('REQUIRE_CKEDITOR','1'); + require("../main.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); @@ -154,9 +156,11 @@ foreach($modules as $const => $desc) print '</tr>'; } -print '</table>'; +print '</table>'."\n"; -print '<br>'; + +print '<br>'."\n"; +print '<!-- Editor name = '.$conf->global->FCKEDITOR_EDITORNAME.' -->'; print_fiche_titre($langs->trans("TestSubmitForm"),'',''); print '<form name="formtest" method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n"; $editor=new DolEditor('formtestfield',isset($conf->global->FCKEDITOR_TEST)?$conf->global->FCKEDITOR_TEST:'Test',200,'dolibarr_notes','In', true); diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index b8354daebeab02c7f5090d33ef09cadace1c4f38..100b150630a635ff3d621ef2f086358a3ce9f4bf 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -29,8 +29,6 @@ * \version $Id$ */ -if (! defined('REQUIRE_CKEDITOR')) define('REQUIRE_CKEDITOR','1'); - require("../main.inc.php"); require_once(DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'); require_once(DOL_DOCUMENT_ROOT."/includes/modules/propale/modules_propale.php"); @@ -974,7 +972,7 @@ if ($id > 0 || ! empty($ref)) * Show object in view mode */ - if ($mesg) + if ($mesg) { if (! preg_match('/div class=/',$mesg)) print '<div class="ok">'.$mesg.'</div><br>'; else print $mesg."<br>"; diff --git a/htdocs/lib/doleditor.class.php b/htdocs/lib/doleditor.class.php index 589d1e720d047afbdc08b71be55975d0e6bcd9ef..52aa96d57828653b0155a821a25e9a59f6f464f4 100644 --- a/htdocs/lib/doleditor.class.php +++ b/htdocs/lib/doleditor.class.php @@ -66,10 +66,11 @@ class DolEditor dol_syslog("DolEditor::DolEditor htmlname=".$htmlname." tool=".$tool); - $this->tool='fckeditor'; // By default + // Name of extended editor to use + $this->tool=empty($conf->global->FCKEDITOR_EDITORNAME)?'fckeditor':$conf->global->FCKEDITOR_EDITORNAME; - // Check fckeditor is ok - if ($this->tool == 'fckeditor' && (empty($conf->fckeditor->enabled) || ! $okforextandededitor || $conf->global->MAIN_USE_CKEDITOR)) + // Check if extended editor is ok. If not we force textarea + if (empty($conf->fckeditor->enabled) || ! $okforextandededitor) { $this->tool = 'textarea'; } @@ -105,7 +106,8 @@ class DolEditor $this->editor->Config['SkinPath'] = DOL_URL_ROOT.'/theme/'.$conf->theme.'/fckeditor/'; } } - if ($this->tool == 'textarea') + + if (in_array($this->tool,array('textarea','ckeditor'))) { $this->content = $content; $this->htmlname = $htmlname; @@ -114,6 +116,7 @@ class DolEditor $this->height = $height; $this->width = 600; } + } @@ -123,7 +126,7 @@ class DolEditor function Create() { global $conf; - + $found=0; if ($this->tool == 'fckeditor') @@ -131,16 +134,15 @@ class DolEditor $found=1; $this->editor->Create(); } - if ($this->tool == 'textarea') + if (in_array($this->tool,array('textarea','ckeditor'))) { $found=1; $cssclass='flat'; - //if ($conf->global->MAIN_USE_CKEDITOR) $cssclass='ckeditor'; print '<textarea id="'.$this->htmlname.'" name="'.$this->htmlname.'" rows="'.$this->rows.'" cols="'.$this->cols.'" class="'.$cssclass.'">'; print $this->content; print '</textarea>'; - - if ($conf->global->MAIN_USE_CKEDITOR) + + if ($this->tool == 'ckeditor') { print '<script type="text/javascript">'; print 'CKEDITOR.replace(\''.$this->htmlname.'\', { toolbar: \'Basic\', width: '.$this->width.', height: '.$this->height.', toolbarStartupExpanded: false });'; @@ -150,7 +152,7 @@ class DolEditor if (empty($found)) { - print 'Error, unknown value for tool in DolEditor constructor.'; + print 'Error, unknown value for tool '.$this->tool.' in DolEditor Create function.'; } }