Make WordPress Core

Changeset 7745


Ignore:
Timestamp:
04/18/2008 10:23:02 PM (17 years ago)
Author:
ryan
Message:

Shift-click to select a range of checkboxes. Props mdawaffe. fixes #6541 for trunk

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/categories.php

    r7484 r7745  
    148148    <thead>
    149149    <tr>
    150         <th scope="col" class="check-column"><input type="checkbox" onclick="checkAll(document.getElementById('posts-filter'));" /></th>
     150        <th scope="col" class="check-column"><input type="checkbox" /></th>
    151151        <th scope="col"><?php _e('Name') ?></th>
    152152        <th scope="col"><?php _e('Description') ?></th>
  • trunk/wp-admin/edit-comments.php

    r7645 r7745  
    186186<thead>
    187187  <tr>
    188     <th scope="col" class="check-column"><input type="checkbox" onclick="checkAll(document.getElementById('comments-form'));" /></th>
     188    <th scope="col" class="check-column"><input type="checkbox" /></th>
    189189    <th scope="col"><?php _e('Comment') ?></th>
    190190    <th scope="col"><?php _e('Date') ?></th>
  • trunk/wp-admin/edit-link-categories.php

    r7537 r7745  
    102102    <thead>
    103103    <tr>
    104         <th scope="col" class="check-column"><input type="checkbox" onclick="checkAll(document.getElementById('posts-filter'));" /></th>
     104        <th scope="col" class="check-column"><input type="checkbox" /></th>
    105105        <th scope="col"><?php _e('Name') ?></th>
    106106        <th scope="col"><?php _e('Description') ?></th>
  • trunk/wp-admin/edit-tags.php

    r7536 r7745  
    173173    <thead>
    174174    <tr>
    175     <th scope="col" class="check-column"><input type="checkbox" onclick="checkAll(document.getElementById('posts-filter'));" /></th>
     175    <th scope="col" class="check-column"><input type="checkbox" /></th>
    176176        <th scope="col"><?php _e('Name') ?></th>
    177177        <th scope="col" class="num" style="width: 90px"><?php _e('Posts') ?></th>
  • trunk/wp-admin/includes/template.php

    r7739 r7745  
    280280function wp_manage_posts_columns() {
    281281    $posts_columns = array();
    282     $posts_columns['cb'] = '<input type="checkbox" onclick="checkAll(document.getElementById(\'posts-filter\'));" />';
     282    $posts_columns['cb'] = '<input type="checkbox" />';
    283283    if ( 'draft' === $_GET['post_status'] )
    284284        $posts_columns['modified'] = __('Modified');
     
    302302function wp_manage_media_columns() {
    303303    $posts_columns = array();
    304     $posts_columns['cb'] = '<input type="checkbox" onclick="checkAll(document.getElementById(\'posts-filter\'));" />';
     304    $posts_columns['cb'] = '<input type="checkbox" />';
    305305    $posts_columns['icon'] = '';
    306306    $posts_columns['media'] = _c('Media|media column header');
     
    317317function wp_manage_pages_columns() {
    318318    $posts_columns = array();
    319     $posts_columns['cb'] = '<input type="checkbox" onclick="checkAll(document.getElementById(\'posts-filter\'));" />';
     319    $posts_columns['cb'] = '<input type="checkbox" />';
    320320    if ( 'draft' === $_GET['post_status'] )
    321321        $posts_columns['modified'] = __('Modified');
  • trunk/wp-admin/js/forms.js

    r7371 r7745  
    1 function checkAll(form) {
    2     for (i = 0, n = form.elements.length; i < n; i++) {
    3         if(form.elements[i].type == "checkbox" && !(form.elements[i].getAttribute('onclick',2))) {
    4             if(form.elements[i].checked == true)
    5                 form.elements[i].checked = false;
    6             else
    7                 form.elements[i].checked = true;
    8         }
    9     }
     1function checkAll(jQ) { // use attr( checked, fn )
     2    jQuery(jQ).find( 'tbody :checkbox' ).attr( 'checked', function() {
     3        return jQuery(this).attr( 'checked' ) ? '' : 'checked';
     4    } );
    105}
    116
    12 function getNumChecked(form) {
    13     var num = 0;
    14     for (i = 0, n = form.elements.length; i < n; i++) {
    15         if (form.elements[i].type == "checkbox") {
    16             if (form.elements[i].checked == true)
    17                 num++;
     7jQuery( function($) {
     8    var lastClicked = false;
     9    $( 'tbody :checkbox' ).click( function(e) {
     10        if ( 'undefined' == e.shiftKey ) { return true; }
     11        if ( e.shiftKey ) {
     12            if ( !lastClicked ) { return true; }
     13            var checks = $( lastClicked ).parents( 'form:first' ).find( ':checkbox' );
     14            var first = checks.index( lastClicked );
     15            var last = checks.index( this );
     16            if ( 0 < first && 0 < last && first != last ) {
     17                checks.slice( first, last ).attr( 'checked', $( this ).is( ':checked' ) ? 'checked' : '' );
     18            }
    1819        }
    19     }
    20     return num;
    21 }
    22 
    23 function checkAllUsers(role) {
    24  var checkboxs = document.getElementsByTagName('input');
    25  for(var i = 0, inp; inp = checkboxs[i]; i++)
    26     if(inp.type.toLowerCase() == 'checkbox' && inp.className == role)
    27         if(inp.checked == false)
    28             inp.checked = true;
    29         else
    30             inp.checked = false;
    31 }
     20        lastClicked = this;
     21        return true;
     22    } );
     23    $( 'thead :checkbox' ).click( function() {
     24        checkAll( $(this).parents( 'form:first' ) );
     25    } );
     26} );
  • trunk/wp-admin/link-manager.php

    r7412 r7745  
    142142    <thead>
    143143    <tr>
    144     <th scope="col" class="check-column"><input type="checkbox" onclick="checkAll(document.getElementById('posts-filter'));" /></th>
     144    <th scope="col" class="check-column"><input type="checkbox" /></th>
    145145<?php foreach($link_columns as $column_display_name) {
    146146    echo $column_display_name;
  • trunk/wp-admin/users.php

    r7660 r7745  
    331331<thead>
    332332<tr class="thead">
    333     <th scope="col" class="check-column"><input type="checkbox" onclick="checkAll(document.getElementById('posts-filter'));" /> </th>
     333    <th scope="col" class="check-column"><input type="checkbox" /></th>
    334334    <th><?php _e('Username') ?></th>
    335335    <th><?php _e('Name') ?></th>
  • trunk/wp-includes/script-loader.php

    r7720 r7745  
    132132            ) );
    133133            $this->add( 'admin-users', '/wp-admin/js/users.js', array('wp-lists'), '20070823' );
    134             $this->add( 'admin-forms', '/wp-admin/js/forms.js', false, '20080317' );
     134            $this->add( 'admin-forms', '/wp-admin/js/forms.js', false, '20080401');
    135135            $this->add( 'xfn', '/wp-admin/js/xfn.js', false, '3517' );
    136136            $this->add( 'upload', '/wp-admin/js/upload.js', array('jquery'), '20070518' );
Note: See TracChangeset for help on using the changeset viewer.