diff options
author | Michael Gapczynski <GapczynskiM@gmail.com> | 2012-04-26 10:33:06 -0400 |
---|---|---|
committer | Michael Gapczynski <GapczynskiM@gmail.com> | 2012-04-26 10:33:24 -0400 |
commit | 754844f5c9884d1889ea29cdf5fd3ecc9ef6fb86 (patch) | |
tree | 7c4621f4da44b15e40b7aa3af0567da7a114961a /apps | |
parent | 6312067ab58b3d7121ed8e3211030f77eda699bd (diff) | |
download | nextcloud-server-754844f5c9884d1889ea29cdf5fd3ecc9ef6fb86.tar.gz nextcloud-server-754844f5c9884d1889ea29cdf5fd3ecc9ef6fb86.zip |
Add ability to send private links from sharing via email
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_sharing/ajax/email.php | 15 | ||||
-rw-r--r-- | apps/files_sharing/js/share.js | 21 |
2 files changed, 34 insertions, 2 deletions
diff --git a/apps/files_sharing/ajax/email.php b/apps/files_sharing/ajax/email.php new file mode 100644 index 00000000000..d6d53c49bff --- /dev/null +++ b/apps/files_sharing/ajax/email.php @@ -0,0 +1,15 @@ +<?php + +require_once('../../../lib/base.php'); + +OC_JSON::checkLoggedIn(); +OC_JSON::checkAppEnabled('files_sharing'); +$user = OC_User::getUser(); +// TODO translations +$subject = $user + ' ' + 'shared a file with you'; +$link = $_POST['link'] + '&f=' + $_POST['f']; +$text = $user + ' ' + 'shared the file' + ' ' + $_POST['f'] + ' ' + 'with you.' + ' ' + 'It is available for download here:' + ' ' + $link; +$fromaddress = OC_Preferences::getValue($user, 'settings', 'email', 'owncloud.org'); +OC_Mail::send($_POST['toaddress'], $_POST['toaddress'], $subject, $text, $fromaddress, $user); + +?>
\ No newline at end of file diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js index 54d749d833e..4125fd14d25 100644 --- a/apps/files_sharing/js/share.js +++ b/apps/files_sharing/js/share.js @@ -163,6 +163,9 @@ $(document).ready(function() { data: data, success: function(){ $('#link').hide('blind'); + $('#emailBreak').remove(); + $('#email').hide('blind'); + $('#emailButton').hide('blind'); } }); } @@ -172,6 +175,14 @@ $(document).ready(function() { $(this).focus(); $(this).select(); }); + + $('#emailButton').live('click', function() { + $('#email').css('font-weight', 'bold'); + $('#email').animate({ fontWeight: 'normal' }, 2000, function() { + $(this).val(''); + }).val('Email sent'); + $.post(OC.filePath('files_sharing','ajax','email.php'), 'toaddress='+$('#email').val()+'&link='+$('#link').val()); + }); }); function createDropdown(filename, files) { @@ -183,10 +194,12 @@ function createDropdown(filename, files) { html += '<ul id="shared_list"></ul>'; html += '</div>'; html += '<div id="public">'; - html += '<input type="checkbox" name="makelink" id="makelink" value="1" /><label for="makelink">make public</label>'; + html += '<input type="checkbox" name="makelink" id="makelink" value="1" /><label for="makelink">Share with private link</label>'; //html += '<input type="checkbox" name="public_link_write" id="public_link_write" value="1" /><label for="public_link_write">allow upload</label>'; html += '<br />'; html += '<input id="link" style="display:none; width:90%;" />'; + html += '<input id="email" style="display:none; width:65%;" value="" placeholder="Email link to person" />'; + html += '<input id="emailButton" style="display:none;" type="submit" value="Send" />'; html += '</div>'; if (filename) { $('tr').filterAttr('data-file',filename).addClass('mouseOver'); @@ -241,5 +254,9 @@ function showPublicLink(token, file) { $('#makelink').attr('checked', true); $('#link').data('token', token); $('#link').val(parent.location.protocol+'//'+location.host+OC.linkTo('files_sharing','get.php')+'?token='+token+'&f='+file); - $('#link').show('blind'); + $('#link').show('blind', function() { + $('#link').after('<br id="emailBreak" />'); + $('#email').show('blind'); + $('#emailButton').show('blind'); + }); } |