AJAXify user addition. Props mdawaffe. fixes #2624
git-svn-id: http://svn.automattic.com/wordpress/trunk@3680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
0497d716ad
commit
30930704b6
|
@ -0,0 +1,21 @@
|
|||
addLoadEvent(function() {
|
||||
theListEls = document.getElementsByTagName('tbody');
|
||||
theUserLists = new Array();
|
||||
for ( var l = 0; l < theListEls.length; l++ ) {
|
||||
theUserLists[theListEls[l].id] = new listMan(theListEls[l].id);
|
||||
}
|
||||
addUserInputs = document.getElementById('adduser').getElementsByTagName('input');
|
||||
for ( var i = 0; i < addUserInputs.length; i++ ) {
|
||||
addUserInputs[i].onkeypress = function(e) { return killSubmit('addUserSubmit();', e); }
|
||||
}
|
||||
document.getElementById('addusersub').onclick = function(e) { return killSubmit('addUserSubmit();', e); }
|
||||
}
|
||||
);
|
||||
|
||||
function addUserSubmit() {
|
||||
var roleEl = document.getElementById('role');
|
||||
var role = roleEl.options[roleEl.selectedIndex].value;
|
||||
if ( !theUserLists['role-' + role] ) return true;
|
||||
theUserLists['role-' + role].clearInputs.push('user_login', 'first_name', 'last_name', 'email', 'url', 'pass1', 'pass2', 'role');
|
||||
return theUserLists['role-' + role].ajaxAdder('user', 'adduser');
|
||||
}
|
Loading…
Reference in New Issue