BUG 9509 "On ProcessMaker 2.0.42 the WYSISWG editor doesn't..." SOLVED
- OutputDocument the WYSISWG editor doesn't generate the content of a GRID correctly - Solved problem, now generated correctly the source of the OutputDocument, was also corrected the problem with the tag <table>
This commit is contained in:
@@ -482,3 +482,13 @@ String.prototype.nl2br = function () {
|
||||
return this.replace(/\n/g,'<br />');
|
||||
}
|
||||
|
||||
/**
|
||||
* String Replace function, if StrSearch has special characters "(", "[", must be escape "\\(", "\\[".
|
||||
*/
|
||||
function stringReplace(strSearch, stringReplace, str)
|
||||
{
|
||||
var expression = eval("/" + strSearch + "/g");
|
||||
|
||||
return str.replace(expression, stringReplace);
|
||||
}
|
||||
|
||||
|
||||
@@ -509,8 +509,12 @@ class OutputDocument extends BaseOutputDocument
|
||||
$aProperties=array()
|
||||
) {
|
||||
if (($sUID != '') && is_array($aFields) && ($sPath != '')) {
|
||||
$nrt = array("\n", "\r", "\t");
|
||||
$nrthtml = array("(n /)", "(r /)", "(t /)");
|
||||
|
||||
$sContent = G::unhtmlentities($sContent);
|
||||
$strContentAux = str_replace(array("\n", "\r", "\t"), array(null, null, null), $sContent);
|
||||
|
||||
$strContentAux = str_replace($nrt, $nrthtml, $sContent);
|
||||
|
||||
$iOcurrences = preg_match_all('/\@(?:([\>])([a-zA-Z\_]\w*)|([a-zA-Z\_][\w\-\>\:]*)\(((?:[^\\\\\)]*(?:[\\\\][\w\W])?)*)\))((?:\s*\[[\'"]?\w+[\'"]?\])+)?/', $strContentAux, $arrayMatch1, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE);
|
||||
|
||||
@@ -554,6 +558,8 @@ class OutputDocument extends BaseOutputDocument
|
||||
}
|
||||
}
|
||||
|
||||
$strContentAux = str_replace($nrthtml, $nrt, $strContentAux);
|
||||
|
||||
$sContent = $strContentAux;
|
||||
|
||||
foreach ($aFields as $sKey => $vValue) {
|
||||
|
||||
@@ -1,13 +1,96 @@
|
||||
function setGridHtml(outdocHtml, swEdit)
|
||||
{
|
||||
var outdocHtmlAux = outdocHtml;
|
||||
|
||||
outdocHtmlAux = stringReplace("\\x0A", "(n /)", outdocHtmlAux); //\n 10
|
||||
outdocHtmlAux = stringReplace("\\x0D", "(r /)", outdocHtmlAux); //\r 13
|
||||
outdocHtmlAux = stringReplace("\\x09", "(t /)", outdocHtmlAux); //\t 9
|
||||
|
||||
var arrayMatch1 = [];
|
||||
var outdocHtmlAux1 = "";
|
||||
var strHtml = "";
|
||||
|
||||
///////
|
||||
outdocHtmlAux1 = outdocHtmlAux;
|
||||
strHtml = "";
|
||||
|
||||
//@>
|
||||
if (swEdit == 1) {
|
||||
while ((arrayMatch1 = /^(.*)<tr>[\(\)nrt\s\/]*<td>[\(\)nrt\s\/]*(@>[a-zA-Z\_]\w*)[\(\)nrt\s\/]*<\/td>[\(\)nrt\s\/]*<\/tr>(.*)$/ig.exec(outdocHtmlAux1))) {
|
||||
outdocHtmlAux1 = arrayMatch1[1];
|
||||
strHtml = arrayMatch1[2] + arrayMatch1[3] + strHtml;
|
||||
}
|
||||
} else {
|
||||
while ((arrayMatch1 = /^(.*<table.*>.*)(@>[a-zA-Z\_]\w*)(.*<\/table>.*)$/ig.exec(outdocHtmlAux1))) {
|
||||
outdocHtmlAux1 = arrayMatch1[1];
|
||||
strHtml = "<tr><td>" + arrayMatch1[2] + "</td></tr>" + arrayMatch1[3] + strHtml;
|
||||
}
|
||||
}
|
||||
|
||||
strHtml = outdocHtmlAux1 + strHtml;
|
||||
|
||||
///////
|
||||
outdocHtmlAux1 = strHtml;
|
||||
strHtml = "";
|
||||
|
||||
//@< //Copy of @>
|
||||
if (swEdit == 1) {
|
||||
while ((arrayMatch1 = /^(.*)<tr>[\(\)nrt\s\/]*<td>[\(\)nrt\s\/]*(@<[a-zA-Z\_]\w*)[\(\)nrt\s\/]*<\/td>[\(\)nrt\s\/]*<\/tr>(.*)$/ig.exec(outdocHtmlAux1))) {
|
||||
outdocHtmlAux1 = arrayMatch1[1];
|
||||
strHtml = arrayMatch1[2] + arrayMatch1[3] + strHtml;
|
||||
}
|
||||
} else {
|
||||
while ((arrayMatch1 = /^(.*<table.*>.*)(@<[a-zA-Z\_]\w*)(.*<\/table>.*)$/ig.exec(outdocHtmlAux1))) {
|
||||
outdocHtmlAux1 = arrayMatch1[1];
|
||||
strHtml = "<tr><td>" + arrayMatch1[2] + "</td></tr>" + arrayMatch1[3] + strHtml;
|
||||
}
|
||||
}
|
||||
|
||||
strHtml = outdocHtmlAux1 + strHtml;
|
||||
|
||||
///////
|
||||
strHtml = stringReplace("\\(n \\/\\)", "\n", strHtml);
|
||||
strHtml = stringReplace("\\(r \\/\\)", "\r", strHtml);
|
||||
strHtml = stringReplace("\\(t \\/\\)", "\t", strHtml);
|
||||
|
||||
outdocHtml = strHtml;
|
||||
|
||||
return outdocHtml;
|
||||
}
|
||||
|
||||
function setHtml(outdocHtml, swEdit)
|
||||
{
|
||||
if (outdocHtml.indexOf("@>") > 0 || outdocHtml.indexOf("@>") > 0) {
|
||||
if (swEdit == 1) {
|
||||
outdocHtml = stringReplace("@>", "@>", outdocHtml);
|
||||
outdocHtml = stringReplace("@<", "@<", outdocHtml);
|
||||
|
||||
outdocHtml = setGridHtml(outdocHtml, swEdit);
|
||||
} else {
|
||||
outdocHtml = setGridHtml(outdocHtml, swEdit);
|
||||
|
||||
outdocHtml = stringReplace("@>", "@>", outdocHtml);
|
||||
outdocHtml = stringReplace("@<", "@<", outdocHtml);
|
||||
}
|
||||
}
|
||||
|
||||
return outdocHtml;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var importOption;
|
||||
|
||||
Ext.onReady(function(){
|
||||
|
||||
Ext.QuickTips.init();
|
||||
|
||||
// turn on validation errors beside the field globally
|
||||
Ext.form.Field.prototype.msgTarget = 'side';
|
||||
|
||||
var bd = Ext.getBody();
|
||||
var sourceEdit = 0;
|
||||
|
||||
importOption = new Ext.Action({
|
||||
text: _('ID_LOAD_FROM_FILE'),
|
||||
@@ -58,25 +141,21 @@ Ext.onReady(function(){
|
||||
uploader.getForm().submit({
|
||||
url: 'outputdocs_Ajax?action=setTemplateFile',
|
||||
waitMsg: _('ID_UPLOADING_FILE'),
|
||||
success: function(o, resp){
|
||||
success: function (o, resp) {
|
||||
w.close();
|
||||
|
||||
Ext.Ajax.request({
|
||||
url: 'outputdocs_Ajax?action=getTemplateFile&r='+Math.random(),
|
||||
success: function(response){
|
||||
txtParse = response.responseText;
|
||||
if ((txtParse.indexOf('@>')>0)||(txtParse.indexOf('@>')>0)){
|
||||
txtParse = txtParse.replace('@<','@<');
|
||||
response.responseText = txtParse;
|
||||
}
|
||||
Ext.getCmp('OUT_DOC_TEMPLATE').setValue(response.responseText);
|
||||
if(Ext.getCmp('OUT_DOC_TEMPLATE').getValue(response.responseText)=='')
|
||||
Ext.Msg.alert(_('ID_ALERT_MESSAGE'), _('ID_INVALID_FILE'));
|
||||
},
|
||||
failure: function(){},
|
||||
params: {request: 'getRows'}
|
||||
});
|
||||
url: "outputdocs_Ajax?action=getTemplateFile&r=" + Math.random(),
|
||||
success: function (response) {
|
||||
Ext.getCmp("OUT_DOC_TEMPLATE").setValue(setHtml(response.responseText, sourceEdit));
|
||||
|
||||
if (Ext.getCmp("OUT_DOC_TEMPLATE").getValue() == "") {
|
||||
Ext.Msg.alert(_("ID_ALERT_MESSAGE"), _("ID_INVALID_FILE"));
|
||||
}
|
||||
},
|
||||
failure: function () {},
|
||||
params: {request: "getRows"}
|
||||
});
|
||||
},
|
||||
failure: function(o, resp){
|
||||
w.close();
|
||||
@@ -116,36 +195,17 @@ Ext.onReady(function(){
|
||||
height:300,
|
||||
anchor:'98%',
|
||||
listeners: {
|
||||
editmodechange: function(he,b){
|
||||
txtParse = he.getRawValue();
|
||||
if (!b){
|
||||
if ((txtParse.indexOf('@>')>0)||(txtParse.indexOf('@>')>0)){
|
||||
txtParse = txtParse.replace('@<','@<');
|
||||
he.setValue(txtParse);
|
||||
}
|
||||
}
|
||||
editmodechange: function (he, srcEdit) {
|
||||
sourceEdit = (srcEdit == true)? 1 : 0;
|
||||
|
||||
he.setValue(setHtml(he.getRawValue(), sourceEdit));
|
||||
},
|
||||
beforepush: function(he, h){
|
||||
txtParse = h;
|
||||
if ((txtParse.indexOf('@>')>0)||(txtParse.indexOf('@>')>0)){
|
||||
if (txtParse.indexOf('@<')>0){
|
||||
txtParse = txtParse.replace('@<','@<');
|
||||
he.setValue(txtParse);
|
||||
beforepush: function (he, outdocHtml) {
|
||||
//
|
||||
}
|
||||
//return false;
|
||||
}
|
||||
}//,
|
||||
// beforesync: function(he, h){
|
||||
// alert(h);
|
||||
// txtParse = h;
|
||||
// if ((txtParse.indexOf('@>')>0)||(txtParse.indexOf('@>')>0)){
|
||||
// if (txtParse.indexOf('@<')>0){
|
||||
// txtParse = txtParse.replace('@<','@<');
|
||||
// he.setValue(txtParse);
|
||||
// }
|
||||
// //return false;
|
||||
// }
|
||||
// }
|
||||
//,
|
||||
//beforesync: function (he, h) {
|
||||
//}
|
||||
}
|
||||
}],
|
||||
|
||||
@@ -153,21 +213,21 @@ Ext.onReady(function(){
|
||||
text: _('ID_SAVE'),
|
||||
handler: function(){
|
||||
Ext.Ajax.request({
|
||||
url: 'outputdocs_Save',
|
||||
success: function(response){
|
||||
url: "outputdocs_Save",
|
||||
success: function (response) {
|
||||
Ext.Msg.show({
|
||||
title: '',
|
||||
msg: _('ID_SAVED_SUCCESSFULLY'),
|
||||
fn: function(){},
|
||||
animEl: 'elId',
|
||||
title: "",
|
||||
msg: _("ID_SAVED_SUCCESSFULLY"),
|
||||
fn: function () {},
|
||||
animEl: "elId",
|
||||
icon: Ext.MessageBox.INFO,
|
||||
buttons: Ext.MessageBox.OK
|
||||
});
|
||||
},
|
||||
failure: function(){},
|
||||
failure: function () {},
|
||||
params: {
|
||||
'form[OUT_DOC_UID]': OUT_DOC_UID,
|
||||
'form[OUT_DOC_TEMPLATE]':Ext.getCmp('OUT_DOC_TEMPLATE').getValue()
|
||||
"form[OUT_DOC_UID]": OUT_DOC_UID,
|
||||
"form[OUT_DOC_TEMPLATE]": setHtml(Ext.getCmp("OUT_DOC_TEMPLATE").getValue(), 1)
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -186,16 +246,12 @@ Ext.onReady(function(){
|
||||
top.render(document.body);
|
||||
|
||||
Ext.Ajax.request({
|
||||
url: 'outputdocs_Ajax?action=loadTemplateContent&r='+Math.random(),
|
||||
url: "outputdocs_Ajax?action=loadTemplateContent&r=" + Math.random(),
|
||||
success: function(response){
|
||||
Ext.getCmp('OUT_DOC_TEMPLATE').setValue(response.responseText);
|
||||
Ext.getCmp("OUT_DOC_TEMPLATE").setValue(setHtml(response.responseText, 0));
|
||||
},
|
||||
failure: function(){},
|
||||
failure: function () {},
|
||||
params: {OUT_DOC_UID: OUT_DOC_UID}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
//function _(ID){
|
||||
// return TRANSLATIONS[ID];
|
||||
//}
|
||||
|
||||
Reference in New Issue
Block a user