Make WordPress Core

Changeset 4583


Ignore:
Timestamp:
12/01/2006 11:00:04 PM (19 years ago)
Author:
ryan
Message:

Better AJAX feedback messages and markup fixes. Props mdawaffe. fixes #3208

Location:
trunk
Files:
8 edited

Legend:

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

    r4575 r4583  
    148148        'id' => $cat->cat_ID,
    149149        'data' => _cat_row( $cat, $level, $cat_full_name ),
    150         'supplemental' => array('name' => $cat_full_name)
     150        'supplemental' => array('name' => $cat_full_name, 'show-link' => sprintf(__( 'Category <a href="#%s">%s</a> added' ), "cat-$cat->cat_ID", $cat_full_name))
    151151    ) );
    152152    $x->send();
     
    212212        exit;
    213213    }
     214    $user_object = new WP_User( $user_id );
    214215    $x = new WP_Ajax_Response( array(
    215216        'what' => 'user',
    216217        'id' => $user_id,
    217         'data' => user_row( $user_id )
     218        'data' => user_row( $user_object ),
     219        'supplemental' => array('show-link' => sprintf(__( 'User <a href="#%s">%s</a> added' ), "user-$user_id", $user_object->user_login))
    218220    ) );
    219221    $x->send();
  • trunk/wp-admin/admin-functions.php

    r4577 r4583  
    815815        $r .= "<a href='edit.php?author=$user_object->ID' title='" . __( 'View posts by this author' ) . "' class='edit'>";
    816816        $r .= sprintf( __('View %1$s %2$s' ), $numposts, __ngettext( 'post', 'posts', $numposts ));
     817        $r .= '</a>';
    817818    }
    818819    $r .= "</td>\n\t\t<td>";
    819     $edit_link = add_query_arg( 'wp_http_referer', wp_specialchars( urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ) ), "user-edit.php?user_id=$user_object->ID" );
    820     if ( current_user_can( 'edit_user', $user_object->ID ) )
     820    if ( current_user_can( 'edit_user', $user_object->ID ) ) {
     821        $edit_link = wp_specialchars( add_query_arg( 'wp_http_referer', urlencode( stripslashes( $_SERVER['REQUEST_URI'] ) ), "user-edit.php?user_id=$user_object->ID" ) );
    821822        $r .= "<a href='$edit_link' class='edit'>".__( 'Edit' )."</a>";
     823    }
    822824    $r .= "</td>\n\t</tr>";
    823825    return $r;
  • trunk/wp-admin/edit-category-form.php

    r4495 r4583  
    1717<div class="wrap">
    1818<h2><?php echo $heading ?></h2>
     19<div id="ajax-response"></div>
    1920<?php echo $form ?>
    2021<input type="hidden" name="action" value="<?php echo $action ?>" />
     
    4243    </table>
    4344<p class="submit"><input type="submit" name="submit" value="<?php echo $submit_text ?>" /></p>
    44 <div id="ajax-response"></div>
    4545<?php do_action('edit_category_form', $category); ?>
    4646</form>
  • trunk/wp-admin/users.js

    r3684 r4583  
    33    theUserLists = new Array();
    44    for ( var l = 0; l < theListEls.length; l++ ) {
    5         theUserLists[theListEls[l].id] = new listMan(theListEls[l].id);
     5        if ( theListEls[l].id )
     6            theUserLists[theListEls[l].id] = new listMan(theListEls[l].id);
    67    }
    78    addUserInputs = document.getElementById('adduser').getElementsByTagName('input');
  • trunk/wp-admin/users.php

    r4559 r4583  
    377377    uksort($roleclass, "strnatcasecmp");
    378378?>
    379 
     379<tbody>
    380380<tr>
    381381<?php if ( !empty($role) ) : ?>
     
    393393    <th colspan="2" style="text-align: center"><?php _e('Actions') ?></th>
    394394</tr>
    395 </thead>
     395</tbody>
    396396<tbody id="role-<?php echo $role; ?>"><?php
    397397$style = '';
     
    438438<div class="wrap">
    439439<h2 id="add-new-user"><?php _e('Add New User') ?></h2>
     440
     441<?php if ( is_wp_error( $add_user_errors ) ) : ?>
     442    <div class="error">
     443        <?php
     444            foreach ( $add_user_errors->get_error_messages() as $message )
     445                echo "<p>$message</p>";
     446        ?>
     447    </div>
     448<?php endif; ?>
     449<div id="ajax-response"></div>
     450
    440451<div class="narrow">
     452
    441453<?php echo '<p>'.sprintf(__('Users can <a href="%1$s">register themselves</a> or you can manually create users here.'), get_option('siteurl').'/wp-register.php').'</p>'; ?>
    442454<form action="#add-new-user" method="post" name="adduser" id="adduser">
     
    489501    <input name="adduser" type="submit" id="addusersub" value="<?php _e('Add User &raquo;') ?>" />
    490502</p>
     503</form>
     504
    491505</div>
    492 </form>
    493 
    494 <?php if ( is_wp_error( $add_user_errors ) ) : ?>
    495     <div class="error">
    496         <?php
    497             foreach ( $add_user_errors->get_error_messages() as $message )
    498                 echo "<p>$message</p>";
    499         ?>
    500     </div>
    501 <?php endif; ?>
    502 <div id="ajax-response"></div>
    503506</div>
    504507
  • trunk/wp-includes/category-template.php

    r4580 r4583  
    181181    $output = '';
    182182    if ( ! empty($categories) ) {
    183         $output = "<select name='$name' class='$class'>\n";
     183        $output = "<select name='$name' id='$name' class='$class'>\n";
    184184
    185185        if ( $show_option_all ) {
  • trunk/wp-includes/js/list-manipulation-js.php

    r4535 r4583  
    3838            var newItems = $A(transport.responseXML.getElementsByTagName(what));
    3939            if ( newItems ) {
     40                var showLinkMessage = '';
     41                var m = '';
    4042                newItems.each( function(i) {
    4143                    var id = i.getAttribute('id');
     
    4547                    else
    4648                        tempObj.addListItem( getNodeValue(i, 'response_data') );
    47                     if ( tempObj.showLink )
    48                         tempObj.showLink = id;
     49                    m = getNodeValue(i, 'show-link');
     50                    showLinkMessage += showLinkMessage ? "<br />\n" : '';
     51                    if ( m )
     52                        showLinkMessage += m;
     53                    else
     54                        showLinkMessage += "<a href='#" + what + '-' + id + "'><?php echo js_escape(__('Jump to new item')); ?>";
    4955                });
    50                 ajaxAdd.myResponseElement.update(tempObj.showLink ? ( "<div id='jumplink' class='updated fade'><p><a href='#" + what + '-' + tempObj.showLink + "'><?php js_escape(__('Jump to new item')); ?></a></p></div>" ) : '');
     56                if ( tempObj.showLink && showLinkMessage )
     57                    ajaxAdd.myResponseElement.update("<div id='jumplink' class='updated fade'><p>" + showLinkMessage + "</p></div>");
    5158            }
    5259            if ( tempObj.addComplete && typeof tempObj.addComplete == 'function' )
  • trunk/wp-includes/script-loader.php

    r4566 r4583  
    2222        $this->add( 'autosave', '/wp-includes/js/autosave.js.php', array('prototype', 'sack'), '4508');
    2323        $this->add( 'wp-ajax', '/wp-includes/js/wp-ajax-js.php', array('prototype'), '4459');
    24         $this->add( 'listman', '/wp-includes/js/list-manipulation-js.php', array('wp-ajax', 'fat'), '4459');
     24        $this->add( 'listman', '/wp-includes/js/list-manipulation-js.php', array('wp-ajax', 'fat'), '4583');
    2525        if ( is_admin() ) {
    2626            $this->add( 'dbx-admin-key', '/wp-admin/dbx-admin-key-js.php', array('dbx'), '3651' );
     
    2929            $this->add( 'admin-custom-fields', '/wp-admin/custom-fields.js', array('listman'), '3733' );
    3030            $this->add( 'admin-comments', '/wp-admin/edit-comments.js', array('listman'), '3847' );
    31             $this->add( 'admin-users', '/wp-admin/users.js', array('listman'), '3684' );
     31            $this->add( 'admin-users', '/wp-admin/users.js', array('listman'), '4583' );
    3232            $this->add( 'xfn', '/wp-admin/xfn.js', false, '3517' );
    33             $this->add( 'upload', '/wp-admin/upload-js.php', array('prototype'), '####' );
     33            $this->add( 'upload', '/wp-admin/upload-js.php', array('prototype'), '4535' );
    3434        }
    3535    }
Note: See TracChangeset for help on using the changeset viewer.