Fix: call ckeditor class if needed by doleditor function
This commit is contained in:
parent
ef8119a70b
commit
e1e6629043
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
|
||||
/* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -26,8 +26,6 @@
|
||||
* \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");
|
||||
|
||||
@ -43,6 +43,7 @@ class DolEditor
|
||||
var $rows;
|
||||
var $cols;
|
||||
var $height;
|
||||
var $width;
|
||||
|
||||
|
||||
/**
|
||||
@ -60,17 +61,17 @@ class DolEditor
|
||||
* @param rows Size of rows for textarea tool
|
||||
* @param cols Size of cols for textarea tool
|
||||
*/
|
||||
function DolEditor($htmlname,$content,$height=200,$toolbarname='Basic',$toolbarlocation='In',$toolbarstartexpanded=false,$uselocalbrowser=true,$okforextandededitor=true,$rows=0,$cols=0)
|
||||
function DolEditor($htmlname,$content,$height=200,$toolbarname='Basic',$toolbarlocation='In',$toolbarstartexpanded=false,$uselocalbrowser=true,$okforextendededitor=true,$rows=0,$cols=0)
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
dol_syslog("DolEditor::DolEditor htmlname=".$htmlname." tool=".$tool);
|
||||
|
||||
// Name of extended editor to use
|
||||
$this->tool=empty($conf->global->FCKEDITOR_EDITORNAME)?'fckeditor':$conf->global->FCKEDITOR_EDITORNAME;
|
||||
$this->tool=empty($conf->global->MAIN_EXTENDED_EDITOR_NAME)?'fckeditor':$conf->global->MAIN_EXTENDED_EDITOR_NAME;
|
||||
|
||||
// Check if extended editor is ok. If not we force textarea
|
||||
if (empty($conf->fckeditor->enabled) || ! $okforextandededitor)
|
||||
if (empty($conf->fckeditor->enabled) || ! $okforextendededitor)
|
||||
{
|
||||
$this->tool = 'textarea';
|
||||
}
|
||||
@ -119,7 +120,6 @@ class DolEditor
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Output edit area inside the HTML stream
|
||||
*/
|
||||
@ -137,15 +137,18 @@ class DolEditor
|
||||
if (in_array($this->tool,array('textarea','ckeditor')))
|
||||
{
|
||||
$found=1;
|
||||
$cssclass='flat';
|
||||
print '<textarea id="'.$this->htmlname.'" name="'.$this->htmlname.'" rows="'.$this->rows.'" cols="'.$this->cols.'" class="'.$cssclass.'">';
|
||||
print '<textarea id="'.$this->htmlname.'" name="'.$this->htmlname.'" rows="'.$this->rows.'" cols="'.$this->cols.'" class="flat">';
|
||||
print $this->content;
|
||||
print '</textarea>';
|
||||
|
||||
if ($this->tool == 'ckeditor')
|
||||
{
|
||||
if (! defined('REQUIRE_CKEDITOR')) define('REQUIRE_CKEDITOR','1');
|
||||
|
||||
print '<script type="text/javascript">';
|
||||
print 'jQuery(document).ready(function () {';
|
||||
print 'CKEDITOR.replace(\''.$this->htmlname.'\', { toolbar: \'Basic\', width: '.$this->width.', height: '.$this->height.', toolbarStartupExpanded: false });';
|
||||
print '});';
|
||||
print '</script>';
|
||||
}
|
||||
}
|
||||
@ -158,5 +161,4 @@ class DolEditor
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@ -886,12 +886,6 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
|
||||
{
|
||||
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/jquery/plugins/layout/jquery.layout-latest'.$ext.'"></script>'."\n";
|
||||
}
|
||||
|
||||
// CKEditor
|
||||
if ($conf->global->MAIN_USE_CKEDITOR && defined('REQUIRE_CKEDITOR'))
|
||||
{
|
||||
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/ckeditor/ckeditor.js"></script>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Output module javascript
|
||||
@ -1572,6 +1566,12 @@ if (! function_exists("llxFooter"))
|
||||
|
||||
print "\n";
|
||||
if ($foot) print '<!-- '.$foot.' -->'."\n";
|
||||
|
||||
// CKEditor
|
||||
if (defined('REQUIRE_CKEDITOR'))
|
||||
{
|
||||
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/ckeditor/ckeditor.js"></script>'."\n";
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_HTML_FOOTER)) print $conf->global->MAIN_HTML_FOOTER."\n";
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user