WYSIWYG EDITOR for dynaforms

WYSIWYG EDITOR for dynaforms
This commit is contained in:
norahmollo
2012-11-15 16:06:53 +00:00
parent 70c3778425
commit 0558942662
9 changed files with 1035 additions and 54 deletions

View File

@@ -1,12 +1,12 @@
body, td, pre {color:#000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px;}
body {background:#FFF;}
body.mceForceColors {background:#FFF; color:#000;}
h1 {font-size: 2em}
h2 {font-size: 1.5em}
h3 {font-size: 1.17em}
h1 {font-size: 1em}
h2 {font-size: 1em}
h3 {font-size: 1em}
h4 {font-size: 1em}
h5 {font-size: .83em}
h6 {font-size: .75em}
h5 {font-size: 3em}
h6 {font-size: 7em}
.mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceItemVisualAid {border: 1px dashed #BBB;}
a.mceItemAnchor {display:inline-block; width:11px !important; height:11px !important; background:url(../default/img/items.gif) no-repeat 0 0;}
span.mceItemNbsp {background: #DDD}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -81,28 +81,44 @@ 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;
tinyMCE.baseURL = "/js/tinymce/jscripts/tiny_mce"
tinyMCE.init({
theme : "advanced",
plugins : "fullpage",
mode : "specific_textareas",
editor_selector : "tmceEditor",
width : "'.$this->width.'",
height : "'.$this->height.'",
theme_advanced_buttons3_add : "fullpage"
});
//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 : "'.$this->width.'",
//height : "'.$this->height.'",
width : 760,
height : "'.$this->height.'",
theme_advanced_buttons3_add : "fullpage",
/*
onchange_callback: function(inst) {
if(inst.isDirty()) {
inst.save();
}
return true;
},*/
handle_event_callback : function(e) {
if(this.isDirty()) {
this.save();
}
return true;
}
});
';
break;
case 'OUTPUT_DOCUMENT':
$editorDefinition = '
//alert("outputdoc");
//delete Array.prototype.toStr;
//delete Object.prototype.toStr;
//delete Object.prototype.concat;
@@ -114,12 +130,20 @@ class XmlForm_Field_WYSIWYG_EDITOR extends XmlForm_Field
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",
plugins : "fullpage",
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"
width : "770",
height : "305",
theme_advanced_buttons1 : "fontselect,bold,italic,underline,forecolor,backcolor,|,justifyleft,justifycenter,justifyright,justifyfull,|,link,numlist,bullist,|,insertfile",
handle_event_callback : function(e) {
if(this.isDirty()) {
this.save();
}
return true;
}
});
';
@@ -140,13 +164,35 @@ class XmlForm_Field_WYSIWYG_EDITOR extends XmlForm_Field
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 : "640",
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",//,|,insertimage",
theme_advanced_buttons2 : "link,unlink,image,|,forecolor,backcolor,|,hr,removeformat,visualaid,|,sub,sup,|,ltr,rtl,|,code",//,|,insertimage",
skin : "o2k7",
skin_variant : "silver"//,
skin_variant : "silver",
content_css : "content.css",
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",
template_replace_values : {
username : "Some User",
staffid : "991234"
},
handle_event_callback : function(e) {
if(this.isDirty()) {
this.save();
}
return true;
}
});
';
@@ -172,6 +218,13 @@ class XmlForm_Field_WYSIWYG_EDITOR extends XmlForm_Field
height : "'. $this->height. '",
theme_advanced_buttons3_add : "fullpage"
});
handle_event_callback : function(e) {
if(this.isDirty()) {
this.save();
}
return true;
}
';
break;
}

View File

@@ -16,10 +16,10 @@
<td class='FormLabel' width="{$form_labelWidth}">{$HTML}</td>
<td class='FormFieldContent' >{$form.HTML}</td>
</tr>
<tr>
<!-- tr>
<td class='FormLabel' width="{$form_labelWidth}">{$HTML2}</td>
<td class='FormFieldContent' >{$form.HTML2}</td>
</tr>
</tr -->
</td>
</tr>
</table>

