summaryrefslogtreecommitdiffstats
path: root/core/js
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2012-06-25 19:27:57 -0400
committerBart Visscher <bartv@thisnet.nl>2012-06-27 01:05:37 +0200
commitcb19fdd55bae285994540f5a7cb3f075317d50fe (patch)
tree64bc1d8c510f0b0a68b4e4ba1782f16fdf83bcd9 /core/js
parentd95d738723073de641d18368e208f79a4e253327 (diff)
downloadnextcloud-server-cb19fdd55bae285994540f5a7cb3f075317d50fe.tar.gz
nextcloud-server-cb19fdd55bae285994540f5a7cb3f075317d50fe.zip
Show users and groups shared with in dropdown
Diffstat (limited to 'core/js')
-rw-r--r--core/js/share.js27
1 files changed, 17 insertions, 10 deletions
diff --git a/core/js/share.js b/core/js/share.js
index 73a7ff86c2d..96ea3077303 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -1,4 +1,7 @@
OC.Share={
+ SHARE_TYPE_USER:0,
+ SHARE_TYPE_GROUP:1,
+ SHARE_TYPE_PRIVATE_LINK:3,
item:[],
statuses:[],
loadIcons:function(itemType) {
@@ -21,11 +24,15 @@ OC.Share={
});
},
loadItem:function(itemType, item) {
- $.get(OC.filePath('core', 'ajax', 'share.php'), { fetch: 'getItemShared', itemType: itemType, item: item }, function(result) {
+ var data = '';
+ $.ajax({type: 'GET', url: OC.filePath('core', 'ajax', 'share.php'), data: { fetch: 'getItemShared', itemType: itemType, item: item }, async: false, success: function(result) {
if (result && result.status === 'success') {
- OC.Share.item = result.data;
+ data = result.data;
+ } else {
+ data = false;
}
- });
+ }});
+ return data;
},
share:function(itemType, item, shareType, shareWith, permissions, callback) {
$.post(OC.filePath('core', 'ajax', 'share.php'), { action: 'share', itemType: itemType, item: item, shareType: shareType, shareWith: shareWith, permissions: permissions }, function(result) {
@@ -57,17 +64,17 @@ OC.Share={
});
},
showDropDown:function(itemType, item, appendTo) {
- OC.Share.loadItem(item);
var html = '<div id="dropdown" class="drop" data-item-type="'+itemType+'" data-item="'+item+'">';
// TODO replace with autocomplete textbox
html += '<input id="shareWith" type="text" placeholder="Share with" />';
html += '<div id="sharedWithList">';
- html += '<ul id="userList"></ul>';
- html += '<div id="groups" style="display:none;">';
- html += '<br />';
- html += 'Groups: ';
- html += '<ul id="groupList"></ul>';
- html += '</div>';
+ var sharedWith = OC.Share.loadItem(itemType, item);
+ if (sharedWith) {
+ $.each(sharedWith, function(index, row) {
+ html += row.share_with;
+ html += '<br />';
+ });
+ }
html += '</div>';
html += '<div id="privateLink">';
html += '<input type="checkbox" name="privateLinkCheckbox" id="privateLinkCheckbox" value="1" /><label for="privateLinkCheckbox">Share with private link</label>';