Pages update and tweaks.

git-svn-id: http://svn.automattic.com/wordpress/trunk@1747 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
saxmatt 2004-10-05 08:27:13 +00:00
parent 3be6575475
commit 2d4dd7e6fb
7 changed files with 84 additions and 131 deletions

View File

@ -707,4 +707,23 @@ function validate_current_theme() {
return true;
}
function parent_dropdown($parent = 0, $level = 0) {
global $wpdb;
$items = $wpdb->get_results("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = $parent AND post_status = 'static' ORDER BY menu_order");
if ($items) {
foreach ($items as $item) {
$pad = str_repeat(' ', $level * 3);
if ($item->ID == $current)
$current = ' selected="selected"';
else
$current = '';
echo "\n\t<option value='$item->ID'$current>$pad $item->post_title</a></option>";
parent_dropdown($item->ID, $level + 1);
}
} else {
return false;
}
}
?>

View File

@ -1,6 +1,6 @@
<div class="wrap">
<h2><?php _e('New Page'); ?></h2>
<?php
if (0 == $post_ID) {
$form_action = 'post';
@ -32,16 +32,32 @@ function focusit() {
window.onload = focusit;
//-->
</script>
<div id="poststuff">
<fieldset id="titlediv">
<legend><a href="http://wordpress.org/docs/reference/post/#title" title="<?php _e('Help on titles') ?>"><?php _e('Title') ?></a></legend>
<legend><?php _e('Page Title') ?></legend>
<div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo $edited_post_title; ?>" id="title" /></div>
</fieldset>
<br />
<fieldset id="commentstatusdiv">
<legend><?php _e('Discussion') ?></legend>
<div><label for="comment_status" class="selectit">
<input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($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($ping_status, 'open'); ?> /> <?php _e('Allow Pings') ?></label>
</div>
</fieldset>
<fieldset id="postpassworddiv">
<legend><?php _e('Page Password') ?></legend>
<div><input name="post_password" type="text" size="13" id="post_password" value="<?php echo $post_password ?>" /></div>
</fieldset>
<fieldset id="pageparent">
<legend><?php _e('Page Parent') ?></a></legend>
<div><select name="parent_id">
<option value='0'>Main Page (no parent)</option>
<?php parent_dropdown(); ?>
</select>
</div>
</fieldset>
<fieldset id="postdiv">
<legend><a href="http://wordpress.org/docs/reference/post/#post" title="<?php _e('Help with page field') ?>"><?php _e('Page') ?></a></legend>
<legend><?php _e('Page Content') ?></legend>
<?php the_quicktags(); ?>
<?php
$rows = get_settings('default_post_edit_rows');
@ -60,11 +76,10 @@ edCanvas = document.getElementById('content');
</script>
<p class="submit">
<input name="savepage" type="submit" id="savepage" tabindex="6" style="font-weight: bold;" value="<?php _e('Save') ?>" />
<input name="savepage" type="submit" id="savepage" tabindex="6" value="<?php _e('Create New Page') ?> &raquo;" />
<input name="referredby" type="hidden" id="referredby" value="<?php if (isset($_SERVER['HTTP_REFERER'])) echo htmlspecialchars($_SERVER['HTTP_REFERER']); ?>" />
</p>
<?php do_action('edit_page_form', ''); ?>
</div>
</form>
</div>

View File

@ -8,35 +8,10 @@ require_once('admin-header.php');
get_currentuserinfo();
?>
<div class="wrap">
<?php echo "<p> <a href='post.php?action=createpage' title='" . __('Create a new page') . "'>Create New Page</a></p>"; ?>
</div>
<div class="wrap">
<h2><?php _e('Page Management'); ?></h2>
<div class="wrap">
<form name="searchform" action="" method="get" style="float: left; width: 20em;">
<fieldset>
<legend><?php _e('Show Pages That Contain...') ?></legend>
<input type="text" name="s" value="<?php if (isset($s)) echo $s; ?>" size="17" />
<input type="submit" name="submit" value="<?php _e('Search') ?>" />
</fieldset>
</form>
<br style="clear:both;" />
<table width="100%" cellpadding="3" cellspacing="3">
<tr>
<th scope="col"><?php _e('ID') ?></th>
<th scope="col"><?php _e('When') ?></th>
<th scope="col"><?php _e('Title') ?></th>
<th scope="col"><?php _e('Author') ?></th>
<th scope="col"></th>
<th scope="col"></th>
<th scope="col"></th>
</tr>
<?php
include(ABSPATH.'wp-blog-header.php');
if (isset($user_ID) && ('' != intval($user_ID))) {
$posts = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_status = 'static' AND post_author = $user_ID");
} else {
@ -44,84 +19,57 @@ if (isset($user_ID) && ('' != intval($user_ID))) {
}
if ($posts) {
?>
<table width="100%" cellpadding="3" cellspacing="3">
<tr>
<th scope="col"><?php _e('ID') ?></th>
<th scope="col"><?php _e('Title') ?></th>
<th scope="col"><?php _e('Owner') ?></th>
<th scope="col"><?php _e('Updated') ?></th>
<th scope="col"></th>
<th scope="col"></th>
<th scope="col"></th>
</tr>
<?php
$bgcolor = '';
foreach ($posts as $post) { start_wp();
foreach ($posts as $post) : start_wp();
$class = ('alternate' == $class) ? '' : 'alternate';
?>
<tr class='<?php echo $class; ?>'>
<th scope="row"><?php echo $id ?></th>
<td><?php the_time('Y-m-d \<\b\r \/\> g:i:s a'); ?></td>
<td>
<?php the_title() ?>
</td>
<td><?php the_author() ?></td>
<td><?php the_author() ?></td>
<td><?php the_time('Y-m-d g:i a'); ?></td>
<td><a href="<?php the_permalink(); ?>" rel="permalink" class="edit">View</a></td>
<td><?php if (($user_level > $authordata->user_level) or ($user_login == $authordata->user_login)) { echo "<a href='post.php?action=edit&amp;post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td>
<td><?php if (($user_level > $authordata->user_level) or ($user_login == $authordata->user_login)) { echo "<a href='post.php?action=delete&amp;post=$id' class='delete' onclick=\"return confirm('" . sprintf(__("You are about to delete this post \'%s\'\\n \'OK\' to delete, \'Cancel\' to stop."), the_title('','',0)) . "')\">" . __('Delete') . "</a>"; } ?></td>
</tr>
<?php endforeach; ?>
</table>
<?php
}
} else {
?>
<tr style='background-color: <?php echo $bgcolor; ?>'>
<td colspan="8"><?php _e('No pages found.') ?></td>
</tr>
<p><?php _e('No pages yet.') ?></p>
<?php
} // end if ($posts)
?>
</table>
<?php
if ( 1 == count($posts) ) {
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id ORDER BY comment_date");
if ($comments) {
?>
<h3><?php _e('Comments') ?></h3>
<ol id="comments">
<?php
foreach ($comments as $comment) {
$comment_status = wp_get_comment_status($comment->comment_ID);
?>
<li <?php if ("unapproved" == $comment_status) echo "class='unapproved'"; ?> >
<?php comment_date('Y-n-j') ?>
@
<?php comment_time('g:m:s a') ?>
<?php
if (($user_level > $authordata->user_level) or ($user_login == $authordata->user_login)) {
echo "[ <a href=\"post.php?action=editcomment&amp;comment=".$comment->comment_ID."\">" . __('Edit') . "</a>";
echo " - <a href=\"post.php?action=deletecomment&amp;p=".$post->ID."&amp;comment=".$comment->comment_ID."\" onclick=\"return confirm('" . sprintf(__("You are about to delete this comment by \'%s\'\\n \'OK\' to delete, \'Cancel\' to stop."), $comment->comment_author) . "')\">" . __('Delete') . "</a> ";
if ( ('none' != $comment_status) && ($user_level >= 3) ) {
if ('approved' == wp_get_comment_status($comment->comment_ID)) {
echo " - <a href=\"post.php?action=unapprovecomment&amp;p=".$post->ID."&amp;comment=".$comment->comment_ID."\">" . __('Unapprove') . "</a> ";
} else {
echo " - <a href=\"post.php?action=approvecomment&amp;p=".$post->ID."&amp;comment=".$comment->comment_ID."\">" . __('Approve') . "</a> ";
}
}
echo "]";
} // end if any comments to show
?>
<br />
<strong>
<?php comment_author() ?>
(
<?php comment_author_email_link() ?>
/
<?php comment_author_url_link() ?>
)</strong> (IP:
<?php comment_author_IP() ?>
)
<?php comment_text() ?>
</li>
<!-- /comment -->
<?php //end of the loop, don't delete
} // end foreach
echo '</ol>';
}//end if comments
?>
<?php } ?>
</div>
<?php
include('admin-footer.php');
?>
<?php
if ($user_level > 0) {
$action = 'post';
get_currentuserinfo();
//set defaults
$post_status = 'static';
$comment_status = get_settings('default_comment_status');
$ping_status = get_settings('default_ping_status');
$post_pingback = get_settings('default_pingback_flag');
include('edit-page-form.php');
}
?>
<?php include('admin-footer.php'); ?>

View File

@ -692,35 +692,6 @@ case 'editedcomment':
do_action('edit_comment', $comment_ID);
break;
case 'createpage':
$standalone = 0;
$title = __('Create New Page');
require_once ('./admin-header.php');
if ($user_level > 0) {
$action = 'post';
get_currentuserinfo();
//set defaults
$post_status = 'static';
$comment_status = get_settings('default_comment_status');
$ping_status = get_settings('default_ping_status');
$post_pingback = get_settings('default_pingback_flag');
include('edit-page-form.php');
} else {
?>
<div class="wrap">
<p><?php printf(__('Since you&#8217;re a newcomer, you&#8217;ll have to wait for an admin to raise your level to 1, in order to be authorized to post.<br />
You can also <a href="mailto:%s?subject=Promotion?">e-mail the admin</a> to ask for a promotion.<br />
When you&#8217;re promoted, just reload this page and you&#8217;ll be able to blog. :)'), get_settings('admin_email')); ?>
</p>
</div>
<?php
}
break;
default:
$standalone = 0;
$title = __('Create New Post');

View File

@ -117,10 +117,9 @@ CREATE TABLE $wpdb->posts (
post_content_filtered text NOT NULL,
post_parent int(11) NOT NULL default '0',
guid varchar(255) NOT NULL default '',
menu_order int(11) NOT NULL default '0',
PRIMARY KEY (ID),
KEY post_date_gmt (post_date_gmt),
KEY post_name (post_name),
KEY post_status (post_status)
);
CREATE TABLE $wpdb->users (
ID int(10) unsigned NOT NULL auto_increment,

View File

@ -47,7 +47,8 @@ body, td {
fieldset {
border: 1px solid #ddd;
padding: 2px;
padding: 3px;
-moz-border-radius: 5px;
}
fieldset label.selectit {
@ -467,7 +468,7 @@ textarea, input, select {
height: 4em;
}
#titlediv, #poststatusdiv, #commentstatusdiv, #slugdiv, #postpassworddiv, #namediv, #uridiv, #emaildiv {
#titlediv, #poststatusdiv, #commentstatusdiv, #slugdiv, #postpassworddiv, #namediv, #uridiv, #emaildiv, #pageparent {
float: left;
height: 6em;
margin-right: 5px;

View File

@ -2,6 +2,6 @@
// This just holds the version number, in a separate file so we can bump it without cluttering the CVS
$wp_version = '1.3-alpha-3';
$wp_version = '1.3-alpha-4';
?>