Changeset 8150
- Timestamp:
- 06/20/08 21:03:18 (5 months ago)
- Files:
-
- branches/crazyhorse/wp-admin/includes/dashboard.php (modified) (3 diffs)
- branches/crazyhorse/wp-admin/post.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/crazyhorse/wp-admin/includes/dashboard.php
r8143 r8150 38 38 39 39 // QuickPress Widget 40 if ( 'post' === strtolower( $_SERVER['REQUEST_METHOD'] ) && isset( $_POST['action'] ) && 0 === strpos( $_POST['action'], 'post-quickpress' ) ) { 41 $view = get_permalink( $_POST['post_ID'] ); 42 $edit = clean_url( get_edit_post_link( $_POST['post_ID'] ) ); 43 if ( 'post-quickpress-publish' == $_POST['action'] ) 44 $notice = sprintf( __( 'Post Published. <a href="%s">View post</a> | <a href="%s">Edit post</a>' ), clean_url( $view ), $edit ); 45 else 46 $notice = sprintf( __( 'Draft Saved. <a href="%s">Preview post</a> | <a href="%s">Edit post</a>' ), clean_url( add_query_arg( 'preview', 1, $view ) ), $edit ); 47 } else { 48 $notice = ''; 49 } 40 50 wp_register_sidebar_widget( 'dashboard_quick_press', __( 'QuickPress' ), 'wp_dashboard_quick_press', 41 array( 'width' => 'half', 'height' => 'double' )51 array( 'width' => 'half', 'height' => 'double', 'notice' => $notice ) 42 52 ); 43 53 … … 298 308 299 309 <p class="submit"> 300 <input type="hidden" name="action" value="post-quickpress" />310 <input type="hidden" name="action" id="quickpost-action" value="post-quickpress-save" /> 301 311 <?php wp_nonce_field('add-post'); ?> 302 312 <input type="submit" name="save" id="save-post" class="button" value="<?php _e('Save'); ?>" /> … … 347 357 /* <![CDATA[ */ 348 358 var quickPressLoad = function($) { 359 var act = $('#quickpost-action'); 349 360 var t = $('#quick-press').submit( function() { 350 t.load( t.attr( 'action' ) + ' #quick-press', t.serializeArray(), function() { 361 var head = $('#dashboard_quick_press div.dashboard-widget').children( 'div').hide().end().children('h3'); 362 head.html( '<span>' + head.html() + '</span><img src="images/loading.gif" style="margin-top: 6px; float: right" /><br class="clear" />' ); 363 364 if ( 'post' == act.val() ) { act.val( 'post-quickpress-publish' ); } 365 366 if ( 'undefined' != typeof tinyMCE ) { 367 tinyMCE.get('quickpress-content').save(); 368 tinyMCE.get('quickpress-content').remove(); 369 } 370 371 $('#dashboard_quick_press').load( t.attr( 'action' ) + ' #dashboard_quick_press div.dashboard-widget', t.serializeArray(), function() { 372 if ( 'undefined' != typeof wpTeenyMCEInit && $.isFunction( wpTeenyMCEInit ) ) { wpTeenyMCEInit(); } 351 373 quickPressLoad($); 352 if ( 'undefined' != typeof wpTeenyMCEInit && $.isFunction( wpTeenyMCEInit ) ) { wpTeenyMCEInit(); }353 374 } ); 354 375 return false; 355 376 } ); 356 $('#publish').click( function() { t.append( "<input type='hidden' name='publish' value='publish' />" ); } ); 377 378 $('#publish').click( function() { act.val( 'post-quickpress-publish' ); } ); 357 379 }; 358 380 jQuery( quickPressLoad ); branches/crazyhorse/wp-admin/post.php
r8143 r8150 58 58 59 59 switch($action) { 60 case 'post-quickpress':61 require_once(ABSPATH . 'wp-admin/includes/dashboard.php');62 add_filter( 'wp_dashboard_widgets', create_function( '$a', 'return array( "dashboard_quick_press" );' ) );63 wp_dashboard_setup();64 wp_dashboard();65 // no break66 60 case 'postajaxpost': 67 61 case 'post': 62 case 'post-quickpress-publish': 63 case 'post-quickpress-save': 68 64 check_admin_referer('add-post'); 65 66 if ( 'post-quickpress-publish' == $action ) 67 $_POST['publish'] = 'publish'; // tell write_post() to publish 69 68 70 69 $post_ID = 'postajaxpost' == $action ? edit_post() : write_post(); 71 70 72 if ( 'post-quickpress' !== $action ) 73 redirect_post($post_ID); 71 if ( 0 === strpos( $action, 'post-quickpress' ) ) { 72 $_POST['post_ID'] = $post_ID; 73 // output the quickpress dashboard widget 74 require_once(ABSPATH . 'wp-admin/includes/dashboard.php'); 75 add_filter( 'wp_dashboard_widgets', create_function( '$a', 'return array( "dashboard_quick_press" );' ) ); 76 wp_dashboard_setup(); 77 wp_dashboard(); 78 exit; 79 } 80 81 redirect_post($post_ID); 74 82 exit(); 75 83 break;
