Changeset 14815
- Timestamp:
- 05/23/2010 07:58:06 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/dashboard.php
r14582 r14815 384 384 } 385 385 386 function wp_dashboard_quick_press() { 386 function wp_dashboard_quick_press_output() { 387 global $post_ID; 388 387 389 $drafts = false; 388 390 if ( 'post' === strtolower( $_SERVER['REQUEST_METHOD'] ) && isset( $_POST['action'] ) && 0 === strpos( $_POST['action'], 'post-quickpress' ) && (int) $_POST['post_ID'] ) { … … 391 393 if ( 'post-quickpress-publish' == $_POST['action'] ) { 392 394 if ( current_user_can('publish_posts') ) 393 printf( '<div class=" message"><p>' . __( 'Post Published. <a href="%s">View post</a> | <a href="%s">Edit post</a>' ) . '</p></div>', esc_url( $view ), $edit );395 printf( '<div class="updated"><p>' . __( 'Post published. <a href="%s">View post</a> | <a href="%s">Edit post</a>' ) . '</p></div>', esc_url( $view ), $edit ); 394 396 else 395 printf( '<div class=" message"><p>' . __( 'Post submitted. <a href="%s">Preview post</a> | <a href="%s">Edit post</a>' ) . '</p></div>', esc_url( add_query_arg( 'preview', 1, $view ) ), $edit );397 printf( '<div class="updated"><p>' . __( 'Post submitted. <a href="%s">Preview post</a> | <a href="%s">Edit post</a>' ) . '</p></div>', esc_url( add_query_arg( 'preview', 1, $view ) ), $edit ); 396 398 } else { 397 printf( '<div class=" message"><p>' . __( 'Draft Saved. <a href="%s">Preview post</a> | <a href="%s">Edit post</a>' ) . '</p></div>', esc_url( add_query_arg( 'preview', 1, $view ) ), $edit );399 printf( '<div class="updated"><p>' . __( 'Draft saved. <a href="%s">Preview post</a> | <a href="%s">Edit post</a>' ) . '</p></div>', esc_url( add_query_arg( 'preview', 1, $view ) ), $edit ); 398 400 $drafts_query = new WP_Query( array( 399 401 'post_type' => 'post', … … 408 410 $drafts =& $drafts_query->posts; 409 411 } 410 printf('<p class="textright">' . __('You can also try %s, easy blogging from anywhere on the Web.') . '</p>', '<a href=" tools.php">' . __('Press This') . '</a>' );412 printf('<p class="textright">' . __('You can also try %s, easy blogging from anywhere on the Web.') . '</p>', '<a href="' . esc_url( admin_url( 'tools.php' ) ) . '">' . __('Press This') . '</a>' ); 411 413 $_REQUEST = array(); // hack for get_default_post_to_edit() 412 414 } 413 415 414 $post = get_default_post_to_edit(); 416 /* Check if a new auto-draft (= no new post_ID) is needed or if the old can be used */ 417 $last_post_id = (int) get_user_option( 'dashboard_quick_press_last_post_id' ); // Get the last post_ID 418 if ( $last_post_id ) { 419 $post = get_post( $last_post_id ); 420 if ( empty( $post ) || $post->post_status != 'auto-draft' ) { // auto-draft doesn't exists anymore 421 $post = get_default_post_to_edit('post', true); 422 update_user_option( (int) $GLOBALS['current_user']->ID, 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID 423 } else { 424 $post->post_title = ''; // Remove the auto draft title 425 } 426 } else { 427 $post = get_default_post_to_edit('post', true); 428 update_user_option( (int) $GLOBALS['current_user']->ID, 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID 429 } 430 431 $post_ID = (int) $post->ID; 415 432 ?> 416 433 … … 441 458 <p class="submit"> 442 459 <input type="hidden" name="action" id="quickpost-action" value="post-quickpress-save" /> 443 <input type="hidden" name="quickpress_post_ID" value="<?php echo (int) $post->ID; ?>" />460 <input type="hidden" name="quickpress_post_ID" value="<?php echo $post_ID; ?>" /> 444 461 <input type="hidden" name="post_type" value="post" /> 445 462 <?php wp_nonce_field('add-post'); ?> … … 458 475 if ( $drafts ) 459 476 wp_dashboard_recent_drafts( $drafts ); 477 } 478 479 function wp_dashboard_quick_press() { 480 echo '<p class="widget-loading hide-if-no-js">' . __( 'Loading…' ) . '</p><p class="describe hide-if-js">' . __('This widget requires JavaScript.') . '</p>'; 460 481 } 461 482 -
trunk/wp-admin/index-extra.php
r14139 r14815 33 33 wp_dashboard_plugins_output(); 34 34 break; 35 36 case 'dashboard_quick_press' : 37 wp_dashboard_quick_press_output(); 38 break; 35 39 36 40 } -
trunk/wp-admin/js/dashboard.dev.js
r13085 r14815 7 7 'dashboard_primary', 8 8 'dashboard_secondary', 9 'dashboard_plugins' 9 'dashboard_plugins', 10 'dashboard_quick_press' 10 11 ]; 11 12 … … 21 22 if ( 'dashboard_plugins' == id && $.isFunction(tb_init) ) 22 23 tb_init('#dashboard_plugins a.thickbox'); 24 if ( 'dashboard_quick_press' == id && $.isFunction(tb_init) ) { 25 tb_init('#dashboard_quick_press a.thickbox'); 26 quickPressLoad(); 27 } 23 28 }); 24 29 }); … … 54 59 $('#dashboard_quick_press #publishing-action img.waiting').css('visibility', 'hidden'); 55 60 $('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').attr('disabled',''); 61 $('#dashboard_quick_press ul').next('p').remove(); 56 62 $('#dashboard_quick_press ul').find('li').each( function() { 57 63 $('#dashboard_recent_drafts ul').prepend( this ); … … 66 72 67 73 }; 68 quickPressLoad();69 74 70 75 } ); -
trunk/wp-admin/js/dashboard.js
r13085 r14815 1 var ajaxWidgets,ajaxPopulateWidgets,quickPressLoad;jQuery(document).ready(function(a){ajaxWidgets=["dashboard_incoming_links","dashboard_primary","dashboard_secondary","dashboard_plugins" ];ajaxPopulateWidgets=function(b){show=function(g,c){var f,d=a("#"+g+" div.inside:visible").find(".widget-loading");if(d.length){f=d.parent();setTimeout(function(){f.load("index-extra.php?jax="+g,"",function(){f.hide().slideDown("normal",function(){a(this).css("display","");if("dashboard_plugins"==g&&a.isFunction(tb_init)){tb_init("#dashboard_plugins a.thickbox")}})})},c*500)}};if(b){b=b.toString();if(a.inArray(b,ajaxWidgets)!=-1){show(b,0)}}else{a.each(ajaxWidgets,function(c){show(this,c)})}};ajaxPopulateWidgets();postboxes.add_postbox_toggles("dashboard",{pbshow:ajaxPopulateWidgets});quickPressLoad=function(){var b=a("#quickpost-action"),c;c=a("#quick-press").submit(function(){a("#dashboard_quick_press #publishing-action img.waiting").css("visibility","visible");a('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').attr("disabled","disabled");if("post"==b.val()){b.val("post-quickpress-publish")}a("#dashboard_quick_press div.inside").load(c.attr("action"),c.serializeArray(),function(){a("#dashboard_quick_press #publishing-action img.waiting").css("visibility","hidden");a('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').attr("disabled","");a("#dashboard_quick_press ul").find("li").each(function(){a("#dashboard_recent_drafts ul").prepend(this)}).end().remove();tb_init("a.thickbox");quickPressLoad()});return false});a("#publish").click(function(){b.val("post-quickpress-publish")})};quickPressLoad()});1 var ajaxWidgets,ajaxPopulateWidgets,quickPressLoad;jQuery(document).ready(function(a){ajaxWidgets=["dashboard_incoming_links","dashboard_primary","dashboard_secondary","dashboard_plugins","dashboard_quick_press"];ajaxPopulateWidgets=function(b){show=function(g,c){var f,d=a("#"+g+" div.inside:visible").find(".widget-loading");if(d.length){f=d.parent();setTimeout(function(){f.load("index-extra.php?jax="+g,"",function(){f.hide().slideDown("normal",function(){a(this).css("display","");if("dashboard_plugins"==g&&a.isFunction(tb_init)){tb_init("#dashboard_plugins a.thickbox")}if("dashboard_quick_press"==g&&a.isFunction(tb_init)){tb_init("#dashboard_quick_press a.thickbox");quickPressLoad()}})})},c*500)}};if(b){b=b.toString();if(a.inArray(b,ajaxWidgets)!=-1){show(b,0)}}else{a.each(ajaxWidgets,function(c){show(this,c)})}};ajaxPopulateWidgets();postboxes.add_postbox_toggles("dashboard",{pbshow:ajaxPopulateWidgets});quickPressLoad=function(){var b=a("#quickpost-action"),c;c=a("#quick-press").submit(function(){a("#dashboard_quick_press #publishing-action img.waiting").css("visibility","visible");a('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').attr("disabled","disabled");if("post"==b.val()){b.val("post-quickpress-publish")}a("#dashboard_quick_press div.inside").load(c.attr("action"),c.serializeArray(),function(){a("#dashboard_quick_press #publishing-action img.waiting").css("visibility","hidden");a('#quick-press .submit input[type="submit"], #quick-press .submit input[type="reset"]').attr("disabled","");a("#dashboard_quick_press ul").next("p").remove();a("#dashboard_quick_press ul").find("li").each(function(){a("#dashboard_recent_drafts ul").prepend(this)}).end().remove();tb_init("a.thickbox");quickPressLoad()});return false});a("#publish").click(function(){b.val("post-quickpress-publish")})}}); -
trunk/wp-admin/post.php
r14585 r14815 132 132 // output the quickpress dashboard widget 133 133 require_once(ABSPATH . 'wp-admin/includes/dashboard.php'); 134 wp_dashboard_quick_press ();134 wp_dashboard_quick_press_output(); 135 135 exit; 136 136 } -
trunk/wp-includes/script-loader.php
r14799 r14815 361 361 $scripts->add( 'farbtastic', '/wp-admin/js/farbtastic.js', array('jquery'), '1.2' ); 362 362 363 $scripts->add( 'dashboard', "/wp-admin/js/dashboard$suffix.js", array( 'jquery', 'admin-comments', 'postbox' ), '20100 213' );363 $scripts->add( 'dashboard', "/wp-admin/js/dashboard$suffix.js", array( 'jquery', 'admin-comments', 'postbox' ), '20100523' ); 364 364 $scripts->add_data( 'dashboard', 'group', 1 ); 365 365
Note: See TracChangeset
for help on using the changeset viewer.