Add expiration date to share by link view
This commit is contained in:
parent
6d680bdebf
commit
b5dea82e45
2 changed files with 41 additions and 0 deletions
|
@ -79,6 +79,38 @@
|
||||||
var permission = parseInt($tr.attr('data-permissions')) | OC.PERMISSION_DELETE;
|
var permission = parseInt($tr.attr('data-permissions')) | OC.PERMISSION_DELETE;
|
||||||
$tr.attr('data-permissions', permission);
|
$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;
|
return $tr;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -172,6 +204,11 @@
|
||||||
|
|
||||||
if (shares[0].ocs && shares[0].ocs.data) {
|
if (shares[0].ocs && shares[0].ocs.data) {
|
||||||
files = files.concat(this._makeFilesFromShares(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) {
|
if (remoteShares && remoteShares[0].ocs && remoteShares[0].ocs.data) {
|
||||||
|
@ -249,6 +286,7 @@
|
||||||
type: share.share_type,
|
type: share.share_type,
|
||||||
target: share.share_with,
|
target: share.share_with,
|
||||||
stime: share.stime * 1000,
|
stime: share.stime * 1000,
|
||||||
|
expiration: share.expiration,
|
||||||
};
|
};
|
||||||
if (self._sharedWithUser) {
|
if (self._sharedWithUser) {
|
||||||
file.shareOwner = share.displayname_owner;
|
file.shareOwner = share.displayname_owner;
|
||||||
|
|
|
@ -22,6 +22,9 @@
|
||||||
<th id="headerDate" class="hidden column-mtime">
|
<th id="headerDate" class="hidden column-mtime">
|
||||||
<a id="modified" class="columntitle" data-sort="mtime"><span><?php p($l->t( 'Share time' )); ?></span><span class="sort-indicator"></span></a>
|
<a id="modified" class="columntitle" data-sort="mtime"><span><?php p($l->t( 'Share time' )); ?></span><span class="sort-indicator"></span></a>
|
||||||
</th>
|
</th>
|
||||||
|
<th class="hidden column-expiration">
|
||||||
|
<a class="columntitle"><span><?php p($l->t( 'Expiration date' )); ?></span></a>
|
||||||
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="fileList">
|
<tbody id="fileList">
|
||||||
|
|
Loading…
Reference in a new issue