Few sidebar.php updates, functionality and look similar to the quick-post dashboard widget

git-svn-id: http://svn.automattic.com/wordpress/trunk@8834 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2008-09-06 06:10:38 +00:00
parent 7e721f6b92
commit 9a9c56866b
2 changed files with 83 additions and 54 deletions

View File

@ -34,7 +34,10 @@ function redirect_post($post_ID = '') {
if ( !empty($_POST['mode']) && 'bookmarklet' == $_POST['mode'] ) {
$location = $_POST['referredby'];
} elseif ( !empty($_POST['mode']) && 'sidebar' == $_POST['mode'] ) {
$location = 'sidebar.php?a=b';
if ( isset($_POST['saveasdraft']) )
$location = 'sidebar.php?a=c';
elseif ( isset($_POST['publish']) )
$location = 'sidebar.php?a=b';
} elseif ( ( isset($_POST['save']) || isset($_POST['publish']) ) && ( empty($referredby) || $referredby == $referer || 'redo' != $referredby ) ) {
if ( $_POST['_wp_original_http_referer'] && strpos( $_POST['_wp_original_http_referer'], '/wp-admin/post.php') === false && strpos( $_POST['_wp_original_http_referer'], '/wp-admin/post-new.php') === false )
$location = add_query_arg( array(

View File

@ -18,78 +18,107 @@ require_once('admin.php');
if ( ! current_user_can('edit_posts') )
wp_die(__('Cheatin’ uh?'));
if ('b' == $_GET['a']) {
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=UTF-8" />
<title><?php _e('WordPress &#8250; Posted'); ?></title>
<?php
wp_admin_css( 'global', true );
wp_admin_css( 'wp-admin', true );
wp_admin_css( 'colors', true );
?>
</head>
<body>
<p><?php _e('Posted !'); ?></p>
<p><?php printf(__('<a href="%s">Click here</a> to post again.'), 'sidebar.php'); ?></p>
</body>
</html><?php
} else {
$post = get_default_post_to_edit();
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('blog_charset'); ?>" />
<title><?php _e('WordPress &#8250; Sidebar'); ?></title>
<?php
wp_admin_css( 'global', true );
wp_admin_css( 'wp-admin', true );
wp_admin_css( 'colors', true );
?>
<title><?php bloginfo('name') ?> &rsaquo; <?php _e('Sidebar'); ?></title>
<style type="text/css" media="screen">
body {
font-size: 0.9em;
margin: 0;
padding: 0;
}
form {
padding: 3px;
padding: 1%;
}
.sidebar-categories {
display: block;
height: 6.6em;
overflow: auto;
background-color: #f4f4f4;
.tags-wrap p {
font-size: 0.75em;
margin-top: 0.4em;
}
.sidebar-categories label {
font-size: 10px;
display: block;
width: 90%;
.button-highlighted, #wphead, label {
font-weight: bold;
}
#post-title, #tags-input, #content {
width: 99%;
padding: 2px;
}
#wphead {
font-size: 1.4em;
background-color: #E4F2FD;
color: #555555;
padding: 0.2em 1%;
}
#wphead p {
margin: 3px;
}
.button {
font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
padding: 3px 5px;
margin-right: 5px;
font-size: 0.75em;
line-height: 1.5em;
border: 1px solid #80b5d0;
-moz-border-radius: 3px;
-khtml-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
cursor: pointer;
background-color: #e5e5e5;
color: #246;
}
.button:hover {
border-color: #535353;
}
.updated {
background-color: #FFFBCC;
border: 1px solid #E6DB55;
margin-bottom: 1em;
padding: 0 0.6em;
}
.updated p {
margin: 0.6em;
}
</style>
</head>
<body id="sidebar">
<h1 id="wphead"><a href="http://wordpress.org/" rel="external">WordPress</a></h1>
<div id="wphead"><p><?php bloginfo('name') ?> &rsaquo; <?php _e('Sidebar'); ?></p></div>
<form name="post" action="post.php" method="post">
<div>
<input type="hidden" name="action" value="post" />
<input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" />
<input type="hidden" name="mode" value="sidebar" />
<?php wp_nonce_field('add-post'); ?>
<p><label for="post_title"><?php _e('Title:'); ?></label>
<input type="text" name="post_title" id="post_title" size="20" tabindex="1" style="width: 100%;" />
</p>
<p><?php _e('Categories:'); ?>
<span class="sidebar-categories">
<?php dropdown_categories(); ?>
</span>
</p>
<input type="hidden" name="ping_status" value="<?php echo $post->ping_status; ?>" />
<input type="hidden" name="comment_status" value="<?php echo $post->comment_status; ?>" />
<?php wp_nonce_field('add-post');
if ( 'b' == $_GET['a'] )
echo '<div class="updated"><p>' . __('Post published.') . '</p></div>';
elseif ( 'c' == $_GET['a'] )
echo '<div class="updated"><p>' . __('Post saved.') . '</p></div>';
?>
<p>
<label for="content">Post:</label>
<textarea rows="8" cols="12" style="width: 100%" name="content" id="content" tabindex="2"></textarea>
<label for="post-title"><?php _e('Title:'); ?></label>
<input type="text" name="post_title" id="post-title" size="20" tabindex="1" autocomplete="off" value="" />
</p>
<p>
<input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" value="<?php _e('Save as Draft'); ?>" />
<label for="content"><?php _e('Post:'); ?></label>
<textarea rows="8" cols="12" name="content" id="content" style="height:10em;line-height:1.4em;" tabindex="2"></textarea>
</p>
<div class="tags-wrap">
<label for="tags-input"><?php _e('Tags:') ?></label>
<input type="text" name="tags_input" id="tags-input" tabindex="3" value="" />
<p><?php _e('Separate tags with commas'); ?></p>
</div>
<p>
<input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" accesskey="s" class="button" value="<?php _e('Save as Draft'); ?>" />
<?php if ( current_user_can('publish_posts') ) : ?>
<input name="publish" type="submit" id="publish" tabindex="6" value="<?php _e('Publish') ?>" class="button button-highlighted" />
<input name="publish" type="submit" id="publish" tabindex="6" accesskey="p" value="<?php _e('Publish') ?>" class="button button-highlighted" />
<?php endif; ?>
</p>
</div>
@ -97,6 +126,3 @@ form {
</body>
</html>
<?php
}
?>