Merged in bugfix/HOR-4039 (pull request #6189)

HOR-4039

Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
Marco Antonio Nina Mena
2017-11-29 19:41:36 +00:00
committed by Julio Cesar Laura Avendaño

View File

@@ -243,13 +243,31 @@ Ext.onReady(function() {
emptyText: '',
fieldLabel: _('ID_IMAGE'),
buttonText: _('ID_SELECT_FILE'),
name : 'img'
name: 'img',
validator: function (filePath) {
var flag, btn;
btn = Ext.getCmp('btnUpload');
btn.disable();
filePath = filePath.replace(/^\s|\s$/g, ""); //trims string
if (filePath.match(/([^\/\\]+)\.(gif|png|jpg|jpeg|pjpeg|x-png)$/i)) {
flag = true;
btn.enable();
} else {
messageError = _('ID_ERROR_UPLOADING_IMAGE_TYPE');
PMExt.notify(_('ID_ERROR'), messageError);
flag = false;
}
return flag;
}
}
],
buttons:
[
{
text: _('ID_UPLOAD'),
id: 'btnUpload',
disabled: true,
handler: function () {
panelRightTop.getForm().submit({
url: '../adminProxy/uploadImage',