Changeset 8684

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

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

Files:

Legend:

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

    r8681 r8684  
    5858 
    5959<?php 
     60function page_submit_meta_box($post){ 
     61?> 
     62<div class="submitbox" id="submitpage"> 
     63 
     64<div id="previewview"> 
     65<?php if ( 'publish' == $post->post_status ) { ?> 
     66<a href="<?php echo clean_url(get_permalink($post->ID)); ?>" target="_blank"  tabindex="4"><?php _e('View this Page'); ?></a> 
     67<?php } elseif ( 'edit' == $action ) { ?> 
     68<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 Page'); ?></a> 
     69<?php } ?> 
     70</div> 
     71 
     72<div class="inside"> 
     73<p><strong><label for='post_status'><?php _e('Publish Status') ?></label></strong></p> 
     74<p> 
     75<select name='post_status' tabindex='4' id='post_status'> 
     76<?php // Show publish in dropdown if user can publish or if they can re-publish this page ('edit_published_pages') 
     77// 'publish' option will be selected for published AND private posts (checkbox overrides dropdown) 
     78if ( current_user_can('publish_pages') OR ( $post->post_status == 'publish' AND current_user_can('edit_page', $post->ID) ) ) : 
     79?> 
     80<option<?php selected( $post->post_status, 'publish' ); selected( $post->post_status, 'private' );?> value='publish'><?php _e('Published') ?></option> 
     81<?php endif; ?> 
     82<?php if ( 'future' == $post->post_status ) : ?> 
     83<option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Pending') ?></option> 
     84<?php endif; ?> 
     85<option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option> 
     86<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Unpublished') ?></option> 
     87</select> 
     88</p> 
     89<?php if ( current_user_can( 'publish_posts' ) ) : ?> 
     90<p><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 page private') ?></label></p> 
     91<?php endif; ?> 
     92 
     93<?php 
     94if ( 0 != $post->ID ) { 
     95    if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date 
     96        $stamp = __('Scheduled for:<br />%1$s at %2$s'); 
     97    } else if ( 'publish' == $post->post_status ) { // already published 
     98        $stamp = __('Published on:<br />%1$s at %2$s'); 
     99    } else if ( '0000-00-00 00:00:00' == $post->post_date ) { // draft, 1 or more saves, no date specified 
     100        $stamp = __('Publish immediately'); 
     101    } else { // draft, 1 or more saves, date specified 
     102        $stamp = __('Publish on:<br />%1$s at %2$s'); 
     103    } 
     104    $date = mysql2date(get_option('date_format'), $post->post_date); 
     105    $time = mysql2date(get_option('time_format'), $post->post_date); 
     106} else { // draft (no saves, and thus no date specified) 
     107    $stamp = __('Publish immediately'); 
     108    $date = mysql2date(get_option('date_format'), current_time('mysql')); 
     109    $time = mysql2date(get_option('time_format'), current_time('mysql')); 
     110} 
     111?> 
     112<p class="curtime"><?php printf($stamp, $date, $time); ?> 
     113&nbsp;<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a></p> 
     114 
     115<div id='timestampdiv' class='hide-if-js'><?php touch_time(($action == 'edit'),1,4); ?></div> 
     116 
     117</div> 
     118 
     119<p class="submit"> 
     120<?php do_action('page_submitbox_start'); ?> 
     121<input type="submit" name="save" class="button button-highlighted" value="<?php _e('Save'); ?>" tabindex="4" /> 
     122<?php 
     123if ( !in_array( $post->post_status, array('publish', 'future') ) || 0 == $post->ID ) { 
     124?> 
     125<?php if ( current_user_can('publish_pages') ) : ?> 
     126    <input name="publish" type="submit" class="button" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" /> 
     127<?php else : ?> 
     128    <input name="publish" type="submit" class="button" id="publish" tabindex="5" accesskey="p" value="<?php _e('Submit for Review') ?>" /> 
     129<?php endif; ?> 
     130<?php 
     131} 
     132 
     133if ( ('edit' == $action) && current_user_can('delete_page', $post->ID) ) 
     134    echo "<a class='submitdelete' href='" . wp_nonce_url("page.php?action=delete&amp;post=$post->ID", 'delete-page_' . $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 page '%s'\n  'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete&nbsp;page') . "</a>"; 
     135?> 
     136<br class="clear" /> 
     137<?php if ( 0 != $post->ID ) : ?> 
     138<?php if ( $last_id = get_post_meta($post->ID, '_edit_last', true) ) { 
     139    $last_user = get_userdata($last_id); 
     140    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)); 
     141} else { 
     142    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)); 
     143} 
     144?> 
     145<br class="clear" /> 
     146<?php endif; ?> 
     147</p> 
     148</div> 
     149<?php 
     150} 
     151add_meta_box('pagesubmitdiv', __('Publish'), 'page_submit_meta_box', 'page', 'side', 'core'); 
     152 
    60153function page_custom_meta_box($post){ 
    61154?> 
     
    311404</div> 
    312405 
    313 <br class="clear" /></div><!-- wpbody-content (fixedbar) --> 
    314  
    315 <div id="fixedbar"> 
    316 <table id="fixedbar-wrap"><tbody><tr> 
    317  
    318 <td id="preview-link">&nbsp; 
    319 <span> 
    320 <?php if ( 'publish' == $post->post_status ) { ?> 
    321 <a href="<?php echo clean_url(get_permalink($post->ID)); ?>" target="_blank"  tabindex="4"><?php _e('View this Page'); ?></a> 
    322 <?php } elseif ( 'edit' == $action ) { ?> 
    323 <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 Page'); ?></a> 
    324 <?php } ?> 
    325 </span> 
    326 </td> 
    327  
    328 <td id="submitpage" class="submitbox"> 
    329 <div id="post-time-info" class="alignleft"> 
    330 <?php 
    331     if ($post_ID) { 
    332         if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date 
    333             $stamp = __('Scheduled for: <span class="timestamp">%1$s at %2$s</span>'); 
    334         } else if ( 'publish' == $post->post_status ) { // already published 
    335             $stamp = __('Published on: <span class="timestamp">%1$s at %2$s</span>'); 
    336         } else if ( '0000-00-00 00:00:00' == $post->post_date ) { // draft, 1 or more saves, no date specified 
    337             $stamp = __('Publish immediately'); 
    338         } else { // draft, 1 or more saves, date specified 
    339             $stamp = __('Publish on: <span class="timestamp">%1$s at %2$s</span>'); 
    340         } 
    341         $date = mysql2date(get_option('date_format'), $post->post_date); 
    342         $time = mysql2date(get_option('time_format'), $post->post_date); 
    343     } else { // draft (no saves, and thus no date specified) 
    344         $stamp = __('Publish immediately'); 
    345         $date = mysql2date(get_option('date_format'), current_time('mysql')); 
    346         $time = mysql2date(get_option('time_format'), current_time('mysql')); 
    347     } 
    348 ?> 
    349     <p id="curtime"><?php printf($stamp, $date, $time); ?> <a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a></p> 
    350     <div id='timestampdiv' class='hide-if-js'><?php touch_time(($action == 'edit'),1,4); ?></div> 
    351 </div> 
    352  
    353 <p class="submit alignright"> 
    354 <?php 
    355 if ( ('edit' == $action ) && current_user_can('delete_page', $post_ID) ) 
    356     echo "<a class='submitdelete' href='" . wp_nonce_url("page.php?action=delete&amp;post=$post_ID", 'delete-page_' . $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 page '%s'\n  'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete&nbsp;page') . "</a>"; 
    357 elseif ( 'edit' != $action ) 
    358     echo "<a class='submitdelete' href='index.php' onclick=\"if ( confirm('" . js_escape( __("You are about to delete this page\n  'Cancel' to stop, 'OK' to delete.")) . "') ) { return true;}return false;\">" . __('Cancel&nbsp;page') . "</a>"; 
    359 ?> 
    360     <input type="submit" name="save" class="button button-highlighted" value="<?php _e('Save'); ?>" tabindex="4" /> 
    361  
    362 <?php 
    363     if ( !in_array( $post->post_status, array('publish', 'future') ) || 0 == $post_ID ) : 
    364         if ( current_user_can('publish_pages') ) : ?> 
    365     <input name="publish" type="submit" class="button" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" /> 
    366 <?php       else : ?> 
    367     <input name="publish" type="submit" class="button" id="publish" tabindex="5" accesskey="p" value="<?php _e('Submit for Review') ?>" /> 
    368 <?php  
    369         endif; 
    370     endif; 
    371 ?> 
    372 </p> 
    373 </td></tr></tbody></table> 
    374 </div><!-- /fixedbar --> 
    375  
     406<br class="clear" /> 
     407</div> 
    376408</form> 
    377409