Make WordPress Core


Ignore:
Timestamp:
11/03/2008 07:06:36 AM (18 years ago)
Author:
markjaquith
Message:

Update to publish box styles. More horizontal room, consistent button placement, better for i18n, better wording.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit-form-advanced.php

    r9451 r9491  
    7272
    7373<div id="minor-publishing">
    74 <div id="misc-publishing-actions">
    7574
    7675<?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>
     
    7978</div>
    8079
    81 <div id="misc-pub-block-1">
    82 <?php if ( $can_publish && current_user_can( 'edit_others_posts' ) ) { ?>
    83     <div class="misc-pub-section" id="sticky-checkbox"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked(is_sticky($post->ID), true); ?> tabindex="4" /> <label for="sticky" class="selectit"><?php _e('Stick to front page') ?></label></div>
    84 <?php } ?>
    85 <!--
    86 <div class="misc-pub-section misc-pub-section-1-last" id="visibility">
     80<div id="minor-publishing-actions">
     81<div id="preview-action">
     82<noscript>
     83<?php if ( 'publish' == $post->post_status ) { ?>
     84<a class="preview button" href="<?php echo clean_url(get_permalink($post->ID)); ?>" target="_blank" tabindex="4"><?php _e('View Post'); ?></a>
     85<?php } else { ?>
     86<a class="preview button" 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'); ?></a>
     87<?php } ?>
     88</noscript>
     89
     90<a class="preview button hide-if-no-js" href="#" id="post-preview" tabindex="4"><?php _e('Preview'); ?></a>
     91<input type="hidden" name="wp-preview" id="wp-preview" value="" />
     92</div>
     93
     94<div id="save-action">
     95<?php if ( 'publish' != $post->post_status && 'private' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status )  { ?>
     96<input type="submit" name="save" id="save-post" value="<?php echo attribute_escape( __('Save Draft') ); ?>" tabindex="4" class="button button-highlighted" />
     97<?php } elseif ( 'pending' == $post->post_status && $can_publish ) { ?>
     98<input type="submit" name="save" id="save-post" value="<?php echo attribute_escape( __('Save as Pending') ); ?>" tabindex="4" class="button button-highlighted" />
     99<?php } ?>
     100</div>
     101<div class="clear"></div>
     102</div><?php // /minor-publishing-actions ?>
     103
     104<div id="misc-publishing-actions">
     105
     106<?php if ( false ) { // Stub for 2.8 ?>
     107<div class="misc-pub-section" id="visibility">
    87108<?php _e('Visibility:'); ?> <b><?php _e('Public'); // TODO: dropdown ?></b>
    88109</div>
    89 -->
    90 </div>
    91 <div id="misc-pub-block-2">
    92 <?php
    93 $datef = _c( 'M j, Y \a\t G:i|Publish box date format');
    94 if ( 0 != $post->ID ) {
    95     if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date
    96         $stamp = __('Scheduled for:<br />%1$s');
    97     } else if ( 'publish' == $post->post_status ) { // already published
    98         $stamp = __('Published on:<br />%1$s');
    99     } else if ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified
    100         $stamp = __('Publish immediately');
    101     } else if ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified
    102         $stamp = __('Schedule for:<br />%1$s');
    103     } else { // draft, 1 or more saves, date specified
    104         $stamp = __('Publish on:<br />%1$s');
    105     }
    106     $date = date_i18n( $datef, strtotime( $post->post_date ) );
    107 } else { // draft (no saves, and thus no date specified)
    108     $stamp = __('Publish immediately');
    109     $date = date_i18n( $datef, strtotime( current_time('mysql') ) );
    110 }
    111 ?>
    112 <?php if ( $can_publish ) : // Contributors don't get to choose the date of publish ?>
    113 <div class="misc-pub-section curtime">
    114     <span id="timestamp">
    115     <?php printf($stamp, $date); ?></span>
    116     &nbsp;<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a>
    117     <div id="timestampdiv" class="hide-if-js"><?php touch_time(($action == 'edit'),1,4); ?></div>
    118 </div>
    119 <?php endif; ?>
    120 
    121 <div class="misc-pub-section misc-pub-section-2-last"><label for="post_status"><?php _e('Status:') ?></label>
     110<?php } ?>
     111
     112<div class="misc-pub-section<?php if ( !$can_publish ) { echo '  misc-pub-section-last'; } ?>"><label for="post_status"><?php _e('Status:') ?></label>
    122113<b><span id="post-status-display">
    123114<?php
     
    153144<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Draft') ?></option>
    154145</select>
    155 <br />
    156 <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a>
    157 <a href="#post_status" class="cancel-post-status hide-if-no-js"><?php _e('Cancel'); ?></a>
    158 </div>
    159 
    160 <?php } ?>
    161 </div>
    162 </div>
    163 </div>
    164 
    165 <div id="minor-publishing-actions">
    166 
    167 <?php if ( 'publish' != $post->post_status && 'private' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status )  { ?>
    168 <input type="submit" name="save" id="save-post" value="<?php echo attribute_escape( __('Save Draft') ); ?>" tabindex="4" class="button button-highlighted" />
    169 <?php } elseif ( 'pending' == $post->post_status && $can_publish ) { ?>
    170 <input type="submit" name="save" id="save-post" value="<?php echo attribute_escape( __('Save Pending') ); ?>" tabindex="4" class="button button-highlighted" />
    171 <?php } ?>
    172 
    173 <noscript>
    174 <?php if ( 'publish' == $post->post_status ) { ?>
    175 <a class="preview button" href="<?php echo clean_url(get_permalink($post->ID)); ?>" target="_blank" tabindex="4"><?php _e('View Post'); ?></a>
    176 <?php } else { ?>
    177 <a class="preview button" 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'); ?></a>
    178 <?php } ?>
    179 </noscript>
    180 
    181 <a class="preview button hide-if-no-js" href="#" id="post-preview" tabindex="4"><?php _e('Preview'); ?></a>
    182 <input type="hidden" name="wp-preview" id="wp-preview" value="" />
     146 <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a>
     147 <a href="#post_status" class="cancel-post-status hide-if-no-js"><?php _e('Cancel'); ?></a>
     148</div>
     149
     150<?php } ?>
     151</div><?php // /misc-pub-section ?>
     152
     153
     154<?php if ( $can_publish && current_user_can( 'edit_others_posts' ) ) { ?>
     155<div class="misc-pub-section " id="sticky-checkbox">
     156<input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked(is_sticky($post->ID), true); ?> tabindex="4" /> <label for="sticky" class="selectit"><?php _e('Stick this post to the front page') ?></label>
     157</div><?php // /misc-pub-section ?>
     158<?php } ?>
     159
     160
     161<?php
     162$datef = _c( 'M j, Y @ G:i|Publish box date format');
     163if ( 0 != $post->ID ) {
     164    if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date
     165        $stamp = __('Scheduled for: <b>%1$s</b>');
     166    } else if ( 'publish' == $post->post_status ) { // already published
     167        $stamp = __('Published on: <b>%1$s</b>');
     168    } else if ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified
     169        $stamp = __('Publish <b>immediately</b>');
     170    } else if ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified
     171        $stamp = __('Schedule for: <b>%1$s</b>');
     172    } else { // draft, 1 or more saves, date specified
     173        $stamp = __('Publish on: <b>%1$s</b>');
     174    }
     175    $date = date_i18n( $datef, strtotime( $post->post_date ) );
     176} else { // draft (no saves, and thus no date specified)
     177    $stamp = __('Publish <b>immediately</b>');
     178    $date = date_i18n( $datef, strtotime( current_time('mysql') ) );
     179}
     180?>
     181<?php if ( $can_publish ) : // Contributors don't get to choose the date of publish ?>
     182<div class="misc-pub-section curtime misc-pub-section-last">
     183    <span id="timestamp">
     184    <?php printf($stamp, $date); ?></span>
     185    &nbsp;<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a>
     186    <div id="timestampdiv" class="hide-if-js"><?php touch_time(($action == 'edit'),1,4); ?></div>
     187</div><?php // /misc-pub-section ?>
     188<?php endif; ?>
    183189
    184190</div>
Note: See TracChangeset for help on using the changeset viewer.