View File

@@ -25,16 +25,16 @@
<en>HTML View</en>
</HTML>
<HTML2 type="textarea" cols="120" rows="16" style="width:100%;" className="htmleditor">
<!-- HTML2 type="textarea" cols="120" rows="16" style="width:100%;" className="htmleditor">
<en>HTML Code</en>
</HTML2>
</HTML2 -->
<PME_SYNCH_JS type="javascript"><![CDATA[
/*getField("HTML").onchange=function()
{
html_html2();
}*/
}
function html_html2()
{
if (window._editorHTML.doc.forms.length>0)
@@ -58,7 +58,7 @@
window._editorHTML.setHTML(getField("HTML2").value);
getField("HTML").value=getField("HTML2").value;
}
}
}*/
var restore_html = function() {
alert('restore_html');
};

View File

@@ -75,6 +75,7 @@
}
function dynaformSave ( form, bOpen ) {
alert('guardando');
var nameDynaForm = getField('DYN_TITLE').value;
var proUid = getField('PRO_UID').value;

View File

@@ -27,6 +27,8 @@ var outputdocsEditor;
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);
}
////////////////////////////////////////////////////
var outputdocsEditor;
function outputdocsEdit( uid, typ ) {
if (( _BROWSER.name == 'msie' ) && ( _BROWSER.version < '9' )) {
@@ -90,8 +92,10 @@ var outputdocsEditor;
}
function outputdocsSave( form ) {
alert(form.action);
ajax_post( form.action, form, 'POST' );
currentPopupWindow.remove();
outputdocsEditor.remove();
@#PAGED_TABLE_ID.refresh();
}

View File

@@ -73,19 +73,20 @@ var uploadFilesScreen = function(PRO_UID, MAIN_DIRECTORY, CURRENT_DIRECTORY) {
var oPanel;
function editFile(pro_uid, fileName){
var typofile = fileName.split(".");
if( typofile[typofile.length-1].toLowerCase() != 'txt' && typofile[typofile.length-1].toLowerCase() != 'html' ){
msgBox(G_STRINGS.HTML_FILES,"alert");return;
}
///////////////////////////////////////////////////////////
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,
size : {w:800,h:600},
position : {x:50,y:50,center:true},
position : {x:50,y:50,center:true},
title : '',
control : {close:true,resize:false},fx:{modal:true},
fx : {shadow:true,modal:true}
control : {close:true,resize:false},
fx : {modal:true},
fx : {shadow:true,modal:true}
};
oPanel.make();
@@ -104,19 +105,24 @@ if( typofile[typofile.length-1].toLowerCase() != 'txt' && typofile[typofile.leng
oRPC.make();
}
/*refresh content tiny*/
function saveFile(pro_uid, fileName){
var fc64 = base64_encode(getField('fcontent').value);
fc64 = fc64.replace(/&amp;/g, "@amp@");
fc64 = fc64.replace(/\+/g, '%2B');
var fc64 = base64_encode(getField('fcontent').value);
fc64 = fc64.replace(/&amp;/g, "@amp@");
fc64 = fc64.replace(/\+/g, '%2B');
var oRPC = new leimnud.module.rpc.xmlhttp({
url : 'processes_Ajax',
args: 'action=saveFile&filename='+fileName+'&pro_uid='+pro_uid+'&MAIN_DIRECTORY='+CURRENT_MAIN_DIRECTORY+'&fcontent='+fc64
});
oPanel.loader.show();
oRPC.callback = function(rpc) {
oPanel.remove();
}.extend(this);
oRPC.make();
oPanel.loader.show();
oRPC.callback = function(rpc) {
oPanel.remove();
}.extend(this);
oRPC.make();
}
var showCreateEmptyOptionsPanel;