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

New: Support the mode readonly of ckeditor

parent e24fb9f4
No related branches found
No related tags found
No related merge requests found
......@@ -1004,7 +1004,7 @@ else
{
// Editeur wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('body',$object->body,'',320,'dolibarr_readonly','',false,true,empty($conf->global->FCKEDITOR_ENABLE_MAILING)?0:1,20,70);
$doleditor=new DolEditor('body',$object->body,'',320,'dolibarr_readonly','',false,true,empty($conf->global->FCKEDITOR_ENABLE_MAILING)?0:1,20,120,1);
$doleditor->Create();
}
else print dol_htmlentitiesbr($object->body);
......@@ -1130,7 +1130,7 @@ else
print '<td colspan="3">';
// Editeur wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('body',$object->body,'',320,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,70);
$doleditor=new DolEditor('body',$object->body,'',320,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,120);
$doleditor->Create();
print '</td></tr>';
......
......@@ -42,6 +42,7 @@ class DolEditor
var $cols;
var $height;
var $width;
var $readonly;
/**
......@@ -60,8 +61,9 @@ class DolEditor
* @param int $okforextendededitor True=Allow usage of extended editor tool (like fckeditor)
* @param int $rows Size of rows for textarea tool
* @param int $cols Size of cols for textarea tool
* @param int $readOnly 0=Read/Edit, 1=Read only
*/
function __construct($htmlname,$content,$width='',$height=200,$toolbarname='Basic',$toolbarlocation='In',$toolbarstartexpanded=false,$uselocalbrowser=true,$okforextendededitor=true,$rows=0,$cols=0)
function __construct($htmlname,$content,$width='',$height=200,$toolbarname='Basic',$toolbarlocation='In',$toolbarstartexpanded=false,$uselocalbrowser=true,$okforextendededitor=true,$rows=0,$cols=0,$readonly=0)
{
global $conf,$langs;
......@@ -75,6 +77,7 @@ class DolEditor
$defaulteditor='ckeditor';
$this->tool=empty($conf->global->FCKEDITOR_EDITORNAME)?$defaulteditor:$conf->global->FCKEDITOR_EDITORNAME;
$this->uselocalbrowser=$uselocalbrowser;
$this->readonly=$readonly;
// Check if extended editor is ok. If not we force textarea
if (empty($conf->fckeditor->enabled) || ! $okforextendededitor) $this->tool = 'textarea';
......@@ -156,6 +159,7 @@ class DolEditor
if (in_array($this->tool,array('textarea','ckeditor')))
{
$found=1;
//$out.= '<textarea id="'.$this->htmlname.'" name="'.$this->htmlname.'" rows="'.$this->rows.'" cols="'.$this->cols.'"'.($this->readonly?' disabled="disabled"':'').' class="flat">';
$out.= '<textarea id="'.$this->htmlname.'" name="'.$this->htmlname.'" rows="'.$this->rows.'" cols="'.$this->cols.'" class="flat">';
$out.= $this->content;
$out.= '</textarea>';
......@@ -177,7 +181,9 @@ class DolEditor
/* should be editor=CKEDITOR.replace but what if serveral editors ? */
CKEDITOR.replace(\''.$this->htmlname.'\',
{
/* property:xxx is same than CKEDITOR.config.property = xxx */
customConfig : ckeditorConfig,
readOnly : '.($this->readonly?'true':'false').',
htmlEncodeOutput :'.$htmlencode_force.',
toolbar: \''.$this->toolbarname.'\',
toolbarStartupExpanded: '.($this->toolbarstartexpanded ? 'true' : 'false').',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment