add expire date to link share if possible
This commit is contained in:
parent
0daabe5b6a
commit
77de47858b
|
@ -119,8 +119,12 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
|
||||||
$subject = (string)$l->t('%s shared »%s« with you', array($ownerDisplayName, $filename));
|
$subject = (string)$l->t('%s shared »%s« with you', array($ownerDisplayName, $filename));
|
||||||
$expiration = null;
|
$expiration = null;
|
||||||
if (isset($items[0]['expiration'])) {
|
if (isset($items[0]['expiration'])) {
|
||||||
$date = new DateTime($items[0]['expiration']);
|
try {
|
||||||
$expiration = $date->format('Y-m-d');
|
$date = new DateTime($items[0]['expiration']);
|
||||||
|
$expiration = $date->format('Y-m-d');
|
||||||
|
} catch (Exception $e) {
|
||||||
|
\OCP\Util::writeLog('sharing', "Couldn't read date: " . $e->getMessage(), \OCP\Util::ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($itemType === 'folder') {
|
if ($itemType === 'folder') {
|
||||||
|
@ -191,6 +195,17 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
|
||||||
$file = $_POST['file'];
|
$file = $_POST['file'];
|
||||||
$to_address = $_POST['toaddress'];
|
$to_address = $_POST['toaddress'];
|
||||||
|
|
||||||
|
$expiration = null;
|
||||||
|
if (isset($_POST['expiration']) && $_POST['expiration'] !== '') {
|
||||||
|
try {
|
||||||
|
$date = new DateTime($_POST['expiration']);
|
||||||
|
$expiration = $date->format('Y-m-d');
|
||||||
|
} catch (Exception $e) {
|
||||||
|
\OCP\Util::writeLog('sharing', "Couldn't read date: " . $e->getMessage(), \OCP\Util::ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// enable l10n support
|
// enable l10n support
|
||||||
$l = OC_L10N::get('core');
|
$l = OC_L10N::get('core');
|
||||||
|
|
||||||
|
@ -202,6 +217,7 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
|
||||||
$content->assign ('type', $type);
|
$content->assign ('type', $type);
|
||||||
$content->assign ('user_displayname', $displayName);
|
$content->assign ('user_displayname', $displayName);
|
||||||
$content->assign ('filename', $file);
|
$content->assign ('filename', $file);
|
||||||
|
$content->assign('expiration', $expiration);
|
||||||
$text = $content->fetchPage();
|
$text = $content->fetchPage();
|
||||||
|
|
||||||
$content = new OC_Template("core", "altmail", "");
|
$content = new OC_Template("core", "altmail", "");
|
||||||
|
@ -209,6 +225,7 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
|
||||||
$content->assign ('type', $type);
|
$content->assign ('type', $type);
|
||||||
$content->assign ('user_displayname', $displayName);
|
$content->assign ('user_displayname', $displayName);
|
||||||
$content->assign ('filename', $file);
|
$content->assign ('filename', $file);
|
||||||
|
$content->assign('expiration', $expiration);
|
||||||
$alttext = $content->fetchPage();
|
$alttext = $content->fetchPage();
|
||||||
|
|
||||||
$default_from = OCP\Util::getDefaultEmailAddress('sharing-noreply');
|
$default_from = OCP\Util::getDefaultEmailAddress('sharing-noreply');
|
||||||
|
|
|
@ -733,12 +733,16 @@ $(document).ready(function() {
|
||||||
var itemSource = $('#dropdown').data('item-source');
|
var itemSource = $('#dropdown').data('item-source');
|
||||||
var file = $('tr').filterAttr('data-id', String(itemSource)).data('file');
|
var file = $('tr').filterAttr('data-id', String(itemSource)).data('file');
|
||||||
var email = $('#email').val();
|
var email = $('#email').val();
|
||||||
|
var expirationDate = '';
|
||||||
|
if ( $('#expirationCheckbox').is(':checked') === true ) {
|
||||||
|
expirationDate = $( "#expirationDate" ).val();
|
||||||
|
}
|
||||||
if (email != '') {
|
if (email != '') {
|
||||||
$('#email').prop('disabled', true);
|
$('#email').prop('disabled', true);
|
||||||
$('#email').val(t('core', 'Sending ...'));
|
$('#email').val(t('core', 'Sending ...'));
|
||||||
$('#emailButton').prop('disabled', true);
|
$('#emailButton').prop('disabled', true);
|
||||||
|
|
||||||
$.post(OC.filePath('core', 'ajax', 'share.php'), { action: 'email', toaddress: email, link: link, itemType: itemType, itemSource: itemSource, file: file},
|
$.post(OC.filePath('core', 'ajax', 'share.php'), { action: 'email', toaddress: email, link: link, itemType: itemType, itemSource: itemSource, file: file, expiration: expirationDate},
|
||||||
function(result) {
|
function(result) {
|
||||||
$('#email').prop('disabled', false);
|
$('#email').prop('disabled', false);
|
||||||
$('#emailButton').prop('disabled', false);
|
$('#emailButton').prop('disabled', false);
|
||||||
|
|
Loading…
Reference in New Issue