Adding the wysiwyg class to the dynaform fields package

This commit is contained in:
user
2012-11-12 11:37:09 -04:00
parent bec3d5e740
commit 5c0c2d1d5f
7 changed files with 1714 additions and 322 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,135 @@
<?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 = '';
/**
* render function is drawing the dynaform
*
* @author
*
*
* @access public
* @param string $value
* @param string $owner
* @return string
*
*/
public function render ($value, $owner = null)
{
$value = ($value == '') ? '<br/>' : $value;
$html = "<textArea class='tmceEditor' id='form[" . $this->name . "]' name='form[" . $this->name . "]' >" . htmlentities( $value, ENT_QUOTES, 'UTF-8' ) . "</textarea>";
return $html;
}
/**
* attachEvents method executes javascript code in order to initialize
* the component configuration, attributes, and additional stuff.
*
* @author
*
*
* @access public
* @param string $element
* @return string
*
*/
public function attachEvents ($element)
{
//cleaning the conflictive prototype functions
$editorDefinition = '';
switch ($this->editorType){
case 'EMAIL_TEMPLATE':
$editorDefinition = '
// delete Array.prototype.toStr;
// delete Object.prototype.toStr;
// delete Object.prototype.concat;
// delete Object.prototype.get_by_key;
// delete Object.prototype.expand;
// delete Object.prototype.setParent;
// delete Object.prototype.isset_key;
tinyMCE.baseURL = "/js/tinymce/jscripts/tiny_mce"
tinyMCE.init({
theme : "advanced",
plugins : "fullpage",
mode : "specific_textareas",
editor_selector : "tmceEditor",
width : "640",
height : "300",
theme_advanced_buttons3_add : "fullpage"
});
';
break;
case 'OUTPUT_DOCUMENT':
$editorDefinition = 'alert("outputdoc")';
break;
case 'DYNAFORM_TEMPLATE':
$editorDefinition = 'alert("dynaform")';
break;
default:
$editorDefinition = '
// delete Array.prototype.toStr;
// delete Object.prototype.toStr;
// delete Object.prototype.concat;
// delete Object.prototype.get_by_key;
// delete Object.prototype.expand;
// delete Object.prototype.setParent;
// delete Object.prototype.isset_key;
tinyMCE.baseURL = "/js/tinymce/jscripts/tiny_mce"
tinyMCE.init({
theme : "advanced",
plugins : "fullpage",
mode : "specific_textareas",
editor_selector : "tmceEditor",
width : "640",
height : "300",
theme_advanced_buttons3_add : "fullpage"
});
';
break;
}
return $editorDefinition;
}
}

View File

@@ -91,6 +91,7 @@ class PmBootstrap extends Bootstrap
$this->autoloader->registerClass('menu', PATH_GULLIVER . 'class.menu');
$this->autoloader->registerClass('xmlMenu', PATH_GULLIVER . 'class.xmlMenu');
$this->autoloader->registerClass('dvEditor', PATH_GULLIVER . 'class.dvEditor');
$this->autoloader->registerClass('wysiwygEditor', PATH_GULLIVER . 'class.wysiwygEditor');
$this->autoloader->registerClass('Controller', PATH_GULLIVER . 'class.controller');
$this->autoloader->registerClass('HttpProxyController', PATH_GULLIVER . 'class.httpProxyController');
$this->autoloader->registerClass('PmException', PATH_GULLIVER . 'class.pmException');
@@ -147,6 +148,7 @@ class PmBootstrap extends Bootstrap
$oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'common/core/effects.js' );
$oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'common/core/webResource.js' );
$oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'dveditor/core/dveditor.js' );
$oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'tinymce/jscripts/tiny_mce/tiny_mce.js' );
$oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'common/tree/tree.js' );
$oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'json/core/json.js' );
$oHeadPublisher->addMaborakFile(PATH_GULLIVER_HOME . 'js' . PATH_SEP . 'form/core/form.js' );

View File

