summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/js
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-09-30 18:20:55 +0200
committerMorris Jobke <hey@morrisjobke.de>2016-07-07 15:10:03 +0200
commitb5dea82e45ec6e7eea293605ddd4eac06a8d9dd0 (patch)
treedd9b61dd6b57f5cf220377588d206f04fb3d1742 /apps/files_sharing/js
parent6d680bdebf944f6ceb1df66266a82a135f7486b9 (diff)
downloadnextcloud-server-b5dea82e45ec6e7eea293605ddd4eac06a8d9dd0.tar.gz
nextcloud-server-b5dea82e45ec6e7eea293605ddd4eac06a8d9dd0.zip
Add expiration date to share by link view
Diffstat (limited to 'apps/files_sharing/js')
-rw-r--r--apps/files_sharing/js/sharedfilelist.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/apps/files_sharing/js/sharedfilelist.js b/apps/files_sharing/js/sharedfilelist.js
index da0f957ed99..10ea3e33efd 100644
--- a/apps/files_sharing/js/sharedfilelist.js
+++ b/apps/files_sharing/js/sharedfilelist.js
@@ -79,6 +79,38 @@
var permission = parseInt($tr.attr('data-permissions')) | OC.PERMISSION_DELETE;
$tr.attr('data-permissions', permission);
}
+
+ // add row with expiration date for link only shares - influenced by _createRow of filelist
+ if (this._linksOnly) {
+ var expirationTimestamp = moment(fileData.shares[0].expiration).valueOf();
+ $tr.attr('data-expiration', expirationTimestamp);
+
+ // date column (1000 milliseconds to seconds, 60 seconds, 60 minutes, 24 hours)
+ // difference in days multiplied by 5 - brightest shade for expiry dates in more than 32 days (160/5)
+ var modifiedColor = Math.round((expirationTimestamp - (new Date()).getTime()) / 1000 / 60 / 60 / 24 * 5);
+ // ensure that the brightest color is still readable
+ if (modifiedColor >= '160') {
+ modifiedColor = 160;
+ }
+
+ if (expirationTimestamp > 0) {
+ formatted = OC.Util.formatDate(expirationTimestamp);
+ text = OC.Util.relativeModifiedDate(expirationTimestamp);
+ } else {
+ formatted = t('files_sharing', 'No expiration date set');
+ text = '';
+ }
+ td = $('<td></td>').attr({"class": "date"});
+ td.append($('<span></span>').attr({
+ "class": "modified",
+ "title": formatted,
+ "style": 'color:rgb(' + modifiedColor + ',' + modifiedColor + ',' + modifiedColor + ')'
+ }).text(text)
+ .tooltip({placement: 'top'})
+ );
+
+ $tr.append(td);
+ }
return $tr;
},
@@ -172,6 +204,11 @@
if (shares[0].ocs && shares[0].ocs.data) {
files = files.concat(this._makeFilesFromShares(shares[0].ocs.data));
+
+ // hide expiration date header for non link only shares
+ if (!this._linksOnly) {
+ this.$el.find('th.column-expiration').addClass('hidden');
+ }
}
if (remoteShares && remoteShares[0].ocs && remoteShares[0].ocs.data) {
@@ -249,6 +286,7 @@
type: share.share_type,
target: share.share_with,
stime: share.stime * 1000,
+ expiration: share.expiration,
};
if (self._sharedWithUser) {
file.shareOwner = share.displayname_owner;