WYSIWYG editor dynaforms and output documents
WYSIWTG editor for dynaforms and output documents
This commit is contained in:
@@ -57,15 +57,15 @@ class XmlForm_Field_WYSIWYG_EDITOR extends XmlForm_Field
|
||||
*/
|
||||
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>";
|
||||
$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
|
||||
* attachEvents method executes javascript code in order to initialize
|
||||
* the component configuration, attributes, and additional stuff.
|
||||
*
|
||||
*
|
||||
* @author
|
||||
*
|
||||
*
|
||||
@@ -81,16 +81,16 @@ class XmlForm_Field_WYSIWYG_EDITOR extends XmlForm_Field
|
||||
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;
|
||||
//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",
|
||||
tinyMCE.init({
|
||||
theme : "advanced",
|
||||
plugins : "fullpage",
|
||||
mode : "specific_textareas",
|
||||
editor_selector : "tmceEditor",
|
||||
@@ -101,13 +101,59 @@ class XmlForm_Field_WYSIWYG_EDITOR extends XmlForm_Field
|
||||
';
|
||||
break;
|
||||
case 'OUTPUT_DOCUMENT':
|
||||
$editorDefinition = 'alert("outputdoc")';
|
||||
$editorDefinition = '
|
||||
//alert("outputdoc");
|
||||
//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 : "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",
|
||||
editor_selector : "tmceEditor",
|
||||
width : "640",
|
||||
height : "300",
|
||||
theme_advanced_buttons1 : "fontselect,bold,italic,underline,forecolor,backcolor,|,justifyleft,justifycenter,justifyright,justifyfull,|,link,numlist,bullist,|,insertfile"
|
||||
});
|
||||
';
|
||||
|
||||
break;
|
||||
case 'DYNAFORM_TEMPLATE':
|
||||
$editorDefinition = 'alert("dynaform")';
|
||||
$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 : "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",
|
||||
editor_selector : "tmceEditor",
|
||||
width : "640",
|
||||
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",//,|,insertimage",
|
||||
skin : "o2k7",
|
||||
skin_variant : "silver"//,
|
||||
|
||||
});
|
||||
';
|
||||
break;
|
||||
default:
|
||||
$editorDefinition = '
|
||||
|
||||
// delete Array.prototype.toStr;
|
||||
// delete Object.prototype.toStr;
|
||||
// delete Object.prototype.concat;
|
||||
@@ -115,10 +161,10 @@ class XmlForm_Field_WYSIWYG_EDITOR extends XmlForm_Field
|
||||
// delete Object.prototype.expand;
|
||||
// delete Object.prototype.setParent;
|
||||
// delete Object.prototype.isset_key;
|
||||
|
||||
|
||||
tinyMCE.baseURL = "/js/tinymce/jscripts/tiny_mce"
|
||||
tinyMCE.init({
|
||||
theme : "advanced",
|
||||
tinyMCE.init({
|
||||
theme : "advanced",
|
||||
plugins : "fullpage",
|
||||
mode : "specific_textareas",
|
||||
editor_selector : "tmceEditor",
|
||||
@@ -128,8 +174,8 @@ class XmlForm_Field_WYSIWYG_EDITOR extends XmlForm_Field
|
||||
});
|
||||
';
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $editorDefinition;
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,7 @@ global $_DBArray;
|
||||
if (! isset( $_DBArray )) {
|
||||
$_DBArray = array ();
|
||||
}
|
||||
|
||||
G::LoadClass( 'dynaformEditor' );
|
||||
$oDynaformEditorAjax = new dynaformEditorAjax( $_POST );
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
$action = isset( $POST['action'] ) ? $POST['action'] : isset( $_GET['action'] ) ? $_GET['action'] : '';
|
||||
$action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] :'';
|
||||
|
||||
// Function call from ajax_function for calling to lookForNameOutput.
|
||||
if ($action == '') {
|
||||
$action = isset( $_POST['function'] ) ? $_POST['function'] : '';
|
||||
$action = isset( $_REQUEST['function'] ) ? $_REQUEST['function'] : '';
|
||||
}
|
||||
|
||||
switch ($action) {
|
||||
@@ -14,14 +14,14 @@ switch ($action) {
|
||||
// file_put_contents($_FILES['templateFile']['name'], file_get_contents($_FILES['templateFile']['tmp_name']));
|
||||
copy( $_FILES['templateFile']['tmp_name'], $_SESSION['outpudocs_tmpFile'] );
|
||||
$result = new stdClass();
|
||||
|
||||
|
||||
$result->success = true;
|
||||
$result->msg = 'success - saved ' . $_SESSION['outpudocs_tmpFile'];
|
||||
echo G::json_encode( $result );
|
||||
break;
|
||||
|
||||
|
||||
case 'getTemplateFile':
|
||||
$aExtensions = array ("exe","com","dll","ocx","fon","ttf","doc","xls","mdb","rtf","bin","jpeg","jpg","jif","jfif","gif","tif","tiff","png","bmp","pdf","aac","mp3","mp3pro","vorbis","realaudio","vqf","wma","aiff","flac","wav","midi","mka","ogg","jpeg","ilbm","tar","zip","rar","arj","gzip","bzip2","afio","kgb","gz","asf","avi","mov","iff","ogg","ogm","mkv","3gp"
|
||||
$aExtensions = array ("exe","com","dll","ocx","fon","ttf","doc","xls","mdb","rtf","bin","jpeg","jpg","jif","jfif","gif","tif","tiff","png","bmp","pdf","aac","mp3","mp3pro","vorbis","realaudio","vqf","wma","aiff","flac","wav","midi","mka","ogg","jpeg","ilbm","tar","zip","rar","arj","gzip","bzip2","afio","kgb","gz","asf","avi","mov","iff","ogg","ogm","mkv","3gp"
|
||||
);
|
||||
$sFileName = strtolower( $_SESSION['outpudocs_tmpFile'] );
|
||||
$strRev = strrev( $sFileName );
|
||||
@@ -31,24 +31,24 @@ switch ($action) {
|
||||
if (! in_array( $sExtension, $aExtensions ))
|
||||
echo $content = file_get_contents( $_SESSION['outpudocs_tmpFile'] );
|
||||
break;
|
||||
|
||||
|
||||
case 'loadTemplateContent':
|
||||
require_once 'classes/model/OutputDocument.php';
|
||||
$ooutputDocument = new OutputDocument();
|
||||
if (isset( $_POST['OUT_DOC_UID'] )) {
|
||||
$aFields = $ooutputDocument->load( $_POST['OUT_DOC_UID'] );
|
||||
|
||||
|
||||
echo $aFields['OUT_DOC_TEMPLATE'];
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'lookForNameOutput':
|
||||
require_once ('classes/model/Content.php');
|
||||
require_once ("classes/model/OutputDocument.php");
|
||||
|
||||
|
||||
$snameInput = urldecode( $_POST['NAMEOUTPUT'] );
|
||||
$sPRO_UID = urldecode( $_POST['proUid'] );
|
||||
|
||||
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
$oCriteria->addSelectColumn( OutputDocumentPeer::OUT_DOC_UID );
|
||||
$oCriteria->add( OutputDocumentPeer::PRO_UID, $sPRO_UID );
|
||||
@@ -57,7 +57,7 @@ switch ($action) {
|
||||
$flag = true;
|
||||
while ($oDataset->next() && $flag) {
|
||||
$aRow = $oDataset->getRow();
|
||||
|
||||
|
||||
$oCriteria1 = new Criteria( 'workflow' );
|
||||
$oCriteria1->addSelectColumn( 'COUNT(*) AS OUTPUTS' );
|
||||
$oCriteria1->add( ContentPeer::CON_CATEGORY, 'OUT_DOC_TITLE' );
|
||||
@@ -68,11 +68,22 @@ switch ($action) {
|
||||
$oDataset1->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
$oDataset1->next();
|
||||
$aRow1 = $oDataset1->getRow();
|
||||
|
||||
|
||||
if ($aRow1['OUTPUTS'])
|
||||
$flag = false;
|
||||
}
|
||||
echo $flag;
|
||||
// G::json_encode($flag);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'loadOutputEditor':
|
||||
global $G_PUBLISH;
|
||||
$G_PUBLISH = new Publisher();
|
||||
$aData = "";
|
||||
|
||||
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'outputdocs/outputdocs_Edit', '', $aData );
|
||||
//$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'outputdocs/outputdocs_Edit', '', $aData );
|
||||
G::RenderPage( 'publish', 'raw' );
|
||||
//echo '<h3>outputss</h3>';
|
||||
break;
|
||||
}
|
||||
@@ -17,19 +17,24 @@
|
||||
<en>Refresh View</en>
|
||||
</PME_REFRESH_VIEW>
|
||||
|
||||
<HTML type="html" width="100%" height="300px" toolbarSet="toolbar2lines">
|
||||
<!-- HTML type="html" width="100%" height="300px" toolbarSet="toolbar2lines">
|
||||
<en>HTML View</en>
|
||||
</HTML -->
|
||||
|
||||
<HTML type="wysiwyg_editor" editorType="DYNAFORM_TEMPLATE" width="100%" height="300px">
|
||||
<en>HTML View</en>
|
||||
</HTML>
|
||||
|
||||
<HTML2 type="textarea" cols="120" rows="16" style="width:100%;" className="htmleditor">
|
||||
<en>HTML Code</en>
|
||||
</HTML2>
|
||||
|
||||
<PME_SYNCH_JS type="javascript"><![CDATA[
|
||||
|
||||
getField("HTML").onchange=function()
|
||||
/*getField("HTML").onchange=function()
|
||||
{
|
||||
html_html2();
|
||||
}
|
||||
}*/
|
||||
function html_html2()
|
||||
{
|
||||
if (window._editorHTML.doc.forms.length>0)
|
||||
@@ -57,7 +62,7 @@
|
||||
var restore_html = function() {
|
||||
alert('restore_html');
|
||||
};
|
||||
html_html2();
|
||||
//html_html2();
|
||||
|
||||
]]></PME_SYNCH_JS>
|
||||
<PME_RESIZE_JS type="javascript"><![CDATA[
|
||||
@@ -68,11 +73,12 @@ function resizeHTMLEditor(){
|
||||
}catch(e){
|
||||
}
|
||||
}
|
||||
resizeHTMLEditor();
|
||||
//resizeHTMLEditor();
|
||||
getField("PME_HTML_ENABLETEMPLATE","dynaforms_HtmlEditor").onclick=function()
|
||||
{
|
||||
/*getField("ENABLETEMPLATE","dynaforms_Properties").checked=this.checked;
|
||||
dynaformEditor.saveProperties();*/
|
||||
|
||||
if (getField("PME_HTML_ENABLETEMPLATE","dynaforms_HtmlEditor").checked == true) {
|
||||
new leimnud.module.app.confirm().make(
|
||||
{
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
|
||||
<js type="javascript" replaceTags="1"><![CDATA[
|
||||
function dynaformAdd(){
|
||||
popupWindow('@G::LoadTranslation(ID_NEW_DYNAFORM)', '@G::encryptlink(@#dynaformsChoseType)?PRO_UID=@%PRO_UID' , 500, 200);
|
||||
//popupWindow('@G::LoadTranslation(ID_NEW_DYNAFORM)', '@G::encryptlink(@#dynaformsNewPlugin)?PRO_UID=@%PRO_UID' , 500, 350);
|
||||
popupWindow('@G::LoadTranslation(ID_NEW_DYNAFORM)', '@G::encryptlink(@#dynaformsChoseType)?PRO_UID=@%PRO_UID' , 500, 200);
|
||||
//popupWindow('@G::LoadTranslation(ID_NEW_DYNAFORM)', '@G::encryptlink(@#dynaformsNewPlugin)?PRO_UID=@%PRO_UID' , 500, 350);
|
||||
}
|
||||
function dynaformPluginAdd(){
|
||||
popupWindow('@G::LoadTranslation(ID_NEW_DYNAFORM)', '@G::encryptlink(@#dynaformsEdit)?PRO_UID=@%PRO_UID' , 500, 350);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<form id="{$form_id}" name="{$form_name}" action="{$form_action}" class="{$form_className}" method="post" encType="multipart/form-data" style="margin:0px;" onsubmit='return validateForm("{$form_objectRequiredFields}".parseJSON());'>
|
||||
|
||||
<div class="borderForm" style="padding-left: 0pt; padding-right: 0pt;">
|
||||
<div class="boxTop"><div class="a"></div><div class="b"></div><div class="c"></div></div>
|
||||
<div class="content" style="">
|
||||
@@ -19,7 +18,7 @@
|
||||
<tr style="display: none;">
|
||||
<td colspan="2">{$form.OUT_DOC_UID}</td>
|
||||
</tr>
|
||||
<tr class="FormFieldContent" >
|
||||
<tr class="FormFieldContent">
|
||||
<td colspan="2">{$form.OUT_DOC_TEMPLATE}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -32,8 +31,7 @@
|
||||
</div>
|
||||
<div class="boxBottom"><div class="a"></div><div class="b"></div><div class="c"></div></div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
<script type="text/javascript">
|
||||
{$form.JS}
|
||||
</script>
|
||||
|
||||
</form>
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
<OUT_DOC_UID type="hidden" showInTable="0"/>
|
||||
|
||||
<OUT_DOC_TEMPLATE type="html" width="100%" height="365px" defaultValue="<br/>"/>
|
||||
<OUT_DOC_TEMPLATE type="wysiwyg_editor" editorType="OUTPUT_DOCUMENT" width="100%" height="365px" defaultValue="<br/>"/>
|
||||
|
||||
<ACCEPT type="button" onclick="outputdocsSave(this.form);">
|
||||
<en>Save</en>
|
||||
|
||||
@@ -26,7 +26,7 @@ var outputdocsEditor;
|
||||
var top = (screen.height/2);//-(h/2);
|
||||
var targetWin = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
function outputdocsEdit( uid, typ ) {
|
||||
|
||||
if (( _BROWSER.name == 'msie' ) && ( _BROWSER.version < '9' )) {
|
||||
@@ -46,17 +46,27 @@ var outputdocsEditor;
|
||||
control : {close:true,resize:false},fx: {modal:false},
|
||||
fx : {shadow:false,modal:false}
|
||||
};
|
||||
|
||||
outputdocsEditor.make();
|
||||
oIFrame = window.document.createElement('iframe');
|
||||
oIFrame.style.border = '0';
|
||||
oIFrame.style.width = '100%';
|
||||
oIFrame.style.height = '100%';
|
||||
oIFrame.src = '../outputdocs/outputdocs_Edit?OUT_DOC_UID=' + uid;
|
||||
outputdocsEditor.addContent(oIFrame);
|
||||
|
||||
|
||||
var oRPC = new leimnud.module.rpc.xmlhttp({
|
||||
url : '../outputdocs/outputdocs_Ajax',
|
||||
args: 'action=loadOutputEditor'
|
||||
});
|
||||
|
||||
outputdocsEditor.loader.show();
|
||||
oRPC.callback = function(rpc) {
|
||||
outputdocsEditor.loader.hide();
|
||||
outputdocsEditor.addContent(rpc.xmlhttp.responseText);
|
||||
var scs=rpc.xmlhttp.responseText.extractScript();
|
||||
scs.evalScript();
|
||||
}.extend(this);
|
||||
oRPC.make();
|
||||
}
|
||||
|
||||
function outputdocsProperties( uid ) {
|
||||
popupWindow('@G::LoadTranslation(ID_OUTPUT_DOCUMENTS)', '@G::encryptlink(@#outputdocs_Properties)?OUT_DOC_UID='+ uid , 600, 530);
|
||||
popupWindow('@G::LoadTranslation(ID_OUTPUT_DOCUMENTS)', '@G::encryptlink(@#outputdocs_Properties)?OUT_DOC_UID='+ uid , 600, 530);
|
||||
}
|
||||
|
||||
function outputdocsPropertiesSave( form ) {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
</MNU_NEWEMPTY>
|
||||
|
||||
<MNU_UPLOAD type="link" value="" link="#" onclick="uploadFilesScreen(@QPRO_UID, @QMAIN_DIRECTORY, @QCURRENT_DIRECTORY);return false;" colAlign="left" colWidth="100">
|
||||
<en>Upload</en>
|
||||
<en>Upload...............</en>
|
||||
</MNU_UPLOAD>
|
||||
|
||||
<PRO_UID type="private"/>
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
<JS type="javascript"><![CDATA[
|
||||
|
||||
|
||||
var CURRENT_PRO_UID = @QPRO_UID;
|
||||
var CURRENT_MAIN_DIRECTORY;
|
||||
var CURRENT_CURRENT_DIRECTORY;
|
||||
@@ -78,7 +77,7 @@ var typofile = fileName.split(".");
|
||||
if( typofile[typofile.length-1].toLowerCase() != 'txt' && typofile[typofile.length-1].toLowerCase() != 'html' ){
|
||||
msgBox(G_STRINGS.HTML_FILES,"alert");return;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
oPanel = new leimnud.module.panel();
|
||||
oPanel.options={
|
||||
limit : true,
|
||||
@@ -101,8 +100,7 @@ if( typofile[typofile.length-1].toLowerCase() != 'txt' && typofile[typofile.leng
|
||||
oPanel.addContent(rpc.xmlhttp.responseText);
|
||||
var scs=rpc.xmlhttp.responseText.extractScript();
|
||||
scs.evalScript();
|
||||
|
||||
}.extend(this);
|
||||
}.extend(this);
|
||||
oRPC.make();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user