Import pmtable>Falta una validacion cuando queremos importar otro archivo que no sea un .pmt
This commit is contained in:
dheeyi william
2016-07-18 12:34:33 -04:00
parent 7e9ba14445
commit ff4543b217
2 changed files with 78 additions and 66 deletions

View File

@@ -770,7 +770,10 @@ class pmTablesProxy extends HttpProxyController
$fileContent = file_get_contents( $PUBLIC_ROOT_PATH . $filename );
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 = '';

View File

@@ -17,6 +17,7 @@ var importOption;
var externalOption;
var externalPermissions;
var currentSelectedRow = -1;
var extensionPmt = 'pmt';
Ext.onReady(function(){
///Keyboard Events
@@ -565,77 +566,85 @@ ImportPMTable = function(){
buttons: [{
id: 'importPMTableButtonUpload',
text: _('ID_UPLOAD'),
handler: function(){
var uploader = Ext.getCmp('uploader');
handler: function () {
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()){
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 (result.success) {
PMExt.notify('', result.message);
}
else {
win = new Ext.Window({
id: 'windowImportingError',
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) {
PMExt.notify('', result.message);
}
else {
win = new Ext.Window({
id: 'windowImportingError',
applyTo:'hello-win',
layout:'fit',
width:500,
height:300,
closeAction:'hide',
plain: true,
html: '<h3>' + _('ID_IMPORTING_ERROR') + '</h3>' + result.message,
items: [],
buttons: [{
text: 'Close',
handler: function () {
win.hide();
}
}]
});
win.show(this);
}
buttons: [{
text: 'Close',
handler: function(){
win.hide();
}
}]
});
win.show(this);
}
w.close();
infoGrid.store.reload();
},
failure: function (o, resp) {
w.close();
infoGrid.store.reload();
w.close();
infoGrid.store.reload();
},
failure: function(o, resp){
w.close();
infoGrid.store.reload();
var result = Ext.util.JSON.decode(resp.response.responseText);
if (result.errorType == 'warning') {
Ext.MessageBox.show({
title: _('ID_WARNING_PMTABLES'),
width: 510,
height: 300,
msg: "<div style=\"overflow: auto; width: 439px; height: 200px;\">" + result.message.replace(/\n/g,' <br>') + "</div>",
buttons: Ext.MessageBox.OK,
animEl: 'mb9',
fn: function(){},
icon: Ext.MessageBox.INFO
var result = Ext.util.JSON.decode(resp.response.responseText);
if (result.errorType == 'warning') {
Ext.MessageBox.show({
title: _('ID_WARNING_PMTABLES'),
width: 510,
height: 300,
msg: "<div style=\"overflow: auto; width: 439px; height: 200px;\">" + result.message.replace(/\n/g, ' <br>') + "</div>",
buttons: Ext.MessageBox.OK,
animEl: 'mb9',
fn: function () {
},
icon: Ext.MessageBox.INFO
});
} else {
if (result.errorType == 'notice') {
Ext.MessageBox.alert(_("ID_ERROR"), result.message);
} 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 {
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',