From 92b57c13c1fd68ad3f6f2e4751bd398f05f620aa Mon Sep 17 00:00:00 2001 From: Pete McFarlane Date: Wed, 11 Sep 2013 11:45:32 +0100 Subject: Added autoFocus to #shareWith autocomplete options --- core/js/share.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'core/js/share.js') diff --git a/core/js/share.js b/core/js/share.js index 27c16f38b92..4ec3bb63e12 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -227,7 +227,7 @@ OC.Share={ } }); } - $('#shareWith').autocomplete({minLength: 1, source: function(search, response) { + $('#shareWith').autocomplete({minLength: 1, autoFocus: true, source: function(search, response) { // if (cache[search.term]) { // response(cache[search.term]); // } else { @@ -423,7 +423,7 @@ OC.Share={ dateFormat : 'dd-mm-yy' }); } -} +}; $(document).ready(function() { @@ -512,7 +512,7 @@ $(document).ready(function() { $(document).on('change', '#dropdown .permissions', function() { if ($(this).attr('name') == 'edit') { - var li = $(this).parent().parent() + 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 -- cgit v1.2.3 From 15be3d85b61c93534b1c3a623fb4c19fceb6c444 Mon Sep 17 00:00:00 2001 From: Pete McFarlane Date: Wed, 11 Sep 2013 15:59:28 +0100 Subject: no autoFocus if no users returned --- core/js/share.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'core/js/share.js') diff --git a/core/js/share.js b/core/js/share.js index 4ec3bb63e12..5d34faf8a5d 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -227,12 +227,13 @@ OC.Share={ } }); } - $('#shareWith').autocomplete({minLength: 1, autoFocus: true, source: function(search, response) { + $('#shareWith').autocomplete({minLength: 1, source: function(search, response) { // if (cache[search.term]) { // response(cache[search.term]); // } else { $.get(OC.filePath('core', 'ajax', 'share.php'), { fetch: 'getShareWith', search: search.term, itemShares: OC.Share.itemShares }, function(result) { if (result.status == 'success' && result.data.length > 0) { + $( "#shareWith" ).autocomplete( "option", "autoFocus", true ); response(result.data); } else { // Suggest sharing via email if valid email address @@ -240,6 +241,7 @@ OC.Share={ // if (pattern.test(search.term)) { // response([{label: t('core', 'Share via email:')+' '+search.term, value: {shareType: OC.Share.SHARE_TYPE_EMAIL, shareWith: search.term}}]); // } else { + $( "#shareWith" ).autocomplete( "option", "autoFocus", false ); response([t('core', 'No people found')]); // } } -- cgit v1.2.3 From d6771502f21349d5393158eda6d2d16569fd60c3 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Tue, 17 Sep 2013 18:11:43 +0200 Subject: check only permission from link-share to decide if public upload is enabled or disabled --- core/js/share.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'core/js/share.js') diff --git a/core/js/share.js b/core/js/share.js index 5d34faf8a5d..250f410072c 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -177,7 +177,9 @@ OC.Share={ if (allowPublicUploadStatus) { return true; } - allowPublicUploadStatus = (value.permissions & OC.PERMISSION_CREATE) ? true : false; + if (value.share_type === OC.Share.SHARE_TYPE_LINK) { + allowPublicUploadStatus = (value.permissions & OC.PERMISSION_CREATE) ? true : false; + } }); html += ''; -- cgit v1.2.3 From 642b064c5b98990f6ac0e3ba344db8cd1fe4d1f8 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Tue, 17 Sep 2013 18:18:23 +0200 Subject: we can leave the loop if the permission of the link share was checked --- core/js/share.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'core/js/share.js') diff --git a/core/js/share.js b/core/js/share.js index 250f410072c..641252a4d78 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -174,11 +174,9 @@ OC.Share={ var allowPublicUploadStatus = false; $.each(data.shares, function(key, value) { - if (allowPublicUploadStatus) { - return true; - } if (value.share_type === OC.Share.SHARE_TYPE_LINK) { allowPublicUploadStatus = (value.permissions & OC.PERMISSION_CREATE) ? true : false; + return true; } }); -- cgit v1.2.3 From cda58ae3dfc938edff0bee048f54a48f3e6451d7 Mon Sep 17 00:00:00 2001 From: Jörn Friedrich Dreyer Date: Thu, 19 Sep 2013 10:14:07 +0200 Subject: css selectors never have a : before [] --- core/js/share.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/js/share.js') diff --git a/core/js/share.js b/core/js/share.js index 5d34faf8a5d..5b93dd30740 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -483,7 +483,7 @@ $(document).ready(function() { if (!$('.cruds', this).is(':visible')) { $('a', this).hide(); if (!$('input[name="edit"]', this).is(':checked')) { - $('input:[type=checkbox]', this).hide(); + $('input[type="checkbox"]', this).hide(); $('label', this).hide(); } } else { -- cgit v1.2.3 From 12b4e7920148e1cf586fa96fafe7fee33a12523b Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Fri, 20 Sep 2013 13:11:05 +0200 Subject: calculate correct permissions while toggle the password protection --- core/js/share.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'core/js/share.js') diff --git a/core/js/share.js b/core/js/share.js index 5d34faf8a5d..f0fc4136e61 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -603,7 +603,17 @@ $(document).ready(function() { if (!$('#showPassword').is(':checked') ) { var itemType = $('#dropdown').data('item-type'); var itemSource = $('#dropdown').data('item-source'); - OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, '', OC.PERMISSION_READ); + var allowPublicUpload = $('#sharingDialogAllowPublicUpload').is(':checked'); + + // Calculate permissions + if (allowPublicUpload) { + permissions = OC.PERMISSION_UPDATE + OC.PERMISSION_CREATE + OC.PERMISSION_READ; + } else { + permissions = OC.PERMISSION_READ; + } + + + OC.Share.share(itemType, itemSource, OC.Share.SHARE_TYPE_LINK, '', permissions); } else { $('#linkPassText').focus(); } -- cgit v1.2.3 From 71e129f295996a65e2e7d73c5e6a964ba9f8bebf Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Fri, 20 Sep 2013 15:47:33 +0200 Subject: initialize variable --- core/js/share.js | 1 + 1 file changed, 1 insertion(+) (limited to 'core/js/share.js') diff --git a/core/js/share.js b/core/js/share.js index f0fc4136e61..094b0be929d 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -604,6 +604,7 @@ $(document).ready(function() { var itemType = $('#dropdown').data('item-type'); var itemSource = $('#dropdown').data('item-source'); var allowPublicUpload = $('#sharingDialogAllowPublicUpload').is(':checked'); + var permissions = 0; // Calculate permissions if (allowPublicUpload) { -- cgit v1.2.3