summaryrefslogtreecommitdiffstats
path: root/core/js/oc-dialogs.js
diff options
context:
space:
mode:
Diffstat (limited to 'core/js/oc-dialogs.js')
-rw-r--r--core/js/oc-dialogs.js39
1 files changed, 28 insertions, 11 deletions
diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js
index 4092b8d0746..8e8a477772b 100644
--- a/core/js/oc-dialogs.js
+++ b/core/js/oc-dialogs.js
@@ -77,7 +77,7 @@ var OCdialogs = {
self.$filePicker = $tmpl.octemplate({
dialog_name: dialog_name,
title: title
- }).data('path', '');
+ }).data('path', '').data('multiselect', multiselect).data('mimetype', mimetype_filter);
if (modal === undefined) {
modal = false;
@@ -100,7 +100,7 @@ var OCdialogs = {
self._handlePickerClick(event, $(this));
});
self._fillFilePicker('');
- }).data('multiselect', multiselect).data('mimetype',mimetype_filter);
+ });
// build buttons
var functionToCall = function() {
@@ -139,8 +139,12 @@ var OCdialogs = {
}
});
})
- .fail(function() {
- alert(t('core', 'Error loading file picker template'));
+ .fail(function(status, error) {
+ // If the method is called while navigating away
+ // from the page, it is probably not needed ;)
+ if(status !== 0) {
+ alert(t('core', 'Error loading file picker template: {error}', {error: error}));
+ }
});
},
/**
@@ -206,8 +210,14 @@ var OCdialogs = {
});
OCdialogs.dialogs_counter++;
})
- .fail(function() {
- alert(t('core', 'Error loading file picker template'));
+ .fail(function(status, error) {
+ // If the method is called while navigating away from
+ // the page, we still want to deliver the message.
+ if(status === 0) {
+ alert(title + ': ' + content);
+ } else {
+ alert(t('core', 'Error loading message template: {error}', {error: error}));
+ }
});
},
_getFilePickerTemplate: function() {
@@ -219,8 +229,8 @@ var OCdialogs = {
self.$listTmpl = self.$filePickerTemplate.find('.filelist li:first-child').detach();
defer.resolve(self.$filePickerTemplate);
})
- .fail(function() {
- defer.reject();
+ .fail(function(jqXHR, textStatus, errorThrown) {
+ defer.reject(jqXHR.status, errorThrown);
});
} else {
defer.resolve(this.$filePickerTemplate);
@@ -235,8 +245,8 @@ var OCdialogs = {
self.$messageTemplate = $(tmpl);
defer.resolve(self.$messageTemplate);
})
- .fail(function() {
- defer.reject();
+ .fail(function(jqXHR, textStatus, errorThrown) {
+ defer.reject(jqXHR.status, errorThrown);
});
} else {
defer.resolve(this.$messageTemplate);
@@ -244,9 +254,16 @@ var OCdialogs = {
return defer.promise();
},
_getFileList: function(dir, mimeType) {
+ if (typeof(mimeType) === "string") {
+ mimeType = [mimeType];
+ }
+
return $.getJSON(
OC.filePath('files', 'ajax', 'rawlist.php'),
- {dir: dir, mimetype: mimeType}
+ {
+ dir: dir,
+ mimetypes: JSON.stringify(mimeType)
+ }
);
},
_determineValue: function(element) {