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 />');
|
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()
|
$aProperties=array()
|
||||||
) {
|
) {
|
||||||
if (($sUID != '') && is_array($aFields) && ($sPath != '')) {
|
if (($sUID != '') && is_array($aFields) && ($sPath != '')) {
|
||||||
|
$nrt = array("\n", "\r", "\t");
|
||||||
|
$nrthtml = array("(n /)", "(r /)", "(t /)");
|
||||||
|
|
||||||
$sContent = G::unhtmlentities($sContent);
|
$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);
|
$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;
|
$sContent = $strContentAux;
|
||||||
|
|
||||||
foreach ($aFields as $sKey => $vValue) {
|
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;
|
var importOption;
|
||||||
|
|
||||||
Ext.onReady(function(){
|
Ext.onReady(function(){
|
||||||
|
|
||||||
Ext.QuickTips.init();
|
Ext.QuickTips.init();
|
||||||
|
|
||||||
// turn on validation errors beside the field globally
|
// turn on validation errors beside the field globally
|
||||||
Ext.form.Field.prototype.msgTarget = 'side';
|
Ext.form.Field.prototype.msgTarget = 'side';
|
||||||
|
|
||||||
var bd = Ext.getBody();
|
var bd = Ext.getBody();
|
||||||
|
var sourceEdit = 0;
|
||||||
|
|
||||||
importOption = new Ext.Action({
|
importOption = new Ext.Action({
|
||||||
text: _('ID_LOAD_FROM_FILE'),
|
text: _('ID_LOAD_FROM_FILE'),
|
||||||
@@ -62,21 +145,17 @@ Ext.onReady(function(){
|
|||||||
w.close();
|
w.close();
|
||||||
|
|
||||||
Ext.Ajax.request({
|
Ext.Ajax.request({
|
||||||
url: 'outputdocs_Ajax?action=getTemplateFile&r='+Math.random(),
|
url: "outputdocs_Ajax?action=getTemplateFile&r=" + Math.random(),
|
||||||
success: function (response) {
|
success: function (response) {
|
||||||
txtParse = response.responseText;
|
Ext.getCmp("OUT_DOC_TEMPLATE").setValue(setHtml(response.responseText, sourceEdit));
|
||||||
if ((txtParse.indexOf('@>')>0)||(txtParse.indexOf('@>')>0)){
|
|
||||||
txtParse = txtParse.replace('@<','@<');
|
if (Ext.getCmp("OUT_DOC_TEMPLATE").getValue() == "") {
|
||||||
response.responseText = txtParse;
|
Ext.Msg.alert(_("ID_ALERT_MESSAGE"), _("ID_INVALID_FILE"));
|
||||||
}
|
}
|
||||||
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 () {},
|
failure: function () {},
|
||||||
params: {request: 'getRows'}
|
params: {request: "getRows"}
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
failure: function(o, resp){
|
failure: function(o, resp){
|
||||||
w.close();
|
w.close();
|
||||||
@@ -116,35 +195,16 @@ Ext.onReady(function(){
|
|||||||
height:300,
|
height:300,
|
||||||
anchor:'98%',
|
anchor:'98%',
|
||||||
listeners: {
|
listeners: {
|
||||||
editmodechange: function(he,b){
|
editmodechange: function (he, srcEdit) {
|
||||||
txtParse = he.getRawValue();
|
sourceEdit = (srcEdit == true)? 1 : 0;
|
||||||
if (!b){
|
|
||||||
if ((txtParse.indexOf('@>')>0)||(txtParse.indexOf('@>')>0)){
|
he.setValue(setHtml(he.getRawValue(), sourceEdit));
|
||||||
txtParse = txtParse.replace('@<','@<');
|
|
||||||
he.setValue(txtParse);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
beforepush: function(he, h){
|
beforepush: function (he, outdocHtml) {
|
||||||
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) {
|
//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;
|
|
||||||
// }
|
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
@@ -153,21 +213,21 @@ Ext.onReady(function(){
|
|||||||
text: _('ID_SAVE'),
|
text: _('ID_SAVE'),
|
||||||
handler: function(){
|
handler: function(){
|
||||||
Ext.Ajax.request({
|
Ext.Ajax.request({
|
||||||
url: 'outputdocs_Save',
|
url: "outputdocs_Save",
|
||||||
success: function (response) {
|
success: function (response) {
|
||||||
Ext.Msg.show({
|
Ext.Msg.show({
|
||||||
title: '',
|
title: "",
|
||||||
msg: _('ID_SAVED_SUCCESSFULLY'),
|
msg: _("ID_SAVED_SUCCESSFULLY"),
|
||||||
fn: function () {},
|
fn: function () {},
|
||||||
animEl: 'elId',
|
animEl: "elId",
|
||||||
icon: Ext.MessageBox.INFO,
|
icon: Ext.MessageBox.INFO,
|
||||||
buttons: Ext.MessageBox.OK
|
buttons: Ext.MessageBox.OK
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
failure: function () {},
|
failure: function () {},
|
||||||
params: {
|
params: {
|
||||||
'form[OUT_DOC_UID]': OUT_DOC_UID,
|
"form[OUT_DOC_UID]": OUT_DOC_UID,
|
||||||
'form[OUT_DOC_TEMPLATE]':Ext.getCmp('OUT_DOC_TEMPLATE').getValue()
|
"form[OUT_DOC_TEMPLATE]": setHtml(Ext.getCmp("OUT_DOC_TEMPLATE").getValue(), 1)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -186,16 +246,12 @@ Ext.onReady(function(){
|
|||||||
top.render(document.body);
|
top.render(document.body);
|
||||||
|
|
||||||
Ext.Ajax.request({
|
Ext.Ajax.request({
|
||||||
url: 'outputdocs_Ajax?action=loadTemplateContent&r='+Math.random(),
|
url: "outputdocs_Ajax?action=loadTemplateContent&r=" + Math.random(),
|
||||||
success: function(response){
|
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}
|
params: {OUT_DOC_UID: OUT_DOC_UID}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//function _(ID){
|
|
||||||
// return TRANSLATIONS[ID];
|
|
||||||
//}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user