Move timestamp to submitbox. Put it in a slidedown. see #5846

git-svn-id: http://svn.automattic.com/wordpress/trunk@6904 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-02-18 22:07:57 +00:00
parent 23a4e81028
commit 7d06b85a36
5 changed files with 58 additions and 39 deletions

View File

@ -127,22 +127,29 @@ addLoadEvent(focusit);
<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'); ?> /> <?php _e('Keep this post private') ?></label></p>
<?php
if ($post_ID):
if ($post_ID) {
if ( 'future' == $post->post_status ) {
$time = __('Scheduled for:<br />%1$s at %2$s');
$date = $post->post_date;
} else if ( 'publish' == $post->post_status ) {
$time = __('Published on:<br />%1$s at %2$s');
$date = $post->post_date;
if ( 'future' == $post->post_status ) {
$stamp = __('Scheduled for:<br />%1$s at %2$s');
} else if ( 'publish' == $post->post_status ) {
$stamp = __('Published on:<br />%1$s at %2$s');
} else {
$stamp = __('Saved on:<br />%1$s at %2$s');
}
$date = mysql2date(get_option('date_format'), $post->post_date);
$time = mysql2date(get_option('time_format'), $post->post_date);
} else {
$time = __('Saved on:<br />%1$s at %2$s');
$date = $post->post_modified;
$stamp = __('Timestamp:<br />%1$s at %2$s');
$date = mysql2date(get_option('date_format'), current_time('mysql'));
$time = mysql2date(get_option('time_format'), current_time('mysql'));
}
?>
<p><?php printf($time, mysql2date(get_option('date_format'), $date), mysql2date(get_option('time_format'), $date)); ?>
<?php endif; ?>
<p><?php printf($stamp, $date, $time); ?>
&nbsp;<a href="#edit_timestamp" class="edit-timestamp"><?php _e('Edit') ?></a></p>
<div id='timestamp'><?php touch_time(($action == 'edit')); ?></div>
</div>
<p class="submit">
@ -316,13 +323,6 @@ list_meta($metadata);
</div>
</div>
<?php if ( current_user_can('edit_posts') ) : ?>
<div id="posttimestampdiv" class="postbox <?php echo postbox_classes('posttimestampdiv', 'post'); ?>">
<h3><?php _e('Post Timestamp'); ?></h3>
<div class="inside"><?php touch_time(($action == 'edit')); ?></div>
</div>
<?php endif; ?>
<?php
$authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM
if ( $post->post_author && !in_array($post->post_author, $authors) )

View File

@ -91,22 +91,30 @@ addLoadEvent(focusit);
<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'); ?> /> <?php _e('Keep this post private') ?></label></p>
<?php
if ($post_ID):
if ( 'future' == $post->post_status ) {
$time = __('Scheduled for:<br />%1$s at %2$s');
$date = $post->post_date;
} else if ( 'publish' == $post->post_status ) {
$time = __('Published on:<br />%1$s at %2$s');
$date = $post->post_date;
if ($post_ID) {
if ( 'future' == $post->post_status ) {
$stamp = __('Scheduled for:<br />%1$s at %2$s');
} else if ( 'publish' == $post->post_status ) {
$stamp = __('Published on:<br />%1$s at %2$s');
} else {
$stamp = __('Saved on:<br />%1$s at %2$s');
}
$date = mysql2date(get_option('date_format'), $post->post_date);
$time = mysql2date(get_option('time_format'), $post->post_date);
} else {
$time = __('Saved on:<br />%1$s at %2$s');
$date = $post->post_modified;
$stamp = __('Timestamp:<br />%1$s at %2$s');
$date = mysql2date(get_option('date_format'), current_time('mysql'));
$time = mysql2date(get_option('time_format'), current_time('mysql'));
}
?>
<p><?php printf($time, mysql2date(get_option('date_format'), $date), mysql2date(get_option('time_format'), $date)); ?>
<?php endif; ?>
<p><?php printf($stamp, $date, $time); ?>
&nbsp;<a href="#edit_timestamp" class="edit-timestamp"><?php _e('Edit') ?></a></p>
<div id='timestamp'><?php touch_time(($action == 'edit')); ?></div>
</div>
<p class="submit">

View File

@ -754,7 +754,7 @@ function touch_time( $edit = 1, $for_post = 1, $tab_index = 0 ) {
if ( (int) $tab_index > 0 )
$tab_index_attribute = " tabindex=\"$tab_index\"";
echo '<fieldset><legend><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp"'.$tab_index_attribute.' /> <label for="timestamp">'.__( 'Edit timestamp' ).'</label></legend>';
echo '<legend><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp"'.$tab_index_attribute.' /> <label for="timestamp">'.__( 'Edit timestamp' ).'</label></legend>';
$time_adj = time() + (get_option( 'gmt_offset' ) * 3600 );
$post_date = ($for_post) ? $post->post_date : $comment->comment_date;
@ -780,13 +780,6 @@ function touch_time( $edit = 1, $for_post = 1, $tab_index = 0 ) {
<input type="text" id="mn" name="mn" value="<?php echo $mn ?>" size="2" maxlength="2" onchange="edit_date.checked=true"<?php echo $tab_index_attribute ?> />
<input type="hidden" id="ss" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" onchange="edit_date.checked=true" />
<?php
if ( $edit ) {
printf( _c( 'Existing timestamp: %1$s %2$s, %3$s @ %4$s:%5$s|1: month, 2: month string, 3: full year, 4: hours, 5: minutes' ), $wp_locale->get_month( $mm ), $jj, $aa, $hh, $mn );
}
?>
</fieldset>
<?php
}
function page_template_dropdown( $default = '' ) {

View File

@ -1,6 +1,15 @@
addLoadEvent( function() {
add_postbox_toggles('page');
make_slugedit_clickable();
jQuery('#timestamp').css('display', 'none');
jQuery('.edit-timestamp').click(function () {
if (jQuery('#timestamp').is(":hidden")) {
jQuery('#timestamp').slideDown("normal");
} else {
jQuery('#timestamp').hide();
}
});
});

View File

@ -140,4 +140,13 @@ addLoadEvent( function() {
return false;
} );
jQuery('.categorychecklist :checkbox').change( syncChecks ).filter( ':checked' ).change();
jQuery('#timestamp').css('display', 'none');
jQuery('.edit-timestamp').click(function () {
if (jQuery('#timestamp').is(":hidden")) {
jQuery('#timestamp').slideDown("normal");
} else {
jQuery('#timestamp').hide();
}
});
});