@@ -443,16 +443,50 @@ try {
}
$fcontent = file_get_contents( $sDirectory );
$extion = explode( ".", $_REQUEST['filename'] );
// $oHeadPublisher = &headPublisher::getSingleton();
// $oHeadPublisher->clearScripts();
// $oHeadPublisher->addScriptFile( '/js/tinymce/jscripts/tiny_mce/tiny_mce.js' );
// $jscriptCode .= '
//
//// var tmpArrToStr = Array.prototype.toStr;
//// var tmpObjToStr = Object.prototype.toStr;
//// var tmpObjConcat = Object.prototype.concat;
//// var tmpObjGetByKey = Object.prototype.get_by_key;
//// var tmpObjExpand = Object.prototype.expand;
//// var tmpObjSetParent = Object.prototype.setParent;
//// var tmpObjIsSetKey = Object.prototype.isset_key;
////
//// delete Array.prototype.toStr;
//// delete Object.prototype.toStr;
//// delete Object.prototype.concat;
//// delete Object.prototype.get_by_key;
//// delete Object.prototype.expand;
//// delete Object.prototype.setParent;
//// delete Object.prototype.isset_key;
//// alert ("hi");
//// document.body.onload = function(){
// alert ("hello");
// tinyMCE.baseURL = "/js/tinymce/jscripts/tiny_mce";
// tinyMCE.init({
// theme : "advanced",
// plugins : "fullpage",
// mode : "specific_textareas",
// editor_selector : "tmceEditor",
// width : "640",
// height : "300",
// theme_advanced_buttons3_add : "fullpage"
// });
//// alert ("goodbye");
//// }
// ';
// $oHeadPublisher->addScriptCode($jscriptCode);
$_REQUEST['fcontent'] = $fcontent;
//if($extion[count($extion)-1]=='html' || $extion[count($extion)-1]=='txt'){
$aData = Array ('pro_uid' => $_REQUEST['pro_uid'],'fcontent' => $fcontent,'filename' => $_REQUEST['filename']
);
$aData = Array ( 'pro_uid' => $_REQUEST['pro_uid'],'fcontent' => $fcontent,'filename' => $_REQUEST['filename'] );
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'processes/processes_FileEdit', '', $aData );
G::RenderPage( 'publish', 'raw' );
/*}else{ echo 'krlos';
$aMessage['MESSAGE'] = G::loadTranslation( 'HTML_FILES' );
$G_PUBLISH->AddContent ( 'xmlform', 'xmlform', 'login/showMessage', '',$aMessage );
}*/
// $G_PUBLISH->AddContent( 'view', 'processes/processesFileEditEmail' );
// G::RenderPage( 'publish', 'blank' );
break;
case 'saveFile':
global $G_PUBLISH;

View File

@@ -8,7 +8,7 @@
<en><![CDATA[<div align="center">Edit @#filename email template</div>]]></en>
</TITLE>
<fcontent type="html" height="420" width="100%" defaultValue="">
<fcontent type="wysiwyg_editor" editorType="EMAIL_TEMPLATE" height="420" width="100%" defaultValue="">
<en/>
</fcontent>

View File

@@ -250,8 +250,9 @@
G::LoadSystem('xmlformExtension');
G::LoadSystem('form');
G::LoadSystem('menu');
G::LoadSystem("xmlMenu");
G::LoadSystem('xmlMenu');
G::LoadSystem('dvEditor');
G::LoadSystem('wysiwygEditor');
G::LoadSystem('controller');
G::LoadSystem('httpProxyController');
G::LoadSystem('pmException');
@@ -259,6 +260,7 @@
// Create headPublisher singleton
G::LoadSystem('headPublisher');
$oHeadPublisher =& headPublisher::getSingleton();
$oHeadPublisher->addScriptFile('/js/tinymce/jscripts/tiny_mce/tiny_mce.js');
// Installer, redirect to install if we don't have a valid shared data folder
if ( !defined('PATH_DATA') || !file_exists(PATH_DATA)) {