aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/ajax/share.php9
-rw-r--r--core/js/share.js54
2 files changed, 27 insertions, 36 deletions
diff --git a/core/ajax/share.php b/core/ajax/share.php
index dbad8f2e971..0dacc17d3a5 100644
--- a/core/ajax/share.php
+++ b/core/ajax/share.php
@@ -83,7 +83,7 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
($return) ? OC_JSON::success() : OC_JSON::error();
}
break;
- case 'informRecipients':
+ case 'informRecipients':
$l = OC_L10N::get('core');
@@ -305,8 +305,9 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
&& $uid != OC_User::getUser()) {
$shareWith[] = array(
'label' => $displayName,
- 'value' => array('shareType' => OCP\Share::SHARE_TYPE_USER,
- 'shareWith' => $uid)
+ 'value' => array(
+ 'shareType' => OCP\Share::SHARE_TYPE_USER,
+ 'shareWith' => $uid)
);
$count++;
}
@@ -324,7 +325,7 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
|| !is_array($_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP])
|| !in_array($group, $_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP])) {
$shareWith[] = array(
- 'label' => $group.' ('.$l->t('group').')',
+ 'label' => $group,
'value' => array(
'shareType' => OCP\Share::SHARE_TYPE_GROUP,
'shareWith' => $group
diff --git a/core/js/share.js b/core/js/share.js
index 6ec15f01c1e..281cccaaef8 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -203,18 +203,7 @@ OC.Share={
html += '<input id="shareWith" type="text" placeholder="'+t('core', 'Share with')+'" />';
html += '<ul id="shareWithList">';
html += '</ul>';
- var linksAllowed = false;
- $.ajax({
- type: 'GET',
- url: OC.filePath('core', 'ajax', 'appconfig.php'),
- data: { action:'getValue', app:'core', key:'shareapi_allow_links', defaultValue:'yes' },
- async: false,
- success: function(result) {
- if (result && result.status === 'success' && result.data === 'yes') {
- linksAllowed = true;
- }
- }
- });
+ var linksAllowed = $('#allowShareWithLink').val() === 'yes';
if (link && linksAllowed) {
html += '<div id="link">';
html += '<input type="checkbox" name="linkCheckbox" id="linkCheckbox" value="1" /><label for="linkCheckbox">'+t('core', 'Share with link')+'</label>';
@@ -293,7 +282,7 @@ OC.Share={
// Default permissions are Edit (CRUD) and Share
var permissions = OC.PERMISSION_ALL;
OC.Share.share(itemType, itemSource, shareType, shareWith, permissions, function() {
- OC.Share.addShareWith(shareType, shareWith, selected.item.value.shareWith, permissions, possiblePermissions);
+ OC.Share.addShareWith(shareType, shareWith, selected.item.label, permissions, possiblePermissions);
$('#shareWith').val('');
OC.Share.updateIcon(itemType, itemSource);
});
@@ -302,12 +291,14 @@ OC.Share={
})
// customize internal _renderItem function to display groups and users differently
.data("ui-autocomplete")._renderItem = function( ul, item ) {
- var insert = $( "<a>" ).text( item.label );
- if(item.label.length > 8 && item.label.substr(item.label.length-8) === ' (group)') {
- // current label is group - wrap "strong" element
- insert = insert.wrapInner('<strong>');
+ var insert = $( "<a>" );
+ var text = (item.value.shareType == 1)? item.label + ' ('+t('core', 'group')+')' : item.label;
+ insert.text( text );
+ if(item.value.shareType == 1) {
+ insert = insert.wrapInner('<strong></strong>');
}
return $( "<li>" )
+ .addClass((item.value.shareType == 1)?'group':'user')
.append( insert )
.appendTo( ul );
};
@@ -540,13 +531,13 @@ $(document).ready(function() {
});
$(document).on('click', '#dropdown .unshare', function() {
- var li = $(this).parent();
+ var $li = $(this).closest('li');
var itemType = $('#dropdown').data('item-type');
var itemSource = $('#dropdown').data('item-source');
- var shareType = $(li).data('share-type');
- var shareWith = $(li).data('share-with');
+ var shareType = $li.data('share-type');
+ var shareWith = $li.data('share-with');
OC.Share.unshare(itemType, itemSource, shareType, shareWith, function() {
- $(li).remove();
+ $li.remove();
var index = OC.Share.itemShares[shareType].indexOf(shareWith);
OC.Share.itemShares[shareType].splice(index, 1);
OC.Share.updateIcon(itemType, itemSource);
@@ -558,8 +549,8 @@ $(document).ready(function() {
});
$(document).on('change', '#dropdown .permissions', function() {
+ var li = $(this).closest('li');
if ($(this).attr('name') == 'edit') {
- var li = $(this).parent().parent();
var checkboxes = $('.permissions', li);
var checked = $(this).is(':checked');
// Check/uncheck Create, Update, and Delete checkboxes if Edit is checked/unck
@@ -567,7 +558,6 @@ $(document).ready(function() {
$(checkboxes).filter('input[name="update"]').attr('checked', checked);
$(checkboxes).filter('input[name="delete"]').attr('checked', checked);
} else {
- var li = $(this).parent().parent().parent();
var checkboxes = $('.permissions', li);
// Uncheck Edit if Create, Update, and Delete are not checked
if (!$(this).is(':checked')
@@ -590,8 +580,8 @@ $(document).ready(function() {
});
OC.Share.setPermissions($('#dropdown').data('item-type'),
$('#dropdown').data('item-source'),
- $(li).data('share-type'),
- $(li).data('share-with'),
+ li.data('share-type'),
+ li.data('share-with'),
permissions);
});
@@ -724,14 +714,14 @@ $(document).ready(function() {
var file = $('tr').filterAttr('data-id', String(itemSource)).data('file');
var email = $('#email').val();
if (email != '') {
- $('#email').attr('disabled', "disabled");
+ $('#email').prop('disabled', true);
$('#email').val(t('core', 'Sending ...'));
- $('#emailButton').attr('disabled', "disabled");
+ $('#emailButton').prop('disabled', true);
$.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");
+ $('#email').prop('disabled', false);
+ $('#emailButton').prop('disabled', false);
if (result && result.status == 'success') {
$('#email').css('font-weight', 'bold');
$('#email').animate({ fontWeight: 'normal' }, 2000, function() {
@@ -745,7 +735,7 @@ $(document).ready(function() {
});
$(document).on('click', '#dropdown input[name=mailNotification]', function() {
- var li = $(this).parent();
+ var $li = $(this).closest('li');
var itemType = $('#dropdown').data('item-type');
var itemSource = $('#dropdown').data('item-source');
var action = '';
@@ -755,8 +745,8 @@ $(document).ready(function() {
action = 'informRecipientsDisabled';
}
- var shareType = $(li).data('share-type');
- var 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') {