Ticket #3824: dashboard-users-01.diff
File dashboard-users-01.diff, 8.5 KB (added by , 18 years ago) |
---|
-
wp-admin/admin-ajax.php
201 201 die('1'); // We know meta exists; we also know it's unchanged (or DB error, in which case there are bigger problems). 202 202 break; 203 203 case 'add-user' : 204 if ( !current_user_can('edit_users') ) 205 die('-1'); 204 if ( !current_user_can('edit_users') ) { 205 $x = new WP_Ajax_Response( array( 206 'what' => 'user', 207 'data' => new WP_Error( 'add_user', __( 'You are not allowed to add users to this blog.' ) ) 208 ) ); 209 $x->send(); 210 break; 211 } 206 212 require_once(ABSPATH . WPINC . '/registration.php'); 207 if ( !$user_id = add_user() ) 208 die('0'); 213 if ( !$user_id = add_user() ) { 214 $x = new WP_Ajax_Response( array( 215 'what' => 'user', 216 'data' => new WP_Error( 'add_user', __( 'Something strange happened. Try refreshing the page.' ) ) 217 ) ); 218 $x->send(); 219 break; 220 } 209 221 elseif ( is_wp_error( $user_id ) ) { 210 foreach( $user_id->get_error_messages() as $message ) 211 echo "<p>$message<p>"; 212 exit; 222 $x = new WP_Ajax_Response( array( 223 'what' => 'user', 224 'data' => $user_id 225 ) ); 226 $x->send(); 227 break; 213 228 } 214 229 $user_object = new WP_User( $user_id ); 215 230 $x = new WP_Ajax_Response( array( … … 220 235 ) ); 221 236 $x->send(); 222 237 break; 238 223 239 case 'autosave' : // The name of this action is hardcoded in edit_post() 224 240 $_POST['post_content'] = $_POST['content']; 225 241 $_POST['post_excerpt'] = $_POST['excerpt']; -
wp-admin/admin-header.php
21 21 <?php if ( ('rtl' == $wp_locale->text_direction) ) : ?> 22 22 <link rel="stylesheet" href="<?php echo get_option('siteurl') ?>/wp-admin/rtl.css?version=<?php bloginfo('version'); ?>" type="text/css" /> 23 23 <?php endif; ?> 24 <script type="text/javascript">25 //<![CDATA[26 function addLoadEvent(func) {if ( typeof wpOnload!='function'){wpOnload=func;}else{ var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}27 //]]>28 </script>29 24 <?php if ( ($parent_file != 'link-manager.php') && ($parent_file != 'options-general.php') ) : ?> 30 25 <style type="text/css">* html { overflow-x: hidden; }</style> 31 26 <?php endif; -
wp-admin/admin.php
28 28 29 29 wp_reset_vars(array('profile', 'redirect', 'redirect_url', 'a', 'popuptitle', 'popupurl', 'text', 'trackback', 'pingback')); 30 30 31 wp_enqueue_script( 'jqwp' ); 31 32 wp_enqueue_script( 'fat' ); 32 33 33 34 $editing = false; -
wp-admin/index.php
4 4 function index_js() { 5 5 ?> 6 6 <script type="text/javascript"> 7 Event.observe( window, 'load', dashboard_init, false ); 8 function dashboard_init() { 9 var update1 = new Ajax.Updater( 'incominglinks', 'index-extra.php?jax=incominglinks' ); 10 var update2 = new Ajax.Updater( 'devnews', 'index-extra.php?jax=devnews' ); 11 var update3 = new Ajax.Updater( 'planetnews', 'index-extra.php?jax=planetnews' ); 12 } 7 jQuery( function() { 8 jQuery( '#incominglinks' ).load( 'index-extra.php?jax=incominglinks' ); 9 jQuery( '#devnews' ).load( 'index-extra.php?jax=devnews' ); 10 jQuery( '#planetnews' ).load( 'index-extra.php?jax=planetnews' ); 11 } ); 13 12 </script> 14 13 <?php 15 14 } 16 15 add_action( 'admin_head', 'index_js' ); 17 wp_enqueue_script('prototype');18 wp_enqueue_script('interface');19 16 20 17 $title = __('Dashboard'); 21 18 $parent_file = 'index.php'; -
wp-admin/users-js.php
1 <?php 2 @require_once('../wp-config.php'); 3 cache_javascript_headers(); 4 ?> 5 jQuery( function() { 6 jQuery( '#adduser' ).submit( function() { 7 var $role = jQuery( '#role-' + jQuery( '#role :selected' ).attr( 'value' ) ); 8 if( 0 == $role.length ) { 9 //html look and feel 10 return true; 11 } 12 else { 13 //ajax look and feel 14 jQuery(this) 15 .ajaxSubmit( { 16 url: 'admin-ajax.php', 17 dataType: 'XML', 18 beforeSubmit: function( data ) { 19 for( var i = 0, top = data.length; i < top; i++ ) { 20 if( data[ i ].name == 'action' ) { 21 data[ i ].value = 'add-user'; 22 break; 23 } 24 } 25 data.push( { name: 'cookie', value: encodeURIComponent(document.cookie) } ); 26 return true; 27 }, 28 success: function( responseXML ) { 29 var data = jQuery.wp.cdata( "wp_error", responseXML ); 30 if( 0 == data.length ) { 31 data = jQuery.wp.cdata( "response_data", responseXML ); 32 if( data[0] && ( '' != data[0] ) ) { 33 var $item = jQuery( data[0] ).appendTo( $role ); 34 if( $item.prev().attr( 'class' ) != 'alternate' ) { 35 $item.attr( 'class', 'alternate' ); 36 } 37 jQuery( '#adduser' ).resetForm(); 38 jQuery( '#ajax-response' ).html( '' ); 39 } 40 else { 41 if( isNaN( responseXML ) ) { 42 jQuery( '#ajax-response' ) 43 .html( "<div class='error'><p>" + responseXML + "</p></div>" ); 44 } 45 var r = parseInt( responseXML, 10 ); 46 if( -1 == r ) { 47 jQuery( '#ajax-response' ) 48 .html( "<div class='error'><p><?php _e("You don't have permission to do that."); ?></p></div>" ); 49 } 50 else if( 0 == r ) { 51 jQuery( '#ajax-response' ) 52 .html( "<div class='error'><p><?php _e("Something strange happened. Try refreshing the page."); ?></p></div>" ); 53 } 54 } 55 } 56 else { 57 jQuery( '#ajax-response' ) 58 .html( "<div class='error'><p>" + data.join( "</p><p>" ) + "</p></div>" ); 59 } 60 } 61 } ); 62 return false; 63 } 64 } ); 65 } ) -
wp-includes/js/jquery/wp-glue.js
1 /* 2 this file glues jQuery to WordPress 3 */ 4 5 //jQuery can coexist with other $ libraries 6 jQuery.noConflict(); 7 8 //the call of addLoadEvent( function ) and its semantics are the same as jQuery( function ) 9 addLoadEvent = jQuery; 10 11 jQuery.wp = { 12 cdata: function( elementToFind, xml ) { 13 var data = []; 14 var re = /\<([\w-]+)(?:\w|\W)*?\>\<\!\[CDATA\[((?:\w|\W)*?)\]\]\>\<\/\1\s*\>/ig; 15 xml.replace( re, function( all, elementFound, content ) { 16 if( elementFound == elementToFind ) { 17 data.push( content ); 18 } 19 } ); 20 return data; 21 } 22 }; -
wp-includes/script-loader.php
30 30 $this->add( 'scriptaculous-controls', '/wp-includes/js/scriptaculous/controls.js', array('scriptaculous-root'), '1.7.0'); 31 31 $this->add( 'scriptaculous', '', array('scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls'), '1.7.0'); 32 32 $this->add( 'cropper', '/wp-includes/js/crop/cropper.js', array('scriptaculous-dragdrop'), '20070118'); 33 $this->add( 'jquery', '/wp-includes/js/jquery/jquery.js', false, '1.1.1'); 34 $this->add( 'interface', '/wp-includes/js/jquery/interface.js', array('jquery'), '1.1.1'); 33 $this->add( 'jquery', '/wp-includes/js/jquery/jquery-latest.pack.js', false, '1.1.2'); 34 $this->add( 'jqwp', '/wp-includes/js/jquery/wp-glue.js', array( 'jquery' ), '20070303' ); 35 $this->add( 'jqform', '/wp-includes/js/jquery/jquery.form.js', array( 'jqwp' ), '0.9' ); 35 36 if ( is_admin() ) { 36 37 $this->add( 'dbx-admin-key', '/wp-admin/dbx-admin-key-js.php', array('dbx'), '3651' ); 37 38 $this->add( 'ajaxcat', '/wp-admin/cat-js.php', array('listman'), '20070118' ); 38 39 $this->add( 'admin-categories', '/wp-admin/categories.js', array('listman'), '3684' ); 39 40 $this->add( 'admin-custom-fields', '/wp-admin/custom-fields.js', array('listman'), '3733' ); 40 41 $this->add( 'admin-comments', '/wp-admin/edit-comments.js', array('listman'), '3847' ); 41 $this->add( 'admin-users', '/wp-admin/users .js', array('listman'), '4583' );42 $this->add( 'admin-users', '/wp-admin/users-js.php', array('jqform'), '20070301' ); 42 43 $this->add( 'xfn', '/wp-admin/xfn.js', false, '3517' ); 43 44 $this->add( 'upload', '/wp-admin/upload-js.php', array('prototype'), '20070118' ); 44 45 }