summaryrefslogtreecommitdiffstats
path: root/core/js
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-05-07 12:17:46 +0200
committerMorris Jobke <hey@morrisjobke.de>2014-05-19 01:40:32 +0200
commitd273b55e986488b9c24d0b2c27130221333d7ac9 (patch)
tree43254e8b6c3d73b4331d9a3cd5ab4ddab83e6cbc /core/js
parentab7ae004f7f5620b474ad506990cba56823c42b2 (diff)
downloadnextcloud-server-d273b55e986488b9c24d0b2c27130221333d7ac9.tar.gz
nextcloud-server-d273b55e986488b9c24d0b2c27130221333d7ac9.zip
Correctly set expiration dates when adding additional shares
Diffstat (limited to 'core/js')
-rw-r--r--core/js/share.js35
1 files changed, 31 insertions, 4 deletions
diff --git a/core/js/share.js b/core/js/share.js
index 6c6631aa2b2..f1d89ae8362 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -136,7 +136,21 @@ OC.Share={
return data;
},
- share:function(itemType, itemSource, shareType, shareWith, permissions, itemSourceName, callback) {
+ share:function(itemType, itemSource, shareType, shareWith, permissions, itemSourceName, expirationDate, callback) {
+ // Add a fallback for old share() calls without expirationDate.
+ // We should remove this in a later version,
+ // after the Apps have been updated.
+ if (typeof callback === 'undefined' &&
+ typeof expirationDate === 'function') {
+ callback = expirationDate;
+ expirationDate = '';
+ console.warn(
+ "Call to 'OC.Share.share()' with too few arguments. " +
+ "'expirationDate' was assumed to be 'callback'. " +
+ "Please revisit the call and fix the list of arguments."
+ );
+ }
+
$.post(OC.filePath('core', 'ajax', 'share.php'),
{
action: 'share',
@@ -145,7 +159,8 @@ OC.Share={
shareType: shareType,
shareWith: shareWith,
permissions: permissions,
- itemSourceName: itemSourceName
+ itemSourceName: itemSourceName,
+ expirationDate: expirationDate
}, function (result) {
if (result && result.status === 'success') {
if (callback) {
@@ -303,6 +318,10 @@ OC.Share={
var itemType = $('#dropdown').data('item-type');
var itemSource = $('#dropdown').data('item-source');
var itemSourceName = $('#dropdown').data('item-source-name');
+ var expirationDate = '';
+ if ( $('#expirationCheckbox').is(':checked') === true ) {
+ expirationDate = $( "#expirationDate" ).val();
+ }
var shareType = selected.item.value.shareType;
var shareWith = selected.item.value.shareWith;
$(this).val(shareWith);
@@ -322,7 +341,7 @@ OC.Share={
permissions = permissions | OC.PERMISSION_SHARE;
}
- OC.Share.share(itemType, itemSource, shareType, shareWith, permissions, itemSourceName, function() {
+ OC.Share.share(itemType, itemSource, shareType, shareWith, permissions, itemSourceName, expirationDate, function() {
OC.Share.addShareWith(shareType, shareWith, selected.item.label, permissions, possiblePermissions);
$('#shareWith').val('');
OC.Share.updateIcon(itemType, itemSource);
@@ -643,6 +662,10 @@ $(document).ready(function() {
var itemType = $('#dropdown').data('item-type');
var itemSource = $('#dropdown').data('item-source');
var itemSourceName = $('#dropdown').data('item-source-name');
+ var expirationDate = '';
+ if ($('#expirationCheckbox').is(':checked') === true) {
+ expirationDate = $( "#expirationDate" ).val();
+ }
if (this.checked) {
// Create a link
if (oc_appconfig.core.enforcePasswordForPublicLink === false) {
@@ -682,6 +705,10 @@ $(document).ready(function() {
var itemType = $('#dropdown').data('item-type');
var itemSource = $('#dropdown').data('item-source');
var itemSourceName = $('#dropdown').data('item-source-name');
+ var expirationDate = '';
+ if ($('#expirationCheckbox').is(':checked') === true) {
+ expirationDate = $( "#expirationDate" ).val();
+ }
var permissions = 0;
// Calculate permissions
@@ -692,7 +719,7 @@ $(document).ready(function() {
}
// Update the share information
- OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, '', permissions, itemSourceName, function(data) {
+ OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, '', permissions, itemSourceName, expirationDate, function(data) {
});
});