Changeset 8683

Show
Ignore:
Timestamp:
08/20/08 04:23:33 (3 months ago)
Author:
ryan
Message:

crazyhorse: Lose fixed bottom bar. Add submit meta box.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/crazyhorse/wp-admin/edit-form-advanced.php

    r8681 r8683  
    6464// All meta boxes should be defined and added before the first do_meta_boxes() call (or potentially during the do_meta_boxes action). 
    6565 
     66function post_submit_meta_box($post) { 
     67?> 
     68<div class="submitbox" id="submitpost"> 
     69 
     70<div id="previewview"> 
     71<?php if ( 'publish' == $post->post_status ) { ?> 
     72<a href="<?php echo clean_url(get_permalink($post->ID)); ?>" target="_blank" tabindex="4"><?php _e('View this Post'); ?></a> 
     73<?php } elseif ( 'edit' == $action ) { ?> 
     74<a href="<?php echo clean_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); ?>" target="_blank"  tabindex="4"><?php _e('Preview this Post'); ?></a> 
     75<?php } ?> 
     76</div> 
     77 
     78<div class="inside"> 
     79 
     80<p><strong><label for='post_status'><?php _e('Publish Status') ?></label></strong></p> 
     81<p> 
     82<select name='post_status' id='post_status' tabindex='4'> 
     83<?php 
     84// only show the publish menu item if they are allowed to publish posts or they are allowed to edit this post (accounts for 'edit_published_posts' capability) 
     85if ( current_user_can('publish_posts') OR ( $post->post_status == 'publish' AND current_user_can('edit_post', $post->ID) ) ) : 
     86?> 
     87<option<?php selected( $post->post_status, 'publish' ); selected( $post->post_status, 'private' );?> value='publish'><?php _e('Published') ?></option> 
     88<?php if ( 'future' == $post->post_status ) : ?> 
     89<option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option> 
     90<?php endif; ?> 
     91<?php endif; ?> 
     92<option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option> 
     93<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Unpublished') ?></option> 
     94</select> 
     95</p> 
     96 
     97<?php if ( current_user_can( 'publish_posts' ) ) : ?> 
     98<p id="private-checkbox"><label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="checkbox" value="private" <?php checked($post->post_status, 'private'); ?> tabindex="4" /> <?php _e('Keep this post private') ?></label></p> 
     99    <?php if ( current_user_can( 'edit_others_posts' ) ) : ?> 
     100        <p id="sticky-checkbox"><label for="sticky" class="selectit"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked(is_sticky($post->ID), true); ?> tabindex="4" /> <?php _e('Stick this post to the front page') ?></label></p> 
     101    <?php endif; ?> 
     102<?php endif; ?> 
     103<?php 
     104if ( 0 != $post->ID ) { 
     105    if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date 
     106        $stamp = __('Scheduled for:<br />%1$s at %2$s'); 
     107    } else if ( 'publish' == $post->post_status ) { // already published 
     108        $stamp = __('Published on:<br />%1$s at %2$s'); 
     109    } else if ( '0000-00-00 00:00:00' == $post->post_date ) { // draft, 1 or more saves, no date specified 
     110        $stamp = __('Publish immediately'); 
     111    } else { // draft, 1 or more saves, date specified 
     112        $stamp = __('Publish on:<br />%1$s at %2$s'); 
     113    } 
     114    $date = mysql2date(get_option('date_format'), $post->post_date); 
     115    $time = mysql2date(get_option('time_format'), $post->post_date); 
     116} else { // draft (no saves, and thus no date specified) 
     117    $stamp = __('Publish immediately'); 
     118    $date = mysql2date(get_option('date_format'), current_time('mysql')); 
     119    $time = mysql2date(get_option('time_format'), current_time('mysql')); 
     120} 
     121?> 
     122<?php if ( current_user_can( 'publish_posts' ) ) : // Contributors don't get to choose the date of publish ?> 
     123<p class="curtime"><?php printf($stamp, $date, $time); ?> 
     124&nbsp;<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a></p> 
     125 
     126<div id='timestampdiv' class='hide-if-js'><?php touch_time(($action == 'edit'),1,4); ?></div> 
     127<?php endif; ?> 
     128 
     129</div> 
     130 
     131<p class="submit"> 
     132<?php do_action('post_submitbox_start'); ?> 
     133<input type="submit" name="save" id="save-post" value="<?php _e('Save'); ?>" tabindex="4" class="button button-highlighted" /> 
     134<?php 
     135if ( !in_array( $post->post_status, array('publish', 'future') ) || 0 == $post->ID ) { 
     136?> 
     137<?php if ( current_user_can('publish_posts') ) : ?> 
     138    <input name="publish" type="submit" class="button" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" /> 
     139<?php else : ?> 
     140    <input name="publish" type="submit" class="button" id="publish" tabindex="5" accesskey="p" value="<?php _e('Submit for Review') ?>" /> 
     141<?php endif; ?> 
     142<?php 
     143} 
     144 
     145if ( ( 'edit' == $action) && current_user_can('delete_post', $post->ID) ) 
     146    echo "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "' onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n  'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n  'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete&nbsp;post') . "</a>"; 
     147?> 
     148<br class="clear" /> 
     149<?php if ( 0 != $post->ID ): ?> 
     150<?php if ( $last_id = get_post_meta($post->ID, '_edit_last', true) ) { 
     151    $last_user = get_userdata($last_id); 
     152    printf(__('Last edited by %1$s on %2$s at %3$s'), wp_specialchars( $last_user->display_name ), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified)); 
     153} else { 
     154    printf(__('Last edited on %1$s at %2$s'), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified)); 
     155} 
     156?> 
     157<br class="clear" /> 
     158<?php endif; ?> 
     159</p> 
     160</div> 
     161<?php 
     162} 
     163add_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', 'post', 'side', 'core'); 
     164 
    66165function post_tags_meta_box($post) { 
    67166?> 
     
    73172add_meta_box('tagsdiv', __('Tags'), 'post_tags_meta_box', 'post', 'side', 'core'); 
    74173 
    75 //crazyhorse 
    76174function post_media_meta_box($post) { 
    77175    echo "<p><small><em>This feature isn't fully functional in this prototype.</em></small></p>"; 
     
    441539 
    442540</div> 
    443 <br class="clear" /></div><!-- wpbody-content (fixedbar) --> 
    444  
    445 <div id="fixedbar"> 
    446 <table id="fixedbar-wrap"><tbody><tr> 
    447 <td id="preview-link">&nbsp; 
    448 <span> 
    449 <?php if ( 'publish' == $post->post_status ) { ?> 
    450 <a href="<?php echo clean_url(get_permalink($post->ID)); ?>" target="_blank" tabindex="4"><?php _e('View this Post'); ?></a> 
    451 <?php } elseif ( 'edit' == $action ) { ?> 
    452 <a href="<?php echo clean_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); ?>" target="_blank"  tabindex="4"><?php _e('Preview this Post'); ?></a> 
    453 <?php } ?> 
    454 </span> 
    455 </td> 
    456  
    457 <td id="submitpost" class="submitbox"> 
    458 <div id="post-time-info" class="alignleft"> 
    459 <?php 
    460     if ( current_user_can( 'publish_posts' ) ) : // Contributors don't get to choose the date of publish 
    461         $stamp = __( 'Timestamp: <span class="timestamp">%1$s%3$s</span>' ); 
    462         $edit = '&nbsp;(<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex="4">' . __('Change') . '</a>)'; 
    463         if ($post_ID) { 
    464             if ( '0000-00-00 00:00:00' == $post->post_date ) { // draft, 1 or more saves, no date specified 
    465                 $stamp = __( 'Timestamp: <span class="timestamp">Today, %1$s%3$s</span>' ); 
    466                 $date = mysql2date(get_option('date_format'), current_time('mysql')); 
    467                 $time = mysql2date(get_option('time_format'), current_time('mysql')); 
    468             } else { 
    469                 $date = mysql2date(get_option('date_format'), $post->post_date); 
    470                 $time = mysql2date(get_option('time_format'), $post->post_date); 
    471             } 
    472         } else { // draft (no saves, and thus no date specified) 
    473             $stamp = __( 'Timestamp: <span class="timestamp">Today, %1$s%3$s</span>' ); 
    474             $date = mysql2date(get_option('date_format'), current_time('mysql')); 
    475             $time = mysql2date(get_option('time_format'), current_time('mysql')); 
    476         } 
    477 ?> 
    478     <p id="curtime"><?php printf($stamp, $date, $time, $edit); ?></p> 
    479     <div id='timestampdiv' class='hide-if-js'><?php touch_time(($action == 'edit'),1,4); ?></div> 
    480  
    481 <?php 
    482     endif; 
    483 ?> 
    484 </div> 
    485 <p class="submit alignright"> 
    486 <?php 
    487  
    488     if ( ( 'edit' == $action ) && current_user_can('delete_post', $post_ID) ) 
    489         echo "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post_ID", 'delete-post_' . $post_ID) . "' onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n  'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n  'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete&nbsp;post') . "</a>"; 
    490     elseif ( 'edit' != $action ) 
    491         echo "<a class='submitdelete' href='index.php' onclick=\"if ( confirm('" . js_escape( __("You are about to delete this post\n  'Cancel' to stop, 'OK' to delete.")) . "') ) { return true;}return false;\">" . __('Cancel&nbsp;post') . "</a>"; 
    492 ?> 
    493  
    494     <input type="submit" name="save" id="save-post" value="<?php _e('Save'); ?>" tabindex="4" class="button button-highlighted" /> 
    495  
    496 <?php 
    497     if ( !in_array( $post->post_status, array('publish', 'future') ) || 0 == $post_ID ) : 
    498         if ( current_user_can('publish_posts') ) : 
    499 ?> 
    500  
    501     <input name="publish" type="submit" class="button" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" /> 
    502  
    503 <?php   else : ?> 
    504  
    505     <input name="publish" type="submit" class="button" id="publish" tabindex="5" accesskey="p" value="<?php _e('Submit for Review') ?>" /> 
    506  
    507 <?php 
    508  
    509         endif; 
    510     endif; 
    511  
    512 ?> 
    513 </p> 
    514 </td></tr></tbody></table> 
     541<br class="clear" /> 
    515542</div> 
    516543