Tiny start of the share overview
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
parent
ca65b82f04
commit
1f9e50086c
|
@ -62,17 +62,6 @@ if ($config->getAppValue('core', 'shareapi_enabled', 'yes') === 'yes') {
|
||||||
'name' => $l->t('Shared with you'),
|
'name' => $l->t('Shared with you'),
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
\OCA\Files\App::getNavigationManager()->add(function () {
|
|
||||||
$l = \OC::$server->getL10N('files_sharing');
|
|
||||||
return [
|
|
||||||
'id' => 'deletedshares',
|
|
||||||
'appname' => 'files_sharing',
|
|
||||||
'script' => 'list.php',
|
|
||||||
'order' => 18,
|
|
||||||
'name' => $l->t('Deleted shares'),
|
|
||||||
];
|
|
||||||
});
|
|
||||||
|
|
||||||
if (\OCP\Util::isSharingDisabledForUser() === false) {
|
if (\OCP\Util::isSharingDisabledForUser() === false) {
|
||||||
\OCA\Files\App::getNavigationManager()->add(function () {
|
\OCA\Files\App::getNavigationManager()->add(function () {
|
||||||
|
@ -100,4 +89,27 @@ if ($config->getAppValue('core', 'shareapi_enabled', 'yes') === 'yes') {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
\OCA\Files\App::getNavigationManager()->add(function () {
|
||||||
|
$l = \OC::$server->getL10N('files_sharing');
|
||||||
|
return [
|
||||||
|
'id' => 'shareoverview',
|
||||||
|
'appname' => 'files_sharing',
|
||||||
|
'script' => 'list.php',
|
||||||
|
'order' => 18,
|
||||||
|
'name' => $l->t('Share overview'),
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
\OCA\Files\App::getNavigationManager()->add(function () {
|
||||||
|
$l = \OC::$server->getL10N('files_sharing');
|
||||||
|
return [
|
||||||
|
'id' => 'deletedshares',
|
||||||
|
'appname' => 'files_sharing',
|
||||||
|
'script' => 'list.php',
|
||||||
|
'order' => 19,
|
||||||
|
'name' => $l->t('Deleted shares'),
|
||||||
|
];
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ OCA.Sharing.App = {
|
||||||
|
|
||||||
_inFileList: null,
|
_inFileList: null,
|
||||||
_outFileList: null,
|
_outFileList: null,
|
||||||
|
_overviewFileList: null,
|
||||||
|
|
||||||
initSharingIn: function($el) {
|
initSharingIn: function($el) {
|
||||||
if (this._inFileList) {
|
if (this._inFileList) {
|
||||||
|
@ -116,6 +117,28 @@ OCA.Sharing.App = {
|
||||||
return this._deletedFileList;
|
return this._deletedFileList;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
initShareingOverview: function($el) {
|
||||||
|
if (this._overviewFileList) {
|
||||||
|
return this._overviewFileList;
|
||||||
|
}
|
||||||
|
this._overviewFileList = new OCA.Sharing.FileList(
|
||||||
|
$el,
|
||||||
|
{
|
||||||
|
id: 'shares.overview',
|
||||||
|
scrollContainer: $('#app-content'),
|
||||||
|
config: OCA.Files.App.getFilesConfig(),
|
||||||
|
isOverview: true
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
this._extendFileList(this._overviewFileList);
|
||||||
|
this._overviewFileList.appName = t('files_sharing', 'Share overview');
|
||||||
|
this._overviewFileList.$el.find('#emptycontent').html('<div class="icon-share"></div>' +
|
||||||
|
'<h2>' + t('files_sharing', 'No shares') + '</h2>' +
|
||||||
|
'<p>' + t('files_sharing', 'Shares will show up here') + '</p>');
|
||||||
|
return this._overviewFileList;
|
||||||
|
},
|
||||||
|
|
||||||
removeSharingIn: function() {
|
removeSharingIn: function() {
|
||||||
if (this._inFileList) {
|
if (this._inFileList) {
|
||||||
this._inFileList.$fileList.empty();
|
this._inFileList.$fileList.empty();
|
||||||
|
@ -140,6 +163,12 @@ OCA.Sharing.App = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
removeSharingOverview: function() {
|
||||||
|
if (this._overviewFileList) {
|
||||||
|
this._overviewFileList.$fileList.empty();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroy the app
|
* Destroy the app
|
||||||
*/
|
*/
|
||||||
|
@ -152,6 +181,7 @@ OCA.Sharing.App = {
|
||||||
this._inFileList = null;
|
this._inFileList = null;
|
||||||
this._outFileList = null;
|
this._outFileList = null;
|
||||||
this._linkFileList = null;
|
this._linkFileList = null;
|
||||||
|
this._overviewFileList = null;
|
||||||
delete this._globalActionsInitialized;
|
delete this._globalActionsInitialized;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -252,4 +282,10 @@ $(document).ready(function() {
|
||||||
$('#app-content-deletedshares').on('hide', function() {
|
$('#app-content-deletedshares').on('hide', function() {
|
||||||
OCA.Sharing.App.removeSharingDeleted();
|
OCA.Sharing.App.removeSharingDeleted();
|
||||||
});
|
});
|
||||||
|
$('#app-content-shareoverview').on('show', function(e) {
|
||||||
|
OCA.Sharing.App.initShareingOverview($(e.target));
|
||||||
|
});
|
||||||
|
$('#app-content-shareoverview').on('hide', function() {
|
||||||
|
OCA.Sharing.App.removeSharingOverview();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
_showDeleted: false,
|
_showDeleted: false,
|
||||||
_clientSideSort: true,
|
_clientSideSort: true,
|
||||||
_allowSelection: false,
|
_allowSelection: false,
|
||||||
|
_isOverview: false,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
|
@ -60,6 +61,9 @@
|
||||||
if (options && options.showDeleted) {
|
if (options && options.showDeleted) {
|
||||||
this._showDeleted = true;
|
this._showDeleted = true;
|
||||||
}
|
}
|
||||||
|
if (options && options.isOverview) {
|
||||||
|
this._isOverview = true;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_renderRow: function() {
|
_renderRow: function() {
|
||||||
|
@ -191,39 +195,92 @@
|
||||||
// there is only root
|
// there is only root
|
||||||
this._setCurrentDir('/', false);
|
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._showDeleted) {
|
if (!!this._sharedWithUser) {
|
||||||
var shares = $.ajax({
|
var remoteShares = $.ajax({
|
||||||
url: OC.linkToOCS('apps/files_sharing/api/v1', 2) + 'deletedshares',
|
url: OC.linkToOCS('apps/files_sharing/api/v1') + 'remote_shares',
|
||||||
/* jshint camelcase: false */
|
/* jshint camelcase: false */
|
||||||
data: {
|
data: {
|
||||||
format: 'json',
|
format: 'json',
|
||||||
include_tags: true
|
include_tags: true
|
||||||
},
|
},
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
beforeSend: function(xhr) {
|
beforeSend: function (xhr) {
|
||||||
xhr.setRequestHeader('OCS-APIREQUEST', 'true');
|
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.reloadCallback.bind(this);
|
||||||
|
return this._reloadCall.then(callBack, callBack);
|
||||||
} else {
|
} else {
|
||||||
var shares = $.ajax({
|
var promises = [];
|
||||||
|
var sharedWith = $.ajax({
|
||||||
url: OC.linkToOCS('apps/files_sharing/api/v1') + 'shares',
|
url: OC.linkToOCS('apps/files_sharing/api/v1') + 'shares',
|
||||||
/* jshint camelcase: false */
|
/* jshint camelcase: false */
|
||||||
data: {
|
data: {
|
||||||
format: 'json',
|
format: 'json',
|
||||||
shared_with_me: !!this._sharedWithUser,
|
shared_with_me: true,
|
||||||
include_tags: true
|
include_tags: true
|
||||||
},
|
},
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
beforeSend: function(xhr) {
|
beforeSend: function (xhr) {
|
||||||
xhr.setRequestHeader('OCS-APIREQUEST', 'true');
|
xhr.setRequestHeader('OCS-APIREQUEST', 'true');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
promises.push(sharedWith);
|
||||||
var promises = [];
|
|
||||||
promises.push(shares);
|
var sharedBy = $.ajax({
|
||||||
|
url: OC.linkToOCS('apps/files_sharing/api/v1') + 'shares',
|
||||||
|
/* jshint camelcase: false */
|
||||||
|
data: {
|
||||||
|
format: 'json',
|
||||||
|
shared_with_me: false,
|
||||||
|
include_tags: true
|
||||||
|
},
|
||||||
|
type: 'GET',
|
||||||
|
beforeSend: function (xhr) {
|
||||||
|
xhr.setRequestHeader('OCS-APIREQUEST', 'true');
|
||||||
|
},
|
||||||
|
});
|
||||||
|
promises.push(sharedBy);
|
||||||
|
|
||||||
if (!!this._sharedWithUser) {
|
|
||||||
var remoteShares = $.ajax({
|
var remoteShares = $.ajax({
|
||||||
url: OC.linkToOCS('apps/files_sharing/api/v1') + 'remote_shares',
|
url: OC.linkToOCS('apps/files_sharing/api/v1') + 'remote_shares',
|
||||||
/* jshint camelcase: false */
|
/* jshint camelcase: false */
|
||||||
|
@ -232,19 +289,23 @@
|
||||||
include_tags: true
|
include_tags: true
|
||||||
},
|
},
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
beforeSend: function(xhr) {
|
beforeSend: function (xhr) {
|
||||||
xhr.setRequestHeader('OCS-APIREQUEST', 'true');
|
xhr.setRequestHeader('OCS-APIREQUEST', 'true');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
promises.push(remoteShares);
|
promises.push(remoteShares);
|
||||||
} else {
|
|
||||||
//Push empty promise so callback gets called the same way
|
|
||||||
promises.push($.Deferred().resolve());
|
|
||||||
}
|
|
||||||
|
|
||||||
this._reloadCall = $.when.apply($, promises);
|
this._reloadCall = $.when.apply($, promises);
|
||||||
var callBack = this.reloadCallback.bind(this);
|
var callBack = this.reloadOverviewCallBack().bind(this);
|
||||||
return this._reloadCall.then(callBack, callBack);
|
return this._reloadCall.then(callBack, callBack, callBack);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
reloadOverviewCallBack: function(sharedWith, sharedBy, remote) {
|
||||||
|
delete this._reloadCall;
|
||||||
|
this.hideMask();
|
||||||
|
|
||||||
|
alert('foo');
|
||||||
},
|
},
|
||||||
|
|
||||||
reloadCallback: function(shares, remoteShares) {
|
reloadCallback: function(shares, remoteShares) {
|
||||||
|
|
Loading…
Reference in New Issue