Update edit page form. Post boxes need fixin'
git-svn-id: http://svn.automattic.com/wordpress/trunk@6665 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c8fb582d2c
commit
0bf9c81fb5
|
@ -1,6 +1,3 @@
|
||||||
|
|
||||||
<div class="wrap">
|
|
||||||
<h2 id="write-post"><?php _e('Write Page'); ?></h2>
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (0 == $post_ID) {
|
if (0 == $post_ID) {
|
||||||
|
@ -25,6 +22,7 @@ if ( 0 != $post_ID && $sendto == get_permalink($post_ID) )
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<form name="post" action="page.php" method="post" id="post">
|
<form name="post" action="page.php" method="post" id="post">
|
||||||
|
<div class="wrap">
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
wp_nonce_field($nonce_action);
|
wp_nonce_field($nonce_action);
|
||||||
|
@ -49,140 +47,99 @@ addLoadEvent(focusit);
|
||||||
</script>
|
</script>
|
||||||
<div id="poststuff">
|
<div id="poststuff">
|
||||||
|
|
||||||
<div id="moremeta">
|
<div id="titlediv">
|
||||||
<div id="grabit" class="dbx-group">
|
<h3><?php _e('Title') ?></h3>
|
||||||
<fieldset id="commentstatusdiv" class="dbx-box">
|
<div class="inside">
|
||||||
<h3 class="dbx-handle"><?php _e('Discussion') ?></h3>
|
<input type="text" name="post_title" size="30" tabindex="1" value="<?php echo attribute_escape( $post->post_title ); ?>" id="title" />
|
||||||
<div class="dbx-content">
|
|
||||||
<input name="advanced_view" type="hidden" value="1" />
|
|
||||||
<label for="comment_status" class="selectit">
|
|
||||||
<input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> />
|
|
||||||
<?php _e('Allow Comments') ?></label>
|
|
||||||
<label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php _e('Allow Pings') ?></label>
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<fieldset class="dbx-box">
|
|
||||||
<h3 class="dbx-handle"><?php _e('Page Status') ?></h3>
|
|
||||||
<div class="dbx-content"><?php if ( current_user_can('publish_pages') ) : ?>
|
|
||||||
<label for="post_status_publish" class="selectit"><input id="post_status_publish" name="post_status" type="radio" value="publish" <?php checked($post->post_status, 'publish'); checked($post->post_status, 'future'); ?> /> <?php _e('Published') ?></label>
|
|
||||||
<?php endif; ?>
|
|
||||||
<label for="post_status_draft" class="selectit"><input id="post_status_draft" name="post_status" type="radio" value="draft" <?php checked($post->post_status, 'draft'); ?> /> <?php _e('Draft') ?></label>
|
|
||||||
<label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="radio" value="private" <?php checked($post->post_status, 'private'); ?> /> <?php _e('Private') ?></label></div>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<fieldset id="passworddiv" class="dbx-box">
|
|
||||||
<h3 class="dbx-handle"><?php _e('Page Password') ?></h3>
|
|
||||||
<div class="dbx-content"><input name="post_password" type="text" size="13" id="post_password" value="<?php echo attribute_escape( $post->post_password ); ?>" /></div>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<fieldset id="pageparent" class="dbx-box">
|
|
||||||
<h3 class="dbx-handle"><?php _e('Page Parent') ?></h3>
|
|
||||||
<div class="dbx-content"><p><select name="parent_id">
|
|
||||||
<option value='0'><?php _e('Main Page (no parent)'); ?></option>
|
|
||||||
<?php parent_dropdown($post->post_parent); ?>
|
|
||||||
</select></p>
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<?php if ( 0 != count( get_page_templates() ) ) { ?>
|
|
||||||
<fieldset id="pagetemplate" class="dbx-box">
|
|
||||||
<h3 class="dbx-handle"><?php _e('Page Template') ?></h3>
|
|
||||||
<div class="dbx-content"><p><select name="page_template">
|
|
||||||
<option value='default'><?php _e('Default Template'); ?></option>
|
|
||||||
<?php page_template_dropdown($post->page_template); ?>
|
|
||||||
</select></p>
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
<fieldset id="slugdiv" class="dbx-box">
|
|
||||||
<h3 class="dbx-handle"><?php _e('Page Slug') ?></h3>
|
|
||||||
<div class="dbx-content"><input name="post_name" type="text" size="13" id="post_name" value="<?php echo attribute_escape( $post->post_name ); ?>" /></div>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<?php if ( $authors = get_editable_authors( $current_user->id ) ) : // TODO: ROLE SYSTEM ?>
|
|
||||||
<fieldset id="authordiv" class="dbx-box">
|
|
||||||
<h3 class="dbx-handle"><?php _e('Page Author'); ?></h3>
|
|
||||||
<div class="dbx-content">
|
|
||||||
<select name="post_author_override" id="post_author_override">
|
|
||||||
<?php
|
|
||||||
foreach ($authors as $o) :
|
|
||||||
$o = get_userdata( $o->ID );
|
|
||||||
if ( $post->post_author == $o->ID || ( empty($post_ID) && $user_ID == $o->ID ) ) $selected = 'selected="selected"';
|
|
||||||
else $selected = '';
|
|
||||||
$o->ID = (int) $o->ID;
|
|
||||||
$o->display_name = wp_specialchars( $o->display_name );
|
|
||||||
echo "<option value='$o->ID' $selected>$o->display_name</option>";
|
|
||||||
endforeach;
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<fieldset id="pageorder" class="dbx-box">
|
|
||||||
<h3 class="dbx-handle"><?php _e('Page Order') ?></h3>
|
|
||||||
<div class="dbx-content"><p><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo $post->menu_order ?>" /></p></div>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<?php do_action('dbx_page_sidebar'); ?>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<fieldset id="titlediv">
|
<div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">
|
||||||
<legend><?php _e('Page Title') ?></legend>
|
<h3><?php _e('Page') ?></h3>
|
||||||
<div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo attribute_escape( $post->post_title ); ?>" id="title" /></div>
|
<?php the_editor($post->post_content); ?>
|
||||||
</fieldset>
|
</div>
|
||||||
|
|
||||||
|
<div id="submitpost">
|
||||||
|
|
||||||
<fieldset id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>">
|
<div id="previewview">
|
||||||
<legend><?php _e('Page Content') ?>
|
|
||||||
|
|
||||||
<?php if ( 'publish' == $post->post_status ) { ?>
|
<?php if ( 'publish' == $post->post_status ) { ?>
|
||||||
<a href="<?php echo clean_url(get_permalink($post->ID)); ?>" style="position: absolute; right: 2em; margin-right: 19em; text-decoration: underline;" target="_blank"><?php _e('View »'); ?></a>
|
<a href="<?php echo clean_url(get_permalink($post->ID)); ?>" target="_blank"><?php _e('View this Page'); ?></a>
|
||||||
<?php } elseif ( 'edit' == $action ) { ?>
|
<?php } elseif ( 'edit' == $action ) { ?>
|
||||||
<a href="<?php echo clean_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); ?>" style="position: absolute; right: 2em; margin-right: 19em; text-decoration: underline;" target="_blank"><?php _e('Preview »'); ?></a>
|
<a href="<?php echo clean_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); ?>" target="_blank"><?php _e('Preview this Page'); ?></a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</legend>
|
</div>
|
||||||
<?php the_editor($post->post_content); ?>
|
|
||||||
</fieldset>
|
<div class="inside">
|
||||||
|
|
||||||
|
<p><strong><?php _e('Publish Status') ?></strong></p>
|
||||||
|
<p>
|
||||||
|
<select name='post_status'>
|
||||||
|
<?php if ( current_user_can('publish_posts') ) : ?>
|
||||||
|
<?php $pub_value = ( 'private' == $post->post_status ) ? 'private' : 'publish'; ?>
|
||||||
|
<option<?php selected( $post->post_status, 'publish' ); selected( $post->post_status, 'private' );?> value='<?php echo $pub_value ?>'><?php _e('Published') ?></option>
|
||||||
|
<?php else: ?>
|
||||||
|
<option<?php selected( $post->post_status, 'private' ); ?> value='private'><?php _e('Published') ?></option>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ( 'future' == $post->post_status ) : ?>
|
||||||
|
<option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Pending') ?></option>
|
||||||
|
<?php endif; ?>
|
||||||
|
<option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option>
|
||||||
|
<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Unpublished') ?></option>
|
||||||
|
</select>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<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');
|
||||||
|
else if ( 'publish' == $post->post_status )
|
||||||
|
$time = __('Published on:<br />%1$s at %2$s');
|
||||||
|
else
|
||||||
|
$time = __('Saved on:<br />%1$s at %2$s');
|
||||||
|
?>
|
||||||
|
<p><?php printf($time, mysql2date(get_option('date_format'), $post->post_date), mysql2date(get_option('time_format'), $post->post_date)); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
<p class="submit">
|
<p class="submit">
|
||||||
<span id="autosave"></span>
|
<input type="submit" name="save" value="<?php _e('Save'); ?>" style="font-weight: bold;" tabindex="4" />
|
||||||
<input name="save" type="submit" id="save" tabindex="3" value="<?php _e('Save and Continue Editing'); ?>" />
|
|
||||||
<input type="submit" name="submit" value="<?php _e('Save') ?>" style="font-weight: bold;" tabindex="4" />
|
|
||||||
<?php
|
<?php
|
||||||
if ('publish' != $post->post_status || 0 == $post_ID):
|
if ( !in_array( $post->post_status, array('publish', 'future') ) || 0 == $post_ID ) {
|
||||||
?>
|
?>
|
||||||
<?php if ( current_user_can('publish_pages') ) : ?>
|
<?php if ( current_user_can('publish_pages') ) : ?>
|
||||||
<input name="publish" type="submit" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" />
|
<input name="publish" type="submit" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" />
|
||||||
<?php endif; endif;?>
|
<?php else : ?>
|
||||||
<input name="referredby" type="hidden" id="referredby" value="<?php echo $sendto; ?>" />
|
<input name="publish" type="submit" id="publish" tabindex="5" accesskey="p" value="<?php _e('Submit for Review') ?>" />
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ('edit' == $action) && current_user_can('delete_page', $post_ID) )
|
||||||
|
echo "<a href='" . wp_nonce_url("page.php?action=delete&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 page '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete page') . "</a>";
|
||||||
|
?>
|
||||||
|
<?php if ($post_ID): ?>
|
||||||
|
<br />
|
||||||
|
<?php 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)); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="submit">
|
||||||
|
|
||||||
|
<span id="autosave"></span>
|
||||||
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<?php do_action('edit_page_form'); ?>
|
<?php do_action('edit_page_form'); ?>
|
||||||
|
|
||||||
<?php
|
<h2><?php _e('Advanced Options'); ?></h2>
|
||||||
if (current_user_can('upload_files')) {
|
|
||||||
$uploading_iframe_ID = (0 == $post_ID ? $temp_ID : $post_ID);
|
|
||||||
$uploading_iframe_src = wp_nonce_url("upload.php?style=inline&tab=upload&post_id=$uploading_iframe_ID", 'inlineuploading');
|
|
||||||
$uploading_iframe_src = apply_filters('uploading_iframe_src', $uploading_iframe_src);
|
|
||||||
if ( false != $uploading_iframe_src )
|
|
||||||
echo '<iframe id="uploading" name="uploading" frameborder="0" src="' . $uploading_iframe_src . '">' . __('This feature requires iframe support.') . '</iframe>';
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
<div id="advancedstuff" class="dbx-group">
|
<div id="postcustom" class="postbox <?php echo postbox_classes('postcustom'); ?>">
|
||||||
|
<h3><?php _e('Custom Fields') ?></h3>
|
||||||
<div class="dbx-b-ox-wrapper">
|
<div class="inside">
|
||||||
<fieldset id="postcustom" class="dbx-box">
|
<div id="postcustomstuff">
|
||||||
<div class="dbx-h-andle-wrapper">
|
|
||||||
<h3 class="dbx-handle"><?php _e('Custom Fields') ?></h3>
|
|
||||||
</div>
|
|
||||||
<div class="dbx-c-ontent-wrapper">
|
|
||||||
<div id="postcustomstuff" class="dbx-content">
|
|
||||||
<table cellpadding="3">
|
<table cellpadding="3">
|
||||||
<?php
|
<?php
|
||||||
$metadata = has_meta($post_ID);
|
$metadata = has_meta($post_ID);
|
||||||
|
@ -196,20 +153,80 @@ list_meta($metadata);
|
||||||
<div id="ajax-response"></div>
|
<div id="ajax-response"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php do_action('dbx_page_advanced'); ?>
|
<div id="commentstatusdiv" class="postbox <?php echo postbox_classes('commentstatusdiv'); ?>">
|
||||||
|
<h3><?php _e('Discussion') ?></h3>
|
||||||
|
<div class="inside">
|
||||||
|
<input name="advanced_view" type="hidden" value="1" />
|
||||||
|
<label for="comment_status" class="selectit">
|
||||||
|
<input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> />
|
||||||
|
<?php _e('Allow Comments') ?></label>
|
||||||
|
<label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php _e('Allow Pings') ?></label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if ('edit' == $action) :
|
<div id="passworddiv" class="postbox <?php echo postbox_classes('passworddiv'); ?>">
|
||||||
$delete_nonce = wp_create_nonce( 'delete-page_' . $post_ID );
|
<h3><?php _e('Page Password') ?></h3>
|
||||||
if ( current_user_can('delete_page', $post->ID) ) ?>
|
<div class="inside">
|
||||||
<input name="deletepost" class="button delete" type="submit" id="deletepost" tabindex="10" value="<?php _e('Delete this page') ?>" <?php echo "onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this page '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { document.forms.post._wpnonce.value = '$delete_nonce'; return true;}return false;\""; ?> />
|
<input name="post_password" type="text" size="13" id="post_password" value="<?php echo attribute_escape( $post->post_password ); ?>" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="slugdiv" class="postbox <?php echo postbox_classes('slugdiv'); ?>">
|
||||||
|
<h3><?php _e('Page Slug') ?></h3>
|
||||||
|
<div class="inside">
|
||||||
|
<input name="post_name" type="text" size="13" id="post_name" value="<?php echo attribute_escape( $post->post_name ); ?>" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="parentdiv" class="postbox <?php echo postbox_classes('parentdiv'); ?>">
|
||||||
|
<h3><?php _e('Page Parent') ?></h3>
|
||||||
|
<div class="inside">
|
||||||
|
<select name="parent_id">
|
||||||
|
<option value='0'><?php _e('Main Page (no parent)'); ?></option>
|
||||||
|
<?php parent_dropdown($post->post_parent); ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if ( 0 != count( get_page_templates() ) ) { ?>
|
||||||
|
<div id="templatediv" class="postbox <?php echo postbox_classes('templatediv'); ?>">
|
||||||
|
<h3><?php _e('Page Template') ?></h3>
|
||||||
|
<div class="inside">
|
||||||
|
<select name="page_template">
|
||||||
|
<option value='default'><?php _e('Default Template'); ?></option>
|
||||||
|
<?php page_template_dropdown($post->page_template); ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<div id="orderdiv" class="postbox <?php echo postbox_classes('orderdiv'); ?>">
|
||||||
|
<h3><?php _e('Page Order') ?></h3>
|
||||||
|
<div class="inside">
|
||||||
|
<input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo $post->menu_order ?>" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM
|
||||||
|
if ( $post->post_author && !in_array($post->post_author, $authors) )
|
||||||
|
$authors[] = $post->post_author;
|
||||||
|
if ( $authors && count( $authors ) > 1 ) :
|
||||||
|
?>
|
||||||
|
<div id="authordiv" class="postbox <?php echo postbox_classes('authordiv'); ?>">
|
||||||
|
<h3><?php _e('Post Author'); ?></h3>
|
||||||
|
<div class="inside">
|
||||||
|
<?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post_ID) ? $user_ID : $post->post_author) ); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
|
@ -4,6 +4,10 @@ $title = __('New Page');
|
||||||
$parent_file = 'post-new.php';
|
$parent_file = 'post-new.php';
|
||||||
$editing = true;
|
$editing = true;
|
||||||
wp_enqueue_script('autosave');
|
wp_enqueue_script('autosave');
|
||||||
|
wp_enqueue_script('post');
|
||||||
|
wp_enqueue_script('thickbox');
|
||||||
|
wp_enqueue_script('media-upload');
|
||||||
|
|
||||||
require_once('admin-header.php');
|
require_once('admin-header.php');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,10 @@ case 'edit':
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wp_enqueue_script('post');
|
||||||
|
wp_enqueue_script('thickbox');
|
||||||
|
wp_enqueue_script('media-upload');
|
||||||
|
|
||||||
if ( 'draft' == $post->post_status )
|
if ( 'draft' == $post->post_status )
|
||||||
wp_enqueue_script('autosave');
|
wp_enqueue_script('autosave');
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue