Skip to content
Snippets Groups Projects
Commit ec8870cf authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Enhancement to allow other editor than fckeditor

parent 50558c33
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
......@@ -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");
......
......@@ -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;
}
}
......@@ -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.';
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment