mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 19:18:44 +02:00
#1148: Fixed dashboards upload: use the more modern fileupload component, since we now hook the ajax call in iTopWebPage and removed references to the old component ajax.fileupload from (almost) everywhere...
SVN:trunk[3753]
This commit is contained in:
@@ -381,7 +381,30 @@ $(function()
|
||||
me.element.dialog('close');
|
||||
//me.onClose();
|
||||
};
|
||||
$('#'+this.options.file_id).bind('change', function() { me._doUpload(); } );
|
||||
$('#'+this.options.file_id).fileupload({
|
||||
url: me.options.submit_to+'&id='+me.options.dashboard_id,
|
||||
dataType: 'json',
|
||||
pasteZone: null, // Don't accept files via Chrome's copy/paste
|
||||
done: function (e, data) {
|
||||
if(typeof(data.result.error) != 'undefined')
|
||||
{
|
||||
if(data.result.error != '')
|
||||
{
|
||||
alert(data.result.error);
|
||||
me.element.dialog('close');
|
||||
}
|
||||
else
|
||||
{
|
||||
me.element.dialog('close');
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
},
|
||||
start: function() {
|
||||
$('#'+me.options.file_id).prop('disabled', true);
|
||||
}
|
||||
});
|
||||
|
||||
this.element
|
||||
.addClass('itop-dashboard_upload_dlg')
|
||||
.dialog({
|
||||
@@ -421,40 +444,6 @@ $(function()
|
||||
_onClose: function()
|
||||
{
|
||||
this.element.remove();
|
||||
},
|
||||
_doUpload: function()
|
||||
{
|
||||
var me = this;
|
||||
$.ajaxFileUpload
|
||||
(
|
||||
{
|
||||
url: me.options.submit_to+'&id='+me.options.dashboard_id,
|
||||
secureuri:false,
|
||||
fileElementId: me.options.file_id,
|
||||
dataType: 'json',
|
||||
success: function (data, status)
|
||||
{
|
||||
if(typeof(data.error) != 'undefined')
|
||||
{
|
||||
if(data.error != '')
|
||||
{
|
||||
alert(data.error);
|
||||
me.element.dialog('close');
|
||||
}
|
||||
else
|
||||
{
|
||||
me.element.dialog('close');
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (data, status, e)
|
||||
{
|
||||
alert(e);
|
||||
me.element.dialog('close');
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user