Enhancement to allow other editor than fckeditor
This commit is contained in:
parent
50558c334d
commit
ec8870cf16
@ -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");
|
||||
@ -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>";
|
||||
|
||||
@ -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.';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user