diff options
author | Morris Jobke <morris.jobke@gmail.com> | 2013-08-20 13:49:48 +0400 |
---|---|---|
committer | Morris Jobke <morris.jobke@gmail.com> | 2013-08-20 13:49:48 +0400 |
commit | de949b1caa4491a8016ed5e609fc781526fea54d (patch) | |
tree | b7e5aee0542b7fee87fbd3f335392edcd0807b25 /settings/js | |
parent | 884c6b5a82fb13c8f2b4fd029b5a16d41e5fc602 (diff) | |
parent | 9840363488cc22e5e71e33735a390d6751c956eb (diff) |
Merge pull request #4447 from owncloud/fix_4351_master
Use JSON to send/receive group data.
Diffstat (limited to 'settings/js')
-rw-r--r-- | settings/js/users.js | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/settings/js/users.js b/settings/js/users.js index 6a8afc4ca36..038ea369801 100644 --- a/settings/js/users.js +++ b/settings/js/users.js @@ -89,10 +89,15 @@ var UserList = { tr.attr('data-displayName', displayname); tr.find('td.name').text(username); tr.find('td.displayName > span').text(displayname); - var groupsSelect = $('<select multiple="multiple" class="groupsselect" data-placehoder="Groups" title="' + t('settings', 'Groups') + '"></select>').attr('data-username', username).attr('data-user-groups', groups); + var groupsSelect = $('<select multiple="multiple" class="groupsselect" data-placehoder="Groups" title="' + t('settings', 'Groups') + '"></select>') + .attr('data-username', username) + .attr('data-user-groups', [groups]); tr.find('td.groups').empty(); if (tr.find('td.subadmins').length > 0) { - var subadminSelect = $('<select multiple="multiple" class="subadminsselect" data-placehoder="subadmins" title="' + t('settings', 'Group Admin') + '">').attr('data-username', username).attr('data-user-groups', groups).attr('data-subadmin', subadmin); + var subadminSelect = $('<select multiple="multiple" class="subadminsselect" data-placehoder="subadmins" title="' + t('settings', 'Group Admin') + '">') + .attr('data-username', username) + .attr('data-user-groups', [groups]) + .attr('data-subadmin', [subadmin]); tr.find('td.subadmins').empty(); } $.each(this.availableGroups, function (i, group) { @@ -227,7 +232,7 @@ var UserList = { var user = element.attr('data-username'); if ($(element).attr('class') === 'groupsselect') { if (element.data('userGroups')) { - checked = String(element.data('userGroups')).split(', '); + checked = element.data('userGroups'); } if (user) { var checkHandeler = function (group) { @@ -244,11 +249,12 @@ var UserList = { group: group }, function (response) { - if(response.status === 'success') { - if(UserList.availableGroups.indexOf(response.data.groupname) === -1 && response.data.action === 'add') { - UserList.availableGroups.push(response.data.groupname); - } - } else { + if(response.status === 'success' + && UserList.availableGroups.indexOf(response.data.groupname) === -1 + && response.data.action === 'add') { + UserList.availableGroups.push(response.data.groupname); + } + if(response.data.message) { OC.Notification.show(response.data.message); } } @@ -282,7 +288,7 @@ var UserList = { } if ($(element).attr('class') === 'subadminsselect') { if (element.data('subadmin')) { - checked = String(element.data('subadmin')).split(', '); + checked = element.data('subadmin'); } var checkHandeler = function (group) { if (group === 'admin') { @@ -321,7 +327,7 @@ var UserList = { $(document).ready(function () { UserList.doSort(); - UserList.availableGroups = $('#content table').attr('data-groups').split(', '); + UserList.availableGroups = $('#content table').data('groups'); $('tbody tr:last').bind('inview', function (event, isInView, visiblePartX, visiblePartY) { OC.Router.registerLoadedCallback(function () { UserList.update(); @@ -450,7 +456,7 @@ $(document).ready(function () { t('settings', 'Error creating user')); } else { if (result.data.groups) { - var addedGroups = result.data.groups.split(', '); + var addedGroups = result.data.groups; UserList.availableGroups = $.unique($.merge(UserList.availableGroups, addedGroups)); } if($('tr[data-uid="' + username + '"]').length === 0) { |