summaryrefslogtreecommitdiffstats
path: root/settings
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2014-07-09 16:36:51 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2014-07-09 16:36:51 +0200
commit899d6eab0056bd5179915cc29bb8ff873240eaa2 (patch)
treec5835c2bccbab08a85aed74bf43dc4a085215b4f /settings
parentb15510ed9aec0d085da0caa634707c0da53c5ad0 (diff)
downloadnextcloud-server-899d6eab0056bd5179915cc29bb8ff873240eaa2.tar.gz
nextcloud-server-899d6eab0056bd5179915cc29bb8ff873240eaa2.zip
some more cleanup
Diffstat (limited to 'settings')
-rw-r--r--settings/js/users/users.js74
1 files changed, 36 insertions, 38 deletions
diff --git a/settings/js/users/users.js b/settings/js/users/users.js
index 5775d83d098..1fcd68bad59 100644
--- a/settings/js/users/users.js
+++ b/settings/js/users/users.js
@@ -20,8 +20,8 @@ var UserList = {
add: function (username, displayname, groups, subadmin, quota, storageLocation, lastLogin, sort) {
var $tr = $userListBody.find('tr:first-child').clone();
- var subadminsEl;
- var subadminSelect;
+ var subAdminsEl;
+ var subAdminSelect;
var groupsSelect;
if ($tr.find('div.avatardiv').length){
$tr.find('.avatardiv').imageplaceholder(username, displayname);
@@ -38,7 +38,7 @@ var UserList = {
.data('username', username)
.data('user-groups', groups);
if ($tr.find('td.subadmins').length > 0) {
- subadminSelect = $('<select multiple="multiple" class="subadminsselect multiselect button" data-placehoder="subadmins" title="' + t('settings', 'Group Admin') + '">')
+ subAdminSelect = $('<select multiple="multiple" class="subadminsselect multiselect button" data-placehoder="subadmins" title="' + t('settings', 'Group Admin') + '">')
.data('username', username)
.data('user-groups', groups)
.data('subadmin', subadmin);
@@ -46,14 +46,14 @@ var UserList = {
}
$.each(this.availableGroups, function (i, group) {
groupsSelect.append($('<option value="' + escapeHTML(group) + '">' + escapeHTML(group) + '</option>'));
- if (typeof subadminSelect !== 'undefined' && group !== 'admin') {
- subadminSelect.append($('<option value="' + escapeHTML(group) + '">' + escapeHTML(group) + '</option>'));
+ if (typeof subAdminSelect !== 'undefined' && group !== 'admin') {
+ subAdminSelect.append($('<option value="' + escapeHTML(group) + '">' + escapeHTML(group) + '</option>'));
}
});
$tr.find('td.groups').empty().append(groupsSelect);
- subadminsEl = $tr.find('td.subadmins');
- if (subadminsEl.length > 0) {
- subadminsEl.append(subadminSelect);
+ subAdminsEl = $tr.find('td.subadmins');
+ if (subAdminsEl.length > 0) {
+ subAdminsEl.append(subAdminSelect);
}
if ($tr.find('td.remove img').length === 0 && OC.currentUser !== username) {
var deleteImage = $('<img class="svg action">').attr({
@@ -81,15 +81,14 @@ var UserList = {
}
$tr.find('td.storageLocation').text(storageLocation);
- if(lastLogin === 0) {
- var lastLoginRel = t('settings', 'never');
- var lastLoginAbs = lastLoginRel;
- } else {
+ var lastLoginRel = t('settings', 'never');
+ var lastLoginAbs = lastLoginRel;
+ if(lastLogin !== 0) {
lastLogin = new Date(lastLogin * 1000);
- var lastLoginRel = relative_modified_date(lastLogin.getTime() / 1000);
- var lastLoginAbs = formatDate(lastLogin.getTime());
+ lastLoginRel = relative_modified_date(lastLogin.getTime() / 1000);
+ lastLoginAbs = formatDate(lastLogin.getTime());
}
- $tdLastLogin = $tr.find('td.lastLogin');
+ var $tdLastLogin = $tr.find('td.lastLogin');
$tdLastLogin.text(lastLoginRel);
//tooltip makes it complicated … to not insert new HTML, we adjust the
//original title. We use a temporary div to get back the html that we
@@ -124,8 +123,8 @@ var UserList = {
window.setTimeout(function(){
$quotaSelect.singleSelect();
UserList.applyGroupSelect(groupsSelect);
- if (subadminSelect) {
- UserList.applySubadminSelect(subadminSelect);
+ if (subAdminSelect) {
+ UserList.applySubadminSelect(subAdminSelect);
}
}, 0);
return $tr;
@@ -238,18 +237,17 @@ var UserList = {
UserList.getRow(uid).show();
},
markRemove: function(uid) {
- $tr = UserList.getRow(uid);
- groups = $tr.find('.groups .groupsselect').val();
- for(i in groups) {
+ var $tr = UserList.getRow(uid);
+ var groups = $tr.find('.groups .groupsselect').val();
+ for(var i in groups) {
var gid = groups[i];
- $li = GroupList.getGroupLI(gid);
- userCount = GroupList.getUserCount($li);
- if(userCount == 1) {
- newUserCount = '';
+ var $li = GroupList.getGroupLI(gid);
+ var userCount = GroupList.getUserCount($li);
+ if(userCount === 1) {
+ GroupList.setUserCount($li, '');
} else {
- newUserCount = userCount - 1;
+ GroupList.setUserCount($li, userCount - 1);
}
- GroupList.setUserCount($li, newUserCount);
}
GroupList.decEveryoneCount();
UserList.hide(uid);
@@ -258,18 +256,17 @@ var UserList = {
UserList.getRow(uid).remove();
},
undoRemove: function(uid) {
- $tr = UserList.getRow(uid);
- groups = $tr.find('.groups .groupsselect').val();
- for(i in groups) {
+ var $tr = UserList.getRow(uid);
+ var groups = $tr.find('.groups .groupsselect').val();
+ for(var i in groups) {
var gid = groups[i];
- $li = GroupList.getGroupLI(gid);
- userCount = GroupList.getUserCount($li);
- if(userCount == 1) {
- newUserCount = '';
+ var $li = GroupList.getGroupLI(gid);
+ var userCount = GroupList.getUserCount($li);
+ if(userCount === 1) {
+ GroupList.setUserCount($li, '');
} else {
- newUserCount = userCount + 1;
+ GroupList.setUserCount($li, userCount + 1);
}
- GroupList.setUserCount($li, newUserCount);
}
GroupList.incEveryoneCount();
UserList.getRow(uid).show();
@@ -359,7 +356,7 @@ var UserList = {
}, 0);
}
UserList.updating = false;
- });
+ });
},
applyGroupSelect: function (element) {
@@ -416,7 +413,8 @@ var UserList = {
var addGroup = function (select, group) {
$('select[multiple]').each(function (index, element) {
$element = $(element);
- if ($element.find('option[value="' + group + '"]').length === 0 && select.data('msid') !== $element.data('msid')) {
+ if ($element.find('option[value="' + group + '"]').length === 0 &&
+ select.data('msid') !== $element.data('msid')) {
$element.append('<option value="' + escapeHTML(group) + '">' + escapeHTML(group) + '</option>');
}
});
@@ -646,7 +644,7 @@ $(document).ready(function () {
if (result.data.groups) {
var addedGroups = result.data.groups;
UserList.availableGroups = $.unique($.merge(UserList.availableGroups, addedGroups));
- for (i in result.data.groups) {
+ for (var i in result.data.groups) {
var gid = result.data.groups[i];
$li = GroupList.getGroupLI(gid);
userCount = GroupList.getUserCount($li);