diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-11-23 09:38:01 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-11-23 09:38:01 +0100 |
commit | 79bbda994bb8dd2231f68f57785237f79f86f6c7 (patch) | |
tree | 65585aed0d21cc679cdf7e2509efd6fa3d33b458 /apps/files_trashbin/js | |
parent | 2f89eef334bd445a7e046d845d5d5d1b3e4b6b8c (diff) | |
parent | 418fefc93c3332c77ec617ef108138efb6a34544 (diff) | |
download | nextcloud-server-79bbda994bb8dd2231f68f57785237f79f86f6c7.tar.gz nextcloud-server-79bbda994bb8dd2231f68f57785237f79f86f6c7.zip |
Merge pull request #16902 from owncloud/jsocclient
Web UI uses Webdav instead of ajax/* calls
Diffstat (limited to 'apps/files_trashbin/js')
-rw-r--r-- | apps/files_trashbin/js/app.js | 5 | ||||
-rw-r--r-- | apps/files_trashbin/js/filelist.js | 72 |
2 files changed, 72 insertions, 5 deletions
diff --git a/apps/files_trashbin/js/app.js b/apps/files_trashbin/js/app.js index 1f46f568bf2..600a8ce2b03 100644 --- a/apps/files_trashbin/js/app.js +++ b/apps/files_trashbin/js/app.js @@ -38,10 +38,7 @@ OCA.Trashbin.App = { var fileActions = new OCA.Files.FileActions(); fileActions.register('dir', 'Open', OC.PERMISSION_READ, '', function (filename, context) { var dir = context.fileList.getCurrentDirectory(); - if (dir !== '/') { - dir = dir + '/'; - } - context.fileList.changeDirectory(dir + filename); + context.fileList.changeDirectory(OC.joinPaths(dir, filename)); }); fileActions.setDefault('dir', 'Open'); diff --git a/apps/files_trashbin/js/filelist.js b/apps/files_trashbin/js/filelist.js index 6b624e333a0..5812aff82f7 100644 --- a/apps/files_trashbin/js/filelist.js +++ b/apps/files_trashbin/js/filelist.js @@ -283,7 +283,77 @@ isSelectedDeletable: function() { return true; - } + }, + + /** + * Reloads the file list using ajax call + * + * @return ajax call object + */ + reload: function() { + this._selectedFiles = {}; + this._selectionSummary.clear(); + this.$el.find('.select-all').prop('checked', false); + this.showMask(); + if (this._reloadCall) { + this._reloadCall.abort(); + } + this._reloadCall = $.ajax({ + url: this.getAjaxUrl('list'), + data: { + dir : this.getCurrentDirectory(), + sort: this._sort, + sortdirection: this._sortDirection + } + }); + var callBack = this.reloadCallback.bind(this); + return this._reloadCall.then(callBack, callBack); + }, + reloadCallback: function(result) { + delete this._reloadCall; + this.hideMask(); + + if (!result || result.status === 'error') { + // if the error is not related to folder we're trying to load, reload the page to handle logout etc + if (result.data.error === 'authentication_error' || + result.data.error === 'token_expired' || + result.data.error === 'application_not_enabled' + ) { + OC.redirect(OC.generateUrl('apps/files')); + } + OC.Notification.show(result.data.message); + return false; + } + + // Firewall Blocked request? + if (result.status === 403) { + // Go home + this.changeDirectory('/'); + OC.Notification.show(t('files', 'This operation is forbidden')); + return false; + } + + // Did share service die or something else fail? + if (result.status === 500) { + // Go home + this.changeDirectory('/'); + OC.Notification.show(t('files', 'This directory is unavailable, please check the logs or contact the administrator')); + return false; + } + + if (result.status === 404) { + // go back home + this.changeDirectory('/'); + return false; + } + // aborted ? + if (result.status === 0){ + return true; + } + + this.setFiles(result.data.files); + return true; + }, }); |