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.js41
1 files changed, 27 insertions, 14 deletions
diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js
index f184a1022bc..8e8a477772b 100644
--- a/core/js/oc-dialogs.js
+++ b/core/js/oc-dialogs.js
@@ -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) {
@@ -285,11 +302,7 @@ var OCdialogs = {
filename: entry.name,
date: OC.mtime2date(entry.mtime)
});
- if (entry.mimetype === "httpd/unix-directory") {
- $li.find('img').attr('src', OC.imagePath('core', 'filetypes/folder.png'));
- } else {
- $li.find('img').attr('src', OC.Router.generate('core_ajax_preview', {x:32, y:32, file:escapeHTML(dir+'/'+entry.name)}) );
- }
+ $li.find('img').attr('src', entry.mimetype_icon);
self.$filelist.append($li);
});