adding missing translations for various strings + fixing tool tip on delete
This commit is contained in:
parent
bca02f4b40
commit
cc9061d20d
|
@ -4,405 +4,413 @@
|
||||||
* See the COPYING-README file.
|
* See the COPYING-README file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var UserList={
|
var UserList = {
|
||||||
useUndo:true,
|
useUndo:true,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initiate user deletion process in UI
|
* @brief Initiate user deletion process in UI
|
||||||
* @param string uid the user ID to be deleted
|
* @param string uid the user ID to be deleted
|
||||||
*
|
*
|
||||||
* Does not actually delete the user; it sets them for
|
* Does not actually delete the user; it sets them for
|
||||||
* deletion when the current page is unloaded, at which point
|
* deletion when the current page is unloaded, at which point
|
||||||
* finishDelete() completes the process. This allows for 'undo'.
|
* finishDelete() completes the process. This allows for 'undo'.
|
||||||
*/
|
*/
|
||||||
do_delete:function( uid ) {
|
do_delete:function (uid) {
|
||||||
if (typeof UserList.deleteUid !== 'undefined') {
|
if (typeof UserList.deleteUid !== 'undefined') {
|
||||||
//Already a user in the undo queue
|
//Already a user in the undo queue
|
||||||
UserList.finishDelete(null);
|
UserList.finishDelete(null);
|
||||||
}
|
}
|
||||||
UserList.deleteUid = uid;
|
UserList.deleteUid = uid;
|
||||||
|
|
||||||
// Set undo flag
|
// Set undo flag
|
||||||
UserList.deleteCanceled = false;
|
UserList.deleteCanceled = false;
|
||||||
|
|
||||||
// Provide user with option to undo
|
// Provide user with option to undo
|
||||||
$('#notification').html(t('users', 'deleted')+' '+uid+'<span class="undo">'+t('users', 'undo')+'</span>');
|
$('#notification').html(t('users', 'deleted') + ' ' + uid + '<span class="undo">' + t('users', 'undo') + '</span>');
|
||||||
$('#notification').data('deleteuser',true);
|
$('#notification').data('deleteuser', true);
|
||||||
$('#notification').fadeIn();
|
$('#notification').fadeIn();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Delete a user via ajax
|
* @brief Delete a user via ajax
|
||||||
* @param bool ready whether to use ready() upon completion
|
* @param bool ready whether to use ready() upon completion
|
||||||
*
|
*
|
||||||
* Executes deletion via ajax of user identified by property deleteUid
|
* Executes deletion via ajax of user identified by property deleteUid
|
||||||
* if 'undo' has not been used. Completes the user deletion procedure
|
* if 'undo' has not been used. Completes the user deletion procedure
|
||||||
* and reflects success in UI.
|
* and reflects success in UI.
|
||||||
*/
|
*/
|
||||||
finishDelete:function( ready ){
|
finishDelete:function (ready) {
|
||||||
|
|
||||||
// Check deletion has not been undone
|
// Check deletion has not been undone
|
||||||
if( !UserList.deleteCanceled && UserList.deleteUid ){
|
if (!UserList.deleteCanceled && UserList.deleteUid) {
|
||||||
|
|
||||||
// Delete user via ajax
|
// Delete user via ajax
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type:'POST',
|
||||||
url: OC.filePath('settings', 'ajax', 'removeuser.php'),
|
url:OC.filePath('settings', 'ajax', 'removeuser.php'),
|
||||||
async: false,
|
async:false,
|
||||||
data: { username: UserList.deleteUid },
|
data:{ username:UserList.deleteUid },
|
||||||
success: function(result) {
|
success:function (result) {
|
||||||
if (result.status == 'success') {
|
if (result.status == 'success') {
|
||||||
// Remove undo option, & remove user from table
|
// Remove undo option, & remove user from table
|
||||||
$('#notification').fadeOut();
|
$('#notification').fadeOut();
|
||||||
$('tr').filterAttr('data-uid', UserList.deleteUid).remove();
|
$('tr').filterAttr('data-uid', UserList.deleteUid).remove();
|
||||||
UserList.deleteCanceled = true;
|
UserList.deleteCanceled = true;
|
||||||
if (ready) {
|
if (ready) {
|
||||||
ready();
|
ready();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
oc.dialogs.alert(result.data.message, t('settings', 'Unable to remove user'));
|
oc.dialogs.alert(result.data.message, t('settings', 'Unable to remove user'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
add:function(username, groups, subadmin, quota, sort) {
|
add:function (username, groups, subadmin, quota, sort) {
|
||||||
var tr = $('tbody tr').first().clone();
|
var tr = $('tbody tr').first().clone();
|
||||||
tr.attr('data-uid', username);
|
tr.attr('data-uid', username);
|
||||||
tr.find('td.name').text(username);
|
tr.find('td.name').text(username);
|
||||||
var groupsSelect = $('<select multiple="multiple" class="groupsselect" data-placehoder="Groups" title="Groups"></select>').attr('data-username', username).attr('data-user-groups', groups);
|
var groupsSelect = $('<select multiple="multiple" class="groupsselect" data-placehoder="Groups" title="' + t('settings', 'Groups') + '"></select>').attr('data-username', username).attr('data-user-groups', groups);
|
||||||
tr.find('td.groups').empty();
|
tr.find('td.groups').empty();
|
||||||
if (tr.find('td.subadmins').length > 0) {
|
if (tr.find('td.subadmins').length > 0) {
|
||||||
var subadminSelect = $('<select multiple="multiple" class="subadminsselect" data-placehoder="subadmins" title="' + t('files', 'Group Admin') + '">').attr('data-username', username).attr('data-user-groups', groups).attr('data-subadmin', subadmin);
|
var subadminSelect = $('<select multiple="multiple" class="subadminsselect" data-placehoder="subadmins" title="' + t('settings', 'Group Admin') + '">').attr('data-username', username).attr('data-user-groups', groups).attr('data-subadmin', subadmin);
|
||||||
tr.find('td.subadmins').empty();
|
tr.find('td.subadmins').empty();
|
||||||
}
|
}
|
||||||
var allGroups = String($('#content table').attr('data-groups')).split(', ');
|
var allGroups = String($('#content table').attr('data-groups')).split(', ');
|
||||||
$.each(allGroups, function(i, group) {
|
$.each(allGroups, function (i, group) {
|
||||||
groupsSelect.append($('<option value="'+group+'">'+group+'</option>'));
|
groupsSelect.append($('<option value="' + group + '">' + group + '</option>'));
|
||||||
if (typeof subadminSelect !== 'undefined' && group != 'admin') {
|
if (typeof subadminSelect !== 'undefined' && group != 'admin') {
|
||||||
subadminSelect.append($('<option value="'+group+'">'+group+'</option>'));
|
subadminSelect.append($('<option value="' + group + '">' + group + '</option>'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
tr.find('td.groups').append(groupsSelect);
|
tr.find('td.groups').append(groupsSelect);
|
||||||
UserList.applyMultiplySelect(groupsSelect);
|
UserList.applyMultiplySelect(groupsSelect);
|
||||||
if (tr.find('td.subadmins').length > 0) {
|
if (tr.find('td.subadmins').length > 0) {
|
||||||
tr.find('td.subadmins').append(subadminSelect);
|
tr.find('td.subadmins').append(subadminSelect);
|
||||||
UserList.applyMultiplySelect(subadminSelect);
|
UserList.applyMultiplySelect(subadminSelect);
|
||||||
}
|
}
|
||||||
if (tr.find('td.remove img').length == 0 && OC.currentUser != username) {
|
if (tr.find('td.remove img').length == 0 && OC.currentUser != username) {
|
||||||
var rm_img = $('<img>', {
|
var rm_img = $('<img>', {
|
||||||
class: 'svg action',
|
class:'svg action',
|
||||||
src: OC.imagePath('core','actions/delete'),
|
src:OC.imagePath('core', 'actions/delete')
|
||||||
alt: t('settings','Delete'),
|
});
|
||||||
title: t('settings','Delete')
|
var rm_link = $('<a>', { class:'action delete', href:'#', 'original-title':t('settings', 'Delete')}).append(rm_img);
|
||||||
});
|
tr.find('td.remove').append(rm_link);
|
||||||
var rm_link = $('<a>', { class: 'action delete', href: '#'}).append(rm_img);
|
} else if (OC.currentUser == username) {
|
||||||
tr.find('td.remove').append(rm_link);
|
tr.find('td.remove a').remove();
|
||||||
} else if (OC.currentUser == username) {
|
}
|
||||||
tr.find('td.remove a').remove();
|
var quotaSelect = tr.find('select.quota-user');
|
||||||
}
|
if (quota == 'default') {
|
||||||
var quotaSelect = tr.find('select.quota-user');
|
quotaSelect.find('option').attr('selected', null);
|
||||||
if (quota == 'default') {
|
quotaSelect.find('option').first().attr('selected', 'selected');
|
||||||
quotaSelect.find('option').attr('selected', null);
|
quotaSelect.data('previous', 'default');
|
||||||
quotaSelect.find('option').first().attr('selected', 'selected');
|
} else {
|
||||||
quotaSelect.data('previous', 'default');
|
if (quotaSelect.find('option[value="' + quota + '"]').length > 0) {
|
||||||
} else {
|
quotaSelect.find('option[value="' + quota + '"]').attr('selected', 'selected');
|
||||||
if (quotaSelect.find('option[value="'+quota+'"]').length > 0) {
|
} else {
|
||||||
quotaSelect.find('option[value="'+quota+'"]').attr('selected', 'selected');
|
quotaSelect.append('<option value="' + quota + '" selected="selected">' + quota + '</option>');
|
||||||
} else {
|
}
|
||||||
quotaSelect.append('<option value="'+quota+'" selected="selected">'+quota+'</option>');
|
}
|
||||||
}
|
var added = false;
|
||||||
}
|
if (sort) {
|
||||||
var added = false;
|
username = username.toLowerCase();
|
||||||
if (sort) {
|
$('tbody tr').each(function () {
|
||||||
username = username.toLowerCase();
|
if (username < $(this).attr('data-uid').toLowerCase()) {
|
||||||
$('tbody tr').each(function() {
|
$(tr).insertBefore($(this));
|
||||||
if (username < $(this).attr('data-uid').toLowerCase()) {
|
added = true;
|
||||||
$(tr).insertBefore($(this));
|
return false;
|
||||||
added = true;
|
}
|
||||||
return false;
|
});
|
||||||
}
|
}
|
||||||
});
|
if (!added) {
|
||||||
}
|
$(tr).appendTo('tbody');
|
||||||
if (!added) {
|
}
|
||||||
$(tr).appendTo('tbody');
|
return tr;
|
||||||
}
|
},
|
||||||
return tr;
|
|
||||||
},
|
|
||||||
|
|
||||||
update:function() {
|
update:function () {
|
||||||
if (typeof UserList.offset === 'undefined') {
|
if (typeof UserList.offset === 'undefined') {
|
||||||
UserList.offset = $('tbody tr').length;
|
UserList.offset = $('tbody tr').length;
|
||||||
}
|
}
|
||||||
$.get(OC.Router.generate('settings_ajax_userlist', { offset: UserList.offset }), function(result) {
|
$.get(OC.Router.generate('settings_ajax_userlist', { offset:UserList.offset }), function (result) {
|
||||||
if (result.status === 'success') {
|
if (result.status === 'success') {
|
||||||
$.each(result.data, function(index, user) {
|
$.each(result.data, function (index, user) {
|
||||||
var tr = UserList.add(user.name, user.groups, user.subadmin, user.quota, false);
|
var tr = UserList.add(user.name, user.groups, user.subadmin, user.quota, false);
|
||||||
UserList.offset++;
|
UserList.offset++;
|
||||||
if (index == 9) {
|
if (index == 9) {
|
||||||
$(tr).bind('inview', function(event, isInView, visiblePartX, visiblePartY) {
|
$(tr).bind('inview', function (event, isInView, visiblePartX, visiblePartY) {
|
||||||
$(this).unbind(event);
|
$(this).unbind(event);
|
||||||
UserList.update();
|
UserList.update();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
applyMultiplySelect:function(element) {
|
applyMultiplySelect:function (element) {
|
||||||
var checked=[];
|
var checked = [];
|
||||||
var user=element.attr('data-username');
|
var user = element.attr('data-username');
|
||||||
if($(element).attr('class') == 'groupsselect'){
|
if ($(element).attr('class') == 'groupsselect') {
|
||||||
if(element.data('userGroups')){
|
if (element.data('userGroups')) {
|
||||||
checked=String(element.data('userGroups')).split(', ');
|
checked = String(element.data('userGroups')).split(', ');
|
||||||
}
|
}
|
||||||
if(user){
|
if (user) {
|
||||||
var checkHandeler=function(group){
|
var checkHandeler = function (group) {
|
||||||
if(user==OC.currentUser && group=='admin'){
|
if (user == OC.currentUser && group == 'admin') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(!isadmin && checked.length == 1 && checked[0] == group){
|
if (!isadmin && checked.length == 1 && checked[0] == group) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$.post(
|
$.post(
|
||||||
OC.filePath('settings','ajax','togglegroups.php'),
|
OC.filePath('settings', 'ajax', 'togglegroups.php'),
|
||||||
{
|
{
|
||||||
username:user,
|
username:user,
|
||||||
group:group
|
group:group
|
||||||
},
|
},
|
||||||
function(){}
|
function () {
|
||||||
);
|
}
|
||||||
};
|
);
|
||||||
}else{
|
};
|
||||||
checkHandeler=false;
|
} else {
|
||||||
}
|
checkHandeler = false;
|
||||||
var addGroup = function(group) {
|
}
|
||||||
$('select[multiple]').each(function(index, element) {
|
var addGroup = function (group) {
|
||||||
if ($(element).find('option[value="'+group +'"]').length == 0) {
|
$('select[multiple]').each(function (index, element) {
|
||||||
$(element).append('<option value="'+group+'">'+group+'</option>');
|
if ($(element).find('option[value="' + group + '"]').length == 0) {
|
||||||
}
|
$(element).append('<option value="' + group + '">' + group + '</option>');
|
||||||
})
|
}
|
||||||
};
|
})
|
||||||
var label;
|
};
|
||||||
if(isadmin){
|
var label;
|
||||||
label = t('core', 'add group');
|
if (isadmin) {
|
||||||
}else{
|
label = t('settings', 'add group');
|
||||||
label = null;
|
} else {
|
||||||
}
|
label = null;
|
||||||
element.multiSelect({
|
}
|
||||||
createCallback:addGroup,
|
element.multiSelect({
|
||||||
createText:label,
|
createCallback:addGroup,
|
||||||
checked:checked,
|
createText:label,
|
||||||
oncheck:checkHandeler,
|
checked:checked,
|
||||||
onuncheck:checkHandeler,
|
oncheck:checkHandeler,
|
||||||
minWidth: 100,
|
onuncheck:checkHandeler,
|
||||||
});
|
minWidth:100,
|
||||||
}
|
});
|
||||||
if($(element).attr('class') == 'subadminsselect'){
|
}
|
||||||
if(element.data('subadmin')){
|
if ($(element).attr('class') == 'subadminsselect') {
|
||||||
checked=String(element.data('subadmin')).split(', ');
|
if (element.data('subadmin')) {
|
||||||
}
|
checked = String(element.data('subadmin')).split(', ');
|
||||||
var checkHandeler=function(group){
|
}
|
||||||
if(group=='admin'){
|
var checkHandeler = function (group) {
|
||||||
return false;
|
if (group == 'admin') {
|
||||||
}
|
return false;
|
||||||
$.post(
|
}
|
||||||
OC.filePath('settings','ajax','togglesubadmins.php'),
|
$.post(
|
||||||
{
|
OC.filePath('settings', 'ajax', 'togglesubadmins.php'),
|
||||||
username:user,
|
{
|
||||||
group:group
|
username:user,
|
||||||
},
|
group:group
|
||||||
function(){}
|
},
|
||||||
);
|
function () {
|
||||||
};
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
var addSubAdmin = function(group) {
|
var addSubAdmin = function (group) {
|
||||||
$('select[multiple]').each(function(index, element) {
|
$('select[multiple]').each(function (index, element) {
|
||||||
if ($(element).find('option[value="'+group +'"]').length == 0) {
|
if ($(element).find('option[value="' + group + '"]').length == 0) {
|
||||||
$(element).append('<option value="'+group+'">'+group+'</option>');
|
$(element).append('<option value="' + group + '">' + group + '</option>');
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
element.multiSelect({
|
element.multiSelect({
|
||||||
createCallback:addSubAdmin,
|
createCallback:addSubAdmin,
|
||||||
createText:null,
|
createText:null,
|
||||||
checked:checked,
|
checked:checked,
|
||||||
oncheck:checkHandeler,
|
oncheck:checkHandeler,
|
||||||
onuncheck:checkHandeler,
|
onuncheck:checkHandeler,
|
||||||
minWidth: 100,
|
minWidth:100,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function () {
|
||||||
|
|
||||||
$('tbody tr:last').bind('inview', function(event, isInView, visiblePartX, visiblePartY) {
|
$('tbody tr:last').bind('inview', function (event, isInView, visiblePartX, visiblePartY) {
|
||||||
UserList.update();
|
UserList.update();
|
||||||
});
|
});
|
||||||
|
|
||||||
function setQuota(uid,quota,ready){
|
function setQuota(uid, quota, ready) {
|
||||||
$.post(
|
$.post(
|
||||||
OC.filePath('settings','ajax','setquota.php'),
|
OC.filePath('settings', 'ajax', 'setquota.php'),
|
||||||
{username:uid,quota:quota},
|
{username:uid, quota:quota},
|
||||||
function(result){
|
function (result) {
|
||||||
if(ready){
|
if (ready) {
|
||||||
ready(result.data.quota);
|
ready(result.data.quota);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$('select[multiple]').each(function(index,element){
|
$('select[multiple]').each(function (index, element) {
|
||||||
UserList.applyMultiplySelect($(element));
|
UserList.applyMultiplySelect($(element));
|
||||||
});
|
});
|
||||||
|
|
||||||
$('td.remove>a').live('click',function(event){
|
$('td.remove>a').live('click', function (event) {
|
||||||
var row = $(this).parent().parent();
|
var row = $(this).parent().parent();
|
||||||
var uid = $(row).attr('data-uid');
|
var uid = $(row).attr('data-uid');
|
||||||
$(row).hide();
|
$(row).hide();
|
||||||
// Call function for handling delete/undo
|
// Call function for handling delete/undo
|
||||||
UserList.do_delete(uid);
|
UserList.do_delete(uid);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('td.password>img').live('click',function(event){
|
$('td.password>img').live('click', function (event) {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
var img=$(this);
|
var img = $(this);
|
||||||
var uid=img.parent().parent().attr('data-uid');
|
var uid = img.parent().parent().attr('data-uid');
|
||||||
var input=$('<input type="password">');
|
var input = $('<input type="password">');
|
||||||
img.css('display','none');
|
img.css('display', 'none');
|
||||||
img.parent().children('span').replaceWith(input);
|
img.parent().children('span').replaceWith(input);
|
||||||
input.focus();
|
input.focus();
|
||||||
input.keypress(function(event) {
|
input.keypress(function (event) {
|
||||||
if(event.keyCode == 13) {
|
if (event.keyCode == 13) {
|
||||||
if($(this).val().length>0){
|
if ($(this).val().length > 0) {
|
||||||
$.post(
|
$.post(
|
||||||
OC.filePath('settings','ajax','changepassword.php'),
|
OC.filePath('settings', 'ajax', 'changepassword.php'),
|
||||||
{username:uid,password:$(this).val()},
|
{username:uid, password:$(this).val()},
|
||||||
function(result){}
|
function (result) {
|
||||||
);
|
}
|
||||||
input.blur();
|
);
|
||||||
}else{
|
input.blur();
|
||||||
input.blur();
|
} else {
|
||||||
}
|
input.blur();
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
input.blur(function(){
|
});
|
||||||
$(this).replaceWith($('<span>●●●●●●●</span>'));
|
input.blur(function () {
|
||||||
img.css('display','');
|
$(this).replaceWith($('<span>●●●●●●●</span>'));
|
||||||
});
|
img.css('display', '');
|
||||||
});
|
});
|
||||||
$('td.password').live('click',function(event){
|
});
|
||||||
$(this).children('img').click();
|
$('td.password').live('click', function (event) {
|
||||||
});
|
$(this).children('img').click();
|
||||||
|
});
|
||||||
|
|
||||||
$('select.quota, select.quota-user').live('change',function(){
|
$('select.quota, select.quota-user').live('change', function () {
|
||||||
var select=$(this);
|
var select = $(this);
|
||||||
var uid=$(this).parent().parent().parent().attr('data-uid');
|
var uid = $(this).parent().parent().parent().attr('data-uid');
|
||||||
var quota=$(this).val();
|
var quota = $(this).val();
|
||||||
var other=$(this).next();
|
var other = $(this).next();
|
||||||
if(quota!='other'){
|
if (quota != 'other') {
|
||||||
other.hide();
|
other.hide();
|
||||||
select.data('previous',quota);
|
select.data('previous', quota);
|
||||||
setQuota(uid,quota);
|
setQuota(uid, quota);
|
||||||
}else{
|
} else {
|
||||||
other.show();
|
other.show();
|
||||||
select.addClass('active');
|
select.addClass('active');
|
||||||
other.focus();
|
other.focus();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('select.quota, select.quota-user').each(function(i,select){
|
$('select.quota, select.quota-user').each(function (i, select) {
|
||||||
$(select).data('previous',$(select).val());
|
$(select).data('previous', $(select).val());
|
||||||
})
|
})
|
||||||
|
|
||||||
$('input.quota-other').live('change',function(){
|
$('input.quota-other').live('change', function () {
|
||||||
var uid=$(this).parent().parent().parent().attr('data-uid');
|
var uid = $(this).parent().parent().parent().attr('data-uid');
|
||||||
var quota=$(this).val();
|
var quota = $(this).val();
|
||||||
var select=$(this).prev();
|
var select = $(this).prev();
|
||||||
var other=$(this);
|
var other = $(this);
|
||||||
if(quota){
|
if (quota) {
|
||||||
setQuota(uid,quota,function(quota){
|
setQuota(uid, quota, function (quota) {
|
||||||
select.children().attr('selected',null);
|
select.children().attr('selected', null);
|
||||||
var existingOption=select.children().filter(function(i,option){
|
var existingOption = select.children().filter(function (i, option) {
|
||||||
return ($(option).val()==quota);
|
return ($(option).val() == quota);
|
||||||
});
|
});
|
||||||
if(existingOption.length){
|
if (existingOption.length) {
|
||||||
existingOption.attr('selected','selected');
|
existingOption.attr('selected', 'selected');
|
||||||
}else{
|
} else {
|
||||||
var option=$('<option/>');
|
var option = $('<option/>');
|
||||||
option.attr('selected','selected').attr('value',quota).text(quota);
|
option.attr('selected', 'selected').attr('value', quota).text(quota);
|
||||||
select.children().last().before(option);
|
select.children().last().before(option);
|
||||||
}
|
}
|
||||||
select.val(quota);
|
select.val(quota);
|
||||||
select.removeClass('active');
|
select.removeClass('active');
|
||||||
other.val(null);
|
other.val(null);
|
||||||
other.hide();
|
other.hide();
|
||||||
});
|
});
|
||||||
}else{
|
} else {
|
||||||
var previous=select.data('previous');
|
var previous = select.data('previous');
|
||||||
select.children().attr('selected',null);
|
select.children().attr('selected', null);
|
||||||
select.children().each(function(i,option){
|
select.children().each(function (i, option) {
|
||||||
if($(option).val()==previous){
|
if ($(option).val() == previous) {
|
||||||
$(option).attr('selected','selected');
|
$(option).attr('selected', 'selected');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
select.removeClass('active');
|
select.removeClass('active');
|
||||||
other.hide();
|
other.hide();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('input.quota-other').live('blur',function(){
|
$('input.quota-other').live('blur', function () {
|
||||||
$(this).change();
|
$(this).change();
|
||||||
})
|
})
|
||||||
|
|
||||||
$('#newuser').submit(function(event){
|
$('#newuser').submit(function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
var username=$('#newusername').val();
|
var username = $('#newusername').val();
|
||||||
var password=$('#newuserpassword').val();
|
var password = $('#newuserpassword').val();
|
||||||
if($('#content table tbody tr').filterAttr('data-uid',username).length>0){
|
if ($('#content table tbody tr').filterAttr('data-uid', username).length > 0) {
|
||||||
OC.dialogs.alert('The username is already being used', 'Error creating user');
|
OC.dialogs.alert(
|
||||||
return;
|
t('settings', 'The username is already being used'),
|
||||||
}
|
t('settings', 'Error creating user'));
|
||||||
if($.trim(username) == '') {
|
return;
|
||||||
OC.dialogs.alert('A valid username must be provided', 'Error creating user');
|
}
|
||||||
return false;
|
if ($.trim(username) == '') {
|
||||||
}
|
OC.dialogs.alert(
|
||||||
if($.trim(password) == '') {
|
t('settings', 'A valid username must be provided'),
|
||||||
OC.dialogs.alert('A valid password must be provided', 'Error creating user');
|
t('settings', 'Error creating user'));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var groups=$('#newusergroups').prev().children('div').data('settings').checked;
|
if ($.trim(password) == '') {
|
||||||
$('#newuser').get(0).reset();
|
OC.dialogs.alert(
|
||||||
$.post(
|
t('settings', 'A valid password must be provided'),
|
||||||
OC.filePath('settings','ajax','createuser.php'),
|
t('settings', 'Error creating user'));
|
||||||
{
|
return false;
|
||||||
username:username,
|
}
|
||||||
password:password,
|
var groups = $('#newusergroups').prev().children('div').data('settings').checked;
|
||||||
groups:groups,
|
$('#newuser').get(0).reset();
|
||||||
},
|
$.post(
|
||||||
function(result){
|
OC.filePath('settings', 'ajax', 'createuser.php'),
|
||||||
if(result.status!='success'){
|
{
|
||||||
OC.dialogs.alert(result.data.message, 'Error creating user');
|
username:username,
|
||||||
} else {
|
password:password,
|
||||||
UserList.add(username, result.data.groups, null, 'default', true);
|
groups:groups,
|
||||||
}
|
},
|
||||||
}
|
function (result) {
|
||||||
);
|
if (result.status != 'success') {
|
||||||
});
|
OC.dialogs.alert(result.data.message,
|
||||||
// Handle undo notifications
|
t('settings', 'Error creating user'));
|
||||||
$('#notification').hide();
|
} else {
|
||||||
$('#notification .undo').live('click', function() {
|
UserList.add(username, result.data.groups, null, 'default', true);
|
||||||
if($('#notification').data('deleteuser')) {
|
}
|
||||||
$('tbody tr').filterAttr('data-uid', UserList.deleteUid).show();
|
}
|
||||||
UserList.deleteCanceled=true;
|
);
|
||||||
}
|
});
|
||||||
$('#notification').fadeOut();
|
// Handle undo notifications
|
||||||
});
|
$('#notification').hide();
|
||||||
UserList.useUndo=('onbeforeunload' in window)
|
$('#notification .undo').live('click', function () {
|
||||||
$(window).bind('beforeunload', function (){
|
if ($('#notification').data('deleteuser')) {
|
||||||
UserList.finishDelete(null);
|
$('tbody tr').filterAttr('data-uid', UserList.deleteUid).show();
|
||||||
});
|
UserList.deleteCanceled = true;
|
||||||
|
}
|
||||||
|
$('#notification').fadeOut();
|
||||||
|
});
|
||||||
|
UserList.useUndo = ('onbeforeunload' in window)
|
||||||
|
$(window).bind('beforeunload', function () {
|
||||||
|
UserList.finishDelete(null);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue