diff options
author | raghunayyar <me@iraghu.com> | 2014-01-28 22:32:51 +0530 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2014-06-02 12:52:52 +0200 |
commit | ce46cd3680979019de59e48654771f3061076e7b (patch) | |
tree | 7e3baaf52980152792d723a6a22cdc9635749dc3 /settings/js | |
parent | b506388b75c8454ef54ce05fa0d98db854c10faf (diff) | |
download | nextcloud-server-ce46cd3680979019de59e48654771f3061076e7b.tar.gz nextcloud-server-ce46cd3680979019de59e48654771f3061076e7b.zip |
Implements Group Creation from Sidebar
Diffstat (limited to 'settings/js')
-rw-r--r-- | settings/js/users.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/settings/js/users.js b/settings/js/users.js index eef3c237277..7b06d961b1a 100644 --- a/settings/js/users.js +++ b/settings/js/users.js @@ -530,6 +530,47 @@ $(document).ready(function () { } ); }); + $('#newgroup').submit(function (event) { + event.preventDefault(); + var groupname = $('#newgroupname').val(); + if ($.trim(groupname) === '') { + OC.dialogs.alert( + t('settings', 'A valid groupname must be provided'), + t('settings', 'Error creating group')); + return false; + } + $.post( + OC.filePath('settings', 'ajax', 'creategroup.php'), + { + groupname : groupname + }, + function (result) { + if (result.status !== 'success') { + OC.dialogs.alert(result.data.message, + t('settings', 'Error creating group')); + } else { + if (result.data.groupname) { + var addedGroups = result.data.groupname; + UserList.availableGroups = $.unique($.merge(UserList.availableGroups, addedGroups)); + } + if (result.data.homeExists){ + OC.Notification.hide(); + OC.Notification.show(t('settings', 'Warning: Home directory for user "{group}" already exists', {group: result.data.groupname})); + if (UserList.notificationTimeout){ + window.clearTimeout(UserList.notificationTimeout); + } + UserList.notificationTimeout = window.setTimeout( + function(){ + OC.Notification.hide(); + UserList.notificationTimeout = null; + }, 10000); + } + } + + } + ) + }); + // Handle undo notifications OC.Notification.hide(); $('#notification').on('click', '.undo', function () { |