From 162a2c0fba6f7d7be3aa2372554e4a77a70a3e00 Mon Sep 17 00:00:00 2001 From: Thomas Mueller Date: Mon, 10 Dec 2012 23:22:42 +0100 Subject: moving sharing email code to core --- apps/files_sharing/ajax/email.php | 39 --------------------------------------- apps/files_sharing/js/share.js | 26 +------------------------- 2 files changed, 1 insertion(+), 64 deletions(-) delete mode 100644 apps/files_sharing/ajax/email.php (limited to 'apps') diff --git a/apps/files_sharing/ajax/email.php b/apps/files_sharing/ajax/email.php deleted file mode 100644 index 4ed4eef723a..00000000000 --- a/apps/files_sharing/ajax/email.php +++ /dev/null @@ -1,39 +0,0 @@ -t('User %s shared a file with you', $user); -if ($type === 'dir') - $subject = (string)$l->t('User %s shared a folder with you', $user); - -$text = (string)$l->t('User %s shared the file "%s" with you. It is available for download here: %s', array($user, $file, $link)); -if ($type === 'dir') - $text = (string)$l->t('User %s shared the folder "%s" with you. It is available for download here: %s', array($user, $file, $link)); - -// handle localhost installations -$server_host = OCP\Util::getServerHost(); -if ($server_host === 'localhost') - $server_host = "example.com"; - -$default_from = 'sharing-noreply@' . $server_host; -$from_address = OCP\Config::getUserValue($user, 'settings', 'email', $default_from ); - -// send it out now -try { - OCP\Util::sendMail($to_address, $to_address, $subject, $text, $from_address, $user); - OCP\JSON::success(); -} catch (Exception $exception) { - OCP\JSON::error(array('data' => array('message' => $exception->getMessage()))); -} diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js index a83252867a9..8a546d62163 100644 --- a/apps/files_sharing/js/share.js +++ b/apps/files_sharing/js/share.js @@ -33,28 +33,4 @@ $(document).ready(function() { }); OC.Share.loadIcons('file'); } - - $('#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 != '') { - $.post(OC.filePath('files_sharing', 'ajax', 'email.php'), { toaddress: email, link: link, type: itemType, file: file }, function(result) { - if (result && result.status == 'success') { - $('#email').css('font-weight', 'bold'); - $('#email').animate({ fontWeight: 'normal' }, 2000, function() { - $(this).val(''); - }).val('Email sent'); - } else { - OC.dialogs.alert(result.data.message, 'Error while sharing'); - } - }); - } - }); - - -}); \ No newline at end of file +}); -- cgit v1.2.3