HOR-1062
Import pmtable>Falta una validacion cuando queremos importar otro archivo que no sea un .pmt
This commit is contained in:
@@ -770,7 +770,10 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
$fileContent = file_get_contents( $PUBLIC_ROOT_PATH . $filename );
|
$fileContent = file_get_contents( $PUBLIC_ROOT_PATH . $filename );
|
||||||
|
|
||||||
if (strpos( $fileContent, '-----== ProcessMaker Open Source Private Tables ==-----' ) === false) {
|
if (strpos( $fileContent, '-----== ProcessMaker Open Source Private Tables ==-----' ) === false) {
|
||||||
throw new Exception( G::loadTranslation( 'ID_PMTABLE_INVALID_FILE' ) );
|
$result->success = false;
|
||||||
|
$result->errorType = 'notice';
|
||||||
|
$result->message = G::loadTranslation( 'ID_PMTABLE_INVALID_FILE', array ($filename));
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
$currentProUid = '';
|
$currentProUid = '';
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ var importOption;
|
|||||||
var externalOption;
|
var externalOption;
|
||||||
var externalPermissions;
|
var externalPermissions;
|
||||||
var currentSelectedRow = -1;
|
var currentSelectedRow = -1;
|
||||||
|
var extensionPmt = 'pmt';
|
||||||
|
|
||||||
Ext.onReady(function(){
|
Ext.onReady(function(){
|
||||||
///Keyboard Events
|
///Keyboard Events
|
||||||
@@ -565,77 +566,85 @@ ImportPMTable = function(){
|
|||||||
buttons: [{
|
buttons: [{
|
||||||
id: 'importPMTableButtonUpload',
|
id: 'importPMTableButtonUpload',
|
||||||
text: _('ID_UPLOAD'),
|
text: _('ID_UPLOAD'),
|
||||||
handler: function(){
|
handler: function () {
|
||||||
var uploader = Ext.getCmp('uploader');
|
var uploader = Ext.getCmp('uploader');
|
||||||
|
if ((eval("/^.+\.(" + extensionPmt + ")$/i").exec(Ext.getCmp('uploader').items.items[0].value))) {
|
||||||
|
if (uploader.getForm().isValid()) {
|
||||||
|
uploader.getForm().submit({
|
||||||
|
url: 'pmTablesProxy/import',
|
||||||
|
waitMsg: _('ID_UPLOADING_FILE'),
|
||||||
|
waitTitle: " ",
|
||||||
|
success: function (o, resp) {
|
||||||
|
var result = Ext.util.JSON.decode(resp.response.responseText);
|
||||||
|
|
||||||
if(uploader.getForm().isValid()){
|
if (result.success) {
|
||||||
uploader.getForm().submit({
|
PMExt.notify('', result.message);
|
||||||
url: 'pmTablesProxy/import',
|
}
|
||||||
waitMsg: _('ID_UPLOADING_FILE'),
|
else {
|
||||||
waitTitle : " ",
|
win = new Ext.Window({
|
||||||
success: function(o, resp){
|
id: 'windowImportingError',
|
||||||
var result = Ext.util.JSON.decode(resp.response.responseText);
|
applyTo: 'hello-win',
|
||||||
|
layout: 'fit',
|
||||||
|
width: 500,
|
||||||
|
height: 300,
|
||||||
|
closeAction: 'hide',
|
||||||
|
plain: true,
|
||||||
|
html: '<h3>' + _('ID_IMPORTING_ERROR') + '</h3>' + result.message,
|
||||||
|
items: [],
|
||||||
|
|
||||||
if (result.success) {
|
buttons: [{
|
||||||
PMExt.notify('', result.message);
|
text: 'Close',
|
||||||
}
|
handler: function () {
|
||||||
else {
|
win.hide();
|
||||||
win = new Ext.Window({
|
}
|
||||||
id: 'windowImportingError',
|
}]
|
||||||
applyTo:'hello-win',
|
});
|
||||||
layout:'fit',
|
win.show(this);
|
||||||
width:500,
|
}
|
||||||
height:300,
|
|
||||||
closeAction:'hide',
|
|
||||||
plain: true,
|
|
||||||
html: '<h3>' + _('ID_IMPORTING_ERROR') + '</h3>' + result.message,
|
|
||||||
items: [],
|
|
||||||
|
|
||||||
buttons: [{
|
w.close();
|
||||||
text: 'Close',
|
infoGrid.store.reload();
|
||||||
handler: function(){
|
},
|
||||||
win.hide();
|
failure: function (o, resp) {
|
||||||
}
|
w.close();
|
||||||
}]
|
infoGrid.store.reload();
|
||||||
});
|
|
||||||
win.show(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
w.close();
|
var result = Ext.util.JSON.decode(resp.response.responseText);
|
||||||
infoGrid.store.reload();
|
if (result.errorType == 'warning') {
|
||||||
},
|
Ext.MessageBox.show({
|
||||||
failure: function(o, resp){
|
title: _('ID_WARNING_PMTABLES'),
|
||||||
w.close();
|
width: 510,
|
||||||
infoGrid.store.reload();
|
height: 300,
|
||||||
|
msg: "<div style=\"overflow: auto; width: 439px; height: 200px;\">" + result.message.replace(/\n/g, ' <br>') + "</div>",
|
||||||
var result = Ext.util.JSON.decode(resp.response.responseText);
|
buttons: Ext.MessageBox.OK,
|
||||||
if (result.errorType == 'warning') {
|
animEl: 'mb9',
|
||||||
Ext.MessageBox.show({
|
fn: function () {
|
||||||
title: _('ID_WARNING_PMTABLES'),
|
},
|
||||||
width: 510,
|
icon: Ext.MessageBox.INFO
|
||||||
height: 300,
|
});
|
||||||
msg: "<div style=\"overflow: auto; width: 439px; height: 200px;\">" + result.message.replace(/\n/g,' <br>') + "</div>",
|
} else {
|
||||||
buttons: Ext.MessageBox.OK,
|
if (result.errorType == 'notice') {
|
||||||
animEl: 'mb9',
|
Ext.MessageBox.alert(_("ID_ERROR"), result.message);
|
||||||
fn: function(){},
|
} else {
|
||||||
icon: Ext.MessageBox.INFO
|
if (result.fromAdmin) { /* from admin tab */
|
||||||
|
aOverwrite = result.arrayOverwrite;
|
||||||
|
aRelated = result.arrayRelated;
|
||||||
|
aMessage = result.arrayMessage;
|
||||||
|
pmtablesErrors(aOverwrite, aRelated, aMessage);
|
||||||
|
} else { /* from designer tab */
|
||||||
|
aOverwrite = result.arrayOverwrite;
|
||||||
|
aRelated = result.arrayRelated;
|
||||||
|
aMessage = result.arrayMessage;
|
||||||
|
pmtablesErrors(aOverwrite, aRelated, aMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
if(result.fromAdmin) { /* from admin tab */
|
|
||||||
aOverwrite = result.arrayOverwrite;
|
|
||||||
aRelated = result.arrayRelated;
|
|
||||||
aMessage = result.arrayMessage;
|
|
||||||
pmtablesErrors(aOverwrite,aRelated,aMessage);
|
|
||||||
} else { /* from designer tab */
|
|
||||||
aOverwrite = result.arrayOverwrite;
|
|
||||||
aRelated = result.arrayRelated;
|
|
||||||
aMessage = result.arrayMessage;
|
|
||||||
pmtablesErrors(aOverwrite,aRelated,aMessage);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
});
|
Ext.MessageBox.alert(_("ID_ERROR"), _("ID_FILE_UPLOAD_INCORRECT_EXTENSION"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},{
|
},{
|
||||||
id: 'importPMTableButtonCancel',
|
id: 'importPMTableButtonCancel',
|
||||||
|
|||||||
Reference in New Issue
Block a user