diff options
author | Jörn Friedrich Dreyer <jfd@butonic.de> | 2013-09-17 19:10:46 +0200 |
---|---|---|
committer | Jörn Friedrich Dreyer <jfd@butonic.de> | 2013-09-17 19:10:46 +0200 |
commit | b59ce403d8ea80ba7aac5683f667853218757502 (patch) | |
tree | 2e657117cc3e9fd7a8dfe032945cb1e9a63edc46 /core/js/oc-dialogs.js | |
parent | 2c9b3d32efa466b655a7f24c5022a42045ef482f (diff) | |
parent | 9d18e16c77e8c2690dd23dd19ca1f8e1968161c8 (diff) | |
download | nextcloud-server-b59ce403d8ea80ba7aac5683f667853218757502.tar.gz nextcloud-server-b59ce403d8ea80ba7aac5683f667853218757502.zip |
Merge branch 'master' into fix_3728_with_file_exists_dialog
Conflicts:
apps/files/css/files.css
apps/files/js/file-upload.js
apps/files/js/filelist.js
apps/files/js/files.js
apps/files_sharing/js/public.js
core/js/jquery.ocdialog.js
core/js/oc-dialogs.js
Diffstat (limited to 'core/js/oc-dialogs.js')
-rw-r--r-- | core/js/oc-dialogs.js | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js index dc293f949c1..28bd94b9b0f 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 message 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})); + } }); }, _fileexistsshown: false, @@ -454,8 +464,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); @@ -470,8 +480,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); @@ -495,9 +505,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) { @@ -536,11 +553,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); }); |