From 0663d954e6d8170c10d444771f90210fb48f65c9 Mon Sep 17 00:00:00 2001 From: raghunayyar Date: Sun, 26 Jan 2014 20:51:29 +0530 Subject: resolve conflicts while picking c0fb623 --- settings/css/settings.css | 1 - settings/templates/users.php | 72 +++++++++++++++++++++++++++++--------------- 2 files changed, 47 insertions(+), 26 deletions(-) (limited to 'settings') diff --git a/settings/css/settings.css b/settings/css/settings.css index be6cfe1e9bf..878ee555890 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -57,7 +57,6 @@ tr:hover>td.password>span, tr:hover>td.displayName>span { margin:0; cursor:point tr:hover>td.remove>a, tr:hover>td.password>img,tr:hover>td.displayName>img, tr:hover>td.quota>img { visibility:visible; cursor:pointer; } tr:hover>td.remove>a { float:right; } -table.grid { width:100%; } div.quota { float: right; display: block; diff --git a/settings/templates/users.php b/settings/templates/users.php index 937b40611b0..1dde76e5bd4 100644 --- a/settings/templates/users.php +++ b/settings/templates/users.php @@ -14,30 +14,29 @@ unset($items['admin']); $_['subadmingroups'] = array_flip($items); ?> -
-
- -
- -
- -
- -
- t('Default Storage'));?> + +
+ + +
+
+ t('Default Storage'));?> +
- +
+
+ +
+ +
+ +
+ +
-- cgit v1.2.3 From 43ced8c6c76eff0f258bf055ca7049e407043a33 Mon Sep 17 00:00:00 2001 From: raghunayyar Date: Tue, 28 Jan 2014 12:29:04 +0530 Subject: Splits Controls overlap in files and users. --- core/css/styles.css | 5 ++++- settings/css/settings.css | 7 +++++++ settings/templates/users.php | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) (limited to 'settings') diff --git a/core/css/styles.css b/core/css/styles.css index fb14ad27acc..43ee9158355 100644 --- a/core/css/styles.css +++ b/core/css/styles.css @@ -309,7 +309,7 @@ input[type="submit"].enabled { position: fixed; top:45px; right: 0; - left:380px; + left:0; height: 44px; width: 100%; padding: 0; @@ -320,6 +320,9 @@ input[type="submit"].enabled { } /* account for shift of controls bar due to app navigation */ #body-user #controls, +#body-settings #controls { + padding-left: 80px; +} #controls .button, #controls button, #controls input[type='submit'], diff --git a/settings/css/settings.css b/settings/css/settings.css index 878ee555890..7d33d2afb92 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -5,6 +5,13 @@ select#languageinput, select#timezone { width:15em; } input#openid, input#webdav { width:20em; } +#user-controls { + -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; + position: fixed; right: 0; left:380px; height: 44px; width: 100%; + padding: 0; margin: 0; + background: #eee; border-bottom: 1px solid #e7e7e7; + z-index: 50; +} /* PERSONAL */ #rootcert_import { diff --git a/settings/templates/users.php b/settings/templates/users.php index 1dde76e5bd4..83b54543b02 100644 --- a/settings/templates/users.php +++ b/settings/templates/users.php @@ -75,7 +75,7 @@ $_['subadmingroups'] = array_flip($items); -
+
Date: Tue, 28 Jan 2014 14:07:42 +0530 Subject: Add GroupList Ajax to Users. --- settings/ajax/grouplist.php | 75 +++++++++++++++++++++++++++++++++++++++++++++ settings/css/settings.css | 2 +- settings/routes.php | 2 ++ 3 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 settings/ajax/grouplist.php (limited to 'settings') diff --git a/settings/ajax/grouplist.php b/settings/ajax/grouplist.php new file mode 100644 index 00000000000..99acf50c764 --- /dev/null +++ b/settings/ajax/grouplist.php @@ -0,0 +1,75 @@ +. + * + */ + +// This file is repsonsible for the Ajax Request for Group list +// Outputs are Names of Groups and IDs of users which are a part of them + +OC_JSON::checkSubAdminUser(); + +$users = array(); +$groupname = array(); +$useringroup = array(); +$userUid = OC_User::getUser(); +$isAdmin = OC_User::isAdminUser($userUid); + +if (isset($_GET['offset'])) { + $offset = $_GET['offset']; +} else { + $offset = 0; +} +if (isset($_GET['limit'])) { + $limit = $_GET['limit']; +} else { + $limit = 10; +} + +if ($isAdmin) { + $groups = OC_Group::getGroups(); + $batch = OC_User::getDisplayNames('', $limit, $offset); + foreach ($batch as $user) { + $users['users'][] = array( 'user' => $user ); + } +} +else { + $groups = OC_SubAdmin::getSubAdminsGroups($userUid); + $batch = OC_Group::usersInGroups($groups, '', $limit, $offset); + foreach ($batch as $user) { + $users['users'][] = array( 'user' => $user ); + } +} + +// convert them to the needed format +foreach( $groups as $gid ) { + $groupname[] = array( + 'id' => str_replace(' ','', $gid ), + 'name' => $gid, + 'useringroup' => OC_Group::usersInGroup($gid, '', $limit, $offset), + 'isAdmin' => !OC_User::isAdminUser($gid), + ); +} + +OCP\JSON::success(array('result' => $groupname )); + +?> \ No newline at end of file diff --git a/settings/css/settings.css b/settings/css/settings.css index 7d33d2afb92..37cd1b6f132 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -65,7 +65,7 @@ tr:hover>td.remove>a, tr:hover>td.password>img,tr:hover>td.displayName>img, tr:h tr:hover>td.remove>a { float:right; } div.quota { - float: right; + margin: 10px; display: block; } div.quota-select-wrapper { position: relative; } diff --git a/settings/routes.php b/settings/routes.php index 0e0f293b9be..77a10f68d6f 100644 --- a/settings/routes.php +++ b/settings/routes.php @@ -25,6 +25,8 @@ $this->create('settings_admin', '/settings/admin') // users $this->create('settings_ajax_userlist', '/settings/ajax/userlist') ->actionInclude('settings/ajax/userlist.php'); +$this->create('settings_ajax_grouplist', '/settings/ajax/grouplist') + ->actionInclude('settings/ajax/grouplist.php'); $this->create('settings_ajax_createuser', '/settings/ajax/createuser.php') ->actionInclude('settings/ajax/createuser.php'); $this->create('settings_ajax_removeuser', '/settings/ajax/removeuser.php') -- cgit v1.2.3 From b506388b75c8454ef54ce05fa0d98db854c10faf Mon Sep 17 00:00:00 2001 From: raghunayyar Date: Tue, 28 Jan 2014 21:36:48 +0530 Subject: Reverts last commit, implements user in group count. --- settings/ajax/grouplist.php | 75 -------------------------------------------- settings/css/settings.css | 1 + settings/routes.php | 2 -- settings/templates/users.php | 5 ++- settings/users.php | 21 +++++++++++-- 5 files changed, 23 insertions(+), 81 deletions(-) delete mode 100644 settings/ajax/grouplist.php (limited to 'settings') diff --git a/settings/ajax/grouplist.php b/settings/ajax/grouplist.php deleted file mode 100644 index 99acf50c764..00000000000 --- a/settings/ajax/grouplist.php +++ /dev/null @@ -1,75 +0,0 @@ -. - * - */ - -// This file is repsonsible for the Ajax Request for Group list -// Outputs are Names of Groups and IDs of users which are a part of them - -OC_JSON::checkSubAdminUser(); - -$users = array(); -$groupname = array(); -$useringroup = array(); -$userUid = OC_User::getUser(); -$isAdmin = OC_User::isAdminUser($userUid); - -if (isset($_GET['offset'])) { - $offset = $_GET['offset']; -} else { - $offset = 0; -} -if (isset($_GET['limit'])) { - $limit = $_GET['limit']; -} else { - $limit = 10; -} - -if ($isAdmin) { - $groups = OC_Group::getGroups(); - $batch = OC_User::getDisplayNames('', $limit, $offset); - foreach ($batch as $user) { - $users['users'][] = array( 'user' => $user ); - } -} -else { - $groups = OC_SubAdmin::getSubAdminsGroups($userUid); - $batch = OC_Group::usersInGroups($groups, '', $limit, $offset); - foreach ($batch as $user) { - $users['users'][] = array( 'user' => $user ); - } -} - -// convert them to the needed format -foreach( $groups as $gid ) { - $groupname[] = array( - 'id' => str_replace(' ','', $gid ), - 'name' => $gid, - 'useringroup' => OC_Group::usersInGroup($gid, '', $limit, $offset), - 'isAdmin' => !OC_User::isAdminUser($gid), - ); -} - -OCP\JSON::success(array('result' => $groupname )); - -?> \ No newline at end of file diff --git a/settings/css/settings.css b/settings/css/settings.css index 37cd1b6f132..39290308cbe 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -51,6 +51,7 @@ table.nostyle label { margin-right: 2em; } table.nostyle td { padding: 0.2em 0; } /* USERS */ +.usercount { float: right; margin:6px;} form { display:inline; } table.grid th { height:2em; color:#999; } table.grid th, table.grid td { border-bottom:1px solid #ddd; padding:0 .5em; padding-left:.8em; text-align:left; font-weight:normal; } diff --git a/settings/routes.php b/settings/routes.php index 77a10f68d6f..0e0f293b9be 100644 --- a/settings/routes.php +++ b/settings/routes.php @@ -25,8 +25,6 @@ $this->create('settings_admin', '/settings/admin') // users $this->create('settings_ajax_userlist', '/settings/ajax/userlist') ->actionInclude('settings/ajax/userlist.php'); -$this->create('settings_ajax_grouplist', '/settings/ajax/grouplist') - ->actionInclude('settings/ajax/grouplist.php'); $this->create('settings_ajax_createuser', '/settings/ajax/createuser.php') ->actionInclude('settings/ajax/createuser.php'); $this->create('settings_ajax_removeuser', '/settings/ajax/removeuser.php') diff --git a/settings/templates/users.php b/settings/templates/users.php index 83b54543b02..a56c7229c1a 100644 --- a/settings/templates/users.php +++ b/settings/templates/users.php @@ -29,7 +29,10 @@ $_['subadmingroups'] = array_flip($items);
  • - + + + +
  • diff --git a/settings/users.php b/settings/users.php index f09d0e90d3c..31a54b05c02 100644 --- a/settings/users.php +++ b/settings/users.php @@ -18,6 +18,17 @@ OC_App::setActiveNavigationEntry( 'core_users' ); $users = array(); $groups = array(); +if (isset($_GET['offset'])) { + $offset = $_GET['offset']; +} else { + $offset = 0; +} +if (isset($_GET['limit'])) { + $limit = $_GET['limit']; +} else { + $limit = 10; +} + $isadmin = OC_User::isAdminUser(OC_User::getUser()); $recoveryAdminEnabled = OC_App::isEnabled('files_encryption') && OC_Appconfig::getValue( 'files_encryption', 'recoveryAdminEnabled' ); @@ -65,9 +76,13 @@ foreach($accessibleusers as $uid => $displayName) { ); } -foreach( $accessiblegroups as $i ) { - // Do some more work here soon - $groups[] = array( "name" => $i ); +foreach( $accessiblegroups as $gid ) { + $groups[] = array( + 'id' => str_replace(' ','', $gid ), + 'name' => $gid, + 'useringroup' => OC_Group::usersInGroup($gid, '', $limit, $offset), + 'isAdmin' => !OC_User::isAdminUser($gid), + ); } $tmpl = new OC_Template( "settings", "users", "user" ); -- cgit v1.2.3 From ce46cd3680979019de59e48654771f3061076e7b Mon Sep 17 00:00:00 2001 From: raghunayyar Date: Tue, 28 Jan 2014 22:32:51 +0530 Subject: Implements Group Creation from Sidebar --- settings/ajax/creategroup.php | 4 ++-- settings/js/users.js | 41 +++++++++++++++++++++++++++++++++++++++++ settings/templates/users.php | 9 ++++++--- 3 files changed, 49 insertions(+), 5 deletions(-) (limited to 'settings') diff --git a/settings/ajax/creategroup.php b/settings/ajax/creategroup.php index 0a79527c219..bd878dc1c0a 100644 --- a/settings/ajax/creategroup.php +++ b/settings/ajax/creategroup.php @@ -7,7 +7,7 @@ $groupname = $_POST["groupname"]; // Does the group exist? if( in_array( $groupname, OC_Group::getGroups())) { - OC_JSON::error(array("data" => array( "message" => $l->t("Group already exists") ))); + OC_JSON::error(array("data" => array( "message" => 'Group already exists' ))); exit(); } @@ -16,5 +16,5 @@ if( OC_Group::createGroup( $groupname )) { OC_JSON::success(array("data" => array( "groupname" => $groupname ))); } else{ - OC_JSON::error(array("data" => array( "message" => $l->t("Unable to add group") ))); + OC_JSON::error(array("data" => array( "message" => 'Unable to add group' ))); } 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 () { diff --git a/settings/templates/users.php b/settings/templates/users.php index a56c7229c1a..83ac79365b6 100644 --- a/settings/templates/users.php +++ b/settings/templates/users.php @@ -19,8 +19,10 @@ $_['subadmingroups'] = array_flip($items);
    • - - + + + +
    • @@ -89,7 +91,8 @@ $_['subadmingroups'] = array_flip($items); - + +
      -- cgit v1.2.3 From 71160ff853a504ba084dc51f305970cd7b5cb597 Mon Sep 17 00:00:00 2001 From: raghunayyar Date: Thu, 30 Jan 2014 21:18:18 +0530 Subject: Deletes Group Clientside Effectively. --- settings/css/settings.css | 6 +++++- settings/js/users.js | 50 ++++++++++++++++++++++++++++++++++++++++++++ settings/templates/users.php | 5 ++++- 3 files changed, 59 insertions(+), 2 deletions(-) (limited to 'settings') diff --git a/settings/css/settings.css b/settings/css/settings.css index 39290308cbe..ae986ccb9b4 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -51,7 +51,11 @@ table.nostyle label { margin-right: 2em; } table.nostyle td { padding: 0.2em 0; } /* USERS */ -.usercount { float: right; margin:6px;} +.usercount { float: left; margin: 5px; } +span.utils .delete { + float: left; position: relative; + margin: 3px; top: 4px; +} form { display:inline; } table.grid th { height:2em; color:#999; } table.grid th, table.grid td { border-bottom:1px solid #ddd; padding:0 .5em; padding-left:.8em; text-align:left; font-weight:normal; } diff --git a/settings/js/users.js b/settings/js/users.js index 7b06d961b1a..8107a98df0b 100644 --- a/settings/js/users.js +++ b/settings/js/users.js @@ -16,6 +16,48 @@ function setQuota (uid, quota, ready) { ); } +var GroupList = { + + delete_group: function (gid) { + if(GroupList.deleteGid !=='undefined') { + GroupList.finishDelete(null); + } + + //Set the undo flag + GroupList.deleteCanceled = false; + + //Provide an option to undo + $('#notification').data('deletegroup', true); + OC.Notification.showHtml(t('settings', 'deleted') + ' ' + escapeHTML(gid) + '' + t('settings', 'undo') + ''); + }, + + finishDelete: function (ready) { + if (!GroupList.deleteCanceled && GroupList.deleteGid) { + $.ajax({ + type: 'POST', + url: OC.filePath('settings', 'ajax', 'removegroup.php'), + async: false, + data: { groupname: GroupList.deleteGid }, + success: function (result) { + if (result.status === 'success') { + // Remove undo option, & remove user from table + OC.Notification.hide(); + $('li').filterAttr('data-gid', GroupList.deleteGid).remove(); + GroupList.deleteCanceled = true; + if (ready) { + ready(); + } + } else { + OC.dialogs.alert(result.data.message, t('settings', 'Unable to remove group')); + } + } + }); + } + + }, + +} + var UserList = { useUndo: true, availableGroups: [], @@ -477,6 +519,14 @@ $(document).ready(function () { }); }); + $('ul').on('click', 'span.utils>a', function (event) { + var li = $(this).parent().parent(); + var gid = $(li).attr('data-gid'); + $(li).hide(); + // Call function for handling delete/undo on Groups + GroupList.delete_group(gid); + }); + $('#newuser').submit(function (event) { event.preventDefault(); var username = $('#newusername').val(); diff --git a/settings/templates/users.php b/settings/templates/users.php index 83ac79365b6..daf0ee49e4a 100644 --- a/settings/templates/users.php +++ b/settings/templates/users.php @@ -30,10 +30,13 @@ $_['subadmingroups'] = array_flip($items);
    • -
    • +
    • + + +
    • -- cgit v1.2.3 From 78e1b71003b59230b4b8150126232ee51566343e Mon Sep 17 00:00:00 2001 From: raghunayyar Date: Tue, 11 Feb 2014 12:46:27 +0530 Subject: Reverts Bogus Changes. --- settings/ajax/creategroup.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'settings') diff --git a/settings/ajax/creategroup.php b/settings/ajax/creategroup.php index bd878dc1c0a..b770aaaf311 100644 --- a/settings/ajax/creategroup.php +++ b/settings/ajax/creategroup.php @@ -7,7 +7,7 @@ $groupname = $_POST["groupname"]; // Does the group exist? if( in_array( $groupname, OC_Group::getGroups())) { - OC_JSON::error(array("data" => array( "message" => 'Group already exists' ))); + OC_JSON::error(array("data" => array( "message" => $l->t("Unable to add group") ))); exit(); } @@ -16,5 +16,5 @@ if( OC_Group::createGroup( $groupname )) { OC_JSON::success(array("data" => array( "groupname" => $groupname ))); } else{ - OC_JSON::error(array("data" => array( "message" => 'Unable to add group' ))); + OC_JSON::error(array("data" => array( "message" => $l->t("Unable to add group") ))); } -- cgit v1.2.3 From 223e342664d5436f25d49fe4c754d4d5f5a4c832 Mon Sep 17 00:00:00 2001 From: raghunayyar Date: Tue, 11 Feb 2014 20:44:04 +0530 Subject: Fixes delete icon only on hover. --- settings/css/settings.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'settings') diff --git a/settings/css/settings.css b/settings/css/settings.css index ae986ccb9b4..d0a64dd6bda 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -53,9 +53,10 @@ table.nostyle td { padding: 0.2em 0; } /* USERS */ .usercount { float: left; margin: 5px; } span.utils .delete { - float: left; position: relative; + float: left; position: relative; display: none; margin: 3px; top: 4px; } +#app-navigation ul li:hover > span.utils .delete { display: block; } form { display:inline; } table.grid th { height:2em; color:#999; } table.grid th, table.grid td { border-bottom:1px solid #ddd; padding:0 .5em; padding-left:.8em; text-align:left; font-weight:normal; } -- cgit v1.2.3 From c7af9cd6dd81072cf686ec123322c4241322bf73 Mon Sep 17 00:00:00 2001 From: raghunayyar Date: Wed, 12 Feb 2014 11:00:10 +0530 Subject: Initial Commit : User Search, Fixes Typos --- settings/ajax/creategroup.php | 2 +- settings/css/settings.css | 4 +++- settings/js/users.js | 11 +++++++++++ settings/templates/users.php | 6 +++++- 4 files changed, 20 insertions(+), 3 deletions(-) (limited to 'settings') diff --git a/settings/ajax/creategroup.php b/settings/ajax/creategroup.php index b770aaaf311..0a79527c219 100644 --- a/settings/ajax/creategroup.php +++ b/settings/ajax/creategroup.php @@ -7,7 +7,7 @@ $groupname = $_POST["groupname"]; // Does the group exist? if( in_array( $groupname, OC_Group::getGroups())) { - OC_JSON::error(array("data" => array( "message" => $l->t("Unable to add group") ))); + OC_JSON::error(array("data" => array( "message" => $l->t("Group already exists") ))); exit(); } diff --git a/settings/css/settings.css b/settings/css/settings.css index d0a64dd6bda..696fe01a91e 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -7,7 +7,7 @@ input#openid, input#webdav { width:20em; } #user-controls { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; - position: fixed; right: 0; left:380px; height: 44px; width: 100%; + position: fixed; right: 0; left:380px; height: 44px; padding: 0; margin: 0; background: #eee; border-bottom: 1px solid #e7e7e7; z-index: 50; @@ -57,6 +57,8 @@ span.utils .delete { margin: 3px; top: 4px; } #app-navigation ul li:hover > span.utils .delete { display: block; } +#usersearchform { position: absolute; top: 4px; right: 10px; } +#usersearchform label { font-weight: 700; } form { display:inline; } table.grid th { height:2em; color:#999; } table.grid th, table.grid td { border-bottom:1px solid #ddd; padding:0 .5em; padding-left:.8em; text-align:left; font-weight:normal; } diff --git a/settings/js/users.js b/settings/js/users.js index 8107a98df0b..c1a52ef9bee 100644 --- a/settings/js/users.js +++ b/settings/js/users.js @@ -620,6 +620,17 @@ $(document).ready(function () { } ) }); + // Implements User Search + $('#usersearchform input').keyup(function() { + var inputVal = $(this).val(); + $('table tbody tr td.name').each(function() { + if ($('table tbody tr').text().search(new RegExp(inputVal, "i")) < 0) { + $('table tbody tr').fadeOut(); + } else { + $('table tbody tr').show(); + } + }); + }); // Handle undo notifications OC.Notification.hide(); diff --git a/settings/templates/users.php b/settings/templates/users.php index daf0ee49e4a..89c83c3bd41 100644 --- a/settings/templates/users.php +++ b/settings/templates/users.php @@ -44,7 +44,7 @@ $_['subadmingroups'] = array_flip($items);
      - t('Default Storage'));?> + t('Default Quota'));?> +
    -- cgit v1.2.3 From 8e34316e04dd2ca3b43f2d862adab050e2fcca57 Mon Sep 17 00:00:00 2001 From: raghunayyar Date: Wed, 12 Feb 2014 19:38:21 +0530 Subject: Fixes User Search by username. --- settings/js/users.js | 10 +++++----- settings/templates/users.php | 3 +-- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'settings') diff --git a/settings/js/users.js b/settings/js/users.js index c1a52ef9bee..4609a56b494 100644 --- a/settings/js/users.js +++ b/settings/js/users.js @@ -622,12 +622,12 @@ $(document).ready(function () { }); // Implements User Search $('#usersearchform input').keyup(function() { - var inputVal = $(this).val(); - $('table tbody tr td.name').each(function() { - if ($('table tbody tr').text().search(new RegExp(inputVal, "i")) < 0) { - $('table tbody tr').fadeOut(); + var inputVal = $(this).val(), regex = new RegExp(inputVal, "i");; + $('table tbody tr td.name').each(function (key,element) { + if (regex.test($(element).text())) { + $(element).parent().show(); } else { - $('table tbody tr').show(); + $(element).parent().hide(); } }); }); diff --git a/settings/templates/users.php b/settings/templates/users.php index 89c83c3bd41..ec9ca074164 100644 --- a/settings/templates/users.php +++ b/settings/templates/users.php @@ -107,8 +107,7 @@ $_['subadmingroups'] = array_flip($items);
    - - +
    -- cgit v1.2.3 From 8e4bbe82972bb7a3fa81cf74f071653f1642aa65 Mon Sep 17 00:00:00 2001 From: raghunayyar Date: Mon, 17 Feb 2014 21:02:25 +0530 Subject: Adds class button to fix font sizes. --- settings/templates/users.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'settings') diff --git a/settings/templates/users.php b/settings/templates/users.php index ec9ca074164..e2373ddddf1 100644 --- a/settings/templates/users.php +++ b/settings/templates/users.php @@ -21,7 +21,7 @@ $_['subadmingroups'] = array_flip($items);
  • - +
  • @@ -95,7 +95,7 @@ $_['subadmingroups'] = array_flip($items); - +
    -- cgit v1.2.3 From 4a30665ec352b3dd44087d5158567213182b9526 Mon Sep 17 00:00:00 2001 From: raghunayyar Date: Mon, 17 Feb 2014 21:32:48 +0530 Subject: Removes Delete Icon from Admin Group. --- settings/templates/users.php | 11 +++++++++++ settings/users.php | 20 ++++++++++++++------ 2 files changed, 25 insertions(+), 6 deletions(-) (limited to 'settings') diff --git a/settings/templates/users.php b/settings/templates/users.php index e2373ddddf1..eb3a93a16eb 100644 --- a/settings/templates/users.php +++ b/settings/templates/users.php @@ -28,6 +28,17 @@ $_['subadmingroups'] = array_flip($items);
  • t('Everyone')); ?>
  • + + + +
  • + t('Admins')); ?> + + + +
  • + +
  • diff --git a/settings/users.php b/settings/users.php index 31a54b05c02..a3faa51ea0e 100644 --- a/settings/users.php +++ b/settings/users.php @@ -77,17 +77,25 @@ foreach($accessibleusers as $uid => $displayName) { } foreach( $accessiblegroups as $gid ) { - $groups[] = array( - 'id' => str_replace(' ','', $gid ), - 'name' => $gid, - 'useringroup' => OC_Group::usersInGroup($gid, '', $limit, $offset), - 'isAdmin' => !OC_User::isAdminUser($gid), - ); + if (!OC_User::isAdminUser($gid)) { + $groups[] = array( + 'id' => str_replace(' ','', $gid ), + 'name' => $gid, + 'useringroup' => OC_Group::usersInGroup($gid, '', $limit, $offset) + ); + } else { + $adminGroup[] = array( + 'id' => str_replace(' ','', $gid ), + 'name' => $gid, + 'useringroup' => OC_Group::usersInGroup($gid, '', $limit, $offset) + ); + } } $tmpl = new OC_Template( "settings", "users", "user" ); $tmpl->assign( 'users', $users ); $tmpl->assign( 'groups', $groups ); +$tmpl->assign( 'adminGroup', $adminGroup ); $tmpl->assign( 'isadmin', (int) $isadmin); $tmpl->assign( 'subadmins', $subadmins); $tmpl->assign( 'numofgroups', count($accessiblegroups)); -- cgit v1.2.3 From dc1523355b351cc0adf3e5893294cafe2651d8a0 Mon Sep 17 00:00:00 2001 From: raghunayyar Date: Mon, 17 Feb 2014 21:46:45 +0530 Subject: Adds Admin to Grouplist Everywhere --- settings/templates/users.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'settings') diff --git a/settings/templates/users.php b/settings/templates/users.php index eb3a93a16eb..7cb40ebbd27 100644 --- a/settings/templates/users.php +++ b/settings/templates/users.php @@ -28,7 +28,7 @@ $_['subadmingroups'] = array_flip($items);
  • t('Everyone')); ?>
  • - +
  • @@ -102,6 +102,9 @@ $_['subadmingroups'] = array_flip($items); class="groupsselect" id="newusergroups" data-placeholder="groups" title="t('Groups'))?>" multiple="multiple"> + + + @@ -160,6 +163,9 @@ $_['subadmingroups'] = array_flip($items); data-user-groups="" data-placeholder="groups" title="t('Groups'))?>" multiple="multiple"> + + + -- cgit v1.2.3 From dc28f589517e05ef29c6c06145ab4944c0aa2994 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Tue, 18 Feb 2014 14:34:08 +0100 Subject: add Storage Location col --- settings/ajax/createuser.php | 5 ++++- settings/ajax/userlist.php | 23 ++++++++++++++--------- settings/js/users.js | 9 +++++---- settings/templates/users.php | 2 ++ settings/users.php | 3 +++ 5 files changed, 28 insertions(+), 14 deletions(-) (limited to 'settings') diff --git a/settings/ajax/createuser.php b/settings/ajax/createuser.php index 94b56fa0349..946081e566a 100644 --- a/settings/ajax/createuser.php +++ b/settings/ajax/createuser.php @@ -43,12 +43,15 @@ try { OC_Group::addToGroup( $username, $i ); } + $userManager = \OC_User::getManager(); + $user = $userManager->get($username); OC_JSON::success(array("data" => array( // returns whether the home already existed "homeExists" => $homeExists, "username" => $username, - "groups" => OC_Group::getUserGroups( $username )))); + "groups" => OC_Group::getUserGroups( $username ), + 'storageLocation' => $user->getHome()))); } catch (Exception $exception) { OC_JSON::error(array("data" => array( "message" => $exception->getMessage()))); } diff --git a/settings/ajax/userlist.php b/settings/ajax/userlist.php index 4abf54b8987..b73826393d9 100644 --- a/settings/ajax/userlist.php +++ b/settings/ajax/userlist.php @@ -33,25 +33,30 @@ if (isset($_GET['limit'])) { $limit = 10; } $users = array(); +$userManager = \OC_User::getManager(); if (OC_User::isAdminUser(OC_User::getUser())) { $batch = OC_User::getDisplayNames('', $limit, $offset); - foreach ($batch as $user => $displayname) { + foreach ($batch as $uid => $displayname) { + $user = $userManager->get($uid); $users[] = array( - 'name' => $user, + 'name' => $uid, 'displayname' => $displayname, - 'groups' => join(', ', OC_Group::getUserGroups($user)), - 'subadmin' => join(', ', OC_SubAdmin::getSubAdminsGroups($user)), - 'quota' => OC_Preferences::getValue($user, 'files', 'quota', 'default')); + 'groups' => join(', ', OC_Group::getUserGroups($uid)), + 'subadmin' => join(', ', OC_SubAdmin::getSubAdminsGroups($uid)), + 'quota' => OC_Preferences::getValue($uid, 'files', 'quota', 'default'), + 'storageLocation' => $user->getHome()); } } else { $groups = OC_SubAdmin::getSubAdminsGroups(OC_User::getUser()); $batch = OC_Group::usersInGroups($groups, '', $limit, $offset); - foreach ($batch as $user) { + foreach ($batch as $uid) { + $user = $userManager->get($uid); $users[] = array( 'name' => $user, - 'displayname' => OC_User::getDisplayName($user), - 'groups' => join(', ', OC_Group::getUserGroups($user)), - 'quota' => OC_Preferences::getValue($user, 'files', 'quota', 'default')); + 'displayname' => $user->getDisplayName(), + 'groups' => join(', ', OC_Group::getUserGroups($uid)), + 'quota' => OC_Preferences::getValue($uid, 'files', 'quota', 'default'), + 'storageLocation' => $user->getHome()); } } OC_JSON::success(array('data' => $users)); diff --git a/settings/js/users.js b/settings/js/users.js index 4609a56b494..5d4fbed2a2b 100644 --- a/settings/js/users.js +++ b/settings/js/users.js @@ -125,7 +125,7 @@ var UserList = { } }, - add: function (username, displayname, groups, subadmin, quota, sort) { + add: function (username, displayname, groups, subadmin, quota, storageLocation, sort) { var tr = $('tbody tr').first().clone(); var subadminsEl; var subadminSelect; @@ -184,6 +184,7 @@ var UserList = { quotaSelect.append(''); } } + tr.find('td.storageLocation').text(storageLocation); $(tr).appendTo('tbody'); if (sort) { @@ -279,7 +280,7 @@ var UserList = { if($('tr[data-uid="' + user.name + '"]').length > 0) { return true; } - var tr = UserList.add(user.name, user.displayname, user.groups, user.subadmin, user.quota, false); + alert(user.storageLocation); tr.addClass('appear transparent'); trs.push(tr); loadedUsers++; @@ -574,7 +575,7 @@ $(document).ready(function () { }, 10000); } if($('tr[data-uid="' + username + '"]').length === 0) { - UserList.add(username, username, result.data.groups, null, 'default', true); + UserList.add(username, username, result.data.groups, null, 'default', result.data.storageLocation, true); } } } @@ -620,7 +621,7 @@ $(document).ready(function () { } ) }); - // Implements User Search + // Implements User Search $('#usersearchform input').keyup(function() { var inputVal = $(this).val(), regex = new RegExp(inputVal, "i");; $('table tbody tr td.name').each(function (key,element) { diff --git a/settings/templates/users.php b/settings/templates/users.php index 7cb40ebbd27..8c624ff655c 100644 --- a/settings/templates/users.php +++ b/settings/templates/users.php @@ -138,6 +138,7 @@ $_['subadmingroups'] = array_flip($items);
  • + @@ -214,6 +215,7 @@ $_['subadmingroups'] = array_flip($items); + - + -- cgit v1.2.3 From 57ffaddf26b47a381c6b920608900dd710178323 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Tue, 18 Feb 2014 18:37:10 +0100 Subject: add Last Login column --- core/js/js.js | 1 + lib/base.php | 4 ++++ lib/private/user/user.php | 20 ++++++++++++++++++++ settings/ajax/userlist.php | 8 ++++++-- settings/js/users.js | 13 ++++++++++--- settings/templates/users.php | 11 +++++++++++ settings/users.php | 1 + 7 files changed, 53 insertions(+), 5 deletions(-) (limited to 'settings') diff --git a/core/js/js.js b/core/js/js.js index 21a2d4c1b35..096cc3ad7c1 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -1087,6 +1087,7 @@ function initCore() { $('a.action.delete').tipsy({gravity:'e', fade:true, live:true}); $('a.action').tipsy({gravity:'s', fade:true, live:true}); $('td .modified').tipsy({gravity:'s', fade:true, live:true}); + $('td.lastLogin').tipsy({gravity:'s', fade:true, html:true}); $('input').tipsy({gravity:'w', fade:true}); // toggle for menus diff --git a/lib/base.php b/lib/base.php index 5f2131f388f..5866c949b6e 100644 --- a/lib/base.php +++ b/lib/base.php @@ -882,6 +882,7 @@ class OC { // if return is true we are logged in -> redirect to the default page if ($return === true) { + OC_User::getManager()->get(OC_User::getUser())->updateLastLogin(); $_REQUEST['redirect_url'] = \OC_Request::requestUri(); OC_Util::redirectToDefaultPage(); exit; @@ -915,6 +916,7 @@ class OC { $granted = OC_User::loginWithCookie( $_COOKIE['oc_username'], $_COOKIE['oc_token']); if($granted === true) { + OC_User::getManager()->get(OC_User::getUser())->updateLastLogin(); OC_Util::redirectToDefaultPage(); // doesn't return } @@ -952,6 +954,7 @@ class OC { } $userid = OC_User::getUser(); + OC_User::getManager()->get($userid)->updateLastLogin(); self::cleanupLoginTokens($userid); if (!empty($_POST["remember_login"])) { if (defined("DEBUG") && DEBUG) { @@ -983,6 +986,7 @@ class OC { if (OC_User::login($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"])) { //OC_Log::write('core',"Logged in with HTTP Authentication", OC_Log::DEBUG); + OC_User::getManager()->get(OC_User::getUser())->updateLastLogin(); OC_User::unsetMagicInCookie(); $_SERVER['HTTP_REQUESTTOKEN'] = OC_Util::callRegister(); } diff --git a/lib/private/user/user.php b/lib/private/user/user.php index 8aba7188e24..82f02e0f2b5 100644 --- a/lib/private/user/user.php +++ b/lib/private/user/user.php @@ -52,6 +52,11 @@ class User { */ private $config; + /** + * @var int $home + */ + private $lastLogin; + /** * @param string $uid * @param \OC_User_Interface $backend @@ -243,4 +248,19 @@ class User { $this->config->setUserValue($this->uid, 'core', 'enabled', $enabled); } } + + /** + * returns the timestamp of the user's last login or 0 if the user did never + * login + * + * @return int + */ + public function getLastLogin() { + return $this->lastLogin; + } + + public function updateLastLogin() { + $this->lastLogin = time(); + \OC_Preferences::setValue($this->uid, 'login', 'lastLogin', $this->lastLogin); + } } diff --git a/settings/ajax/userlist.php b/settings/ajax/userlist.php index b73826393d9..b1c26429534 100644 --- a/settings/ajax/userlist.php +++ b/settings/ajax/userlist.php @@ -44,7 +44,9 @@ if (OC_User::isAdminUser(OC_User::getUser())) { 'groups' => join(', ', OC_Group::getUserGroups($uid)), 'subadmin' => join(', ', OC_SubAdmin::getSubAdminsGroups($uid)), 'quota' => OC_Preferences::getValue($uid, 'files', 'quota', 'default'), - 'storageLocation' => $user->getHome()); + 'storageLocation' => $user->getHome(), + 'lastLogin' => $user->getLastLogin(), + ); } } else { $groups = OC_SubAdmin::getSubAdminsGroups(OC_User::getUser()); @@ -56,7 +58,9 @@ if (OC_User::isAdminUser(OC_User::getUser())) { 'displayname' => $user->getDisplayName(), 'groups' => join(', ', OC_Group::getUserGroups($uid)), 'quota' => OC_Preferences::getValue($uid, 'files', 'quota', 'default'), - 'storageLocation' => $user->getHome()); + 'storageLocation' => $user->getHome(), + 'lastLogin' => $user->getLastLogin(), + ); } } OC_JSON::success(array('data' => $users)); diff --git a/settings/js/users.js b/settings/js/users.js index f31367472a8..0068cb36414 100644 --- a/settings/js/users.js +++ b/settings/js/users.js @@ -125,7 +125,7 @@ var UserList = { } }, - add: function (username, displayname, groups, subadmin, quota, storageLocation, sort) { + add: function (username, displayname, groups, subadmin, quota, storageLocation, lastLogin, sort) { var tr = $('tbody tr').first().clone(); var subadminsEl; var subadminSelect; @@ -185,6 +185,13 @@ var UserList = { } } tr.find('td.storageLocation').text(storageLocation); + if(lastLogin == 0) { + lastLogin = t('settings', 'never'); + } else { + lastLogin = new Date(lastLogin); + lastLogin = relative_modified_date(lastLogin.getTime() / 1000); + } + tr.find('td.lastLogin').text(lastLogin); $(tr).appendTo('tbody'); if (sort) { @@ -280,7 +287,7 @@ var UserList = { if($('tr[data-uid="' + user.name + '"]').length > 0) { return true; } - alert(user.storageLocation); + var tr = UserList.add(user.name, user.displayname, user.groups, user.subadmin, user.quota, user.storageLocation, user.lastLogin, false); tr.addClass('appear transparent'); trs.push(tr); loadedUsers++; @@ -575,7 +582,7 @@ $(document).ready(function () { }, 10000); } if($('tr[data-uid="' + username + '"]').length === 0) { - UserList.add(username, username, result.data.groups, null, 'default', result.data.storageLocation, true); + UserList.add(username, username, result.data.groups, null, 'default', result.data.storageLocation, 0, true); } } } diff --git a/settings/templates/users.php b/settings/templates/users.php index 129f01282a5..204079977a8 100644 --- a/settings/templates/users.php +++ b/settings/templates/users.php @@ -141,6 +141,7 @@ $_['subadmingroups'] = array_flip($items); + @@ -218,6 +219,16 @@ $_['subadmingroups'] = array_flip($items); + + +
    t('Group Admin')); ?> t('Storage')); ?>t('Storage Location')); ?>  
    diff --git a/settings/users.php b/settings/users.php index a3faa51ea0e..e1b3083ed3e 100644 --- a/settings/users.php +++ b/settings/users.php @@ -17,6 +17,7 @@ OC_App::setActiveNavigationEntry( 'core_users' ); $users = array(); $groups = array(); +$userManager = \OC_User::getManager(); if (isset($_GET['offset'])) { $offset = $_GET['offset']; @@ -66,6 +67,7 @@ foreach($accessibleusers as $uid => $displayName) { $name = $name . ' ('.$uid.')'; } + $user = $userManager->get($uid); $users[] = array( "name" => $uid, "displayName" => $displayName, @@ -73,6 +75,7 @@ foreach($accessibleusers as $uid => $displayName) { 'quota' => $quota, 'isQuotaUserDefined' => $isQuotaUserDefined, 'subadmin' => OC_SubAdmin::getSubAdminsGroups($uid), + 'storageLocation' => $user->getHome(), ); } -- cgit v1.2.3 From 970f8997260606d805880192dbb389e8b196371a Mon Sep 17 00:00:00 2001 From: raghunayyar Date: Tue, 18 Feb 2014 21:59:45 +0530 Subject: Initial Commit : Changes Storage to Quota, Implements GroupName editing. --- settings/ajax/changegroupname.php | 24 ++++++++++++++++++++++++ settings/css/settings.css | 7 ++++++- settings/js/users.js | 33 +++++++++++++++++++++++++++++++++ settings/routes.php | 2 ++ settings/templates/users.php | 4 +++- 5 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 settings/ajax/changegroupname.php (limited to 'settings') diff --git a/settings/ajax/changegroupname.php b/settings/ajax/changegroupname.php new file mode 100644 index 00000000000..cbf1e3e5e86 --- /dev/null +++ b/settings/ajax/changegroupname.php @@ -0,0 +1,24 @@ + array( + "message" => $l->t('Group name has been changed.'), + "groupname" => $groupname, + ) + ) + ); +} else { + OC_JSON::error(array("data" => array( "message" => $l->t("Unable to change group name")))); +} \ No newline at end of file diff --git a/settings/css/settings.css b/settings/css/settings.css index 696fe01a91e..b96c0806b99 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -52,11 +52,16 @@ table.nostyle td { padding: 0.2em 0; } /* USERS */ .usercount { float: left; margin: 5px; } +span.utils .delete, span.utils .rename { + float: left; position: relative; display: none; + margin: 3px; top: 4px; +} +#app-navigation ul li:hover > span.utils .delete, +#app-navigation ul li:hover > span.utils .rename { display: block; } span.utils .delete { float: left; position: relative; display: none; margin: 3px; top: 4px; } -#app-navigation ul li:hover > span.utils .delete { display: block; } #usersearchform { position: absolute; top: 4px; right: 10px; } #usersearchform label { font-weight: 700; } form { display:inline; } diff --git a/settings/js/users.js b/settings/js/users.js index 5d4fbed2a2b..f31367472a8 100644 --- a/settings/js/users.js +++ b/settings/js/users.js @@ -632,6 +632,39 @@ $(document).ready(function () { } }); }); + + // Implements Groupname editing. + $('#app-navigation').on('click', 'span.utils>img.rename', function (event) { + event.stopPropagation(); + var img = $(this); + var gid = img.parent().parent().attr('data-gid'); + var groupname = escapeHTML(img.parent().parent().attr('data-gid')); + var input = $(''); + img.css('display', 'none'); + img.parent().parent().children('a').replaceWith(input); + input.focus(); + input.keypress(function (event) { + if (event.keyCode === 13) { + if ($(this).val().length > 0) { + $.post( + OC.filePath('settings', 'ajax', 'changegroupname.php'), + { groupname: gid, + groupname: $(this).val() + } + ); + input.blur(); + } else { + input.blur(); + } + } + }); + input.blur(function () { + var input = $(this), groupname = input.val(); + input.closest('li').attr('data-gid', groupname); + input.replaceWith('' + escapeHTML(groupname) + ''); + img.css('display', ''); + }); + }); // Handle undo notifications OC.Notification.hide(); diff --git a/settings/routes.php b/settings/routes.php index 0e0f293b9be..1352fac8383 100644 --- a/settings/routes.php +++ b/settings/routes.php @@ -44,6 +44,8 @@ $this->create('settings_users_changepassword', '/settings/users/changepassword') ->action('OC\Settings\ChangePassword\Controller', 'changeUserPassword'); $this->create('settings_ajax_changedisplayname', '/settings/ajax/changedisplayname.php') ->actionInclude('settings/ajax/changedisplayname.php'); +$this->create('settings_ajax_changegorupname', '/settings/ajax/changegroupname.php') + ->actionInclude('settings/ajax/changegroupname.php'); // personal $this->create('settings_personal_changepassword', '/settings/personal/changepassword') ->post() diff --git a/settings/templates/users.php b/settings/templates/users.php index 8c624ff655c..129f01282a5 100644 --- a/settings/templates/users.php +++ b/settings/templates/users.php @@ -45,6 +45,8 @@ $_['subadmingroups'] = array_flip($items); + <?php p($l->t(" title="t("change group name"))?>" /> @@ -137,7 +139,7 @@ $_['subadmingroups'] = array_flip($items); t('Group Admin')); ?> t('Storage')); ?>t('Quota')); ?> t('Storage Location')); ?>  
    t('Quota')); ?> t('Storage Location')); ?>t('Last Login')); ?>  
    ').p($lastLoginDate).p(''); ?>"> diff --git a/settings/users.php b/settings/users.php index e1b3083ed3e..dd0fdd80eb4 100644 --- a/settings/users.php +++ b/settings/users.php @@ -76,6 +76,7 @@ foreach($accessibleusers as $uid => $displayName) { 'isQuotaUserDefined' => $isQuotaUserDefined, 'subadmin' => OC_SubAdmin::getSubAdminsGroups($uid), 'storageLocation' => $user->getHome(), + 'lastLogin' => $user->getLastLogin(), ); } -- cgit v1.2.3 From 3a92d481041b74bb661fcdeb83dd903edf8239b4 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Tue, 18 Feb 2014 18:43:20 +0100 Subject: reduce template function calls --- settings/templates/users.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'settings') diff --git a/settings/templates/users.php b/settings/templates/users.php index 204079977a8..e9fa5df6675 100644 --- a/settings/templates/users.php +++ b/settings/templates/users.php @@ -228,7 +228,7 @@ $_['subadmingroups'] = array_flip($items); $lastLoginDate = \OC_Util::formatDate($user["lastLogin"]); } ?> - ').p($lastLoginDate).p(''); ?>">'.$lastLoginDate.''); ?>"> -- cgit v1.2.3 From f751e0bc48fb107a1f8314ea1071f6808d226595 Mon Sep 17 00:00:00 2001 From: raghunayyar Date: Wed, 19 Feb 2014 13:14:18 +0530 Subject: Splits Code for Users and Groups. --- settings/js/users.js | 689 -------------------------------------------- settings/js/users/groups.js | 130 +++++++++ settings/js/users/users.js | 566 ++++++++++++++++++++++++++++++++++++ settings/users.php | 3 +- 4 files changed, 698 insertions(+), 690 deletions(-) delete mode 100644 settings/js/users.js create mode 100644 settings/js/users/groups.js create mode 100644 settings/js/users/users.js (limited to 'settings') diff --git a/settings/js/users.js b/settings/js/users.js deleted file mode 100644 index 0068cb36414..00000000000 --- a/settings/js/users.js +++ /dev/null @@ -1,689 +0,0 @@ -/** - * Copyright (c) 2011, Robin Appelman - * This file is licensed under the Affero General Public License version 3 or later. - * See the COPYING-README file. - */ - -function setQuota (uid, quota, ready) { - $.post( - OC.filePath('settings', 'ajax', 'setquota.php'), - {username: uid, quota: quota}, - function (result) { - if (ready) { - ready(result.data.quota); - } - } - ); -} - -var GroupList = { - - delete_group: function (gid) { - if(GroupList.deleteGid !=='undefined') { - GroupList.finishDelete(null); - } - - //Set the undo flag - GroupList.deleteCanceled = false; - - //Provide an option to undo - $('#notification').data('deletegroup', true); - OC.Notification.showHtml(t('settings', 'deleted') + ' ' + escapeHTML(gid) + '' + t('settings', 'undo') + ''); - }, - - finishDelete: function (ready) { - if (!GroupList.deleteCanceled && GroupList.deleteGid) { - $.ajax({ - type: 'POST', - url: OC.filePath('settings', 'ajax', 'removegroup.php'), - async: false, - data: { groupname: GroupList.deleteGid }, - success: function (result) { - if (result.status === 'success') { - // Remove undo option, & remove user from table - OC.Notification.hide(); - $('li').filterAttr('data-gid', GroupList.deleteGid).remove(); - GroupList.deleteCanceled = true; - if (ready) { - ready(); - } - } else { - OC.dialogs.alert(result.data.message, t('settings', 'Unable to remove group')); - } - } - }); - } - - }, - -} - -var UserList = { - useUndo: true, - availableGroups: [], - offset: 30, //The first 30 users are there. No prob, if less in total. - //hardcoded in settings/users.php - - usersToLoad: 10, //So many users will be loaded when user scrolls down - - /** - * @brief Initiate user deletion process in UI - * @param string uid the user ID to be deleted - * - * Does not actually delete the user; it sets them for - * deletion when the current page is unloaded, at which point - * finishDelete() completes the process. This allows for 'undo'. - */ - do_delete: function (uid) { - if (typeof UserList.deleteUid !== 'undefined') { - //Already a user in the undo queue - UserList.finishDelete(null); - } - UserList.deleteUid = uid; - - // Set undo flag - UserList.deleteCanceled = false; - - // Provide user with option to undo - $('#notification').data('deleteuser', true); - OC.Notification.showHtml(t('settings', 'deleted') + ' ' + escapeHTML(uid) + '' + t('settings', 'undo') + ''); - }, - - /** - * @brief Delete a user via ajax - * @param bool ready whether to use ready() upon completion - * - * Executes deletion via ajax of user identified by property deleteUid - * if 'undo' has not been used. Completes the user deletion procedure - * and reflects success in UI. - */ - finishDelete: function (ready) { - - // Check deletion has not been undone - if (!UserList.deleteCanceled && UserList.deleteUid) { - - // Delete user via ajax - $.ajax({ - type: 'POST', - url: OC.filePath('settings', 'ajax', 'removeuser.php'), - async: false, - data: { username: UserList.deleteUid }, - success: function (result) { - if (result.status === 'success') { - // Remove undo option, & remove user from table - OC.Notification.hide(); - $('tr').filterAttr('data-uid', UserList.deleteUid).remove(); - UserList.deleteCanceled = true; - if (ready) { - ready(); - } - } else { - OC.dialogs.alert(result.data.message, t('settings', 'Unable to remove user')); - } - } - }); - } - }, - - add: function (username, displayname, groups, subadmin, quota, storageLocation, lastLogin, sort) { - var tr = $('tbody tr').first().clone(); - var subadminsEl; - var subadminSelect; - var groupsSelect; - if (tr.find('div.avatardiv').length){ - $('div.avatardiv', tr).avatar(username, 32); - } - tr.attr('data-uid', username); - tr.attr('data-displayName', displayname); - tr.find('td.name').text(username); - tr.find('td.displayName > span').text(displayname); - - // make them look like the multiselect buttons - // until they get time to really get initialized - groupsSelect = $('') - .attr('data-username', username) - .data('user-groups', groups); - if (tr.find('td.subadmins').length > 0) { - subadminSelect = $(''); - img.css('display', 'none'); - img.parent().children('span').replaceWith(input); - input.focus(); - input.keypress(function (event) { - if (event.keyCode === 13) { - if ($(this).val().length > 0) { - var recoveryPasswordVal = $('input:password[id="recoveryPassword"]').val(); - $.post( - OC.generateUrl('/settings/users/changepassword'), - {username: uid, password: $(this).val(), recoveryPassword: recoveryPasswordVal}, - function (result) { - if (result.status != 'success') { - OC.Notification.show(t('admin', result.data.message)); - } - } - ); - input.blur(); - } else { - input.blur(); - } - } - }); - input.blur(function () { - $(this).replaceWith($('●●●●●●●')); - img.css('display', ''); - }); - }); - $('input:password[id="recoveryPassword"]').keyup(function(event) { - OC.Notification.hide(); - }); - - $('table').on('click', 'td.password', function (event) { - $(this).children('img').click(); - }); - - $('table').on('click', 'td.displayName>img', function (event) { - event.stopPropagation(); - var img = $(this); - var uid = img.parent().parent().attr('data-uid'); - var displayName = escapeHTML(img.parent().parent().attr('data-displayName')); - var input = $(''); - img.css('display', 'none'); - img.parent().children('span').replaceWith(input); - input.focus(); - input.keypress(function (event) { - if (event.keyCode === 13) { - if ($(this).val().length > 0) { - $.post( - OC.filePath('settings', 'ajax', 'changedisplayname.php'), - {username: uid, displayName: $(this).val()}, - function (result) { - if (result && result.status==='success'){ - img.parent().parent().find('div.avatardiv').avatar(result.data.username, 32); - } - } - ); - input.blur(); - } else { - input.blur(); - } - } - }); - input.blur(function () { - var input = $(this), - displayName = input.val(); - input.closest('tr').attr('data-displayName', displayName); - input.replaceWith('' + escapeHTML(displayName) + ''); - img.css('display', ''); - }); - }); - $('table').on('click', 'td.displayName', function (event) { - $(this).children('img').click(); - }); - - $('select.quota, select.quota-user').singleSelect().on('change', function () { - var select = $(this); - var uid = $(this).parent().parent().attr('data-uid'); - var quota = $(this).val(); - setQuota(uid, quota, function(returnedQuota){ - if (quota !== returnedQuota) { - select.find(':selected').text(returnedQuota); - } - }); - }); - - $('ul').on('click', 'span.utils>a', function (event) { - var li = $(this).parent().parent(); - var gid = $(li).attr('data-gid'); - $(li).hide(); - // Call function for handling delete/undo on Groups - GroupList.delete_group(gid); - }); - - $('#newuser').submit(function (event) { - event.preventDefault(); - var username = $('#newusername').val(); - var password = $('#newuserpassword').val(); - if ($.trim(username) === '') { - OC.dialogs.alert( - t('settings', 'A valid username must be provided'), - t('settings', 'Error creating user')); - return false; - } - if ($.trim(password) === '') { - OC.dialogs.alert( - t('settings', 'A valid password must be provided'), - t('settings', 'Error creating user')); - return false; - } - var groups = $('#newusergroups').prev().children('div').data('settings').checked; - $('#newuser').get(0).reset(); - $.post( - OC.filePath('settings', 'ajax', 'createuser.php'), - { - username: username, - password: password, - groups: groups - }, - function (result) { - if (result.status !== 'success') { - OC.dialogs.alert(result.data.message, - t('settings', 'Error creating user')); - } else { - if (result.data.groups) { - var addedGroups = result.data.groups; - UserList.availableGroups = $.unique($.merge(UserList.availableGroups, addedGroups)); - } - if (result.data.homeExists){ - OC.Notification.hide(); - OC.Notification.show(t('settings', 'Warning: Home directory for user "{user}" already exists', {user: result.data.username})); - if (UserList.notificationTimeout){ - window.clearTimeout(UserList.notificationTimeout); - } - UserList.notificationTimeout = window.setTimeout( - function(){ - OC.Notification.hide(); - UserList.notificationTimeout = null; - }, 10000); - } - if($('tr[data-uid="' + username + '"]').length === 0) { - UserList.add(username, username, result.data.groups, null, 'default', result.data.storageLocation, 0, true); - } - } - } - ); - }); - $('#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); - } - } - - } - ) - }); - // Implements User Search - $('#usersearchform input').keyup(function() { - var inputVal = $(this).val(), regex = new RegExp(inputVal, "i");; - $('table tbody tr td.name').each(function (key,element) { - if (regex.test($(element).text())) { - $(element).parent().show(); - } else { - $(element).parent().hide(); - } - }); - }); - - // Implements Groupname editing. - $('#app-navigation').on('click', 'span.utils>img.rename', function (event) { - event.stopPropagation(); - var img = $(this); - var gid = img.parent().parent().attr('data-gid'); - var groupname = escapeHTML(img.parent().parent().attr('data-gid')); - var input = $(''); - img.css('display', 'none'); - img.parent().parent().children('a').replaceWith(input); - input.focus(); - input.keypress(function (event) { - if (event.keyCode === 13) { - if ($(this).val().length > 0) { - $.post( - OC.filePath('settings', 'ajax', 'changegroupname.php'), - { groupname: gid, - groupname: $(this).val() - } - ); - input.blur(); - } else { - input.blur(); - } - } - }); - input.blur(function () { - var input = $(this), groupname = input.val(); - input.closest('li').attr('data-gid', groupname); - input.replaceWith('' + escapeHTML(groupname) + ''); - img.css('display', ''); - }); - }); - - // Handle undo notifications - OC.Notification.hide(); - $('#notification').on('click', '.undo', function () { - if ($('#notification').data('deleteuser')) { - $('tbody tr').filterAttr('data-uid', UserList.deleteUid).show(); - UserList.deleteCanceled = true; - } - OC.Notification.hide(); - }); - UserList.useUndo = ('onbeforeunload' in window); - $(window).bind('beforeunload', function () { - UserList.finishDelete(null); - }); -}); diff --git a/settings/js/users/groups.js b/settings/js/users/groups.js new file mode 100644 index 00000000000..9920f72889b --- /dev/null +++ b/settings/js/users/groups.js @@ -0,0 +1,130 @@ +/** + * Copyright (c) 2014, Raghu Nayyar + * This file is licensed under the Affero General Public License version 3 or later. + * See the COPYING-README file. + */ + + var GroupList = { + + delete_group: function (gid) { + if(GroupList.deleteGid !=='undefined') { + GroupList.finishDelete(null); + } + + //Set the undo flag + GroupList.deleteCanceled = false; + + //Provide an option to undo + $('#notification').data('deletegroup', true); + OC.Notification.showHtml(t('settings', 'deleted') + ' ' + escapeHTML(gid) + '' + t('settings', 'undo') + ''); + }, + + finishDelete: function (ready) { + if (!GroupList.deleteCanceled && GroupList.deleteGid) { + $.ajax({ + type: 'POST', + url: OC.filePath('settings', 'ajax', 'removegroup.php'), + async: false, + data: { groupname: GroupList.deleteGid }, + success: function (result) { + if (result.status === 'success') { + // Remove undo option, & remove user from table + OC.Notification.hide(); + $('li').filterAttr('data-gid', GroupList.deleteGid).remove(); + GroupList.deleteCanceled = true; + if (ready) { + ready(); + } + } else { + OC.dialogs.alert(result.data.message, t('settings', 'Unable to remove group')); + } + } + }); + } + + }, + +} + +$(document).ready( function () { + $('ul').on('click', 'span.utils>a', function (event) { + var li = $(this).parent().parent(); + var gid = $(li).attr('data-gid'); + $(li).hide(); + // Call function for handling delete/undo on Groups + GroupList.delete_group(gid); + }); + $('#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); + } + } + + } + ) + }); + // Implements Groupname editing. + $('#app-navigation').on('click', 'span.utils>img.rename', function (event) { + event.stopPropagation(); + var img = $(this); + var gid = img.parent().parent().attr('data-gid'); + var groupname = escapeHTML(img.parent().parent().attr('data-gid')); + var input = $(''); + img.css('display', 'none'); + img.parent().parent().children('a').replaceWith(input); + input.focus(); + input.keypress(function (event) { + if (event.keyCode === 13) { + if ($(this).val().length > 0) { + $.post( + OC.filePath('settings', 'ajax', 'changegroupname.php'), + { groupname: gid, + groupname: $(this).val() + } + ); + input.blur(); + } else { + input.blur(); + } + } + }); + input.blur(function () { + var input = $(this), groupname = input.val(); + input.closest('li').attr('data-gid', groupname); + input.replaceWith('' + escapeHTML(groupname) + ''); + img.css('display', ''); + }); + }); + +}); \ No newline at end of file diff --git a/settings/js/users/users.js b/settings/js/users/users.js new file mode 100644 index 00000000000..47fe5cc5a69 --- /dev/null +++ b/settings/js/users/users.js @@ -0,0 +1,566 @@ +/** + * Copyright (c) 2011, Robin Appelman + * This file is licensed under the Affero General Public License version 3 or later. + * See the COPYING-README file. + */ + +var UserList = { + useUndo: true, + availableGroups: [], + offset: 30, //The first 30 users are there. No prob, if less in total. + //hardcoded in settings/users.php + + usersToLoad: 10, //So many users will be loaded when user scrolls down + + /** + * @brief Initiate user deletion process in UI + * @param string uid the user ID to be deleted + * + * Does not actually delete the user; it sets them for + * deletion when the current page is unloaded, at which point + * finishDelete() completes the process. This allows for 'undo'. + */ + do_delete: function (uid) { + if (typeof UserList.deleteUid !== 'undefined') { + //Already a user in the undo queue + UserList.finishDelete(null); + } + UserList.deleteUid = uid; + + // Set undo flag + UserList.deleteCanceled = false; + + // Provide user with option to undo + $('#notification').data('deleteuser', true); + OC.Notification.showHtml(t('settings', 'deleted') + ' ' + escapeHTML(uid) + '' + t('settings', 'undo') + ''); + }, + + /** + * @brief Delete a user via ajax + * @param bool ready whether to use ready() upon completion + * + * Executes deletion via ajax of user identified by property deleteUid + * if 'undo' has not been used. Completes the user deletion procedure + * and reflects success in UI. + */ + finishDelete: function (ready) { + + // Check deletion has not been undone + if (!UserList.deleteCanceled && UserList.deleteUid) { + + // Delete user via ajax + $.ajax({ + type: 'POST', + url: OC.filePath('settings', 'ajax', 'removeuser.php'), + async: false, + data: { username: UserList.deleteUid }, + success: function (result) { + if (result.status === 'success') { + // Remove undo option, & remove user from table + OC.Notification.hide(); + $('tr').filterAttr('data-uid', UserList.deleteUid).remove(); + UserList.deleteCanceled = true; + if (ready) { + ready(); + } + } else { + OC.dialogs.alert(result.data.message, t('settings', 'Unable to remove user')); + } + } + }); + } + }, + + add: function (username, displayname, groups, subadmin, quota, storageLocation, lastLogin, sort) { + var tr = $('tbody tr').first().clone(); + var subadminsEl; + var subadminSelect; + var groupsSelect; + if (tr.find('div.avatardiv').length){ + $('div.avatardiv', tr).avatar(username, 32); + } + tr.attr('data-uid', username); + tr.attr('data-displayName', displayname); + tr.find('td.name').text(username); + tr.find('td.displayName > span').text(displayname); + + // make them look like the multiselect buttons + // until they get time to really get initialized + groupsSelect = $('') + .attr('data-username', username) + .data('user-groups', groups); + if (tr.find('td.subadmins').length > 0) { + subadminSelect = $(''); + img.css('display', 'none'); + img.parent().children('span').replaceWith(input); + input.focus(); + input.keypress(function (event) { + if (event.keyCode === 13) { + if ($(this).val().length > 0) { + var recoveryPasswordVal = $('input:password[id="recoveryPassword"]').val(); + $.post( + OC.generateUrl('/settings/users/changepassword'), + {username: uid, password: $(this).val(), recoveryPassword: recoveryPasswordVal}, + function (result) { + if (result.status != 'success') { + OC.Notification.show(t('admin', result.data.message)); + } + } + ); + input.blur(); + } else { + input.blur(); + } + } + }); + input.blur(function () { + $(this).replaceWith($('●●●●●●●')); + img.css('display', ''); + }); + }); + $('input:password[id="recoveryPassword"]').keyup(function(event) { + OC.Notification.hide(); + }); + + $('table').on('click', 'td.password', function (event) { + $(this).children('img').click(); + }); + + $('table').on('click', 'td.displayName>img', function (event) { + event.stopPropagation(); + var img = $(this); + var uid = img.parent().parent().attr('data-uid'); + var displayName = escapeHTML(img.parent().parent().attr('data-displayName')); + var input = $(''); + img.css('display', 'none'); + img.parent().children('span').replaceWith(input); + input.focus(); + input.keypress(function (event) { + if (event.keyCode === 13) { + if ($(this).val().length > 0) { + $.post( + OC.filePath('settings', 'ajax', 'changedisplayname.php'), + {username: uid, displayName: $(this).val()}, + function (result) { + if (result && result.status==='success'){ + img.parent().parent().find('div.avatardiv').avatar(result.data.username, 32); + } + } + ); + input.blur(); + } else { + input.blur(); + } + } + }); + input.blur(function () { + var input = $(this), + displayName = input.val(); + input.closest('tr').attr('data-displayName', displayName); + input.replaceWith('' + escapeHTML(displayName) + ''); + img.css('display', ''); + }); + }); + $('table').on('click', 'td.displayName', function (event) { + $(this).children('img').click(); + }); + + $('select.quota, select.quota-user').singleSelect().on('change', function () { + var select = $(this); + var uid = $(this).parent().parent().attr('data-uid'); + var quota = $(this).val(); + setQuota(uid, quota, function(returnedQuota){ + if (quota !== returnedQuota) { + select.find(':selected').text(returnedQuota); + } + }); + }); + + $('#newuser').submit(function (event) { + event.preventDefault(); + var username = $('#newusername').val(); + var password = $('#newuserpassword').val(); + if ($.trim(username) === '') { + OC.dialogs.alert( + t('settings', 'A valid username must be provided'), + t('settings', 'Error creating user')); + return false; + } + if ($.trim(password) === '') { + OC.dialogs.alert( + t('settings', 'A valid password must be provided'), + t('settings', 'Error creating user')); + return false; + } + var groups = $('#newusergroups').prev().children('div').data('settings').checked; + $('#newuser').get(0).reset(); + $.post( + OC.filePath('settings', 'ajax', 'createuser.php'), + { + username: username, + password: password, + groups: groups + }, + function (result) { + if (result.status !== 'success') { + OC.dialogs.alert(result.data.message, + t('settings', 'Error creating user')); + } else { + if (result.data.groups) { + var addedGroups = result.data.groups; + UserList.availableGroups = $.unique($.merge(UserList.availableGroups, addedGroups)); + } + if (result.data.homeExists){ + OC.Notification.hide(); + OC.Notification.show(t('settings', 'Warning: Home directory for user "{user}" already exists', {user: result.data.username})); + if (UserList.notificationTimeout){ + window.clearTimeout(UserList.notificationTimeout); + } + UserList.notificationTimeout = window.setTimeout( + function(){ + OC.Notification.hide(); + UserList.notificationTimeout = null; + }, 10000); + } + if($('tr[data-uid="' + username + '"]').length === 0) { + UserList.add(username, username, result.data.groups, null, 'default', result.data.storageLocation, 0, true); + } + } + } + ); + }); + // Implements User Search + $('#usersearchform input').keyup(function() { + var inputVal = $(this).val(), regex = new RegExp(inputVal, "i");; + $('table tbody tr td.name').each(function (key,element) { + if (regex.test($(element).text())) { + $(element).parent().show(); + } else { + $(element).parent().hide(); + } + }); + }); + + // Handle undo notifications + OC.Notification.hide(); + $('#notification').on('click', '.undo', function () { + if ($('#notification').data('deleteuser')) { + $('tbody tr').filterAttr('data-uid', UserList.deleteUid).show(); + UserList.deleteCanceled = true; + } + OC.Notification.hide(); + }); + UserList.useUndo = ('onbeforeunload' in window); + $(window).bind('beforeunload', function () { + UserList.finishDelete(null); + }); +}); diff --git a/settings/users.php b/settings/users.php index dd0fdd80eb4..d391ff0ca81 100644 --- a/settings/users.php +++ b/settings/users.php @@ -8,7 +8,8 @@ OC_Util::checkSubAdminUser(); // We have some javascript foo! -OC_Util::addScript( 'settings', 'users' ); +OC_Util::addScript( 'settings', 'users/users' ); +OC_Util::addScript( 'settings', 'users/groups' ); OC_Util::addScript( 'core', 'multiselect' ); OC_Util::addScript( 'core', 'singleselect' ); OC_Util::addScript('core', 'jquery.inview'); -- cgit v1.2.3 From e681e1eec094385e2a41ea301834d6593d97ec0b Mon Sep 17 00:00:00 2001 From: raghunayyar Date: Wed, 19 Feb 2014 14:40:49 +0530 Subject: Initial Commit: Takes Quota Settings inside Navigation, Changes Create -> Add Group --- settings/js/users/groups.js | 9 ++++++ settings/templates/users.php | 66 +++++++++++++++++++++++--------------------- 2 files changed, 44 insertions(+), 31 deletions(-) (limited to 'settings') diff --git a/settings/js/users/groups.js b/settings/js/users/groups.js index 9920f72889b..5e9f5582b5a 100644 --- a/settings/js/users/groups.js +++ b/settings/js/users/groups.js @@ -127,4 +127,13 @@ $(document).ready( function () { }); }); + // Implements Quota Settings Toggle. + $('#app-navigation').find('.settings-button').on('click', function (e) { + e.stopPropagation(); + $('#app-settings').removeClass('open'); + $('#app-settings').toggleClass('open'); + $(document).click(function() { + $('#app-settings').removeClass('open'); + }); + }); }); \ No newline at end of file diff --git a/settings/templates/users.php b/settings/templates/users.php index e9fa5df6675..1feaecd8e86 100644 --- a/settings/templates/users.php +++ b/settings/templates/users.php @@ -21,7 +21,7 @@ $_['subadmingroups'] = array_flip($items);
  • - +
  • @@ -54,37 +54,41 @@ $_['subadmingroups'] = array_flip($items); - -
    -
    - t('Default Quota'));?> - - "> + - - - - - - - - - - + t('Unlimited'));?> + + + + + + + + + + + - - - - -
  • - t('Everyone')); ?> -
  • - - - -
  • - t('Admins')); ?> - - 0) { p(count($adminGroup['useringroup'])); } ?> - -
  • - - - - -
  • - - - 0) { p(count($group['useringroup'])); } ?> - <?php p($l->t(" title="t("change group name"))?>" /> - - - - -
  • - - - -
    -
    - -
    -
    -
    - - t('Default Quota'));?> - - - - - - -
    -
    -
    -
    -
    - - -
    - -
    - -
    - -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - " - data-displayName=""> - - - - - - - - - - - - - - - - - - -
    t('Username'))?>t( 'Full Name' )); ?>t( 'Password' )); ?>t( 'Groups' )); ?>t('Group Admin')); ?>t('Quota')); ?>t('Storage Location')); ?>t('Last Login')); ?> 
    <?php p($l->t(" title="t("change full name"))?>"/> - ●●●●●●● <?php p($l->t(" title="t("set new password"))?>"/> - - - - - '.$lastLoginDate.''); ?>"> - - - - - -
    diff --git a/settings/templates/users/main.php b/settings/templates/users/main.php new file mode 100644 index 00000000000..99c6848d2ec --- /dev/null +++ b/settings/templates/users/main.php @@ -0,0 +1,29 @@ + + * This file is licensed under the Affero General Public License version 3 or later. + * See the COPYING-README file. + */ +$allGroups=array(); +foreach($_["groups"] as $group) { + $allGroups[] = $group['name']; +} +$_['subadmingroups'] = $allGroups; +$items = array_flip($_['subadmingroups']); +unset($items['admin']); +$_['subadmingroups'] = array_flip($items); +?> + + + +
    + inc('users/part.grouplist')); ?> +
    + inc('users/part.setquota')); ?> +
    +
    + +
    + inc('users/part.createuser')); ?> + inc('users/part.userlist')); ?> +
    \ No newline at end of file diff --git a/settings/templates/users/part.createuser.php b/settings/templates/users/part.createuser.php new file mode 100644 index 00000000000..e52f0da0b36 --- /dev/null +++ b/settings/templates/users/part.createuser.php @@ -0,0 +1,30 @@ +
    +
    + + +
    + +
    + +
    + +
    + +
    +
    \ No newline at end of file diff --git a/settings/templates/users/part.grouplist.php b/settings/templates/users/part.grouplist.php new file mode 100644 index 00000000000..cf7338b5096 --- /dev/null +++ b/settings/templates/users/part.grouplist.php @@ -0,0 +1,38 @@ +
      + +
    • +
      + + +
      +
    • + +
    • + t('Everyone')); ?> +
    • + + + +
    • + t('Admins')); ?> + + 0) { p(count($adminGroup['useringroup'])); } ?> + +
    • + + + + +
    • + + + 0) { p(count($group['useringroup'])); } ?> + <?php p($l->t(" title="t("change group name"))?>" /> + + + + +
    • + +
    \ No newline at end of file diff --git a/settings/templates/users/part.setquota.php b/settings/templates/users/part.setquota.php new file mode 100644 index 00000000000..23fdbe6ab54 --- /dev/null +++ b/settings/templates/users/part.setquota.php @@ -0,0 +1,42 @@ +
    + +
    +
    +
    + + t('Default Quota'));?> + + + + + + +
    \ No newline at end of file diff --git a/settings/templates/users/part.userlist.php b/settings/templates/users/part.userlist.php new file mode 100644 index 00000000000..9df069364d4 --- /dev/null +++ b/settings/templates/users/part.userlist.php @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + " + data-displayName=""> + + + + + + + + + + + + + + + + + + +
    t('Username'))?>t( 'Full Name' )); ?>t( 'Password' )); ?>t( 'Groups' )); ?>t('Group Admin')); ?>t('Quota')); ?>t('Storage Location')); ?>t('Last Login')); ?> 
    <?php p($l->t(" title="t("change full name"))?>"/> + ●●●●●●● <?php p($l->t(" title="t("set new password"))?>"/> + + + + + '.$lastLoginDate.''); ?>"> + + + + + +
    diff --git a/settings/users.php b/settings/users.php index 6b16e3aff73..7bf240fa16e 100644 --- a/settings/users.php +++ b/settings/users.php @@ -115,7 +115,7 @@ if(!empty($adminGroup)) { array_multisort($sortAdminGroupsKeys, SORT_DESC, $adminGroup); } -$tmpl = new OC_Template( "settings", "users", "user" ); +$tmpl = new OC_Template( "settings", "users/main", "user" ); $tmpl->assign( 'users', $users ); $tmpl->assign( 'groups', $groups ); $tmpl->assign( 'adminGroup', $adminGroup ); -- cgit v1.2.3 From 63645461f01c915ac0a4aadd0b81ab534209cdbc Mon Sep 17 00:00:00 2001 From: raghunayyar Date: Wed, 19 Feb 2014 21:32:10 +0530 Subject: Fixes Markup in templates. --- settings/templates/users/part.setquota.php | 55 ++++++++++++++---------------- 1 file changed, 26 insertions(+), 29 deletions(-) (limited to 'settings') diff --git a/settings/templates/users/part.setquota.php b/settings/templates/users/part.setquota.php index 23fdbe6ab54..4b650002a7f 100644 --- a/settings/templates/users/part.setquota.php +++ b/settings/templates/users/part.setquota.php @@ -6,37 +6,34 @@ t('Default Quota'));?> - "> + + + + + + + + - - - + + + + - - - - + + +
    \ No newline at end of file -- cgit v1.2.3 From 16fb48f2ebf9e7c67972fa74e8a421c9ce694fba Mon Sep 17 00:00:00 2001 From: raghunayyar Date: Thu, 20 Feb 2014 13:24:41 +0530 Subject: Adds admin check on groupname changes. --- settings/ajax/changegroupname.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'settings') diff --git a/settings/ajax/changegroupname.php b/settings/ajax/changegroupname.php index cbf1e3e5e86..2b149b2bba5 100644 --- a/settings/ajax/changegroupname.php +++ b/settings/ajax/changegroupname.php @@ -4,6 +4,8 @@ OCP\JSON::callCheck(); OC_JSON::checkLoggedIn(); +OCP\JSON::checkAdminUser(); + $l=OC_L10N::get('core'); $groupname = $_POST["groupname"]; -- cgit v1.2.3 From 8a8800203e33fd95cd479997f9a0e4397e0e61cc Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Thu, 20 Feb 2014 10:52:34 +0100 Subject: Remove legacy "Check for user comment" I don't think these comments are necessary anymore and therefore they should get killed. --- settings/ajax/changegroupname.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'settings') diff --git a/settings/ajax/changegroupname.php b/settings/ajax/changegroupname.php index 2b149b2bba5..1d9c24b6b35 100644 --- a/settings/ajax/changegroupname.php +++ b/settings/ajax/changegroupname.php @@ -1,9 +1,7 @@ array( "message" => $l->t("Unable to change group name")))); -} \ No newline at end of file +} -- cgit v1.2.3 From ed1a23c9a254a4322fded5a8377cb9bfa9b18500 Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Thu, 20 Feb 2014 11:00:44 +0100 Subject: Use OCP\JSON instead of OC_JSON --- settings/ajax/changegroupname.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'settings') diff --git a/settings/ajax/changegroupname.php b/settings/ajax/changegroupname.php index 1d9c24b6b35..a70440c0e4e 100644 --- a/settings/ajax/changegroupname.php +++ b/settings/ajax/changegroupname.php @@ -1,7 +1,7 @@ array( "message" => $l->t('Group name has been changed.'), "groupname" => $groupname, @@ -20,5 +20,5 @@ if(OC_Group::setGroupname($groupname)) { ) ); } else { - OC_JSON::error(array("data" => array( "message" => $l->t("Unable to change group name")))); + OCP\JSON::error(array("data" => array( "message" => $l->t("Unable to change group name")))); } -- cgit v1.2.3 From 86d3cf53d1a7b894a91f1191b461ec4dcbb749e8 Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Thu, 20 Feb 2014 11:01:30 +0100 Subject: Let's switch to OCP\JSON --- settings/ajax/createuser.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'settings') diff --git a/settings/ajax/createuser.php b/settings/ajax/createuser.php index 946081e566a..4f0424754af 100644 --- a/settings/ajax/createuser.php +++ b/settings/ajax/createuser.php @@ -1,7 +1,7 @@ get($username); - OC_JSON::success(array("data" => + OCP\JSON::success(array("data" => array( // returns whether the home already existed "homeExists" => $homeExists, @@ -53,5 +53,5 @@ try { "groups" => OC_Group::getUserGroups( $username ), 'storageLocation' => $user->getHome()))); } catch (Exception $exception) { - OC_JSON::error(array("data" => array( "message" => $exception->getMessage()))); + OCP\JSON::error(array("data" => array( "message" => $exception->getMessage()))); } -- cgit v1.2.3 From f7903e92beda140cdc07927620bf2e13c8d9c741 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Thu, 20 Feb 2014 11:35:31 +0100 Subject: do not forget to pass parameters to subtemplate --- settings/templates/users/main.php | 10 ++++++---- settings/templates/users/part.userlist.php | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'settings') diff --git a/settings/templates/users/main.php b/settings/templates/users/main.php index 99c6848d2ec..23148def2df 100644 --- a/settings/templates/users/main.php +++ b/settings/templates/users/main.php @@ -4,14 +4,16 @@ * This file is licensed under the Affero General Public License version 3 or later. * See the COPYING-README file. */ +$userlistParams = array(); $allGroups=array(); foreach($_["groups"] as $group) { $allGroups[] = $group['name']; } -$_['subadmingroups'] = $allGroups; -$items = array_flip($_['subadmingroups']); +$userlistParams['subadmingroups'] = $allGroups; +$userlistParams['allGroups'] = json_encode($allGroups); +$items = array_flip($userlistParams['subadmingroups']); unset($items['admin']); -$_['subadmingroups'] = array_flip($items); +$userlistParams['subadmingroups'] = array_flip($items); ?> @@ -25,5 +27,5 @@ $_['subadmingroups'] = array_flip($items);
    inc('users/part.createuser')); ?> - inc('users/part.userlist')); ?> + inc('users/part.userlist', $userlistParams)); ?>
    \ No newline at end of file diff --git a/settings/templates/users/part.userlist.php b/settings/templates/users/part.userlist.php index 9df069364d4..989d5f362c4 100644 --- a/settings/templates/users/part.userlist.php +++ b/settings/templates/users/part.userlist.php @@ -1,4 +1,4 @@ - +
    -- cgit v1.2.3 From 1f4bc7cb1047525422c9db1cc5ba56c564304fb1 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Thu, 20 Feb 2014 18:42:03 +0100 Subject: port scroll improvements --- settings/js/users/users.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'settings') diff --git a/settings/js/users/users.js b/settings/js/users/users.js index 3ef6706b98c..8b1d04e2a36 100644 --- a/settings/js/users/users.js +++ b/settings/js/users/users.js @@ -11,6 +11,7 @@ var UserList = { //hardcoded in settings/users.php usersToLoad: 10, //So many users will be loaded when user scrolls down + currentGid: '', /** * @brief Initiate user deletion process in UI @@ -237,7 +238,10 @@ var UserList = { if(gid === undefined) { gid = ''; } + UserList.currentGid = gid; $.get(OC.Router.generate('settings_ajax_userlist', { offset: UserList.offset, limit: UserList.usersToLoad, gid: gid }), function (result) { + var loadedUsers = 0; + var trs = []; if (result.status === 'success') { //The offset does not mirror the amount of users available, //because it is backend-dependent. For correct retrieval, @@ -371,8 +375,8 @@ var UserList = { if (!!UserList.noMoreEntries) { return; } - if ($(window).scrollTop() + $(window).height() > $(document).height() - 500) { - UserList.update(true); + if (UserList.scrollArea.scrollTop() + UserList.scrollArea.height() > UserList.scrollArea.get(0).scrollHeight - 500) { + UserList.update(UserList.currentGid, true); } }, }; @@ -394,6 +398,7 @@ $(document).ready(function () { UserList.doSort(); UserList.availableGroups = $('#content table').data('groups'); $(window).scroll(function(e) {UserList._onScroll(e);}); + UserList.scrollArea.scroll(function(e) {UserList._onScroll(e);}); $('table').after($('')); $('select[multiple]').each(function (index, element) { -- cgit v1.2.3 From d650cd66dc54ec17f3ee4644d8945223f54e20d3 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Thu, 20 Feb 2014 19:11:52 +0100 Subject: mark selected group active --- settings/js/users/groups.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'settings') diff --git a/settings/js/users/groups.js b/settings/js/users/groups.js index f6124eaa795..5275d437ec8 100644 --- a/settings/js/users/groups.js +++ b/settings/js/users/groups.js @@ -22,6 +22,11 @@ showGroup: function (gid) { UserList.empty(); UserList.update(gid); + $('#app-navigation li').removeClass('active'); + if(gid !== undefined) { + //TODO: treat Everyone properly + $('#app-navigation li').filterAttr('data-gid', gid).addClass('active'); + } }, finishDelete: function (ready) { -- cgit v1.2.3 From f946a5281933282f120b37075c994c5561893dff Mon Sep 17 00:00:00 2001 From: raghunayyar Date: Fri, 21 Feb 2014 15:07:37 +0530 Subject: Rename and Delete Happens only on Active Group. --- settings/css/settings.css | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'settings') diff --git a/settings/css/settings.css b/settings/css/settings.css index b96c0806b99..20b9a945a7f 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -56,9 +56,9 @@ span.utils .delete, span.utils .rename { float: left; position: relative; display: none; margin: 3px; top: 4px; } -#app-navigation ul li:hover > span.utils .delete, -#app-navigation ul li:hover > span.utils .rename { display: block; } -span.utils .delete { +#app-navigation ul li.active:hover > span.utils .delete, +#app-navigation ul li.active:hover > span.utils .rename { display: block; } +.active span.utils .delete { float: left; position: relative; display: none; margin: 3px; top: 4px; } -- cgit v1.2.3 From d51b384c0c52771225dbf3f0ab8d379e2ed9ca31 Mon Sep 17 00:00:00 2001 From: raghunayyar Date: Fri, 21 Feb 2014 15:35:46 +0530 Subject: Enhancement: Always show edit & delete for the active group. --- settings/css/settings.css | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'settings') diff --git a/settings/css/settings.css b/settings/css/settings.css index 20b9a945a7f..067f80fc9a7 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -52,14 +52,15 @@ table.nostyle td { padding: 0.2em 0; } /* USERS */ .usercount { float: left; margin: 5px; } -span.utils .delete, span.utils .rename { - float: left; position: relative; display: none; +li.active span.utils .delete, li.active span.utils .rename { + float: left; position: relative; margin: 3px; top: 4px; } -#app-navigation ul li.active:hover > span.utils .delete, -#app-navigation ul li.active:hover > span.utils .rename { display: block; } -.active span.utils .delete { - float: left; position: relative; display: none; +span.utils .delete, span.utils .rename { display: none; } +#app-navigation ul li.active > span.utils .delete, +#app-navigation ul li.active > span.utils .rename { display: block; } +li.active span.utils .delete { + float: left; position: relative; margin: 3px; top: 4px; } #usersearchform { position: absolute; top: 4px; right: 10px; } -- cgit v1.2.3 From ceb6c4df04c15f3c16af6675b02e460b1ab4b473 Mon Sep 17 00:00:00 2001 From: raghunayyar Date: Sat, 22 Feb 2014 02:40:47 +0530 Subject: Enhancement: Makes Edit and Delete Icons Tapable, 44px by 44px dimensions. --- settings/css/settings.css | 13 ++++++++----- settings/templates/users/part.grouplist.php | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'settings') diff --git a/settings/css/settings.css b/settings/css/settings.css index 067f80fc9a7..0e62ab6763d 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -52,17 +52,20 @@ table.nostyle td { padding: 0.2em 0; } /* USERS */ .usercount { float: left; margin: 5px; } +li.active span.utils .delete { left: 7px; } li.active span.utils .delete, li.active span.utils .rename { float: left; position: relative; - margin: 3px; top: 4px; + top: -7px; width: 44px; height: 44px; } +li.active span.utils .rename { + width: 16px; height: 16px; + padding: 14px; + cursor: pointer; +} +li.active span.utils .delete img { margin: 14px; } span.utils .delete, span.utils .rename { display: none; } #app-navigation ul li.active > span.utils .delete, #app-navigation ul li.active > span.utils .rename { display: block; } -li.active span.utils .delete { - float: left; position: relative; - margin: 3px; top: 4px; -} #usersearchform { position: absolute; top: 4px; right: 10px; } #usersearchform label { font-weight: 700; } form { display:inline; } diff --git a/settings/templates/users/part.grouplist.php b/settings/templates/users/part.grouplist.php index cf7338b5096..ce038c90107 100644 --- a/settings/templates/users/part.grouplist.php +++ b/settings/templates/users/part.grouplist.php @@ -28,7 +28,7 @@ 0) { p(count($group['useringroup'])); } ?> <?php p($l->t(" title="t("change group name"))?>" /> + original-title="t('Edit'))?>" alt="t("change group name"))?>" title="t("change group name"))?>" /> -- cgit v1.2.3 From 6526b939d376a016ad4137151aa80dc5dcaaea92 Mon Sep 17 00:00:00 2001 From: raghunayyar Date: Sat, 22 Feb 2014 02:45:39 +0530 Subject: Enhancement: Transparency added to icons, changes opacity to 1 on hover. --- settings/css/settings.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'settings') diff --git a/settings/css/settings.css b/settings/css/settings.css index 0e62ab6763d..2012818338f 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -54,7 +54,7 @@ table.nostyle td { padding: 0.2em 0; } .usercount { float: left; margin: 5px; } li.active span.utils .delete { left: 7px; } li.active span.utils .delete, li.active span.utils .rename { - float: left; position: relative; + float: left; position: relative; opacity: 0.5; top: -7px; width: 44px; height: 44px; } li.active span.utils .rename { @@ -63,6 +63,7 @@ li.active span.utils .rename { cursor: pointer; } li.active span.utils .delete img { margin: 14px; } +li.active span.utils .delete:hover, li.active span.utils .rename:hover { opacity: 1; } span.utils .delete, span.utils .rename { display: none; } #app-navigation ul li.active > span.utils .delete, #app-navigation ul li.active > span.utils .rename { display: block; } -- cgit v1.2.3 From eed108ec1b6181356b4ec3223e63ba4669e8b3af Mon Sep 17 00:00:00 2001 From: raghunayyar Date: Sun, 23 Feb 2014 02:58:44 +0530 Subject: Enhancement : The edit icon looks like files app rename fileaction. --- settings/css/settings.css | 19 ++++++++++--------- settings/js/users/groups.js | 6 +++--- settings/templates/users/part.grouplist.php | 14 ++++++++++---- 3 files changed, 23 insertions(+), 16 deletions(-) (limited to 'settings') diff --git a/settings/css/settings.css b/settings/css/settings.css index 2012818338f..2f0585f2990 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -52,19 +52,20 @@ table.nostyle td { padding: 0.2em 0; } /* USERS */ .usercount { float: left; margin: 5px; } -li.active span.utils .delete { left: 7px; } -li.active span.utils .delete, li.active span.utils .rename { +li.active span.utils .delete { float: left; position: relative; opacity: 0.5; - top: -7px; width: 44px; height: 44px; + top: -7px; left: 7px; width: 44px; height: 44px; } -li.active span.utils .rename { - width: 16px; height: 16px; - padding: 14px; - cursor: pointer; +li.active .rename { + padding: 8px 14px 20px 14px; + top: 0px; position: absolute; width: 16px; height: 16px; + opacity: 0.5; + display: inline-block !important; } li.active span.utils .delete img { margin: 14px; } -li.active span.utils .delete:hover, li.active span.utils .rename:hover { opacity: 1; } -span.utils .delete, span.utils .rename { display: none; } +li.active .rename { opacity: 0.5; } +li.active span.utils .delete:hover, li.active .rename:hover { opacity: 1; } +span.utils .delete, .rename { display: none; } #app-navigation ul li.active > span.utils .delete, #app-navigation ul li.active > span.utils .rename { display: block; } #usersearchform { position: absolute; top: 4px; right: 10px; } diff --git a/settings/js/users/groups.js b/settings/js/users/groups.js index 5275d437ec8..3234d6911e4 100644 --- a/settings/js/users/groups.js +++ b/settings/js/users/groups.js @@ -105,14 +105,14 @@ $(document).ready( function () { ) }); // Implements Groupname editing. - $('#app-navigation').on('click', 'span.utils>img.rename', function (event) { + $('#app-navigation').on('click', 'img.rename', function (event) { event.stopPropagation(); var img = $(this); var gid = img.parent().parent().attr('data-gid'); var groupname = escapeHTML(img.parent().parent().attr('data-gid')); var input = $(''); img.css('display', 'none'); - img.parent().parent().children('a').replaceWith(input); + img.parent().children('span').replaceWith(input); input.focus(); input.keypress(function (event) { if (event.keyCode === 13) { @@ -132,7 +132,7 @@ $(document).ready( function () { input.blur(function () { var input = $(this), groupname = input.val(); input.closest('li').attr('data-gid', groupname); - input.replaceWith('' + escapeHTML(groupname) + ''); + input.replaceWith('' + escapeHTML(groupname) + ''); img.css('display', ''); }); }); diff --git a/settings/templates/users/part.grouplist.php b/settings/templates/users/part.grouplist.php index ce038c90107..7833bb69a1a 100644 --- a/settings/templates/users/part.grouplist.php +++ b/settings/templates/users/part.grouplist.php @@ -8,7 +8,11 @@
  • - t('Everyone')); ?> + + + t('Everyone')); ?> + +
  • @@ -24,11 +28,13 @@
  • - + + + <?php p($l->t(" title="t("change group name"))?>" /> + 0) { p(count($group['useringroup'])); } ?> - <?php p($l->t(" title="t("change group name"))?>" /> -- cgit v1.2.3 From b3221f0e4e67e7cee6a117de1a170417a86c0b2a Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Mon, 24 Feb 2014 18:25:03 +0100 Subject: LDAP: adjust main template according to PR 7291 --- settings/templates/users/main.php | 2 -- 1 file changed, 2 deletions(-) (limited to 'settings') diff --git a/settings/templates/users/main.php b/settings/templates/users/main.php index 23148def2df..1c35690d2ac 100644 --- a/settings/templates/users/main.php +++ b/settings/templates/users/main.php @@ -16,8 +16,6 @@ unset($items['admin']); $userlistParams['subadmingroups'] = array_flip($items); ?> - -
    inc('users/part.grouplist')); ?>
    -- cgit v1.2.3 From 004dd73c5e738b1b610acfaf6d2d67dc06c345b8 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Tue, 25 Feb 2014 09:49:00 +0100 Subject: fix user creation, checkSubAdminUser is only available in OC_JSON --- settings/ajax/createuser.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'settings') diff --git a/settings/ajax/createuser.php b/settings/ajax/createuser.php index 4f0424754af..ae1d8856f43 100644 --- a/settings/ajax/createuser.php +++ b/settings/ajax/createuser.php @@ -1,7 +1,7 @@ Date: Tue, 25 Feb 2014 09:54:38 +0100 Subject: stricter test for 0 --- settings/js/users/users.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'settings') diff --git a/settings/js/users/users.js b/settings/js/users/users.js index 8b1d04e2a36..e82a6ceac13 100644 --- a/settings/js/users/users.js +++ b/settings/js/users/users.js @@ -132,7 +132,7 @@ var UserList = { } } tr.find('td.storageLocation').text(storageLocation); - if(lastLogin == 0) { + if(lastLogin === 0) { lastLogin = t('settings', 'never'); } else { lastLogin = new Date(lastLogin); -- cgit v1.2.3 From 17e640af22d07c5ecede6ae1b6d1a89509e104a9 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Tue, 25 Feb 2014 10:21:10 +0100 Subject: set admin gid to Admins filter. I.e. hard-coding the admin group, but this is OC reality atm - other admin groups are not possible. --- settings/templates/users/part.grouplist.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'settings') diff --git a/settings/templates/users/part.grouplist.php b/settings/templates/users/part.grouplist.php index 7833bb69a1a..51351733d0d 100644 --- a/settings/templates/users/part.grouplist.php +++ b/settings/templates/users/part.grouplist.php @@ -17,7 +17,7 @@ -
  • +
  • t('Admins')); ?> 0) { p(count($adminGroup['useringroup'])); } ?> -- cgit v1.2.3 From 65aa20433c796c40592e6031eb8ba323c171c108 Mon Sep 17 00:00:00 2001 From: raghunayyar Date: Tue, 25 Feb 2014 15:39:01 +0530 Subject: Enhancement : Toggle Add Group on Click, @blizzz have a look here. --- settings/css/settings.css | 5 +++++ settings/js/users/groups.js | 18 +++++++++++++++++- settings/templates/users/part.grouplist.php | 9 +++++++-- 3 files changed, 29 insertions(+), 3 deletions(-) (limited to 'settings') diff --git a/settings/css/settings.css b/settings/css/settings.css index 2f0585f2990..e6ad4fd304f 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -51,6 +51,11 @@ table.nostyle label { margin-right: 2em; } table.nostyle td { padding: 0.2em 0; } /* USERS */ +#newgroup-init a span { margin-left: 20px; } +#newgroup-init a span:before { + position: absolute; left: 12px; top:-2px; + content: '+'; font-weight: bold; font-size: 150%; +} .usercount { float: left; margin: 5px; } li.active span.utils .delete { float: left; position: relative; opacity: 0.5; diff --git a/settings/js/users/groups.js b/settings/js/users/groups.js index 3234d6911e4..3ac8d3f36e3 100644 --- a/settings/js/users/groups.js +++ b/settings/js/users/groups.js @@ -64,7 +64,23 @@ $(document).ready( function () { // Call function for handling delete/undo on Groups GroupList.delete_group(gid); }); - $('#newgroup').submit(function (event) { + + // Display or hide of Create Group List Element + $('#newgroup-form').hide(); + $('#newgroup-init').on('click', function (e) { + e.stopPropagation(); + $('#newgroup-form').show(); + $('#newgroup-init').hide(); + $(document).click( function (e) { + if (e.target.id !== 'newgroup-form') { + $("#newgroup-form").hide(); + $("#newgroup-init").show(); + } + }); + }); + + // Responsible for Creating Groups. + $('#newgroup-form form').submit(function (event) { event.preventDefault(); var groupname = $('#newgroupname').val(); if ($.trim(groupname) === '') { diff --git a/settings/templates/users/part.grouplist.php b/settings/templates/users/part.grouplist.php index 51351733d0d..620049eb298 100644 --- a/settings/templates/users/part.grouplist.php +++ b/settings/templates/users/part.grouplist.php @@ -1,7 +1,12 @@
  • - + t('never'); $lastLoginDate = ''; } else { $lastLogin = relative_modified_date($user["lastLogin"]); -- cgit v1.2.3 From d779db5aba7bbf5a0042e611808e902063089bde Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Wed, 16 Apr 2014 18:57:35 +0200 Subject: js cleanup --- settings/js/users/deleteHandler.js | 40 +++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'settings') diff --git a/settings/js/users/deleteHandler.js b/settings/js/users/deleteHandler.js index 83d1cafc30d..82c44b30581 100644 --- a/settings/js/users/deleteHandler.js +++ b/settings/js/users/deleteHandler.js @@ -14,7 +14,7 @@ * @param Function markCallback: the function to be called after successfully * marking the object for deletion. * @param Function removeCallback: the function to be called after successful - * delete. The id of the object will be passed as argument. Insuccessful + * delete. The id of the object will be passed as argument. Unsuccessful * operations will display an error using OC.dialogs, no callback is fired. */ function DeleteHandler(endpoint, paramID, markCallback, removeCallback) { @@ -37,23 +37,23 @@ function DeleteHandler(endpoint, paramID, markCallback, removeCallback) { /** * @brief enabled the notification system. Required for undo UI. * @param Object notifier: Usually OC.Notification - * @param String dataID: an identifier for the notificatior, e.g. 'deleteuser' + * @param String dataID: an identifier for the notifier, e.g. 'deleteuser' * @param String message: the message that should be shown upon delete. %oid * will be replaced with the affected id of the item to be deleted - * @param Function undoCb: called after "undo" was clicked so consument can + * @param Function undoCb: called after "undo" was clicked so the consumer can * update the web interface */ -DeleteHandler.prototype.setNotification = function(notifier, dataID, message, undoCb) { +DeleteHandler.prototype.setNotification = function(notifier, dataID, message, undoCallback) { this.notifier = notifier; this.notificationDataID = dataID; this.notificationMessage = message; - this.undoCallback = undoCb; + this.undoCallback = undoCallback; - dh = this; + var dh = this; $('#notification').on('click', '.undo', function () { if ($('#notification').data(dh.notificationDataID)) { - oid = dh.oidToDelete; + var oid = dh.oidToDelete; UserDeleteHandler.cancel(); if(typeof dh.undoCallback !== 'undefined') { dh.undoCallback(oid); @@ -61,7 +61,7 @@ DeleteHandler.prototype.setNotification = function(notifier, dataID, message, un } dh.notifier.hide(); }); -} +}; /** * @brief shows the Undo Notification (if configured) @@ -72,12 +72,12 @@ DeleteHandler.prototype.showNotification = function() { this.hideNotification(); } $('#notification').data(this.notificationDataID, true); - msg = this.notificationMessage.replace(this.notificationPlaceholder, + var msg = this.notificationMessage.replace(this.notificationPlaceholder, this.oidToDelete); console.log('NOTISHOW ' + msg); this.notifier.showHtml(msg); } -} +}; /** * @brief hides the Undo Notification @@ -87,10 +87,10 @@ DeleteHandler.prototype.hideNotification = function() { $('#notification').removeData(this.notificationDataID); this.notifier.hide(); } -} +}; /** - * @brief initilizes the delete operation for a given object id + * @brief initializes the delete operation for a given object id * @param String oid: the object id */ DeleteHandler.prototype.mark = function(oid) { @@ -101,19 +101,19 @@ DeleteHandler.prototype.mark = function(oid) { this.canceled = false; this.markCallback(oid); this.showNotification(); -} +}; /** * @brief cancels a delete operation */ -DeleteHandler.prototype.cancel = function(oid) { +DeleteHandler.prototype.cancel = function() { this.canceled = true; this.oidToDelete = false; -} +}; /** * @brief executes a delete operation. Requires that the operation has been - * initilized by mark(). On error, it will show a message via + * initialized by mark(). On error, it will show a message via * OC.dialogs.alert. On success, a callback is fired so that the client can * update the web interface accordingly. */ @@ -122,15 +122,15 @@ DeleteHandler.prototype.delete = function() { return false; } - dh = this; + var dh = this; console.log($('#notification').data(this.notificationDataID)); if($('#notification').data(this.notificationDataID) === true) { dh.hideNotification(); console.log('HIDDEN NOTI'); } - payload = {}; - payload[dh['ajaxParamID']] = dh.oidToDelete; + var payload = {}; + payload[dh.ajaxParamID] = dh.oidToDelete; $.ajax({ type: 'POST', url: OC.filePath('settings', 'ajax', dh.ajaxEndpoint), @@ -150,4 +150,4 @@ DeleteHandler.prototype.delete = function() { } } }); -} \ No newline at end of file +}; -- cgit v1.2.3 From 3c9788d40ccdad168eefbd75ba74e9550ee3805b Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Wed, 16 Apr 2014 19:41:09 +0200 Subject: js cleanup + typos --- settings/js/users/filter.js | 12 ++++++------ settings/js/users/groups.js | 40 ++++++++++++++++++++-------------------- 2 files changed, 26 insertions(+), 26 deletions(-) (limited to 'settings') diff --git a/settings/js/users/filter.js b/settings/js/users/filter.js index 89c2f46dacf..3b04a8750cf 100644 --- a/settings/js/users/filter.js +++ b/settings/js/users/filter.js @@ -5,7 +5,7 @@ */ /** - * @brief this object takes care of the filter funcationality on the user + * @brief this object takes care of the filter functionality on the user * management page * @param jQuery input element that works as the user text input field * @param object the UserList object @@ -24,9 +24,9 @@ function UserManagementFilter(filterInput, userList, groupList) { * @brief sets up when the filter action shall be triggered */ UserManagementFilter.prototype.init = function() { - umf = this; + var umf = this; this.filterInput.keyup(function(e) { - //we want to react on any printable letter, plus on modyfing stuff like + //we want to react on any printable letter, plus on modifying stuff like //Backspace and Delete. extended https://stackoverflow.com/a/12467610 var valid = e.keyCode === 0 || e.keyCode === 8 || // like ö or ж; backspace @@ -51,7 +51,7 @@ UserManagementFilter.prototype.init = function() { } umf.oldVal = umf.getPattern(); }); -} +}; /** * @brief the filter action needs to be done, here the accurate steps are being @@ -62,7 +62,7 @@ UserManagementFilter.prototype.run = function() { this.userList.update(); this.groupList.empty(); this.groupList.update(); -} +}; /** * @brief returns the filter String @@ -70,4 +70,4 @@ UserManagementFilter.prototype.run = function() { */ UserManagementFilter.prototype.getPattern = function() { return this.filterInput.val(); -} \ No newline at end of file +}; diff --git a/settings/js/users/groups.js b/settings/js/users/groups.js index 1088467ca11..25b865cf18d 100644 --- a/settings/js/users/groups.js +++ b/settings/js/users/groups.js @@ -77,7 +77,7 @@ GroupList.toggleAddGroup(); } } - ) + ); }, update: function() { @@ -85,7 +85,7 @@ return; } GroupList.updating = true; - pattern = filter.getPattern(); + var pattern = filter.getPattern(); var query = $.param({ pattern: pattern }); $.get(OC.generateUrl('/settings/ajax/grouplist') + '?' + query, function (result) { var lis = []; @@ -116,12 +116,12 @@ }, elementBelongsToAddGroup: function(el) { - return !(el !== $('#newgroup-form').get(0) - && $('#newgroup-form').find($(el)).length === 0); + return !(el !== $('#newgroup-form').get(0) && + $('#newgroup-form').find($(el)).length === 0); }, hasAddGroupNameText: function() { - name = $('#newgroupname').val(); + var name = $('#newgroupname').val(); if($.trim(name) === '') { return false; } @@ -158,7 +158,7 @@ isGroupNameValid: function(groupname) { if ($.trim(groupname) === '') { OC.dialogs.alert( - t('settings', 'A valid groupname must be provided'), + t('settings', 'A valid group name must be provided'), t('settings', 'Error creating group')); return false; } @@ -184,15 +184,15 @@ //configure undo OC.Notification.hide(); - msg = t('settings', 'deleted') + ' %oid ' + - t('settings', 'undo') + ''; + var msg = t('settings', 'deleted') + ' %oid ' + + t('settings', 'undo') + ''; GroupDeleteHandler.setNotification(OC.Notification, 'deletegroup', msg, - GroupList.show); + GroupList.show); //when to mark user for delete - $('ul').on('click', 'span.utils>a', function (event) { + $('ul').on('click', 'span.utils>a', function () { // Call function for handling delete/undo - gid = $(this).parent().parent().attr('data-gid'); + var gid = $(this).parent().parent().attr('data-gid'); GroupDeleteHandler.mark(gid); }); @@ -201,8 +201,8 @@ $(window).on('beforeunload', function () { GroupDeleteHandler.delete(); }); - }, -} + } +}; $(document).ready( function () { GroupList.initDeleteHandling(); @@ -214,9 +214,9 @@ $(document).ready( function () { }); $(document).on('click keydown keyup', function(event) { - if(!GroupList.isAddGroupButtonVisible() - && !GroupList.elementBelongsToAddGroup(event.target) - && !GroupList.hasAddGroupNameText()) { + if(!GroupList.isAddGroupButtonVisible() && + !GroupList.elementBelongsToAddGroup(event.target) && + !GroupList.hasAddGroupNameText()) { GroupList.toggleAddGroup(); } // Escape @@ -236,7 +236,7 @@ $(document).ready( function () { // click on group name // FIXME: also triggered when clicking on "remove" - $('ul').on('click', 'li[data-gid]', function (event) { + $('ul').on('click', 'li[data-gid]', function () { var li = $(this); var gid = $(li).attr('data-gid'); GroupList.showGroup(gid); @@ -296,6 +296,6 @@ $(document).ready( function () { }); var wrongKey = function(event) { - return ((event.type === 'keydown' || event.type === 'keypress') - && (event.keyCode !== 32 && event.keyCode !== 13)); -}; \ No newline at end of file + return ((event.type === 'keydown' || event.type === 'keypress') && + (event.keyCode !== 32 && event.keyCode !== 13)); +}; -- cgit v1.2.3 From d87347e64ef90b89b1ff2b2221514b6fe1c57086 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Wed, 16 Apr 2014 22:16:55 +0200 Subject: update GroupList when a users is added or removed to a group --- settings/js/users/groups.js | 16 +++++++++++----- settings/js/users/users.js | 10 ++++++---- 2 files changed, 17 insertions(+), 9 deletions(-) (limited to 'settings') diff --git a/settings/js/users/groups.js b/settings/js/users/groups.js index 25b865cf18d..4c555bd4c86 100644 --- a/settings/js/users/groups.js +++ b/settings/js/users/groups.js @@ -7,15 +7,11 @@ var GroupList = { addGroup: function(gid, usercount) { - if(usercount === undefined || usercount === 0) { - usercount = ''; - } var li = $('li[data-gid]').last().clone(); var ul = $('li[data-gid]').first().parent(); li.attr('data-gid', gid); - li.attr('data-usercount', usercount); li.find('a span').first().text(gid); - li.find('span[class=usercount]').first().text(usercount); + GroupList.setUserCount(li, usercount); $(li).appendTo(ul); @@ -24,6 +20,14 @@ return li; }, + setUserCount: function(groupLiElement, usercount) { + if(usercount === undefined || usercount === 0) { + usercount = ''; + } + groupLiElement.attr('data-usercount', usercount); + groupLiElement.find('span[class=usercount]').first().text(usercount); + }, + sortGroups: function(usercount) { var lis = $('li[data-gid]').filterAttr('data-usercount', usercount.toString()).get(); var ul = $(lis).first().parent(); @@ -93,6 +97,8 @@ $.each(result.data, function (i, subset) { $.each(subset, function (index, group) { if($('li[data-gid="' + group.name + '"]').length > 0) { + var li = $('li[data-gid="' + group.name + '"]'); + GroupList.setUserCount(li, group.usercount); return true; } var li = GroupList.addGroup(group.name, group.usercount); diff --git a/settings/js/users/users.js b/settings/js/users/users.js index e9c85d20e95..d1cab63eaab 100644 --- a/settings/js/users/users.js +++ b/settings/js/users/users.js @@ -289,10 +289,12 @@ var UserList = { group: group }, function (response) { - if(response.status === 'success' - && UserList.availableGroups.indexOf(response.data.groupname) === -1 - && response.data.action === 'add') { - UserList.availableGroups.push(response.data.groupname); + if(response.status === 'success') { + GroupList.update(); + if(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); -- cgit v1.2.3 From 3e411c82a537b5ee0663f1d3a516cdfa93ee4581 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Thu, 17 Apr 2014 18:13:35 +0200 Subject: unify and consolidate group fetching method for initial template fill and ajax request --- settings/ajax/grouplist.php | 81 ++++++++++++++++------------- settings/templates/users/part.grouplist.php | 6 +-- settings/users.php | 50 +++--------------- 3 files changed, 56 insertions(+), 81 deletions(-) (limited to 'settings') diff --git a/settings/ajax/grouplist.php b/settings/ajax/grouplist.php index 1041d7374e7..ba36dd65bf9 100644 --- a/settings/ajax/grouplist.php +++ b/settings/ajax/grouplist.php @@ -30,46 +30,57 @@ if (isset($_GET['pattern']) && !empty($_GET['pattern'])) { $groups = array(); $adminGroups = array(); $groupManager = \OC_Group::getManager(); +$isAdmin = OC_User::isAdminUser(OC_User::getUser()); + +//we pass isAdmin as true, because OC_SubAdmin has no search feature, +//groups will be filtered out later +$groupsInfo = new \OC\Group\MetaData(OC_User::getUser(), true, $groupManager); +$groupsInfo->setSorting($groupsInfo::SORT_USERCOUNT); +list($adminGroup, $groups) = $groupsInfo->get($pattern); $accessiblegroups = $groupManager->search($pattern); -if (!OC_User::isAdminUser(OC_User::getUser())) { +if(!$isAdmin) { $subadminGroups = OC_SubAdmin::getSubAdminsGroups(OC_User::getUser()); - $accessiblegroups = array_intersect($accessiblegroups, $subadminGroups); -} - -$sortGroupsIndex = 0; -$sortGroupsKeys = array(); -$sortAdminGroupsIndex = 0; -$sortAdminGroupsKeys = array(); - -foreach($accessiblegroups as $group) { - $gid = $group->getGID(); - $usersInGroup = OC_Group::usersInGroup($gid, ''); - if (!OC_User::isAdminUser($gid)) { - $groups[] = array( - 'id' => str_replace(' ','', $gid ), - 'name' => $gid, - 'usercount' => count($usersInGroup), - ); - $sortGroupsKeys[$sortGroupsIndex] = count($usersInGroup); - $sortGroupsIndex++; - } else { - $adminGroup[] = array( - 'id' => str_replace(' ','', $gid ), - 'name' => $gid, - 'usercount' => count($usersInGroup) - ); - $sortAdminGroupsKeys[$sortAdminGroupsIndex] = count($usersInGroup); - $sortAdminGroupsIndex++; - } + $accessiblegroups = array_intersect($groups, $subadminGroups); } -if(!empty($groups)) { - array_multisort($sortGroupsKeys, SORT_DESC, $groups); -} -if(!empty($adminGroup)) { - array_multisort($sortAdminGroupsKeys, SORT_DESC, $adminGroup); -} +// $sortGroupsIndex = 0; +// $sortGroupsKeys = array(); +// $sortAdminGroupsIndex = 0; +// $sortAdminGroupsKeys = array(); +// +// foreach($accessiblegroups as $group) { +// $gid = $group->getGID(); +// $group = $groupManager->get($gid); +// if(!$group) { +// continue; +// } +// $usersInGroup = $group->count(); +// if (!OC_User::isAdminUser($gid)) { +// $groups[] = array( +// 'id' => str_replace(' ','', $gid ), +// 'name' => $gid, +// 'usercount' => $usersInGroup, +// ); +// $sortGroupsKeys[$sortGroupsIndex] = $usersInGroup; +// $sortGroupsIndex++; +// } else { +// $adminGroup[] = array( +// 'id' => str_replace(' ','', $gid ), +// 'name' => $gid, +// 'usercount' => $usersInGroup +// ); +// $sortAdminGroupsKeys[$sortAdminGroupsIndex] = $usersInGroup; +// $sortAdminGroupsIndex++; +// } +// } +// +// if(!empty($groups)) { +// array_multisort($sortGroupsKeys, SORT_DESC, $groups); +// } +// if(!empty($adminGroup)) { +// array_multisort($sortAdminGroupsKeys, SORT_DESC, $adminGroup); +// } OC_JSON::success( array('data' => array('adminGroups' => $adminGroups, 'groups' => $groups))); diff --git a/settings/templates/users/part.grouplist.php b/settings/templates/users/part.grouplist.php index 0d5fef7775c..5b9d23e43ad 100644 --- a/settings/templates/users/part.grouplist.php +++ b/settings/templates/users/part.grouplist.php @@ -28,21 +28,21 @@
  • t('Admins')); ?> - 0) { p($adminGroup['useringroup']); } ?> + 0) { p($adminGroup['usercount']); } ?>
  • -
  • +
  • <?php p($l->t(" title="t("change group name"))?>" /> - 0) { p($group['useringroup']); } ?> + 0) { p($group['usercount']); } ?> diff --git a/settings/users.php b/settings/users.php index d3fcbb26a36..a1a1a41e67f 100644 --- a/settings/users.php +++ b/settings/users.php @@ -19,8 +19,6 @@ OC_Util::addStyle( 'settings', 'settings' ); OC_App::setActiveNavigationEntry( 'core_users' ); $users = array(); -$groups = array(); -$adminGroup = array(); $userManager = \OC_User::getManager(); $groupManager = \OC_Group::getManager(); @@ -36,16 +34,19 @@ if (isset($_GET['limit'])) { } $isadmin = OC_User::isAdminUser(OC_User::getUser()); + +$groupsInfo = new \OC\Group\MetaData(OC_User::getUser(), $isadmin, $groupManager); +$groupsInfo->setSorting($groupsInfo::SORT_USERCOUNT); +list($adminGroup, $groups) = $groupsInfo->get(); + $recoveryAdminEnabled = OC_App::isEnabled('files_encryption') && OC_Appconfig::getValue( 'files_encryption', 'recoveryAdminEnabled' ); if($isadmin) { - $accessiblegroups = OC_Group::getGroups(); $accessibleusers = OC_User::getDisplayNames('', 30); $subadmins = OC_SubAdmin::getAllSubAdmins(); }else{ - $accessiblegroups = OC_SubAdmin::getSubAdminsGroups(OC_User::getUser()); - $accessibleusers = OC_Group::displayNamesInGroups($accessiblegroups, '', 30); + $accessibleusers = OC_Group::displayNamesInGroups($groups, '', 30); $subadmins = false; } @@ -85,50 +86,13 @@ foreach($accessibleusers as $uid => $displayName) { ); } -$sortGroupsIndex = 0; -$sortGroupsKeys = array(); -$sortAdminGroupsIndex = 0; -$sortAdminGroupsKeys = array(); -foreach( $accessiblegroups as $gid ) { - $group = $groupManager->get($gid); - if(!$group) { - continue; - } - $usersInGroup = $group->count(); - if (!OC_User::isAdminUser($gid)) { - $groups[] = array( - 'id' => str_replace(' ','', $gid ), - 'name' => $gid, - 'useringroup' => $usersInGroup, - ); - $sortGroupsKeys[$sortGroupsIndex] = $usersInGroup; - $sortGroupsIndex++; - } else { - $adminGroup[] = array( - 'id' => str_replace(' ','', $gid ), - 'name' => $gid, - 'useringroup' => $usersInGroup - ); - $sortAdminGroupsKeys[$sortAdminGroupsIndex] = $usersInGroup; - $sortAdminGroupsIndex++; - } -} - -//sorts groups by number of users (descending) -if(!empty($groups)) { - array_multisort($sortGroupsKeys, SORT_DESC, $groups); -} -if(!empty($adminGroup)) { - array_multisort($sortAdminGroupsKeys, SORT_DESC, $adminGroup); -} - $tmpl = new OC_Template( "settings", "users/main", "user" ); $tmpl->assign( 'users', $users ); $tmpl->assign( 'groups', $groups ); $tmpl->assign( 'adminGroup', $adminGroup ); $tmpl->assign( 'isadmin', (int) $isadmin); $tmpl->assign( 'subadmins', $subadmins); -$tmpl->assign( 'numofgroups', count($accessiblegroups)); +$tmpl->assign( 'numofgroups', count($groups) + count($adminGroup)); $tmpl->assign( 'quota_preset', $quotaPreset); $tmpl->assign( 'default_quota', $defaultQuota); $tmpl->assign( 'defaultQuotaIsUserDefined', $defaultQuotaIsUserDefined); -- cgit v1.2.3 From 5444a1114d27d326d3c1af246d163912cda3e7b2 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Thu, 17 Apr 2014 18:25:05 +0200 Subject: cleanup --- settings/ajax/grouplist.php | 38 -------------------------------------- 1 file changed, 38 deletions(-) (limited to 'settings') diff --git a/settings/ajax/grouplist.php b/settings/ajax/grouplist.php index ba36dd65bf9..62c345a9ff0 100644 --- a/settings/ajax/grouplist.php +++ b/settings/ajax/grouplist.php @@ -44,43 +44,5 @@ if(!$isAdmin) { $accessiblegroups = array_intersect($groups, $subadminGroups); } -// $sortGroupsIndex = 0; -// $sortGroupsKeys = array(); -// $sortAdminGroupsIndex = 0; -// $sortAdminGroupsKeys = array(); -// -// foreach($accessiblegroups as $group) { -// $gid = $group->getGID(); -// $group = $groupManager->get($gid); -// if(!$group) { -// continue; -// } -// $usersInGroup = $group->count(); -// if (!OC_User::isAdminUser($gid)) { -// $groups[] = array( -// 'id' => str_replace(' ','', $gid ), -// 'name' => $gid, -// 'usercount' => $usersInGroup, -// ); -// $sortGroupsKeys[$sortGroupsIndex] = $usersInGroup; -// $sortGroupsIndex++; -// } else { -// $adminGroup[] = array( -// 'id' => str_replace(' ','', $gid ), -// 'name' => $gid, -// 'usercount' => $usersInGroup -// ); -// $sortAdminGroupsKeys[$sortAdminGroupsIndex] = $usersInGroup; -// $sortAdminGroupsIndex++; -// } -// } -// -// if(!empty($groups)) { -// array_multisort($sortGroupsKeys, SORT_DESC, $groups); -// } -// if(!empty($adminGroup)) { -// array_multisort($sortAdminGroupsKeys, SORT_DESC, $adminGroup); -// } - OC_JSON::success( array('data' => array('adminGroups' => $adminGroups, 'groups' => $groups))); -- cgit v1.2.3 From 7b8935abdacfa25c55738b0395440c84bf86ffbb Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Thu, 17 Apr 2014 20:14:51 +0200 Subject: show users whose username starts with the search pattern first We may want to switch or extend it to display name. I leave it like this for now, continued work on this needs to have sortable columns in mind --- settings/js/users/users.js | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) (limited to 'settings') diff --git a/settings/js/users/users.js b/settings/js/users/users.js index d1cab63eaab..092998c029f 100644 --- a/settings/js/users/users.js +++ b/settings/js/users/users.js @@ -145,12 +145,43 @@ var UserList = { } return aa.length - bb.length; }, + preSortSearchString: function(a, b) { + var pattern = filter.getPattern(); + if(typeof pattern === 'undefined') { + return undefined; + } + pattern = pattern.toLowerCase(); + var aMatches = false; + var bMatches = false; + if(typeof a === 'string' && a.toLowerCase().indexOf(pattern) === 0) { + aMatches = true; + } + if(typeof b === 'string' && b.toLowerCase().indexOf(pattern) === 0) { + bMatches = true; + } + + if((aMatches && bMatches) || (!aMatches && !bMatches)) { + return undefined; + } + + if(aMatches) { + return -1; + } else { + return 1; + } + }, doSort: function() { var self = this; var rows = $('tbody tr').get(); rows.sort(function(a, b) { - return UserList.alphanum($(a).find('td.name').text(), $(b).find('td.name').text()); + a = $(a).find('td.name').text(); + b = $(b).find('td.name').text(); + var firstSort = UserList.preSortSearchString(a, b); + if(typeof firstSort !== 'undefined') { + return firstSort; + } + return UserList.alphanum(a, b); }); var items = []; @@ -391,6 +422,10 @@ function setQuota (uid, quota, ready) { $(document).ready(function () { UserList.initDeleteHandling(); + // Implements User Search + filter = new UserManagementFilter( + $('#usersearchform input'), UserList, GroupList); + UserList.doSort(); UserList.availableGroups = $('#content table').data('groups'); @@ -548,7 +583,5 @@ $(document).ready(function () { } ); }); - // Implements User Search - filter = new UserManagementFilter( - $('#usersearchform input'), UserList, GroupList); + }); -- cgit v1.2.3 From dea7f457823e5b1a18f4165ded98baa0815ae79e Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Thu, 17 Apr 2014 21:40:28 +0200 Subject: stick with current group when the filter is used --- settings/js/users/filter.js | 2 +- settings/js/users/groups.js | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'settings') diff --git a/settings/js/users/filter.js b/settings/js/users/filter.js index 3b04a8750cf..456c51376b9 100644 --- a/settings/js/users/filter.js +++ b/settings/js/users/filter.js @@ -59,7 +59,7 @@ UserManagementFilter.prototype.init = function() { */ UserManagementFilter.prototype.run = function() { this.userList.empty(); - this.userList.update(); + this.userList.update(GroupList.getCurrentGID()); this.groupList.empty(); this.groupList.update(); }; diff --git a/settings/js/users/groups.js b/settings/js/users/groups.js index 4c555bd4c86..e62dfd9dff7 100644 --- a/settings/js/users/groups.js +++ b/settings/js/users/groups.js @@ -6,6 +6,8 @@ */ var GroupList = { + activeGID: '', + addGroup: function(gid, usercount) { var li = $('li[data-gid]').last().clone(); var ul = $('li[data-gid]').first().parent(); @@ -28,6 +30,10 @@ groupLiElement.find('span[class=usercount]').first().text(usercount); }, + getCurrentGID: function() { + return GroupList.activeGID; + }, + sortGroups: function(usercount) { var lis = $('li[data-gid]').filterAttr('data-usercount', usercount.toString()).get(); var ul = $(lis).first().parent(); @@ -135,6 +141,7 @@ }, showGroup: function (gid) { + GroupList.activeGID = gid; UserList.empty(); UserList.update(gid); $('#app-navigation li').removeClass('active'); -- cgit v1.2.3 From 3ff123f247b8bc29665a28c3641c3fc445a4a161 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Thu, 17 Apr 2014 21:51:51 +0200 Subject: more appropriate label --- settings/templates/users/part.createuser.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'settings') diff --git a/settings/templates/users/part.createuser.php b/settings/templates/users/part.createuser.php index 73799ff5d5b..6af1e934e1d 100644 --- a/settings/templates/users/part.createuser.php +++ b/settings/templates/users/part.createuser.php @@ -27,6 +27,6 @@ - + \ No newline at end of file -- cgit v1.2.3 From a9bd416643ad950de5f21aaaa4f5c77dd51c787a Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Thu, 17 Apr 2014 22:14:04 +0200 Subject: add reset button for the filter field --- settings/css/settings.css | 10 ++++++++-- settings/js/users/filter.js | 12 ++++++++++++ settings/js/users/users.js | 1 + settings/templates/users/part.createuser.php | 3 ++- 4 files changed, 23 insertions(+), 3 deletions(-) (limited to 'settings') diff --git a/settings/css/settings.css b/settings/css/settings.css index e6ad4fd304f..604b5024371 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -63,8 +63,8 @@ li.active span.utils .delete { } li.active .rename { padding: 8px 14px 20px 14px; - top: 0px; position: absolute; width: 16px; height: 16px; - opacity: 0.5; + top: 0px; position: absolute; width: 16px; height: 16px; + opacity: 0.5; display: inline-block !important; } li.active span.utils .delete img { margin: 14px; } @@ -108,6 +108,12 @@ div.quota>span { } select.quota.active { background: #fff; } +input.userFilter {width: 200px;} +span.userFilterReset { + width: 16px; height: 16px; position: absolute; + padding-top: 20px; margin-left: -20px; +} + /* positioning fixes */ #newuser .multiselect { min-width: 150px !important; diff --git a/settings/js/users/filter.js b/settings/js/users/filter.js index 456c51376b9..403e9c00c11 100644 --- a/settings/js/users/filter.js +++ b/settings/js/users/filter.js @@ -71,3 +71,15 @@ UserManagementFilter.prototype.run = function() { UserManagementFilter.prototype.getPattern = function() { return this.filterInput.val(); }; + +/** + * @brief adds reset functionality to an HTML element + * @param jQuery the jQuery representation of that element + */ +UserManagementFilter.prototype.addResetButton = function(button) { + var umf = this; + button.click(function(){ + umf.filterInput.val(''); + umf.run(); + }); +}; \ No newline at end of file diff --git a/settings/js/users/users.js b/settings/js/users/users.js index 092998c029f..3832464c346 100644 --- a/settings/js/users/users.js +++ b/settings/js/users/users.js @@ -425,6 +425,7 @@ $(document).ready(function () { // Implements User Search filter = new UserManagementFilter( $('#usersearchform input'), UserList, GroupList); + filter.addResetButton($('.userFilterReset').first()); UserList.doSort(); UserList.availableGroups = $('#content table').data('groups'); diff --git a/settings/templates/users/part.createuser.php b/settings/templates/users/part.createuser.php index 6af1e934e1d..2e37f3885a0 100644 --- a/settings/templates/users/part.createuser.php +++ b/settings/templates/users/part.createuser.php @@ -27,6 +27,7 @@
    - + + \ No newline at end of file -- cgit v1.2.3 From b56d14260d1c5f1fc7a7dd8d7b66974f9ca4e43f Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Sat, 19 Apr 2014 23:53:47 +0200 Subject: Rename $isadmin to $isAdmin --- settings/templates/users/part.setquota.php | 4 ++-- settings/users.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'settings') diff --git a/settings/templates/users/part.setquota.php b/settings/templates/users/part.setquota.php index 4b650002a7f..e246a94ad29 100644 --- a/settings/templates/users/part.setquota.php +++ b/settings/templates/users/part.setquota.php @@ -5,7 +5,7 @@
    t('Default Quota'));?> - + - + -
    \ No newline at end of file -- cgit v1.2.3 From 57cc51d21dd83ea638c00473b5b852f7db1918e8 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Wed, 7 May 2014 17:14:29 +0200 Subject: user management: remove autocompletion of user/password fields, fix #8464 --- settings/templates/users/part.createuser.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'settings') diff --git a/settings/templates/users/part.createuser.php b/settings/templates/users/part.createuser.php index 58d02e31513..4d573168fc1 100644 --- a/settings/templates/users/part.createuser.php +++ b/settings/templates/users/part.createuser.php @@ -1,10 +1,12 @@
    - + + autocomplete="off" autocapitalize="off" autocorrect="off" /> ') - .attr('data-username', username) + .data('username', username) .data('user-groups', groups); - if (tr.find('td.subadmins').length > 0) { + if ($tr.find('td.subadmins').length > 0) { subadminSelect = $(''); - img.css('display', 'none'); - img.parent().children('span').replaceWith(input); - input.focus(); - input.keypress(function (event) { - if (event.keyCode === 13) { - if ($(this).val().length > 0) { - var recoveryPasswordVal = $('input:password[id="recoveryPassword"]').val(); - $.post( - OC.generateUrl('/settings/users/changepassword'), - {username: uid, password: $(this).val(), recoveryPassword: recoveryPasswordVal}, - function (result) { - if (result.status != 'success') { - OC.Notification.show(t('admin', result.data.message)); + + var $td = $(this).closest('td'); + var $tr = $td.closest('tr'); + var uid = $tr.data('uid'); + var $input = $(''); + $td.find('img').hide(); + $td.children('span').replaceWith($input); + $input + .focus() + .keypress(function (event) { + if (event.keyCode === 13) { + if ($(this).val().length > 0) { + var recoveryPasswordVal = $('input:password[id="recoveryPassword"]').val(); + $.post( + OC.generateUrl('/settings/users/changepassword'), + {username: uid, password: $(this).val(), recoveryPassword: recoveryPasswordVal}, + function (result) { + if (result.status != 'success') { + OC.Notification.show(t('admin', result.data.message)); + } } - } - ); - input.blur(); - } else { - input.blur(); + ); + $input.blur(); + } else { + $input.blur(); + } } - } - }); - input.blur(function () { - $(this).replaceWith($('●●●●●●●')); - img.css('display', ''); - }); + }) + .blur(function () { + $(this).replaceWith($('●●●●●●●')); + $td.find('img').show(); + }); }); - $('input:password[id="recoveryPassword"]').keyup(function(event) { + $('input:password[id="recoveryPassword"]').keyup(function() { OC.Notification.hide(); }); - $('table').on('click', 'td.password', function (event) { - $(this).children('img').click(); - }); - - $('table').on('click', 'td.displayName>img', function (event) { + $userListBody.on('click', '.displayName', function (event) { event.stopPropagation(); - var img = $(this); - var uid = img.parent().parent().attr('data-uid'); - var displayName = escapeHTML(img.parent().parent().attr('data-displayName')); - var input = $(''); - img.css('display', 'none'); - img.parent().children('span').replaceWith(input); - input.focus(); - input.keypress(function (event) { - if (event.keyCode === 13) { - if ($(this).val().length > 0) { - $.post( - OC.filePath('settings', 'ajax', 'changedisplayname.php'), - {username: uid, displayName: $(this).val()}, - function (result) { - if (result && result.status==='success'){ - img.parent().parent().find('div.avatardiv').avatar(result.data.username, 32); + var $td = $(this).closest('td'); + var $tr = $td.closest('tr'); + var uid = $tr.data('uid'); + var displayName = escapeHTML($tr.data('displayname')); + var $input = $(''); + $td.find('img').hide(); + $td.children('span').replaceWith($input); + $input + .focus() + .keypress(function (event) { + if (event.keyCode === 13) { + if ($(this).val().length > 0) { + $tr.find('.avatardiv').imageplaceholder(uid, displayName); + $.post( + OC.filePath('settings', 'ajax', 'changedisplayname.php'), + {username: uid, displayName: $(this).val()}, + function (result) { + if (result && result.status==='success'){ + $tr.find('.avatardiv').avatar(result.data.username, 32); + } } - } - ); - input.blur(); - } else { - input.blur(); + ); + $input.blur(); + } else { + $input.blur(); + } } - } - }); - input.blur(function () { - var input = $(this), - displayName = input.val(); - input.closest('tr').attr('data-displayName', displayName); - input.replaceWith('' + escapeHTML(displayName) + ''); - img.css('display', ''); - }); - }); - $('table').on('click', 'td.displayName', function (event) { - $(this).children('img').click(); + }) + .blur(function () { + var displayName = $input.val(); + $tr.data('displayname', displayName); + $input.replaceWith('' + escapeHTML(displayName) + ''); + $td.find('img').show(); + }); }); - $('select.quota, select.quota-user').singleSelect().on('change', function () { - var select = $(this); - var uid = $(this).parent().parent().attr('data-uid'); + $('#default_quota, .quota-user').singleSelect().on('change', function () { + var $select = $(this); + var uid = $select.closest('tr').data('uid'); var quota = $(this).val(); setQuota(uid, quota, function(returnedQuota){ if (quota !== returnedQuota) { - select.find(':selected').text(returnedQuota); + $select.find(':selected').text(returnedQuota); } }); }); @@ -546,7 +570,7 @@ $(document).ready(function () { t('settings', 'Error creating user')); return false; } - var groups = $('#newusergroups').prev().children('div').data('settings').checked; + var groups = $('#newusergroups').val(); $('#newuser').get(0).reset(); $.post( OC.filePath('settings', 'ajax', 'createuser.php'), @@ -576,7 +600,7 @@ $(document).ready(function () { UserList.notificationTimeout = null; }, 10000); } - if($('tr[data-uid="' + username + '"]').length === 0) { + if(!UserList.has(username)) { UserList.add(username, username, result.data.groups, null, 'default', result.data.storageLocation, 0, true); } } diff --git a/settings/templates/users/part.setquota.php b/settings/templates/users/part.setquota.php index e246a94ad29..fc5624d069a 100644 --- a/settings/templates/users/part.setquota.php +++ b/settings/templates/users/part.setquota.php @@ -6,7 +6,7 @@ t('Default Quota'));?> - "> diff --git a/settings/templates/users/part.userlist.php b/settings/templates/users/part.userlist.php index 047ebb46670..c74fdcc9efa 100644 --- a/settings/templates/users/part.userlist.php +++ b/settings/templates/users/part.userlist.php @@ -1,4 +1,4 @@ -
  • + + - + +
    +
    @@ -20,7 +20,7 @@ " - data-displayName=""> + data-displayname=""> -- cgit v1.2.3 From 097887a659d582b5f481aee205ee9adeac551d0a Mon Sep 17 00:00:00 2001 From: ringmaster Date: Tue, 6 May 2014 09:01:37 -0400 Subject: Add the admin group to the group list data. Fixes the admin group disappearing from the list when updating the display as the result of a search. This group data should probably be managed on the page entirely by the javascript GroupList object, but this seems like the interim method. --- settings/templates/users/main.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'settings') diff --git a/settings/templates/users/main.php b/settings/templates/users/main.php index 1c35690d2ac..c5805d53476 100644 --- a/settings/templates/users/main.php +++ b/settings/templates/users/main.php @@ -9,6 +9,9 @@ $allGroups=array(); foreach($_["groups"] as $group) { $allGroups[] = $group['name']; } +foreach($_["adminGroup"] as $group) { + $allGroups[] = $group['name']; +} $userlistParams['subadmingroups'] = $allGroups; $userlistParams['allGroups'] = json_encode($allGroups); $items = array_flip($userlistParams['subadmingroups']); -- cgit v1.2.3 From 1115d68f2500ede7c6f8b8b0e574b2f9b76e9590 Mon Sep 17 00:00:00 2001 From: ringmaster Date: Tue, 6 May 2014 10:50:33 -0400 Subject: Fix broken span. --- settings/templates/users/part.createuser.php | 1 + 1 file changed, 1 insertion(+) (limited to 'settings') diff --git a/settings/templates/users/part.createuser.php b/settings/templates/users/part.createuser.php index 4d573168fc1..adddc418a90 100644 --- a/settings/templates/users/part.createuser.php +++ b/settings/templates/users/part.createuser.php @@ -30,5 +30,6 @@ + \ No newline at end of file -- cgit v1.2.3 From ad1c34db45f74a61e6a933ca54ebf24aac031309 Mon Sep 17 00:00:00 2001 From: ringmaster Date: Tue, 6 May 2014 10:52:14 -0400 Subject: Revisions from review. * Explicit toString()-based getters for uid and displayname data. * Restored user check for group multiselect in new user creation form. * Removed jQuery colon expr for uid. --- settings/js/users/users.js | 101 ++++++++++++++++++++++++--------------------- 1 file changed, 54 insertions(+), 47 deletions(-) (limited to 'settings') diff --git a/settings/js/users/users.js b/settings/js/users/users.js index f40854cf637..cd81a4b7718 100644 --- a/settings/js/users/users.js +++ b/settings/js/users/users.js @@ -101,7 +101,7 @@ var UserList = { } $quotaSelect.on('change', function () { - var uid = $(this).closest('tr').data('uid'); + var uid = UserList.getUID(this); var quota = $(this).val(); setQuota(uid, quota, function(returnedQuota){ if (quota !== returnedQuota) { @@ -222,16 +222,27 @@ var UserList = { UserList.checkUsersToLoad(); }, hide: function(uid) { - $('tr:data(' + uid + ')').hide(); + UserList.getRow(uid).hide(); }, show: function(uid) { - $('tr:data(' + uid + ')').show(); + UserList.getRow(uid).show(); }, remove: function(uid) { - $('tr:data(' + uid + ')').remove(); + UserList.getRow(uid).remove(); }, has: function(uid) { - return $('tr:data(' + uid + ')').length > 0; + return UserList.getRow(uid).length > 0; + }, + getRow: function(uid) { + return $userListBody.find('tr').filter(function(){ + return UserList.getUID(this) === uid; + }); + }, + getUID: function(element) { + return ($(element).closest('tr').data('uid') || '').toString(); + }, + getDisplayName: function(element) { + return ($(element).closest('tr').data('displayname') || '').toString(); }, initDeleteHandling: function() { //set up handler @@ -248,7 +259,7 @@ var UserList = { //when to mark user for delete $userListBody.on('click', '.delete', function () { // Call function for handling delete/undo - var uid = $(this).closest('tr').data('uid'); + var uid = UserList.getUID(this); UserDeleteHandler.mark(uid); }); @@ -280,7 +291,7 @@ var UserList = { //because it is backend-dependent. For correct retrieval, //always the limit(requested amount of users) needs to be added. $.each(result.data, function (index, user) { - if($('tr:data(' + user.name + ')').length > 0) { + if(UserList.has(user.name)) { return true; } var $tr = UserList.add(user.name, user.displayname, user.groups, user.subadmin, user.quota, user.storageLocation, user.lastLogin, false); @@ -311,38 +322,41 @@ var UserList = { applyGroupSelect: function (element) { var checked = []; var $element = $(element); - var user = $element.data('username'); + var user = UserList.getUID($element); if ($element.data('user-groups')) { checked = $element.data('user-groups'); } - var checkHandler = function (group) { - if (user === OC.currentUser && group === 'admin') { - return false; - } - if (!oc_isadmin && checked.length === 1 && checked[0] === group) { - return false; - } - $.post( - OC.filePath('settings', 'ajax', 'togglegroups.php'), - { - username: user, - group: group - }, - function (response) { - if (response.status === 'success') { - GroupList.update(); - if (UserList.availableGroups.indexOf(response.data.groupname) === -1 && - response.data.action === 'add' - ) { - UserList.availableGroups.push(response.data.groupname); + var checkHandler = null; + if(user) { // Only if in a user row, and not the #newusergroups select + checkHandler = function (group) { + if (user === OC.currentUser && group === 'admin') { + return false; + } + if (!oc_isadmin && checked.length === 1 && checked[0] === group) { + return false; + } + $.post( + OC.filePath('settings', 'ajax', 'togglegroups.php'), + { + username: user, + group: group + }, + function (response) { + if (response.status === 'success') { + GroupList.update(); + if (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); } } - if (response.data.message) { - OC.Notification.show(response.data.message); - } - } - ); + ); + } }; var addGroup = function (select, group) { $('select[multiple]').each(function (index, element) { @@ -374,7 +388,7 @@ var UserList = { applySubadminSelect: function (element) { var checked = []; var $element = $(element); - var user = $element.data('username'); + var user = UserList.getUID($element); if ($element.data('subadmin')) { checked = $element.data('subadmin'); @@ -411,7 +425,7 @@ var UserList = { }); }, - _onScroll: function(e) { + _onScroll: function() { if (!!UserList.noMoreEntries) { return; } @@ -437,12 +451,6 @@ $(document).ready(function () { $userList = $('#userlist'); $userListBody = $userList.find('tbody'); - // This adds a custom :data(value) jQuery selector, to select elements having data-uid="value": - jQuery.expr[':'].uid = function(elem, index, match) { - // if the requested value's set, compare it, otherwise return whether the element has the uid data element - return match[3] ? jQuery(elem).data('uid') === match[3] : !!jQuery(elem).data('uid'); - }; - UserList.initDeleteHandling(); // Implements User Search @@ -470,8 +478,7 @@ $(document).ready(function () { event.stopPropagation(); var $td = $(this).closest('td'); - var $tr = $td.closest('tr'); - var uid = $tr.data('uid'); + var uid = UserList.getUID($td); var $input = $(''); $td.find('img').hide(); $td.children('span').replaceWith($input); @@ -509,8 +516,8 @@ $(document).ready(function () { event.stopPropagation(); var $td = $(this).closest('td'); var $tr = $td.closest('tr'); - var uid = $tr.data('uid'); - var displayName = escapeHTML($tr.data('displayname')); + var uid = UserList.getUID($td); + var displayName = escapeHTML(UserList.getDisplayName($td)); var $input = $(''); $td.find('img').hide(); $td.children('span').replaceWith($input); @@ -545,8 +552,8 @@ $(document).ready(function () { $('#default_quota, .quota-user').singleSelect().on('change', function () { var $select = $(this); - var uid = $select.closest('tr').data('uid'); - var quota = $(this).val(); + var uid = UserList.getUID($select); + var quota = $select.val(); setQuota(uid, quota, function(returnedQuota){ if (quota !== returnedQuota) { $select.find(':selected').text(returnedQuota); -- cgit v1.2.3 From c38548a1aa47fb53c61da8f54427ac923c7fdc64 Mon Sep 17 00:00:00 2001 From: ringmaster Date: Thu, 8 May 2014 09:42:55 -0400 Subject: Rebase cleanup. Removing code that should not have been restored. Originally removed in 45fd8f6d. --- settings/js/users/users.js | 1 - settings/templates/users/part.createuser.php | 1 - 2 files changed, 2 deletions(-) (limited to 'settings') diff --git a/settings/js/users/users.js b/settings/js/users/users.js index cd81a4b7718..48586b485d5 100644 --- a/settings/js/users/users.js +++ b/settings/js/users/users.js @@ -455,7 +455,6 @@ $(document).ready(function () { // Implements User Search filter = new UserManagementFilter($('#usersearchform input'), UserList, GroupList); - filter.addResetButton($('.userFilterReset').first()); UserList.doSort(); UserList.availableGroups = $userList.data('groups'); diff --git a/settings/templates/users/part.createuser.php b/settings/templates/users/part.createuser.php index adddc418a90..4d573168fc1 100644 --- a/settings/templates/users/part.createuser.php +++ b/settings/templates/users/part.createuser.php @@ -30,6 +30,5 @@
    - \ No newline at end of file -- cgit v1.2.3 From 4de14fe6da1dacea9c44396927564ab990105df2 Mon Sep 17 00:00:00 2001 From: ringmaster Date: Thu, 8 May 2014 17:38:29 -0400 Subject: Javascript cleanup for groups. --- settings/js/users/groups.js | 275 ++++++++++++++-------------- settings/templates/users/part.grouplist.php | 14 +- 2 files changed, 148 insertions(+), 141 deletions(-) (limited to 'settings') diff --git a/settings/js/users/groups.js b/settings/js/users/groups.js index e62dfd9dff7..5939731cca1 100644 --- a/settings/js/users/groups.js +++ b/settings/js/users/groups.js @@ -5,84 +5,82 @@ * See the COPYING-README file. */ - var GroupList = { +var $userGroupList; + +var GroupList; +GroupList = { activeGID: '', - addGroup: function(gid, usercount) { - var li = $('li[data-gid]').last().clone(); - var ul = $('li[data-gid]').first().parent(); - li.attr('data-gid', gid); - li.find('a span').first().text(gid); - GroupList.setUserCount(li, usercount); + addGroup: function (gid, usercount) { + var $li = $userGroupList.find('.isgroup:last-child').clone(); + $li + .data('gid', gid) + .find('.groupname').text(gid); + GroupList.setUserCount($li, usercount); - $(li).appendTo(ul); + $li.appendTo($userGroupList); - GroupList.sortGroups(0); + GroupList.sortGroups(); - return li; + return $li; }, - setUserCount: function(groupLiElement, usercount) { - if(usercount === undefined || usercount === 0) { + setUserCount: function (groupLiElement, usercount) { + var $groupLiElement = $(groupLiElement); + if (usercount === undefined || usercount === 0) { usercount = ''; } - groupLiElement.attr('data-usercount', usercount); - groupLiElement.find('span[class=usercount]').first().text(usercount); + $groupLiElement.data('usercount', usercount); + $groupLiElement.find('.usercount').text(usercount); }, - getCurrentGID: function() { + getCurrentGID: function () { return GroupList.activeGID; }, - sortGroups: function(usercount) { - var lis = $('li[data-gid]').filterAttr('data-usercount', usercount.toString()).get(); - var ul = $(lis).first().parent(); + sortGroups: function () { + var lis = $('.isgroup').get(); - lis.sort(function(a, b) { - return UserList.alphanum($(a).find('a span').text(), $(b).find('a span').text()); + lis.sort(function (a, b) { + return UserList.alphanum( + $(a).find('a span').text(), + $(b).find('a span').text() + ); }); var items = []; - $.each(lis, function(index, li) { + $.each(lis, function (index, li) { items.push(li); - if(items.length === 100) { - $(ul).append(items); + if (items.length === 100) { + $userGroupList.append(items); items = []; } }); - if(items.length > 0) { - $(ul).append(items); + if (items.length > 0) { + $userGroupList.append(items); } }, - createGroup: function(groupname) { + createGroup: function (groupname) { $.post( OC.filePath('settings', 'ajax', 'creategroup.php'), { - groupname : groupname + groupname: groupname }, function (result) { if (result.status !== 'success') { OC.dialogs.alert(result.data.message, t('settings', 'Error creating group')); - } else { + } + else { if (result.data.groupname) { - var addedGroups = result.data.groupname; - UserList.availableGroups = $.unique($.merge(UserList.availableGroups, addedGroups)); + var addedGroup = result.data.groupname; + UserList.availableGroups = $.unique($.merge(UserList.availableGroups, [addedGroup])); GroupList.addGroup(result.data.groupname); - $('#newusergroups').children().first().attr('value', result.data.groupname); - $('#newusergroups').children().first().text(result.data.groupname); - - $('.groupsselect').each( function (index, element) { - $(element).children().first().attr('value', result.data.groupname); - $(element).children().first().text(result.data.groupname); - }); - - $('.subadminsselect').each( function (index, element) { - $(element).children().first().attr('value', result.data.groupname); - $(element).children().first().text(result.data.groupname); - }); + $('.groupsselect, .subadminsselect') + .append($('