Make WordPress Core

Ticket #5592: 5592.diff

File 5592.diff, 6.0 KB (added by mdawaffe, 17 years ago)

patch compatible with ajax adding

  • wp-includes/script-loader.php

     
    119119                        $this->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists'), '20071104' );
    120120                        $this->add( 'admin-posts', '/wp-admin/js/edit-posts.js', array('wp-lists'), '20071023' );
    121121                        $this->add( 'admin-users', '/wp-admin/js/users.js', array('wp-lists'), '20070823' );
     122                        $this->add( 'admin-forms', '/wp-admin/js/forms.js', array('wp-lists'), '20080108' );
    122123                        $this->add( 'xfn', '/wp-admin/js/xfn.js', false, '3517' );
    123124                        $this->add( 'upload', '/wp-admin/js/upload.js', array('jquery'), '20070518' );
    124125                        $this->add( 'post', '/wp-admin/js/post.js', array('suggest'), '20080102' );
  • wp-admin/users.php

     
    209209<form action="" method="post" name="updateusers" id="updateusers">
    210210<?php wp_nonce_field('delete-users') ?>
    211211<?php echo $referer; ?>
     212
    212213<div class="wrap">
    213214<h2><?php _e('Delete Users'); ?></h2>
    214215<p><?php _e('You have specified these users for deletion:'); ?></p>
     
    270271
    271272default:
    272273        wp_enqueue_script('admin-users');
    273 
     274        wp_enqueue_script('admin-forms');
     275       
    274276        include('admin-header.php');
    275277
    276278        // Query the users
     
    385387<?php endif; ?>
    386388</tr>
    387389<tr class="thead">
     390        <th><input type="checkbox" onclick="checkAllUsers('<?php echo $role; ?>')"/></th>
    388391        <th><?php _e('ID') ?></th>
    389392        <th><?php _e('Username') ?></th>
    390393        <th><?php _e('Name') ?></th>
     
    397400$style = '';
    398401foreach ( (array) $roleclass as $user_object ) {
    399402        $style = ( ' class="alternate"' == $style ) ? '' : ' class="alternate"';
    400         echo "\n\t" . user_row($user_object, $style);
     403        echo "\n\t" . user_row($user_object, $style, $role);
    401404}
    402405?>
    403406
  • wp-admin/edit-comments.php

     
    44$title = __('Edit Comments');
    55$parent_file = 'edit-comments.php';
    66wp_enqueue_script( 'admin-comments' );
     7wp_enqueue_script('admin-forms');
    78
    89require_once('admin-header.php');
    910if (empty($_GET['mode'])) $mode = 'view';
    1011else $mode = attribute_escape($_GET['mode']);
    1112?>
    12 
    13 <script type="text/javascript">
    14 <!--
    15 function checkAll(form)
    16 {
    17         for (i = 0, n = form.elements.length; i < n; i++) {
    18                 if(form.elements[i].type == "checkbox") {
    19                         if(form.elements[i].checked == true)
    20                                 form.elements[i].checked = false;
    21                         else
    22                                 form.elements[i].checked = true;
    23                 }
    24         }
    25 }
    26 
    27 function getNumChecked(form)
    28 {
    29         var num = 0;
    30         for (i = 0, n = form.elements.length; i < n; i++) {
    31                 if(form.elements[i].type == "checkbox") {
    32                         if(form.elements[i].checked == true)
    33                                 num++;
    34                 }
    35         }
    36         return num;
    37 }
    38 //-->
    39 </script>
    4013<div class="wrap">
    4114<h2><?php _e('Comments'); ?></h2>
    4215<form name="searchform" action="" method="get" id="editcomments">
  • wp-admin/admin-ajax.php

     
    387387        $x = new WP_Ajax_Response( array(
    388388                'what' => 'user',
    389389                'id' => $user_id,
    390                 'data' => user_row( $user_object ),
     390                'data' => user_row( $user_object, '', $user_object->roles[0] ),
    391391                'supplemental' => array(
    392392                        'show-link' => sprintf(__( 'User <a href="#%s">%s</a> added' ), "user-$user_id", $user_object->user_login),
    393393                        'role' => $user_object->roles[0]
  • wp-admin/includes/template.php

     
    313313         }
    314314}
    315315
    316 function user_row( $user_object, $style = '' ) {
     316function user_row( $user_object, $style = '', $role = '' ) {
    317317        if ( !( is_object( $user_object) && is_a( $user_object, 'WP_User' ) ) )
    318318                $user_object = new WP_User( (int) $user_object );
    319319        $email = $user_object->user_email;
     
    326326                $short_url =  substr( $short_url, 0, 32 ).'...';
    327327        $numposts = get_usernumposts( $user_object->ID );
    328328        $r = "<tr id='user-$user_object->ID'$style>
    329                 <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>
     329                <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>
    330330                <td><label for='user_{$user_object->ID}'><strong>$user_object->user_login</strong></label></td>
    331331                <td><label for='user_{$user_object->ID}'>$user_object->first_name $user_object->last_name</label></td>
    332332                <td><a href='mailto:$email' title='" . sprintf( __('e-mail: %s' ), $email ) . "'>$email</a></td>
  • wp-admin/link-manager.php

     
    77require_once ('admin.php');
    88
    99wp_enqueue_script( 'wp-lists' );
     10wp_enqueue_script('admin-forms');
    1011
    1112wp_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[]'));
    1213
     
    4546                break;
    4647}
    4748?>
    48 <script type="text/javascript">
    49 /* <![CDATA[ */
    50 function checkAll(form)
    51 {
    52         for (i = 0, n = form.elements.length; i < n; i++) {
    53                 if(form.elements[i].type == "checkbox") {
    54                         if(form.elements[i].checked == true)
    55                                 form.elements[i].checked = false;
    56                         else
    57                                 form.elements[i].checked = true;
    58                 }
    59         }
    60 }
    61 
    62 jQuery(function($){$('#the-list').wpList();});
    63 
    64 /* ]]> */
    65 </script>
    66 
     49<script type="text/javascript" src="js/edit-comments.js"></script>
    6750<?php
    6851if ( isset($_GET['deleted']) ) {
    6952        echo '<div style="background-color: rgb(207, 235, 247);" id="message" class="updated fade"><p>';