Don't call finish or change callbacks if upload fails

This commit is contained in:
Nathan Gray 2014-03-25 21:03:35 +00:00
parent 660f57e176
commit b93286a467

View File

@ -120,10 +120,11 @@ var et2_file = et2_inputWidget.extend(
return self.onStart(event, file_count); return self.onStart(event, file_count);
}, },
onFinish: function(event, file_count) { onFinish: function(event, file_count) {
self.onFinish.apply(self, [event, file_count]); if(self.onFinish.apply(self, [event, file_count]))
{
// Fire legacy change action when done // Fire legacy change action when done
self.change(self.input); self.change(self.input);
}
}, },
onStartOne: function(event, file_name, index, file_count) { onStartOne: function(event, file_name, index, file_count) {
// Here 'this' is the input // Here 'this' is the input
@ -426,7 +427,11 @@ var et2_file = et2_inputWidget.extend(
onFinish: function(event, file_count) { onFinish: function(event, file_count) {
this.disabled_buttons.attr("disabled", false); this.disabled_buttons.attr("disabled", false);
event.data = this; event.data = this;
if(this.options.onFinish) return et2_call(this.options.onFinish, event, file_count); if(this.options.onFinish && !jQuery.isEmptyObject(this.getValue()))
{
return et2_call(this.options.onFinish, event, file_count);
}
return (file_count == 0 || !jQuery.isEmptyObject(this.getValue()));
}, },