aboutsummaryrefslogtreecommitdiffstats
path: root/settings/js
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-07-05 15:15:25 +0200
committerGitHub <noreply@github.com>2017-07-05 15:15:25 +0200
commit7d58bb7db513c2a488ce41efcd6833b9dfaa86da (patch)
tree3c9adb889eaf368e80c425f670ebbe148ebb3eec /settings/js
parentefa52ec1113eeccbd3935a8c96ea23c47ca190ab (diff)
parentf2b8535c7e6ab070465933ccee558dcfbeb7e8bb (diff)
downloadnextcloud-server-7d58bb7db513c2a488ce41efcd6833b9dfaa86da.tar.gz
nextcloud-server-7d58bb7db513c2a488ce41efcd6833b9dfaa86da.zip
Merge pull request #5342 from nextcloud/userlist-used-space
show used space in user list
Diffstat (limited to 'settings/js')
-rw-r--r--settings/js/users/users.js270
1 files changed, 154 insertions, 116 deletions
diff --git a/settings/js/users/users.js b/settings/js/users/users.js
index e608efb491a..6fb74e1ba63 100644
--- a/settings/js/users/users.js
+++ b/settings/js/users/users.js
@@ -25,7 +25,7 @@ var UserList = {
* Initializes the user list
* @param $el user list table element
*/
- initialize: function($el) {
+ initialize: function ($el) {
this.$el = $el;
// initially the list might already contain user entries (not fully ajaxified yet)
@@ -37,18 +37,20 @@ var UserList = {
* Add a user row from user object
*
* @param user object containing following keys:
- * {
+ * {
* 'name': 'username',
* 'displayname': 'Users display name',
* 'groups': ['group1', 'group2'],
* 'subadmin': ['group4', 'group5'],
* 'quota': '10 GB',
+ * 'quota_bytes': '10737418240',
* 'storageLocation': '/srv/www/owncloud/data/username',
* 'lastLogin': '1418632333'
* 'backend': 'LDAP',
* 'email': 'username@example.org'
* 'isRestoreDisabled':false
- * 'isEnabled': true
+ * 'isEnabled': true,
+ * 'size': 156789
* }
*/
add: function (user) {
@@ -109,13 +111,23 @@ var UserList = {
.append(menuImage);
$tr.find('td.userActions > span').replaceWith(menuLink);
} else if (OC.currentUser === user.name) {
- $tr.find('td.userActions').empty();
+ $tr.find('td.userActions').empty();
}
/**
* quota
*/
+ UserList.updateQuotaProgressbar($tr, user.quota_bytes, user.size);
+ $tr.data('size', user.size);
var $quotaSelect = $tr.find('.quota-user');
+ var humanSize = humanFileSize(user.size, true);
+ $quotaSelect.tooltip({
+ title: t('settings', '{size} used', {size: humanSize}, 0 , {escape: false}).replace('&lt;', '<'),
+ delay: {
+ show: 100,
+ hide: 0
+ }
+ });
if (user.quota === 'default') {
$quotaSelect
.data('previous', 'default')
@@ -147,7 +159,7 @@ var UserList = {
*/
var lastLoginRel = t('settings', 'never');
var lastLoginAbs = lastLoginRel;
- if(user.lastLogin !== 0) {
+ if (user.lastLogin !== 0) {
lastLoginRel = OC.Util.relativeModifiedDate(user.lastLogin);
lastLoginAbs = OC.Util.formatDate(user.lastLogin);
}
@@ -165,17 +177,17 @@ var UserList = {
$quotaSelect.on('change', UserList.onQuotaSelect);
// defer init so the user first sees the list appear more quickly
- window.setTimeout(function(){
+ window.setTimeout(function () {
$quotaSelect.singleSelect();
}, 0);
},
// From http://my.opera.com/GreyWyvern/blog/show.dml/1671288
- alphanum: function(a, b) {
- function chunkify(t) {
+ alphanum: function (a, b) {
+ function chunkify (t) {
var tz = [], x = 0, y = -1, n = 0, i, j;
while (i = (j = t.charAt(x++)).charCodeAt(0)) {
- var m = (i === 46 || (i >=48 && i <= 57));
+ var m = (i === 46 || (i >= 48 && i <= 57));
if (m !== n) {
tz[++y] = "";
n = m;
@@ -200,73 +212,73 @@ var UserList = {
}
return aa.length - bb.length;
},
- preSortSearchString: function(a, b) {
+ preSortSearchString: function (a, b) {
var pattern = this.filter;
- if(typeof pattern === 'undefined') {
+ if (typeof pattern === 'undefined') {
return undefined;
}
pattern = pattern.toLowerCase();
var aMatches = false;
var bMatches = false;
- if(typeof a === 'string' && a.toLowerCase().indexOf(pattern) === 0) {
+ if (typeof a === 'string' && a.toLowerCase().indexOf(pattern) === 0) {
aMatches = true;
}
- if(typeof b === 'string' && b.toLowerCase().indexOf(pattern) === 0) {
+ if (typeof b === 'string' && b.toLowerCase().indexOf(pattern) === 0) {
bMatches = true;
}
- if((aMatches && bMatches) || (!aMatches && !bMatches)) {
+ if ((aMatches && bMatches) || (!aMatches && !bMatches)) {
return undefined;
}
- if(aMatches) {
+ if (aMatches) {
return -1;
} else {
return 1;
}
},
- doSort: function() {
+ doSort: function () {
// some browsers like Chrome lose the scrolling information
// when messing with the list elements
var lastScrollTop = this.scrollArea.scrollTop();
var lastScrollLeft = this.scrollArea.scrollLeft();
var rows = $userListBody.find('tr').get();
- rows.sort(function(a, b) {
+ rows.sort(function (a, b) {
// FIXME: inefficient way of getting the names,
// better use a data attribute
a = $(a).find('.name').text();
b = $(b).find('.name').text();
var firstSort = UserList.preSortSearchString(a, b);
- if(typeof firstSort !== 'undefined') {
+ if (typeof firstSort !== 'undefined') {
return firstSort;
}
return OC.Util.naturalSortCompare(a, b);
});
var items = [];
- $.each(rows, function(index, row) {
+ $.each(rows, function (index, row) {
items.push(row);
- if(items.length === 100) {
+ if (items.length === 100) {
$userListBody.append(items);
items = [];
}
});
- if(items.length > 0) {
+ if (items.length > 0) {
$userListBody.append(items);
}
this.scrollArea.scrollTop(lastScrollTop);
this.scrollArea.scrollLeft(lastScrollLeft);
},
- checkUsersToLoad: function() {
+ checkUsersToLoad: function () {
//30 shall be loaded initially, from then on always 10 upon scrolling
- if(UserList.isEmpty === false) {
+ if (UserList.isEmpty === false) {
UserList.usersToLoad = 10;
} else {
UserList.usersToLoad = UserList.initialUsersToLoad;
}
},
- empty: function() {
+ empty: function () {
//one row needs to be kept, because it is cloned to add new rows
$userListBody.find('tr:not(:first)').remove();
var $tr = $userListBody.find('tr:first');
@@ -278,16 +290,16 @@ var UserList = {
UserList.offset = 0;
UserList.checkUsersToLoad();
},
- hide: function(uid) {
+ hide: function (uid) {
UserList.getRow(uid).hide();
},
- show: function(uid) {
+ show: function (uid) {
UserList.getRow(uid).show();
},
- markRemove: function(uid) {
+ markRemove: function (uid) {
var $tr = UserList.getRow(uid);
var groups = $tr.find('.groups').data('groups');
- for(var i in groups) {
+ for (var i in groups) {
var gid = groups[i];
var $li = GroupList.getGroupLI(gid);
var userCount = GroupList.getUserCount($li);
@@ -296,13 +308,13 @@ var UserList = {
GroupList.decEveryoneCount();
UserList.hide(uid);
},
- remove: function(uid) {
+ remove: function (uid) {
UserList.getRow(uid).remove();
},
- undoRemove: function(uid) {
+ undoRemove: function (uid) {
var $tr = UserList.getRow(uid);
var groups = $tr.find('.groups').data('groups');
- for(var i in groups) {
+ for (var i in groups) {
var gid = groups[i];
var $li = GroupList.getGroupLI(gid);
var userCount = GroupList.getUserCount($li);
@@ -311,40 +323,40 @@ var UserList = {
GroupList.incEveryoneCount();
UserList.getRow(uid).show();
},
- has: function(uid) {
+ has: function (uid) {
return UserList.getRow(uid).length > 0;
},
- getRow: function(uid) {
- return $userListBody.find('tr').filter(function(){
+ getRow: function (uid) {
+ return $userListBody.find('tr').filter(function () {
return UserList.getUID(this) === uid;
});
},
- getUID: function(element) {
+ getUID: function (element) {
return ($(element).closest('tr').data('uid') || '').toString();
},
- getDisplayName: function(element) {
+ getDisplayName: function (element) {
return ($(element).closest('tr').data('displayname') || '').toString();
},
- getMailAddress: function(element) {
+ getMailAddress: function (element) {
return ($(element).closest('tr').data('mailAddress') || '').toString();
},
- getRestoreDisabled: function(element) {
+ getRestoreDisabled: function (element) {
return ($(element).closest('tr').data('restoreDisabled') || '');
},
- getUserEnabled: function(element) {
+ getUserEnabled: function (element) {
return ($(element).closest('tr').data('userEnabled') || '');
},
- initDeleteHandling: function() {
+ initDeleteHandling: function () {
//set up handler
UserDeleteHandler = new DeleteHandler('/settings/users/users', 'username',
- UserList.markRemove, UserList.remove);
+ UserList.markRemove, UserList.remove);
//configure undo
OC.Notification.hide();
var msg = escapeHTML(t('settings', 'deleted {userName}', {userName: '%oid'})) + '<span class="undo">' +
escapeHTML(t('settings', 'undo')) + '</span>';
UserDeleteHandler.setNotification(OC.Notification, 'deleteuser', msg,
- UserList.undoRemove);
+ UserList.undoRemove);
//when to mark user for delete
$userListBody.on('click', '.action-remove', function () {
@@ -352,7 +364,7 @@ var UserList = {
var uid = UserList.getUID(this);
if (OC.PasswordConfirmation.requiresPasswordConfirmation()) {
- OC.PasswordConfirmation.requirePasswordConfirmation(function() {
+ OC.PasswordConfirmation.requirePasswordConfirmation(function () {
UserDeleteHandler.mark(uid);
});
return;
@@ -370,25 +382,25 @@ var UserList = {
if (UserList.updating) {
return;
}
- if(!limit) {
+ if (!limit) {
limit = UserList.usersToLoad;
}
$userList.siblings('.loading').css('visibility', 'visible');
UserList.updating = true;
- if(gid === undefined) {
+ if (gid === undefined) {
gid = '';
}
UserList.currentGid = gid;
var pattern = this.filter;
$.get(
OC.generateUrl('/settings/users/users'),
- { offset: UserList.offset, limit: limit, gid: gid, pattern: pattern },
+ {offset: UserList.offset, limit: limit, gid: gid, pattern: pattern},
function (result) {
//The offset does not mirror the amount of users available,
//because it is backend-dependent. For correct retrieval,
//always the limit(requested amount of users) needs to be added.
$.each(result, function (index, user) {
- if(UserList.has(user.name)) {
+ if (UserList.has(user.name)) {
return true;
}
UserList.add(user);
@@ -407,16 +419,16 @@ var UserList = {
UserList.noMoreEntries = true;
$userList.siblings('.loading').remove();
- if (pattern !== ""){
+ if (pattern !== "") {
$userListHead.hide();
$emptyContainer.show();
$emptyContainer.find('h2').html(t('settings', 'No user found for <strong>{pattern}</strong>', {pattern: pattern}));
}
}
UserList.offset += limit;
- }).always(function() {
- UserList.updating = false;
- });
+ }).always(function () {
+ UserList.updating = false;
+ });
},
applyGroupSelect: function (element, user, checked) {
@@ -429,7 +441,7 @@ var UserList = {
var addUserToGroup = null,
removeUserFromGroup = null;
- if(user) { // Only if in a user row, and not the #newusergroups select
+ if (user) { // Only if in a user row, and not the #newusergroups select
var handleUserGroupMembership = function (group, add) {
if (user === OC.getCurrentUser().uid && group === 'admin') {
return false;
@@ -446,7 +458,7 @@ var UserList = {
}
$.ajax({
- url: OC.linkToOCS('cloud/users/' + user , 2) + 'groups',
+ url: OC.linkToOCS('cloud/users/' + user, 2) + 'groups',
data: {
groupid: group
},
@@ -454,7 +466,7 @@ var UserList = {
beforeSend: function (request) {
request.setRequestHeader('Accept', 'application/json');
},
- success: function() {
+ success: function () {
GroupList.update();
if (add && UserList.availableGroups.indexOf(group) === -1) {
UserList.availableGroups.push(group);
@@ -466,7 +478,7 @@ var UserList = {
GroupList.decGroupCount(group);
}
},
- error: function() {
+ error: function () {
if (add) {
OC.Notification.show(t('settings', 'Unable to add user to group {group}', {
group: group
@@ -541,7 +553,7 @@ var UserList = {
});
},
- _onScroll: function() {
+ _onScroll: function () {
if (!!UserList.noMoreEntries) {
return;
}
@@ -550,28 +562,48 @@ var UserList = {
}
},
+ updateQuotaProgressbar: function ($tr, quota, size) {
+ var usedQuota;
+ if (quota > 0) {
+ usedQuota = Math.min(100, Math.round(size / quota * 100));
+ } else {
+ var usedInGB = size / (10 * Math.pow(2, 30));
+ //asymptotic curve approaching 50% at 10GB to visualize used stace with infinite quota
+ usedQuota = 95 * (1 - (1 / (usedInGB + 1)));
+ }
+ $tr.find('.quota_progress').width(usedQuota + '%');
+ },
+
/**
* Event handler for when a quota has been changed through a single select.
* This will save the value.
*/
- onQuotaSelect: function(ev) {
+ onQuotaSelect: function (ev) {
var $select = $(ev.target);
+ var $tr = $select.closest('tr');
+ const size = $tr.data('size');
var uid = UserList.getUID($select);
var quota = $select.val();
if (quota === 'other') {
return;
}
- if ((quota !== 'default' && quota !=="none") && (!OC.Util.computerFileSize(quota))) {
+ if ((quota !== 'default' && quota !== "none") && (!OC.Util.computerFileSize(quota))) {
// the select component has added the bogus value, delete it again
$select.find('option[selected]').remove();
OC.Notification.showTemporary(t('core', 'Invalid quota value "{val}"', {val: quota}));
return;
}
- UserList._updateQuota(uid, quota, function(returnedQuota) {
+
+ UserList._updateQuota(uid, quota, function (returnedQuota) {
if (quota !== returnedQuota) {
$select.find(':selected').text(returnedQuota);
+ UserList.updateQuotaProgressbar($tr, OC.Util.computerFileSize(returnedQuota), size);
}
});
+
+ UserList.updateQuotaProgressbar($tr, OC.Util.computerFileSize(quota), size);
+ // remove the background color that the "other" option placed on the select
+ $select.css('background-color', 'transparent');
},
/**
@@ -580,7 +612,7 @@ var UserList = {
* @param {String} quota quota value
* @param {Function} ready callback after save
*/
- _updateQuota: function(uid, quota, ready) {
+ _updateQuota: function (uid, quota, ready) {
if (OC.PasswordConfirmation.requiresPasswordConfirmation()) {
OC.PasswordConfirmation.requirePasswordConfirmation(_.bind(this._updateQuota, this, uid, quota, ready));
return;
@@ -604,7 +636,7 @@ var UserList = {
/**
* Creates a temporary jquery.multiselect selector on the given group field
*/
- _triggerGroupEdit: function($td, isSubadminSelect) {
+ _triggerGroupEdit: function ($td, isSubadminSelect) {
var $groupsListContainer = $td.find('.groupsListContainer');
var placeholder = $groupsListContainer.attr('data-placeholder') || t('settings', 'no group');
var user = UserList.getUID($td);
@@ -621,7 +653,7 @@ var UserList = {
$groupsSelect = $('<select multiple="multiple" class="subadminsselect multiselect button" title="' + placeholder + '"></select>')
}
- function createItem(group) {
+ function createItem (group) {
if (isSubadminSelect && group === 'admin') {
// can't become subadmin of "admin" group
return;
@@ -652,7 +684,7 @@ var UserList = {
$groupsListContainer.addClass('hidden');
$td.find('.multiselect:not(.groupsListContainer):first').click();
- $groupsSelect.on('dropdownclosed', function(e) {
+ $groupsSelect.on('dropdownclosed', function (e) {
$groupsSelect.remove();
$td.find('.multiselect:not(.groupsListContainer)').parent().remove();
$td.find('.multiselectoptions').remove();
@@ -664,7 +696,7 @@ var UserList = {
/**
* Updates the groups list td with the given groups selection
*/
- _updateGroupListLabel: function($td, groups) {
+ _updateGroupListLabel: function ($td, groups) {
var placeholder = $td.find('.groupsListContainer').attr('data-placeholder');
var $groupsEl = $td.find('.groupsList');
$groupsEl.text(groups.join(', ') || placeholder || t('settings', 'no group'));
@@ -682,23 +714,25 @@ $(document).ready(function () {
UserList.initDeleteHandling();
// Implements User Search
- OCA.Search.users= new UserManagementFilter(UserList, GroupList);
+ OCA.Search.users = new UserManagementFilter(UserList, GroupList);
UserList.scrollArea = $('#app-content');
UserList.doSort();
UserList.availableGroups = $userList.data('groups');
- UserList.scrollArea.scroll(function(e) {UserList._onScroll(e);});
+ UserList.scrollArea.scroll(function (e) {
+ UserList._onScroll(e);
+ });
$userList.after($('<div class="loading" style="height: 200px; visibility: hidden;"></div>'));
// TODO: move other init calls inside of initialize
UserList.initialize($('#userlist'));
- var _submitPasswordChange = function(uid, password, recoveryPasswordVal, blurFunction) {
+ var _submitPasswordChange = function (uid, password, recoveryPasswordVal, blurFunction) {
if (OC.PasswordConfirmation.requiresPasswordConfirmation()) {
- OC.PasswordConfirmation.requirePasswordConfirmation(function() {
+ OC.PasswordConfirmation.requirePasswordConfirmation(function () {
_submitPasswordChange(uid, password, recoveryPasswordVal, blurFunction);
});
return;
@@ -706,7 +740,11 @@ $(document).ready(function () {
$.post(
OC.generateUrl('/settings/users/changepassword'),
- {username: uid, password: password, recoveryPassword: recoveryPasswordVal},
+ {
+ username: uid,
+ password: password,
+ recoveryPassword: recoveryPasswordVal
+ },
function (result) {
blurFunction();
if (result.status === 'success') {
@@ -733,11 +771,11 @@ $(document).ready(function () {
$tr.removeClass('row-warning');
};
blurFunction = _.bind(blurFunction, $input);
- if(isRestoreDisabled) {
+ if (isRestoreDisabled) {
$tr.addClass('row-warning');
// add tooltip if the password change could cause data loss - no recovery enabled
$input.attr('title', t('settings', 'Changing the password will result in data loss, because data recovery is not available for this user'));
- $input.tooltip({placement:'bottom'});
+ $input.tooltip({placement: 'bottom'});
}
$td.find('img').hide();
$td.children('span').replaceWith($input);
@@ -756,18 +794,18 @@ $(document).ready(function () {
})
.blur(blurFunction);
});
- $('input:password[id="recoveryPassword"]').keyup(function() {
+ $('input:password[id="recoveryPassword"]').keyup(function () {
OC.Notification.hide();
});
- var _submitDisplayNameChange = function($tr, uid, displayName, blurFunction) {
+ var _submitDisplayNameChange = function ($tr, uid, displayName, blurFunction) {
var $div = $tr.find('div.avatardiv');
if ($div.length) {
$div.imageplaceholder(uid, displayName);
}
if (OC.PasswordConfirmation.requiresPasswordConfirmation()) {
- OC.PasswordConfirmation.requirePasswordConfirmation(function() {
+ OC.PasswordConfirmation.requirePasswordConfirmation(function () {
_submitDisplayNameChange($tr, uid, displayName, blurFunction);
});
return;
@@ -781,7 +819,7 @@ $(document).ready(function () {
displayName: displayName
}
}).success(function (result) {
- if (result && result.status==='success' && $div.length){
+ if (result && result.status === 'success' && $div.length) {
$div.avatar(result.data.username, 32);
}
$tr.data('displayname', displayName);
@@ -799,7 +837,7 @@ $(document).ready(function () {
var uid = UserList.getUID($td);
var displayName = escapeHTML(UserList.getDisplayName($td));
var $input = $('<input type="text" value="' + displayName + '">');
- var blurFunction = function() {
+ var blurFunction = function () {
var displayName = $tr.data('displayname');
$input.replaceWith('<span>' + escapeHTML(displayName) + '</span>');
$td.find('img').show();
@@ -821,9 +859,9 @@ $(document).ready(function () {
.blur(blurFunction);
});
- var _submitEmailChange = function($tr, $td, $input, uid, mailAddress, blurFunction) {
+ var _submitEmailChange = function ($tr, $td, $input, uid, mailAddress, blurFunction) {
if (OC.PasswordConfirmation.requiresPasswordConfirmation()) {
- OC.PasswordConfirmation.requirePasswordConfirmation(function() {
+ OC.PasswordConfirmation.requirePasswordConfirmation(function () {
_submitEmailChange($tr, $td, $input, uid, mailAddress, blurFunction);
});
return;
@@ -865,8 +903,8 @@ $(document).ready(function () {
var uid = UserList.getUID($td);
var mailAddress = escapeHTML(UserList.getMailAddress($td));
var $input = $('<input type="text">').val(mailAddress);
- var blurFunction = function() {
- if($td.find('.loading-small').css('display') === 'inline-block') {
+ var blurFunction = function () {
+ if ($td.find('.loading-small').css('display') === 'inline-block') {
// in Chrome the blur event is fired too early by the browser - even if the request is still running
return;
}
@@ -910,21 +948,21 @@ $(document).ready(function () {
var $tr = $($td).closest('tr');
var menudiv = $tr.find('.popovermenu');
- if($tr.is('.active')) {
+ if ($tr.is('.active')) {
$tr.removeClass('active');
return;
}
$('#userlist tr.active').removeClass('active');
menudiv.find('.action-togglestate').empty();
- if($tr.data('userEnabled')) {
- $('.action-togglestate', $td).html('<span class="icon icon-close"></span><span>'+t('settings', 'Disable')+'</span>');
+ if ($tr.data('userEnabled')) {
+ $('.action-togglestate', $td).html('<span class="icon icon-close"></span><span>' + t('settings', 'Disable') + '</span>');
} else {
- $('.action-togglestate', $td).html('<span class="icon icon-add"></span><span>'+t('settings', 'Enable')+'</span>');
+ $('.action-togglestate', $td).html('<span class="icon icon-add"></span><span>' + t('settings', 'Enable') + '</span>');
}
$tr.addClass('active');
});
- $(document.body).click(function() {
+ $(document.body).click(function () {
$('#userlist tr.active').removeClass('active');
});
@@ -938,23 +976,23 @@ $(document).ready(function () {
OC.generateUrl('/settings/users/{id}/setEnabled', {id: uid}),
{username: uid, enabled: setEnabled},
function (result) {
- if (result && result.status==='success'){
+ if (result && result.status === 'success') {
var count = GroupList.getUserCount(GroupList.getGroupLI('_disabledUsers'));
$tr.remove();
- if(result.data.enabled == 1) {
+ if (result.data.enabled == 1) {
$tr.data('userEnabled', true);
- GroupList.setUserCount(GroupList.getGroupLI('_disabledUsers'), count-1);
+ GroupList.setUserCount(GroupList.getGroupLI('_disabledUsers'), count - 1);
} else {
$tr.data('userEnabled', false);
- GroupList.setUserCount(GroupList.getGroupLI('_disabledUsers'), count+1);
+ GroupList.setUserCount(GroupList.getGroupLI('_disabledUsers'), count + 1);
}
} else {
OC.dialogs.alert(result.data.message, t('settings', 'Error while changing status of {user}', {user: uid}));
}
}
- ).fail(function(result){
+ ).fail(function (result) {
var message = 'Unknown error';
- if( result.responseJSON &&
+ if (result.responseJSON &&
result.responseJSON.data &&
result.responseJSON.data.message) {
message = result.responseJSON.data.message;
@@ -962,13 +1000,13 @@ $(document).ready(function () {
OC.dialogs.alert(message, t('settings', 'Error while changing status of {user}', {user: uid}));
});
});
-
+
// init the quota field select box after it is shown the first time
- $('#app-settings').one('show', function() {
+ $('#app-settings').one('show', function () {
$(this).find('#default_quota').singleSelect().on('change', UserList.onQuotaSelect);
});
- $('#newuser input').click(function() {
+ $('#newuser input').click(function () {
// empty the container also here to avoid visual delay
$emptyContainer.hide();
OC.Search = new OCA.Search($('#searchbox'), $('#searchresults'));
@@ -979,7 +1017,7 @@ $(document).ready(function () {
var _submitNewUserForm = function (event) {
event.preventDefault();
if (OC.PasswordConfirmation.requiresPasswordConfirmation()) {
- OC.PasswordConfirmation.requirePasswordConfirmation(function() {
+ OC.PasswordConfirmation.requirePasswordConfirmation(function () {
_submitNewUserForm(event);
});
return;
@@ -1000,11 +1038,11 @@ $(document).ready(function () {
}));
return false;
}
- if(!$('#CheckboxMailOnUserCreate').is(':checked')) {
+ if (!$('#CheckboxMailOnUserCreate').is(':checked')) {
email = '';
}
if ($('#CheckboxMailOnUserCreate').is(':checked') && $.trim(email) === '') {
- OC.Notification.showTemporary( t('settings', 'Error creating user: {message}', {
+ OC.Notification.showTemporary(t('settings', 'Error creating user: {message}', {
message: t('settings', 'A valid email must be provided')
}));
return false;
@@ -1017,7 +1055,7 @@ $(document).ready(function () {
promise = $.Deferred().resolve().promise();
}
- promise.then(function() {
+ promise.then(function () {
var groups = $('#newuser .groups').data('groups') || [];
$.post(
OC.generateUrl('/settings/users/users'),
@@ -1031,7 +1069,7 @@ $(document).ready(function () {
if (result.groups) {
for (var i in result.groups) {
var gid = result.groups[i];
- if(UserList.availableGroups.indexOf(gid) === -1) {
+ if (UserList.availableGroups.indexOf(gid) === -1) {
UserList.availableGroups.push(gid);
}
var $li = GroupList.getGroupLI(gid);
@@ -1039,19 +1077,19 @@ $(document).ready(function () {
GroupList.setUserCount($li, userCount + 1);
}
}
- if(!UserList.has(username)) {
+ if (!UserList.has(username)) {
UserList.add(result);
UserList.doSort();
}
$('#newusername').focus();
GroupList.incEveryoneCount();
- }).fail(function(result) {
- OC.Notification.showTemporary(t('settings', 'Error creating user: {message}', {
- message: result.responseJSON.message
- }, undefined, {escape: false}));
- }).success(function(){
- $('#newuser').get(0).reset();
- });
+ }).fail(function (result) {
+ OC.Notification.showTemporary(t('settings', 'Error creating user: {message}', {
+ message: result.responseJSON.message
+ }, undefined, {escape: false}));
+ }).success(function () {
+ $('#newuser').get(0).reset();
+ });
});
};
$('#newuser').submit(_submitNewUserForm);
@@ -1060,7 +1098,7 @@ $(document).ready(function () {
$("#userlist .storageLocation").show();
}
// Option to display/hide the "Storage location" column
- $('#CheckboxStorageLocation').click(function() {
+ $('#CheckboxStorageLocation').click(function () {
if ($('#CheckboxStorageLocation').is(':checked')) {
$("#userlist .storageLocation").show();
if (OC.isUserAdmin()) {
@@ -1078,7 +1116,7 @@ $(document).ready(function () {
$("#userlist .lastLogin").show();
}
// Option to display/hide the "Last Login" column
- $('#CheckboxLastLogin').click(function() {
+ $('#CheckboxLastLogin').click(function () {
if ($('#CheckboxLastLogin').is(':checked')) {
$("#userlist .lastLogin").show();
if (OC.isUserAdmin()) {
@@ -1096,7 +1134,7 @@ $(document).ready(function () {
$("#userlist .mailAddress").show();
}
// Option to display/hide the "Mail Address" column
- $('#CheckboxEmailAddress').click(function() {
+ $('#CheckboxEmailAddress').click(function () {
if ($('#CheckboxEmailAddress').is(':checked')) {
$("#userlist .mailAddress").show();
if (OC.isUserAdmin()) {
@@ -1114,7 +1152,7 @@ $(document).ready(function () {
$("#userlist .userBackend").show();
}
// Option to display/hide the "User Backend" column
- $('#CheckboxUserBackend').click(function() {
+ $('#CheckboxUserBackend').click(function () {
if ($('#CheckboxUserBackend').is(':checked')) {
$("#userlist .userBackend").show();
if (OC.isUserAdmin()) {
@@ -1132,7 +1170,7 @@ $(document).ready(function () {
$("#newemail").show();
}
// Option to display/hide the "E-Mail" input field
- $('#CheckboxMailOnUserCreate').click(function() {
+ $('#CheckboxMailOnUserCreate').click(function () {
if ($('#CheckboxMailOnUserCreate').is(':checked')) {
$("#newemail").show();
if (OC.isUserAdmin()) {
@@ -1149,14 +1187,14 @@ $(document).ready(function () {
// calculate initial limit of users to load
var initialUserCountLimit = UserList.initialUsersToLoad,
containerHeight = $('#app-content').height();
- if(containerHeight > 40) {
- initialUserCountLimit = Math.floor(containerHeight/40);
+ if (containerHeight > 40) {
+ initialUserCountLimit = Math.floor(containerHeight / 40);
if (initialUserCountLimit < UserList.initialUsersToLoad) {
initialUserCountLimit = UserList.initialUsersToLoad;
}
}
//realign initialUserCountLimit with usersToLoad as a safeguard
- while((initialUserCountLimit % UserList.usersToLoad) !== 0) {
+ while ((initialUserCountLimit % UserList.usersToLoad) !== 0) {
// must be a multiple of this, otherwise LDAP freaks out.
// FIXME: solve this in LDAP backend in 8.1
initialUserCountLimit = initialUserCountLimit + 1;
@@ -1165,7 +1203,7 @@ $(document).ready(function () {
// trigger loading of users on startup
UserList.update(UserList.currentGid, initialUserCountLimit);
- _.defer(function() {
+ _.defer(function () {
$('#app-content').trigger($.Event('apprendered'));
});