aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/js/sharedfilelist.js
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_sharing/js/sharedfilelist.js')
-rw-r--r--apps/files_sharing/js/sharedfilelist.js99
1 files changed, 80 insertions, 19 deletions
diff --git a/apps/files_sharing/js/sharedfilelist.js b/apps/files_sharing/js/sharedfilelist.js
index 973d2120b16..e89a061e992 100644
--- a/apps/files_sharing/js/sharedfilelist.js
+++ b/apps/files_sharing/js/sharedfilelist.js
@@ -40,6 +40,7 @@
_showDeleted: false,
_clientSideSort: true,
_allowSelection: false,
+ _isOverview: false,
/**
* @private
@@ -60,6 +61,9 @@
if (options && options.showDeleted) {
this._showDeleted = true;
}
+ if (options && options.isOverview) {
+ this._isOverview = true;
+ }
},
_renderRow: function() {
@@ -191,39 +195,92 @@
// there is only root
this._setCurrentDir('/', false);
+ if (!this._isOverview) {
+ if (this._showDeleted) {
+ var shares = $.ajax({
+ url: OC.linkToOCS('apps/files_sharing/api/v1', 2) + 'deletedshares',
+ /* jshint camelcase: false */
+ data: {
+ format: 'json',
+ include_tags: true
+ },
+ type: 'GET',
+ beforeSend: function (xhr) {
+ xhr.setRequestHeader('OCS-APIREQUEST', 'true');
+ },
+ });
+ } else {
+ var shares = $.ajax({
+ url: OC.linkToOCS('apps/files_sharing/api/v1') + 'shares',
+ /* jshint camelcase: false */
+ data: {
+ format: 'json',
+ shared_with_me: !!this._sharedWithUser,
+ include_tags: true
+ },
+ type: 'GET',
+ beforeSend: function (xhr) {
+ xhr.setRequestHeader('OCS-APIREQUEST', 'true');
+ },
+ });
+ }
+ var promises = [];
+ promises.push(shares);
+
+ if (!!this._sharedWithUser) {
+ var remoteShares = $.ajax({
+ url: OC.linkToOCS('apps/files_sharing/api/v1') + 'remote_shares',
+ /* jshint camelcase: false */
+ data: {
+ format: 'json',
+ include_tags: true
+ },
+ type: 'GET',
+ beforeSend: function (xhr) {
+ xhr.setRequestHeader('OCS-APIREQUEST', 'true');
+ },
+ });
+ promises.push(remoteShares);
+ } else {
+ //Push empty promise so callback gets called the same way
+ promises.push($.Deferred().resolve());
+ }
- if (this._showDeleted) {
- var shares = $.ajax({
- url: OC.linkToOCS('apps/files_sharing/api/v1', 2) + 'deletedshares',
+ this._reloadCall = $.when.apply($, promises);
+ var callBack = this.reloadCallback.bind(this);
+ return this._reloadCall.then(callBack, callBack);
+ } else {
+ var promises = [];
+ var sharedWith = $.ajax({
+ url: OC.linkToOCS('apps/files_sharing/api/v1') + 'shares',
/* jshint camelcase: false */
data: {
format: 'json',
+ shared_with_me: true,
include_tags: true
},
type: 'GET',
- beforeSend: function(xhr) {
+ beforeSend: function (xhr) {
xhr.setRequestHeader('OCS-APIREQUEST', 'true');
},
});
- } else {
- var shares = $.ajax({
+ promises.push(sharedWith);
+
+ var sharedBy = $.ajax({
url: OC.linkToOCS('apps/files_sharing/api/v1') + 'shares',
/* jshint camelcase: false */
data: {
format: 'json',
- shared_with_me: !!this._sharedWithUser,
+ shared_with_me: false,
include_tags: true
},
type: 'GET',
- beforeSend: function(xhr) {
+ beforeSend: function (xhr) {
xhr.setRequestHeader('OCS-APIREQUEST', 'true');
},
});
- }
- var promises = [];
- promises.push(shares);
+ promises.push(sharedBy);
- if (!!this._sharedWithUser) {
var remoteShares = $.ajax({
url: OC.linkToOCS('apps/files_sharing/api/v1') + 'remote_shares',
/* jshint camelcase: false */
@@ -232,19 +289,23 @@
include_tags: true
},
type: 'GET',
- beforeSend: function(xhr) {
+ beforeSend: function (xhr) {
xhr.setRequestHeader('OCS-APIREQUEST', 'true');
},
});
promises.push(remoteShares);
- } else {
- //Push empty promise so callback gets called the same way
- promises.push($.Deferred().resolve());
+
+ this._reloadCall = $.when.apply($, promises);
+ var callBack = this.reloadOverviewCallBack().bind(this);
+ return this._reloadCall.then(callBack, callBack, callBack);
}
+ },
+
+ reloadOverviewCallBack: function(sharedWith, sharedBy, remote) {
+ delete this._reloadCall;
+ this.hideMask();
- this._reloadCall = $.when.apply($, promises);
- var callBack = this.reloadCallback.bind(this);
- return this._reloadCall.then(callBack, callBack);
+ alert('foo');
},
reloadCallback: function(shares, remoteShares) {