2012-11-12 11:37:09 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* class.wysiwygEditor.php
|
|
|
|
|
*
|
|
|
|
|
* @package gulliver.system
|
|
|
|
|
*
|
|
|
|
|
* ProcessMaker Open Source Edition
|
|
|
|
|
* Copyright (C) 2004 - 2012 Colosa Inc.
|
|
|
|
|
*
|
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*
|
|
|
|
|
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
|
|
|
|
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
//XmlForm_Field_DVEditor
|
|
|
|
|
/**
|
|
|
|
|
* XmlForm_Field_HTML class definition
|
|
|
|
|
* It is useful to see dynaforms how are built
|
|
|
|
|
*
|
|
|
|
|
* @package gulliver.system
|
|
|
|
|
* @author
|
|
|
|
|
*
|
|
|
|
|
* @copyright (C) 2012 by Colosa Development Team.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
class XmlForm_Field_WYSIWYG_EDITOR extends XmlForm_Field
|
|
|
|
|
{
|
|
|
|
|
//public $toolbarSet = '';
|
|
|
|
|
public $width = '100%';
|
|
|
|
|
public $height = '300';
|
|
|
|
|
public $defaultValue = '<br/>';
|
|
|
|
|
public $editorType = '';
|
|
|
|
|
/**
|
2012-11-20 09:07:40 -04:00
|
|
|
* render function returns the HTML definition for the Dynaform Field
|
2012-11-12 11:37:09 -04:00
|
|
|
*
|
|
|
|
|
* @author
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* @access public
|
|
|
|
|
* @param string $value
|
|
|
|
|
* @param string $owner
|
|
|
|
|
* @return string
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
public function render ($value, $owner = null)
|
|
|
|
|
{
|
2012-11-14 12:53:49 +00:00
|
|
|
$value = ($value == '') ? '<br/>' : $value;
|
|
|
|
|
$html = "<textArea class='tmceEditor' id='form[" . $this->name . "]' name='form[" . $this->name . "]' >" . htmlentities( $value, ENT_QUOTES, 'UTF-8' ) . "</textarea>";
|
2012-11-12 11:37:09 -04:00
|
|
|
return $html;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2012-11-20 09:07:40 -04:00
|
|
|
* attachEvents method returns some javascript code in order to initialize
|
|
|
|
|
* the Dynaform Field configuration, attributes, and additional stuff.
|
2012-11-14 12:53:49 +00:00
|
|
|
*
|
2012-11-12 11:37:09 -04:00
|
|
|
* @author
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* @access public
|
|
|
|
|
* @param string $element
|
|
|
|
|
* @return string
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
public function attachEvents ($element)
|
|
|
|
|
{
|
|
|
|
|
//cleaning the conflictive prototype functions
|
2012-11-20 09:07:40 -04:00
|
|
|
$editorDefinition = 'tinyMCE.baseURL = "/js/tinymce/jscripts/tiny_mce"';
|
2012-11-12 11:37:09 -04:00
|
|
|
switch ($this->editorType){
|
|
|
|
|
case 'EMAIL_TEMPLATE':
|
|
|
|
|
$editorDefinition = '
|
2012-11-15 16:06:53 +00:00
|
|
|
tinyMCE.init({
|
|
|
|
|
theme : "advanced",
|
|
|
|
|
plugins : "fullpage",
|
|
|
|
|
mode : "specific_textareas",
|
|
|
|
|
editor_selector : "tmceEditor",
|
|
|
|
|
width : 760,
|
|
|
|
|
height : "'.$this->height.'",
|
|
|
|
|
theme_advanced_buttons3_add : "fullpage",
|
2012-11-16 20:13:09 +00:00
|
|
|
|
2012-11-15 16:06:53 +00:00
|
|
|
onchange_callback: function(inst) {
|
|
|
|
|
if(inst.isDirty()) {
|
|
|
|
|
inst.save();
|
|
|
|
|
}
|
|
|
|
|
return true;
|
2012-11-15 15:49:10 -04:00
|
|
|
},
|
|
|
|
|
handle_event_callback : function(e) {
|
2012-11-15 16:06:53 +00:00
|
|
|
if(this.isDirty()) {
|
|
|
|
|
this.save();
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
});
|
2012-11-12 11:37:09 -04:00
|
|
|
';
|
|
|
|
|
break;
|
|
|
|
|
case 'OUTPUT_DOCUMENT':
|
2012-11-15 13:07:06 -04:00
|
|
|
|
2012-11-19 20:48:57 +00:00
|
|
|
$editorDefinition = '
|
2012-11-15 13:07:06 -04:00
|
|
|
tinyMCE.baseURL = "/js/tinymce/jscripts/tiny_mce"
|
|
|
|
|
tinyMCE.init({
|
2012-11-19 20:48:57 +00:00
|
|
|
theme : "advanced",
|
|
|
|
|
plugins : "fullpage, pmSimpleUploader, pmVariablePicker",
|
|
|
|
|
mode : "specific_textareas",
|
|
|
|
|
editor_selector : "tmceEditor",
|
|
|
|
|
width : "770",
|
|
|
|
|
height : "305",
|
2012-11-20 09:07:40 -04:00
|
|
|
theme_advanced_buttons1 : "pmSimpleUploader,|,pmVariablePicker",
|
|
|
|
|
theme_advanced_buttons2 : "fontselect,bold,italic,underline,forecolor,backcolor,|,justifyleft,justifycenter,justifyright,justifyfull,|,link,numlist,bullist,|,code",
|
2012-11-19 20:48:57 +00:00
|
|
|
onchange_callback: function(inst) {
|
2012-11-20 09:07:40 -04:00
|
|
|
if(inst.isDirty()) {
|
|
|
|
|
inst.save();
|
|
|
|
|
}
|
|
|
|
|
return true;
|
2012-11-19 20:48:57 +00:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
';
|
2012-11-12 11:37:09 -04:00
|
|
|
break;
|
2012-11-19 20:48:57 +00:00
|
|
|
|
2012-11-12 11:37:09 -04:00
|
|
|
case 'DYNAFORM_TEMPLATE':
|
2012-11-14 12:53:49 +00:00
|
|
|
$editorDefinition = '
|
|
|
|
|
tinyMCE.init({
|
2012-11-15 15:49:10 -04:00
|
|
|
theme : "advanced",
|
|
|
|
|
plugins : "advhr,advimage,advlink,advlist,autolink,autoresize,autosave,bbcode,contextmenu,directionality,emotions,example,example_dependency,fullpage,fullscreen,iespell,inlinepopups,insertdatetime,layer,legacyoutput,lists,media,nonbreaking,noneditable,pagebreak,paste,preview,print,save,searchreplace,spellchecker,style,tabfocus,table,template,visualblocks,visualchars,wordcount,xhtmlxtras",
|
|
|
|
|
mode : "specific_textareas",
|
|
|
|
|
//apply_source_formatting : true,
|
|
|
|
|
//remove_linebreaks: false,
|
|
|
|
|
editor_selector : "tmceEditor",
|
|
|
|
|
width : "700",
|
|
|
|
|
height : "300",
|
|
|
|
|
theme_advanced_buttons1 : "bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,fontselect,fontsizeselect,|,cut,copy,paste,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo",
|
|
|
|
|
theme_advanced_buttons2 : "link,unlink,image,|,forecolor,backcolor,|,hr,removeformat,visualaid,|,sub,sup,|,ltr,rtl,|,code",//,|,insertimage",
|
2012-11-15 16:06:53 +00:00
|
|
|
|
2012-11-15 15:49:10 -04:00
|
|
|
skin : "o2k7",
|
|
|
|
|
skin_variant : "silver",
|
2012-11-15 16:06:53 +00:00
|
|
|
|
2012-11-15 15:49:10 -04:00
|
|
|
template_external_list_url : "js/template_list.js",
|
|
|
|
|
external_link_list_url : "js/link_list.js",
|
|
|
|
|
external_image_list_url : "js/image_list.js",
|
|
|
|
|
media_external_list_url : "js/media_list.js",
|
2012-11-14 12:53:49 +00:00
|
|
|
|
2012-11-15 15:49:10 -04:00
|
|
|
template_replace_values : {
|
|
|
|
|
username : "Some User",
|
|
|
|
|
staffid : "991234"
|
|
|
|
|
},
|
|
|
|
|
handle_event_callback : function(e) {
|
|
|
|
|
if(this.isDirty()) {
|
|
|
|
|
this.save();
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2012-11-14 12:53:49 +00:00
|
|
|
});
|
2012-11-20 09:07:40 -04:00
|
|
|
alert("new");
|
|
|
|
|
alert(tinyMCE.execCommand("mceRmoveControl", false, "form[HTML]"));
|
2012-11-14 12:53:49 +00:00
|
|
|
';
|
2012-11-12 11:37:09 -04:00
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
$editorDefinition = '
|
2012-11-14 12:53:49 +00:00
|
|
|
tinyMCE.init({
|
|
|
|
|
theme : "advanced",
|
2012-11-12 11:37:09 -04:00
|
|
|
plugins : "fullpage",
|
|
|
|
|
mode : "specific_textareas",
|
|
|
|
|
editor_selector : "tmceEditor",
|
2012-11-14 09:39:24 -04:00
|
|
|
width : "'. $this->width. '",
|
|
|
|
|
height : "'. $this->height. '",
|
2012-11-20 09:07:40 -04:00
|
|
|
theme_advanced_buttons3_add : "fullpage",
|
|
|
|
|
handle_event_callback : function(e) {
|
|
|
|
|
if(this.isDirty()) {
|
|
|
|
|
this.save();
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2012-11-12 11:37:09 -04:00
|
|
|
});
|
|
|
|
|
';
|
|
|
|
|
break;
|
2012-11-14 12:53:49 +00:00
|
|
|
}
|
|
|
|
|
|
2012-11-12 11:37:09 -04:00
|
|
|
return $editorDefinition;
|
|
|
|
|
}
|
2012-11-15 13:07:06 -04:00
|
|
|
}
|