New: Support the mode readonly of ckeditor
This commit is contained in:
parent
e24fb9f48a
commit
20c9370690
@ -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').',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user