diff options
author | Michael Gapczynski <mtgap@owncloud.com> | 2012-09-01 18:53:48 -0400 |
---|---|---|
committer | Michael Gapczynski <mtgap@owncloud.com> | 2012-09-01 18:53:48 -0400 |
commit | 6c29334b4888309e7b60cbdf4defdac1c47195bf (patch) | |
tree | ba6e3f3398420e5a8b821228df9c0c0e885f2195 /core | |
parent | aad7dc8390b67ee7d04d83765b1295b9507767f5 (diff) | |
download | nextcloud-server-6c29334b4888309e7b60cbdf4defdac1c47195bf.tar.gz nextcloud-server-6c29334b4888309e7b60cbdf4defdac1c47195bf.zip |
Add support for share expiration
Diffstat (limited to 'core')
-rw-r--r-- | core/ajax/share.php | 6 | ||||
-rw-r--r-- | core/js/share.js | 27 |
2 files changed, 33 insertions, 0 deletions
diff --git a/core/ajax/share.php b/core/ajax/share.php index debdf612c0e..8c2e85523e3 100644 --- a/core/ajax/share.php +++ b/core/ajax/share.php @@ -55,6 +55,12 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo ($return) ? OC_JSON::success() : OC_JSON::error(); } break; + case 'setExpirationDate': + if (isset($_POST['date'])) { + $return = OCP\Share::setExpirationDate($_POST['itemType'], $_POST['itemSource'], $_POST['date']); + ($return) ? OC_JSON::success() : OC_JSON::error(); + } + break; } } else if (isset($_GET['fetch'])) { switch ($_GET['fetch']) { diff --git a/core/js/share.js b/core/js/share.js index 4c164f65b24..2f3b5c2fa50 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -143,6 +143,9 @@ OC.Share={ html += '<input id="linkPassText" type="password" placeholder="Password" style="display:none; width:90%;" />'; html += '</div>'; } + html += '<div id="expiration">'; + html += '<input type="checkbox" name="expirationCheckbox" id="expirationCheckbox" value="1" /><label for="expirationCheckbox">Set expiration date</label>'; + html += '<input id="expirationDate" type="text" placeholder="Expiration date" style="display:none; width:90%;" />'; html += '</div>'; $(html).appendTo(appendTo); // Reset item shares @@ -422,6 +425,30 @@ $(document).ready(function() { } }); + $('#expirationCheckbox').live('change', function() { + if (this.checked) { + console.log('checked'); + $('#expirationDate').before('<br />'); + $('#expirationDate').show(); + $('#expirationDate').datepicker({ + dateFormat : 'dd-mm-yy' + }); + } else { + console.log('unchecled'); + $('#expirationDate').hide(); + } + }); + + $('#expirationDate').live('change', function() { + var itemType = $('#dropdown').data('item-type'); + var itemSource = $('#dropdown').data('item-source'); + $.post(OC.filePath('core', 'ajax', 'share.php'), { action: 'setExpirationDate', itemType: itemType, itemSource: itemSource, date: $(this).val() }, function(result) { + if (!result || result.status !== 'success') { + OC.dialogs.alert('Error', 'Error setting expiration date'); + } + }); + }); + $('#emailPrivateLink').live('submit', function() { OC.Share.emailPrivateLink(); }); |