From 77adaee6457c3e17d0f0b32c74da4cdbfce60164 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Fri, 30 Aug 2013 13:53:49 +0200 Subject: enable user to inform recipients about a shared file by mail --- core/js/share.js | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) (limited to 'core/js') diff --git a/core/js/share.js b/core/js/share.js index 27c16f38b92..c806d83f10c 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -217,9 +217,9 @@ OC.Share={ OC.Share.showLink(share.token, share.share_with, itemSource); } else { if (share.collection) { - OC.Share.addShareWith(share.share_type, share.share_with, share.share_with_displayname, share.permissions, possiblePermissions, share.collection); + OC.Share.addShareWith(share.share_type, share.share_with, share.share_with_displayname, share.permissions, possiblePermissions, share.mail_send, share.collection); } else { - OC.Share.addShareWith(share.share_type, share.share_with, share.share_with_displayname, share.permissions, possiblePermissions, false); + OC.Share.addShareWith(share.share_type, share.share_with, share.share_with_displayname, share.mail_send, share.permissions, possiblePermissions, share.mail_send, false); } } if (share.expiration != null) { @@ -299,7 +299,7 @@ OC.Share={ } }); }, - addShareWith:function(shareType, shareWith, shareWithDisplayName, permissions, possiblePermissions, collection) { + addShareWith:function(shareType, shareWith, shareWithDisplayName, permissions, possiblePermissions, mailSend, collection) { if (!OC.Share.itemShares[shareType]) { OC.Share.itemShares[shareType] = []; } @@ -341,6 +341,14 @@ OC.Share={ }else{ html += escapeHTML(shareWithDisplayName); } + mailNotificationEnabled = $('input:hidden[name=mailNotificationEnabled]').val(); + if (mailNotificationEnabled === 'yes') { + checked = ''; + if (mailSend === true) { + checked = 'checked'; + } + html += ''+t('core', 'notify user by email')+''; + } if (possiblePermissions & OC.PERMISSION_CREATE || possiblePermissions & OC.PERMISSION_UPDATE || possiblePermissions & OC.PERMISSION_DELETE) { if (editChecked == '') { html += ''; diff --git a/lib/public/share.php b/lib/public/share.php index eac6fab2b6a..c2dd0096ab9 100644 --- a/lib/public/share.php +++ b/lib/public/share.php @@ -1030,19 +1030,19 @@ class Share { if ($format == self::FORMAT_STATUSES) { if ($itemType == 'file' || $itemType == 'folder') { $select = '`*PREFIX*share`.`id`, `item_type`, `*PREFIX*share`.`parent`,' - .' `share_type`, `file_source`, `path`, `expiration`, `storage`'; + .' `share_type`, `file_source`, `path`, `expiration`, `storage`, `mail_send`'; } else { - $select = '`id`, `item_type`, `item_source`, `parent`, `share_type`, `expiration`'; + $select = '`id`, `item_type`, `item_source`, `parent`, `share_type`, `expiration`, `mail_send`'; } } else { if (isset($uidOwner)) { if ($itemType == 'file' || $itemType == 'folder') { $select = '`*PREFIX*share`.`id`, `item_type`, `*PREFIX*share`.`parent`,' .' `share_type`, `share_with`, `file_source`, `path`, `permissions`, `stime`,' - .' `expiration`, `token`, `storage`'; + .' `expiration`, `token`, `storage`, `storage`, `mail_send`'; } else { $select = '`id`, `item_type`, `item_source`, `parent`, `share_type`, `share_with`, `permissions`,' - .' `stime`, `file_source`, `expiration`, `token`'; + .' `stime`, `file_source`, `expiration`, `token`, `storage`, `mail_send`'; } } else { if ($fileDependent) { @@ -1053,11 +1053,11 @@ class Share { $select = '`*PREFIX*share`.`id`, `item_type`, `*PREFIX*share`.`parent`, `uid_owner`, ' .'`share_type`, `share_with`, `file_source`, `path`, `file_target`, ' .'`permissions`, `expiration`, `storage`, `*PREFIX*filecache`.`parent` as `file_parent`, ' - .'`name`, `mtime`, `mimetype`, `mimepart`, `size`, `encrypted`, `etag`'; + .'`name`, `mtime`, `mimetype`, `mimepart`, `size`, `encrypted`, `etag`, `storage`, `mail_send`'; } else { $select = '`*PREFIX*share`.`id`, `item_type`, `item_source`, `item_target`, `*PREFIX*share`.`parent`, `share_type`, `share_with`, `uid_owner`, - `file_source`, `path`, `file_target`, `permissions`, `stime`, `expiration`, `token`, `storage`'; + `file_source`, `path`, `file_target`, `permissions`, `stime`, `expiration`, `token`, `storage`, `storage`, `mail_send`'; } } else { $select = '*'; -- cgit v1.2.3 From 65ddefc89d6730f3c32727bddae2895232c66a62 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Fri, 30 Aug 2013 16:29:22 +0200 Subject: set sendMail status back to false --- core/ajax/share.php | 8 +++----- core/js/share.js | 4 +--- 2 files changed, 4 insertions(+), 8 deletions(-) (limited to 'core/js') diff --git a/core/ajax/share.php b/core/ajax/share.php index 9727f7d02e3..76a67f54720 100644 --- a/core/ajax/share.php +++ b/core/ajax/share.php @@ -134,7 +134,7 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo \OCP\User::getDisplayName() ); } catch (Exception $exception) { - $noMail[] = \OCP\User::getDisplayName($recipient['displayName']); + $noMail[] = \OCP\User::getDisplayName($recipient); } } else { $noMail[] = \OCP\User::getDisplayName($recipient); @@ -151,12 +151,10 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo break; case 'informRecipientsDisabled': $itemSource = $_POST['itemSource']; + $shareType = $_POST['shareType']; $itemType = $_POST['itemType']; $recipient = $_POST['recipient']; - //$share = $shareManager->getShares($itemType, array('shareWith' => $recipient, 'isShareWithUser' => true, 'itemSource' => $itemSource)); - //$share[0]->setMailSend(false); - //$shareManager->update($share[0]); - //write status to db + \OCP\Share::setSendMailStatus($itemType, $itemSource, $shareType, false); OCP\JSON::success(); break; diff --git a/core/js/share.js b/core/js/share.js index 7d7f580c9bb..e253f77ef27 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -695,9 +695,7 @@ $(document).ready(function() { } }); - $(document).on('click', '#dropdown input[name=mailNotification]', function(event) { - event.preventDefault(); - event.stopPropagation(); + $(document).on('click', '#dropdown input[name=mailNotification]', function() { var li = $(this).parent(); var itemType = $('#dropdown').data('item-type'); var itemSource = $('#dropdown').data('item-source'); -- cgit v1.2.3 From fd7469db9e1cd1fd85e3a8a18aac87c7040ec8e7 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Tue, 3 Sep 2013 13:37:06 +0200 Subject: coding-style fixes --- core/ajax/share.php | 16 ++++++++++++++-- core/js/share.js | 2 +- lib/defaults.php | 9 +++++++-- 3 files changed, 22 insertions(+), 5 deletions(-) (limited to 'core/js') diff --git a/core/ajax/share.php b/core/ajax/share.php index 1e954ac4f9d..8f5432a0fcb 100644 --- a/core/ajax/share.php +++ b/core/ajax/share.php @@ -129,7 +129,13 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo } $url = \OCP\Util::linkToAbsolute('files', 'index.php', array("dir" => $foldername)); - $text = $defaults->getShareNotificationText(\OCP\User::getDisplayName(), $filename, $itemType, $url, $expiration); + $text = $defaults->getShareNotificationText( + \OCP\User::getDisplayName(), + $filename, + $itemType, + $url, + $expiration + ); try { OCP\Util::sendMail( @@ -153,7 +159,13 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo if (empty($noMail)) { OCP\JSON::success(); } else { - OCP\JSON::error(array('data' => array('message' => $l->t("Couldn't send mail to following users: %s ", implode(', ', $noMail))))); + OCP\JSON::error(array( + 'data' => array( + 'message' => $l->t("Couldn't send mail to following users: %s ", + implode(', ', $noMail) + ) + ) + )); } break; case 'informRecipientsDisabled': diff --git a/core/js/share.js b/core/js/share.js index e253f77ef27..763713e7cf2 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -493,7 +493,7 @@ $(document).ready(function() { $('input:[type=checkbox]', this).hide(); $('label', this).hide(); } - } else { + } else { $('a.unshare', this).hide(); } }); diff --git a/lib/defaults.php b/lib/defaults.php index 0685fbb16c0..efb6c2c7b32 100644 --- a/lib/defaults.php +++ b/lib/defaults.php @@ -72,9 +72,14 @@ class OC_Defaults { return $this->theme->getShareNotificationText($sender, $itemName, $itemType, $link, $expiration); } else { if ($expiration) { - return $this->l->t("%s shared a %s called %s with you. The share will expire at %s. You can find the %s here: %s", array($sender, $itemType, $itemName, $expiration, $itemType, $link)); + return $this->l->t("%s shared a %s called %s with you. " . + "The share will expire at %s. ". + "You can find the %s here: %s", + array($sender, $itemType, $itemName, $expiration, $itemType, $link)); } else { - return $this->l->t("%s shared a %s called %s with you. You can find the %s here: %s", array($sender, $itemType, $itemName, $itemType, $link)); + return $this->l->t("%s shared a %s called %s with you. ". + "You can find the %s here: %s", + array($sender, $itemType, $itemName, $itemType, $link)); } } } -- cgit v1.2.3 From 6d0987bdb439e11a2027d3823c4499341180ba09 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Tue, 24 Sep 2013 18:32:57 +0200 Subject: some small js fixes --- core/js/share.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'core/js') diff --git a/core/js/share.js b/core/js/share.js index cf078d42ffc..b366665ed3f 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -344,9 +344,9 @@ OC.Share={ }else{ html += escapeHTML(shareWithDisplayName); } - mailNotificationEnabled = $('input:hidden[name=mailNotificationEnabled]').val(); + var mailNotificationEnabled = $('input:hidden[name=mailNotificationEnabled]').val(); if (mailNotificationEnabled === 'yes') { - checked = ''; + var checked = ''; if (mailSend === '1') { checked = 'checked'; } @@ -712,14 +712,15 @@ $(document).ready(function() { var li = $(this).parent(); var itemType = $('#dropdown').data('item-type'); var itemSource = $('#dropdown').data('item-source'); + var action = ''; if (this.checked) { action = 'informRecipients'; } else { action = 'informRecipientsDisabled'; } - shareType = $(li).data('share-type'); - shareWith = $(li).data('share-with'); + var shareType = $(li).data('share-type'); + var shareWith = $(li).data('share-with'); $.post(OC.filePath('core', 'ajax', 'share.php'), {action: action, recipient: shareWith, shareType: shareType, itemSource: itemSource, itemType: itemType}, function(result) { if (result.status !== 'success') { -- cgit v1.2.3 From b0ff10a5365ebaec2741c8095493c0eff836c439 Mon Sep 17 00:00:00 2001 From: kondou Date: Fri, 4 Oct 2013 02:27:53 +0200 Subject: Hide defaultavatar in #header and don't darken proper avatars in #header --- core/css/styles.css | 4 ++++ core/js/avatar.js | 2 +- core/js/jquery.avatar.js | 20 +++++++++++++++----- settings/js/personal.js | 12 ++++++++---- 4 files changed, 28 insertions(+), 10 deletions(-) (limited to 'core/js') diff --git a/core/css/styles.css b/core/css/styles.css index 06b61f0fa68..49a2bdaadb2 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -43,6 +43,10 @@ body { background:#fefefe; font:normal .8em/1.6em "Helvetica Neue",Helvetica,Ari display: inline-block; } +#header .avatardiv img { + opacity: 1; +} + /* INPUTS */ input[type="text"], input[type="password"], input[type="search"], input[type="number"], input[type="email"], input[type="url"], textarea, select, diff --git a/core/js/avatar.js b/core/js/avatar.js index 57e6daa0930..c54c4068768 100644 --- a/core/js/avatar.js +++ b/core/js/avatar.js @@ -1,6 +1,6 @@ $(document).ready(function(){ if (OC.currentUser) { - $('#header .avatardiv').avatar(OC.currentUser, 32); + $('#header .avatardiv').avatar(OC.currentUser, 32, undefined, true); // Personal settings $('#avatar .avatardiv').avatar(OC.currentUser, 128); } diff --git a/core/js/jquery.avatar.js b/core/js/jquery.avatar.js index 88a4c25d1ee..00068101726 100644 --- a/core/js/jquery.avatar.js +++ b/core/js/jquery.avatar.js @@ -15,7 +15,7 @@ * You may use this on any
* Here I'm using
as an example. * - * There are 4 ways to call this: + * There are 5 ways to call this: * * 1. $('.avatardiv').avatar('jdoe', 128); * This will make the div to jdoe's fitting avatar, with a size of 128px. @@ -34,10 +34,15 @@ * 4. $('.avatardiv').avatar('jdoe', 128, true); * This will behave like the first example, except it will also append random * hashes to the custom avatar images, to force image reloading in IE8. + * + * 5. $('.avatardiv').avatar('jdoe', 128, undefined, true); + * This will behave like the first example, but it will hide the avatardiv, if + * it will display the default placeholder. undefined is the ie8fix from + * example 4 and can be either true, or false/undefined, to be ignored. */ (function ($) { - $.fn.avatar = function(user, size, ie8fix) { + $.fn.avatar = function(user, size, ie8fix, hidedefault) { if (typeof(size) === 'undefined') { if (this.height() > 0) { size = this.height(); @@ -69,12 +74,17 @@ var url = OC.Router.generate('core_avatar_get', {user: user, size: size})+'?requesttoken='+oc_requesttoken; $.get(url, function(result) { if (typeof(result) === 'object') { - if (result.data && result.data.displayname) { - $div.placeholder(user, result.data.displayname); + if (!hidedefault) { + if (result.data && result.data.displayname) { + $div.placeholder(user, result.data.displayname); + } else { + $div.placeholder(user); + } } else { - $div.placeholder(user); + $div.hide(); } } else { + $div.show(); if (ie8fix === true) { $div.html(''); } else { diff --git a/settings/js/personal.js b/settings/js/personal.js index a923b475731..3fdc2907c46 100644 --- a/settings/js/personal.js +++ b/settings/js/personal.js @@ -45,12 +45,16 @@ function changeDisplayName(){ } } -function updateAvatar () { +function updateAvatar (hidedefault) { $headerdiv = $('#header .avatardiv'); $displaydiv = $('#displayavatar .avatardiv'); - $headerdiv.css({'background-color': ''}); - $headerdiv.avatar(OC.currentUser, 32, true); + if(hidedefault) { + $headerdiv.hide(); + } else { + $headerdiv.css({'background-color': ''}); + $headerdiv.avatar(OC.currentUser, 32, true); + } $displaydiv.css({'background-color': ''}); $displaydiv.avatar(OC.currentUser, 128, true); } @@ -232,7 +236,7 @@ $(document).ready(function(){ type: 'DELETE', url: OC.Router.generate('core_avatar_delete'), success: function(msg) { - updateAvatar(); + updateAvatar(true); } }); }); -- cgit v1.2.3