diff options
Diffstat (limited to 'core/js/share.js')
-rw-r--r-- | core/js/share.js | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/core/js/share.js b/core/js/share.js index 475abb58bff..df5ebf008b4 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -168,6 +168,10 @@ OC.Share={ html += '<input id="linkPassText" type="password" placeholder="'+t('core', 'Password')+'" />'; html += '</div>'; html += '</div>'; + html += '<form id="emailPrivateLink" >'; + html += '<input id="email" style="display:none; width:65%;" value="" placeholder="'+t('core', 'Email link to person')+'" type="text" />'; + html += '<input id="emailButton" style="display:none; float:right;" type="submit" value="'+t('core', 'Send')+'" />'; + html += '</form>'; } html += '<div id="expiration">'; html += '<input type="checkbox" name="expirationCheckbox" id="expirationCheckbox" value="1" /><label for="expirationCheckbox">'+t('core', 'Set expiration date')+'</label>'; @@ -349,13 +353,17 @@ OC.Share={ $('#linkPassText').attr('placeholder', t('core', 'Password protected')); } $('#expiration').show(); + $('#emailPrivateLink #email').show(); + $('#emailPrivateLink #emailButton').show(); }, hideLink:function() { $('#linkText').hide('blind'); $('#showPassword').hide(); $('#linkPass').hide(); - }, - dirname:function(path) { + $('#emailPrivateLink #email').hide(); + $('#emailPrivateLink #emailButton').hide(); + }, + dirname:function(path) { return path.replace(/\\/g,'/').replace(/\/[^\/]*$/, ''); }, showExpirationDate:function(date) { @@ -547,4 +555,34 @@ $(document).ready(function() { }); }); + + $('#emailPrivateLink').live('submit', function(event) { + event.preventDefault(); + var link = $('#linkText').val(); + var itemType = $('#dropdown').data('item-type'); + var itemSource = $('#dropdown').data('item-source'); + var file = $('tr').filterAttr('data-id', String(itemSource)).data('file'); + var email = $('#email').val(); + if (email != '') { + $('#email').attr('disabled', "disabled"); + $('#email').val(t('core', 'Sending ...')); + $('#emailButton').attr('disabled', "disabled"); + + $.post(OC.filePath('core', 'ajax', 'share.php'), { action: 'email', toaddress: email, link: link, itemType: itemType, itemSource: itemSource, file: file}, + function(result) { + $('#email').attr('disabled', "false"); + $('#emailButton').attr('disabled', "false"); + if (result && result.status == 'success') { + $('#email').css('font-weight', 'bold'); + $('#email').animate({ fontWeight: 'normal' }, 2000, function() { + $(this).val(''); + }).val(t('core','Email sent')); + } else { + OC.dialogs.alert(result.data.message, t('core', 'Error while sharing')); + } + }); + } + }); + + }); |