Mass select for users from cpoteet and mdawaffe. fixes #5592
git-svn-id: https://develop.svn.wordpress.org/trunk@6570 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
16d3b034ab
commit
5daadf8ce7
@ -387,7 +387,7 @@ case 'add-user' :
|
|||||||
$x = new WP_Ajax_Response( array(
|
$x = new WP_Ajax_Response( array(
|
||||||
'what' => 'user',
|
'what' => 'user',
|
||||||
'id' => $user_id,
|
'id' => $user_id,
|
||||||
'data' => user_row( $user_object ),
|
'data' => user_row( $user_object, '', $user_object->roles[0] ),
|
||||||
'supplemental' => array(
|
'supplemental' => array(
|
||||||
'show-link' => sprintf(__( 'User <a href="#%s">%s</a> added' ), "user-$user_id", $user_object->user_login),
|
'show-link' => sprintf(__( 'User <a href="#%s">%s</a> added' ), "user-$user_id", $user_object->user_login),
|
||||||
'role' => $user_object->roles[0]
|
'role' => $user_object->roles[0]
|
||||||
|
@ -4,39 +4,12 @@ require_once('admin.php');
|
|||||||
$title = __('Edit Comments');
|
$title = __('Edit Comments');
|
||||||
$parent_file = 'edit-comments.php';
|
$parent_file = 'edit-comments.php';
|
||||||
wp_enqueue_script( 'admin-comments' );
|
wp_enqueue_script( 'admin-comments' );
|
||||||
|
wp_enqueue_script('admin-forms');
|
||||||
|
|
||||||
require_once('admin-header.php');
|
require_once('admin-header.php');
|
||||||
if (empty($_GET['mode'])) $mode = 'view';
|
if (empty($_GET['mode'])) $mode = 'view';
|
||||||
else $mode = attribute_escape($_GET['mode']);
|
else $mode = attribute_escape($_GET['mode']);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
<!--
|
|
||||||
function checkAll(form)
|
|
||||||
{
|
|
||||||
for (i = 0, n = form.elements.length; i < n; i++) {
|
|
||||||
if(form.elements[i].type == "checkbox") {
|
|
||||||
if(form.elements[i].checked == true)
|
|
||||||
form.elements[i].checked = false;
|
|
||||||
else
|
|
||||||
form.elements[i].checked = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getNumChecked(form)
|
|
||||||
{
|
|
||||||
var num = 0;
|
|
||||||
for (i = 0, n = form.elements.length; i < n; i++) {
|
|
||||||
if(form.elements[i].type == "checkbox") {
|
|
||||||
if(form.elements[i].checked == true)
|
|
||||||
num++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return num;
|
|
||||||
}
|
|
||||||
//-->
|
|
||||||
</script>
|
|
||||||
<div class="wrap">
|
<div class="wrap">
|
||||||
<h2><?php _e('Comments'); ?></h2>
|
<h2><?php _e('Comments'); ?></h2>
|
||||||
<form name="searchform" action="" method="get" id="editcomments">
|
<form name="searchform" action="" method="get" id="editcomments">
|
||||||
|
@ -313,7 +313,7 @@ function page_rows( $pages ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function user_row( $user_object, $style = '' ) {
|
function user_row( $user_object, $style = '', $role = '' ) {
|
||||||
if ( !( is_object( $user_object) && is_a( $user_object, 'WP_User' ) ) )
|
if ( !( is_object( $user_object) && is_a( $user_object, 'WP_User' ) ) )
|
||||||
$user_object = new WP_User( (int) $user_object );
|
$user_object = new WP_User( (int) $user_object );
|
||||||
$email = $user_object->user_email;
|
$email = $user_object->user_email;
|
||||||
@ -326,7 +326,7 @@ function user_row( $user_object, $style = '' ) {
|
|||||||
$short_url = substr( $short_url, 0, 32 ).'...';
|
$short_url = substr( $short_url, 0, 32 ).'...';
|
||||||
$numposts = get_usernumposts( $user_object->ID );
|
$numposts = get_usernumposts( $user_object->ID );
|
||||||
$r = "<tr id='user-$user_object->ID'$style>
|
$r = "<tr id='user-$user_object->ID'$style>
|
||||||
<td><input type='checkbox' name='users[]' id='user_{$user_object->ID}' value='{$user_object->ID}' /> <label for='user_{$user_object->ID}'>{$user_object->ID}</label></td>
|
<td><input type='checkbox' name='users[]' id='user_{$user_object->ID}' class='$role' value='{$user_object->ID}' /> <label for='user_{$user_object->ID}'>{$user_object->ID}</label></td>
|
||||||
<td><label for='user_{$user_object->ID}'><strong>$user_object->user_login</strong></label></td>
|
<td><label for='user_{$user_object->ID}'><strong>$user_object->user_login</strong></label></td>
|
||||||
<td><label for='user_{$user_object->ID}'>$user_object->first_name $user_object->last_name</label></td>
|
<td><label for='user_{$user_object->ID}'>$user_object->first_name $user_object->last_name</label></td>
|
||||||
<td><a href='mailto:$email' title='" . sprintf( __('e-mail: %s' ), $email ) . "'>$email</a></td>
|
<td><a href='mailto:$email' title='" . sprintf( __('e-mail: %s' ), $email ) . "'>$email</a></td>
|
||||||
|
31
wp-admin/js/forms.js
Normal file
31
wp-admin/js/forms.js
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
function checkAll(form) {
|
||||||
|
for (i = 0, n = form.elements.length; i < n; i++) {
|
||||||
|
if(form.elements[i].type == "checkbox" && !(form.elements[i].hasAttribute('onclick'))) {
|
||||||
|
if(form.elements[i].checked == true)
|
||||||
|
form.elements[i].checked = false;
|
||||||
|
else
|
||||||
|
form.elements[i].checked = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getNumChecked(form) {
|
||||||
|
var num = 0;
|
||||||
|
for (i = 0, n = form.elements.length; i < n; i++) {
|
||||||
|
if (form.elements[i].type == "checkbox") {
|
||||||
|
if (form.elements[i].checked == true)
|
||||||
|
num++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkAllUsers(role) {
|
||||||
|
var checkboxs = document.getElementsByTagName('input');
|
||||||
|
for(var i = 0, inp; inp = checkboxs[i]; i++)
|
||||||
|
if(inp.type.toLowerCase() == 'checkbox' && inp.className == role)
|
||||||
|
if(inp.checked == false)
|
||||||
|
inp.checked = true;
|
||||||
|
else
|
||||||
|
inp.checked = false;
|
||||||
|
}
|
@ -7,6 +7,7 @@
|
|||||||
require_once ('admin.php');
|
require_once ('admin.php');
|
||||||
|
|
||||||
wp_enqueue_script( 'wp-lists' );
|
wp_enqueue_script( 'wp-lists' );
|
||||||
|
wp_enqueue_script('admin-forms');
|
||||||
|
|
||||||
wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image', 'description', 'visible', 'target', 'category', 'link_id', 'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel', 'notes', 'linkcheck[]'));
|
wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image', 'description', 'visible', 'target', 'category', 'link_id', 'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel', 'notes', 'linkcheck[]'));
|
||||||
|
|
||||||
@ -45,25 +46,7 @@ switch ($order_by) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript" src="js/edit-comments.js"></script>
|
||||||
/* <![CDATA[ */
|
|
||||||
function checkAll(form)
|
|
||||||
{
|
|
||||||
for (i = 0, n = form.elements.length; i < n; i++) {
|
|
||||||
if(form.elements[i].type == "checkbox") {
|
|
||||||
if(form.elements[i].checked == true)
|
|
||||||
form.elements[i].checked = false;
|
|
||||||
else
|
|
||||||
form.elements[i].checked = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
jQuery(function($){$('#the-list').wpList();});
|
|
||||||
|
|
||||||
/* ]]> */
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if ( isset($_GET['deleted']) ) {
|
if ( isset($_GET['deleted']) ) {
|
||||||
echo '<div style="background-color: rgb(207, 235, 247);" id="message" class="updated fade"><p>';
|
echo '<div style="background-color: rgb(207, 235, 247);" id="message" class="updated fade"><p>';
|
||||||
|
@ -209,6 +209,7 @@ case 'delete':
|
|||||||
<form action="" method="post" name="updateusers" id="updateusers">
|
<form action="" method="post" name="updateusers" id="updateusers">
|
||||||
<?php wp_nonce_field('delete-users') ?>
|
<?php wp_nonce_field('delete-users') ?>
|
||||||
<?php echo $referer; ?>
|
<?php echo $referer; ?>
|
||||||
|
|
||||||
<div class="wrap">
|
<div class="wrap">
|
||||||
<h2><?php _e('Delete Users'); ?></h2>
|
<h2><?php _e('Delete Users'); ?></h2>
|
||||||
<p><?php _e('You have specified these users for deletion:'); ?></p>
|
<p><?php _e('You have specified these users for deletion:'); ?></p>
|
||||||
@ -270,7 +271,8 @@ case 'adduser':
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
wp_enqueue_script('admin-users');
|
wp_enqueue_script('admin-users');
|
||||||
|
wp_enqueue_script('admin-forms');
|
||||||
|
|
||||||
include('admin-header.php');
|
include('admin-header.php');
|
||||||
|
|
||||||
// Query the users
|
// Query the users
|
||||||
@ -385,6 +387,7 @@ foreach($roleclasses as $role => $roleclass) {
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="thead">
|
<tr class="thead">
|
||||||
|
<th><input type="checkbox" onclick="checkAllUsers('<?php echo $role; ?>')"/></th>
|
||||||
<th><?php _e('ID') ?></th>
|
<th><?php _e('ID') ?></th>
|
||||||
<th><?php _e('Username') ?></th>
|
<th><?php _e('Username') ?></th>
|
||||||
<th><?php _e('Name') ?></th>
|
<th><?php _e('Name') ?></th>
|
||||||
@ -397,7 +400,7 @@ foreach($roleclasses as $role => $roleclass) {
|
|||||||
$style = '';
|
$style = '';
|
||||||
foreach ( (array) $roleclass as $user_object ) {
|
foreach ( (array) $roleclass as $user_object ) {
|
||||||
$style = ( ' class="alternate"' == $style ) ? '' : ' class="alternate"';
|
$style = ( ' class="alternate"' == $style ) ? '' : ' class="alternate"';
|
||||||
echo "\n\t" . user_row($user_object, $style);
|
echo "\n\t" . user_row($user_object, $style, $role);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
@ -119,6 +119,7 @@ class WP_Scripts {
|
|||||||
$this->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists'), '20071104' );
|
$this->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists'), '20071104' );
|
||||||
$this->add( 'admin-posts', '/wp-admin/js/edit-posts.js', array('wp-lists'), '20071023' );
|
$this->add( 'admin-posts', '/wp-admin/js/edit-posts.js', array('wp-lists'), '20071023' );
|
||||||
$this->add( 'admin-users', '/wp-admin/js/users.js', array('wp-lists'), '20070823' );
|
$this->add( 'admin-users', '/wp-admin/js/users.js', array('wp-lists'), '20070823' );
|
||||||
|
$this->add( 'admin-forms', '/wp-admin/js/forms.js', array('wp-lists'), '20080108' );
|
||||||
$this->add( 'xfn', '/wp-admin/js/xfn.js', false, '3517' );
|
$this->add( 'xfn', '/wp-admin/js/xfn.js', false, '3517' );
|
||||||
$this->add( 'upload', '/wp-admin/js/upload.js', array('jquery'), '20070518' );
|
$this->add( 'upload', '/wp-admin/js/upload.js', array('jquery'), '20070518' );
|
||||||
$this->add( 'post', '/wp-admin/js/post.js', array('suggest'), '20080102' );
|
$this->add( 'post', '/wp-admin/js/post.js', array('suggest'), '20080102' );
|
||||||
|
Loading…
Reference in New Issue
Block a user