Merged in luisfernandosl/processmaker/PM-1573 (pull request #1526)
PM-1573 "Boton ID_IMPORT_BPMN dentro del designer..."
This commit is contained in:
@@ -308,14 +308,6 @@ Ext.onReady(function(){
|
|||||||
importProcessGlobal.processFileType = "pm";
|
importProcessGlobal.processFileType = "pm";
|
||||||
importProcess();
|
importProcess();
|
||||||
}
|
}
|
||||||
},{
|
|
||||||
text: _('ID_IMPORT_BPMN'),
|
|
||||||
iconCls: 'silk-add',
|
|
||||||
icon: '/images/import.gif',
|
|
||||||
handler : function(){
|
|
||||||
importProcessGlobal.processFileType = "bpmn";
|
|
||||||
importProcessBpmn();
|
|
||||||
}
|
|
||||||
},{
|
},{
|
||||||
xtype: 'tbfill'
|
xtype: 'tbfill'
|
||||||
},{
|
},{
|
||||||
@@ -1217,6 +1209,10 @@ importProcess = function()
|
|||||||
name : 'processFileType',
|
name : 'processFileType',
|
||||||
xtype : 'hidden',
|
xtype : 'hidden',
|
||||||
value : processFileType
|
value : processFileType
|
||||||
|
},{
|
||||||
|
name: "createMode",
|
||||||
|
xtype: "hidden",
|
||||||
|
value: "create"
|
||||||
}, {
|
}, {
|
||||||
xtype : 'fileuploadfield',
|
xtype : 'fileuploadfield',
|
||||||
id : 'form-file',
|
id : 'form-file',
|
||||||
@@ -1232,14 +1228,23 @@ importProcess = function()
|
|||||||
buttons : [{
|
buttons : [{
|
||||||
text : _('ID_UPLOAD'),
|
text : _('ID_UPLOAD'),
|
||||||
handler : function(){
|
handler : function(){
|
||||||
var uploader = Ext.getCmp('uploader');
|
var arrayMatch = [];
|
||||||
|
|
||||||
|
if ((arrayMatch = eval("/^.+\.(pm|pmx|bpmn)$/i").exec(Ext.getCmp("form-file").getValue()))) {
|
||||||
|
var fileExtension = arrayMatch[1];
|
||||||
|
|
||||||
|
switch (fileExtension) {
|
||||||
|
case "pm":
|
||||||
|
case "pmx":
|
||||||
|
var uploader = Ext.getCmp("uploader");
|
||||||
|
|
||||||
if (uploader.getForm().isValid()) {
|
if (uploader.getForm().isValid()) {
|
||||||
uploader.getForm().submit({
|
uploader.getForm().submit({
|
||||||
url : 'processes_Import_Ajax',
|
url : "processes_Import_Ajax",
|
||||||
waitMsg : _('ID_UPLOADING_PROCESS_FILE'),
|
waitMsg : _("ID_UPLOADING_PROCESS_FILE"),
|
||||||
waitTitle: " ",
|
waitTitle: " ",
|
||||||
success : function(o, resp) {
|
success: function(o, resp)
|
||||||
|
{
|
||||||
var resp_ = Ext.util.JSON.decode(resp.response.responseText);
|
var resp_ = Ext.util.JSON.decode(resp.response.responseText);
|
||||||
|
|
||||||
if (resp_.status) {
|
if (resp_.status) {
|
||||||
@@ -1265,12 +1270,13 @@ importProcess = function()
|
|||||||
if (typeof(winDesigner) == "undefined" || winDesigner.closed){
|
if (typeof(winDesigner) == "undefined" || winDesigner.closed){
|
||||||
winDesigner = window.open(
|
winDesigner = window.open(
|
||||||
"../designer?prj_uid=" + sNewProUid,
|
"../designer?prj_uid=" + sNewProUid,
|
||||||
'winDesigner'
|
"winDesigner"
|
||||||
);
|
);
|
||||||
|
|
||||||
w.close();
|
w.close();
|
||||||
processesGrid.store.reload();
|
processesGrid.store.reload();
|
||||||
} else {
|
} else {
|
||||||
PMExt.error( _('ID_FAILED'), _('PROCESS_ALREADY_OPENED'));
|
PMExt.error( _("ID_FAILED"), _("PROCESS_ALREADY_OPENED"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
window.location.href = "../designer?prj_uid=" + sNewProUid;
|
window.location.href = "../designer?prj_uid=" + sNewProUid;
|
||||||
@@ -1278,46 +1284,53 @@ importProcess = function()
|
|||||||
} else {
|
} else {
|
||||||
window.location.href = "processes_Map?PRO_UID=" + sNewProUid;
|
window.location.href = "processes_Map?PRO_UID=" + sNewProUid;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
importProcessGlobal.sNewProUid = resp_.sNewProUid;
|
importProcessGlobal.sNewProUid = resp_.sNewProUid;
|
||||||
importProcessGlobal.proFileName = resp_.proFileName;
|
importProcessGlobal.proFileName = resp_.proFileName;
|
||||||
importProcessGlobal.groupBeforeAccion = resp_.groupBeforeAccion;
|
importProcessGlobal.groupBeforeAccion = resp_.groupBeforeAccion;
|
||||||
importProcessExistGroup();
|
importProcessExistGroup();
|
||||||
}
|
}
|
||||||
}
|
} else if (resp_.ExistProcessInDatabase == "1") {
|
||||||
else if (resp_.ExistProcessInDatabase == "1") {
|
|
||||||
|
|
||||||
importProcessGlobal.proFileName = resp_.proFileName;
|
importProcessGlobal.proFileName = resp_.proFileName;
|
||||||
importProcessExistProcess();
|
importProcessExistProcess();
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
w.close();
|
w.close();
|
||||||
|
|
||||||
Ext.MessageBox.show({
|
Ext.MessageBox.show({
|
||||||
title : '',
|
title : "",
|
||||||
msg : resp_.catchMessage,
|
msg : resp_.catchMessage,
|
||||||
buttons: Ext.MessageBox.OK,
|
buttons: Ext.MessageBox.OK,
|
||||||
animEl : 'mb9',
|
animEl : "mb9",
|
||||||
fn : function(){},
|
fn : function(){},
|
||||||
icon : Ext.MessageBox.ERROR
|
icon : Ext.MessageBox.ERROR
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
failure : function(o, resp) {
|
failure : function(o, resp)
|
||||||
|
{
|
||||||
w.close();
|
w.close();
|
||||||
|
|
||||||
Ext.MessageBox.show({
|
Ext.MessageBox.show({
|
||||||
title : '',
|
title : "",
|
||||||
msg : resp.catchMessage,
|
msg : resp.catchMessage,
|
||||||
buttons: Ext.MessageBox.OK,
|
buttons: Ext.MessageBox.OK,
|
||||||
animEl : 'mb9',
|
animEl : "mb9",
|
||||||
fn : function(){},
|
fn : function(){},
|
||||||
icon : Ext.MessageBox.ERROR
|
icon : Ext.MessageBox.ERROR
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case "bpmn":
|
||||||
|
importProcessGlobal.processFileType = "bpmn";
|
||||||
|
importProcessBpmnSubmit();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Ext.MessageBox.alert(_("ID_ERROR"), _("ID_FILE_UPLOAD_INCORRECT_EXTENSION"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},{
|
},{
|
||||||
text: _('ID_CANCEL'),
|
text: _('ID_CANCEL'),
|
||||||
@@ -1331,78 +1344,6 @@ importProcess = function()
|
|||||||
w.show();
|
w.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
importProcessBpmn = function ()
|
|
||||||
{
|
|
||||||
var w = new Ext.Window({
|
|
||||||
id: 'import_process_bpmn',
|
|
||||||
title: _('ID_IMPORT_PROCESS'),
|
|
||||||
width: 420,
|
|
||||||
height: 130,
|
|
||||||
modal: true,
|
|
||||||
autoScroll: false,
|
|
||||||
maximizable: false,
|
|
||||||
resizable: false,
|
|
||||||
items: [
|
|
||||||
new Ext.FormPanel({
|
|
||||||
id: 'uploader',
|
|
||||||
fileUpload: true,
|
|
||||||
width: 400,
|
|
||||||
height: 90,
|
|
||||||
frame: true,
|
|
||||||
title: _('ID_IMPORT_PROCESS'),
|
|
||||||
header: false,
|
|
||||||
autoHeight: false,
|
|
||||||
bodyStyle: 'padding: 10px 10px 0 10px;',
|
|
||||||
labelWidth: 50,
|
|
||||||
defaults: {
|
|
||||||
anchor: '90%',
|
|
||||||
allowBlank: false,
|
|
||||||
msgTarget: 'side'
|
|
||||||
},
|
|
||||||
items: [
|
|
||||||
{
|
|
||||||
name: 'ajaxAction',
|
|
||||||
xtype: 'hidden',
|
|
||||||
value: 'uploadFileNewProcess'
|
|
||||||
}, {
|
|
||||||
name: 'processFileType',
|
|
||||||
xtype: 'hidden',
|
|
||||||
value: importProcessGlobal.processFileType
|
|
||||||
},{
|
|
||||||
name: 'createMode',
|
|
||||||
xtype: 'hidden',
|
|
||||||
value: 'create'
|
|
||||||
}, {
|
|
||||||
xtype: 'fileuploadfield',
|
|
||||||
id: 'form-file',
|
|
||||||
emptyText: _('ID_SELECT_PROCESS_FILE'),
|
|
||||||
fieldLabel: _('ID_LAN_FILE'),
|
|
||||||
name: 'PROCESS_FILENAME',
|
|
||||||
buttonText: '',
|
|
||||||
buttonCfg: {
|
|
||||||
iconCls: 'upload-icon'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
buttons: [
|
|
||||||
{
|
|
||||||
text: _('ID_UPLOAD'),
|
|
||||||
handler: function () {
|
|
||||||
importProcessBpmnSubmit();
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
text: _('ID_CANCEL'),
|
|
||||||
handler: function () {
|
|
||||||
w.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
|
||||||
]
|
|
||||||
});
|
|
||||||
w.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
var windowbpmnoption = new Ext.Window({
|
var windowbpmnoption = new Ext.Window({
|
||||||
title: _('ID_IMPORT_PROCESS'),
|
title: _('ID_IMPORT_PROCESS'),
|
||||||
header: false,
|
header: false,
|
||||||
@@ -1447,7 +1388,7 @@ var windowbpmnoption = new Ext.Window({
|
|||||||
}, {
|
}, {
|
||||||
text: _('ID_CANCEL'),
|
text: _('ID_CANCEL'),
|
||||||
handler: function () {
|
handler: function () {
|
||||||
Ext.getCmp('import_process_bpmn').close();
|
Ext.getCmp('importProcessWindow').close();
|
||||||
windowbpmnoption.hide();
|
windowbpmnoption.hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1480,7 +1421,7 @@ importProcessBpmnSubmit = function () {
|
|||||||
windowbpmnoption.show();
|
windowbpmnoption.show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Ext.getCmp('import_process_bpmn').close();
|
Ext.getCmp('importProcessWindow').close();
|
||||||
var stringxml = document.createElement("input");
|
var stringxml = document.createElement("input");
|
||||||
stringxml.type = "hidden";
|
stringxml.type = "hidden";
|
||||||
stringxml.name = "stringBpmn";
|
stringxml.name = "stringBpmn";
|
||||||
@@ -1494,7 +1435,7 @@ importProcessBpmnSubmit = function () {
|
|||||||
form.submit();
|
form.submit();
|
||||||
},
|
},
|
||||||
failure: function (o, resp) {
|
failure: function (o, resp) {
|
||||||
Ext.getCmp('import_process_bpmn').close();
|
Ext.getCmp('importProcessWindow').close();
|
||||||
Ext.MessageBox.show({
|
Ext.MessageBox.show({
|
||||||
title: '',
|
title: '',
|
||||||
msg: resp.catchMessage,
|
msg: resp.catchMessage,
|
||||||
|
|||||||
Reference in New Issue
Block a user