Alpha 2 multiple category support.
git-svn-id: http://svn.automattic.com/wordpress/trunk@571 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
41327030fd
commit
cbccab200c
|
@ -575,7 +575,8 @@ function add_option() {
|
|||
}
|
||||
|
||||
function get_postdata($postid) {
|
||||
global $tableusers, $tablecategories, $tableposts, $tablecomments, $wpdb;
|
||||
global $post, $tableusers, $tablecategories, $tableposts, $tablecomments, $wpdb;
|
||||
|
||||
$post = $wpdb->get_row("SELECT * FROM $tableposts WHERE ID = $postid");
|
||||
|
||||
$postdata = array (
|
||||
|
@ -662,22 +663,29 @@ function profile($user_login) {
|
|||
echo "<a href='b2profile.php?user=".$user_data->user_login."' onclick=\"javascript:window.open('b2profile.php?user=".$user_data->user_login."','Profile','toolbar=0,status=1,location=0,directories=0,menuBar=1,scrollbars=1,resizable=0,width=480,height=320,left=100,top=100'); return false;\">$user_login</a>";
|
||||
}
|
||||
|
||||
function dropdown_categories($blog_ID=1, $default=1) {
|
||||
global $postdata,$tablecategories,$mode, $wpdb;
|
||||
$query="SELECT * FROM $tablecategories ORDER BY cat_name";
|
||||
$results = $wpdb->get_results($query);
|
||||
$width = ($mode=="sidebar") ? "100%" : "170px";
|
||||
echo '<select name="post_category" style="width:'.$width.';" tabindex="2" id="category">';
|
||||
if ($postdata["Category"] != '') {
|
||||
$default = $postdata["Category"];
|
||||
}
|
||||
foreach($results as $post) {
|
||||
echo "<option value=\"".$post->cat_ID."\"";
|
||||
if ($post->cat_ID == $default)
|
||||
echo " selected";
|
||||
echo ">".$post->cat_name."</option>";
|
||||
function dropdown_categories($default = 0) {
|
||||
global $post, $tablecategories, $tablepost2cat, $mode, $wpdb;
|
||||
$categories = $wpdb->get_results("SELECT * FROM $tablecategories ORDER BY cat_name");
|
||||
|
||||
if ($post->ID) {
|
||||
$postcategories = $wpdb->get_col("
|
||||
SELECT category_id
|
||||
FROM $tablecategories, $tablepost2cat
|
||||
WHERE $tablepost2cat.category_id = cat_ID AND $tablepost2cat.post_id = $post->ID
|
||||
");
|
||||
} else {
|
||||
$postcategories[] = $default;
|
||||
}
|
||||
echo "</select>";
|
||||
|
||||
foreach($categories as $category) {
|
||||
++$i;
|
||||
$category->cat_name = stripslashes($category->cat_name);
|
||||
echo "<label for='category-$category->cat_ID' class='selectit'><input value='$category->cat_ID' type='checkbox' name='post_category' id='category-$category->cat_ID'";
|
||||
if ($postcategories && in_array($category->cat_ID, $postcategories))
|
||||
echo " checked='checked'";
|
||||
echo ">$category->cat_name</label> ";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function touch_time($edit = 1) {
|
||||
|
|
|
@ -13,7 +13,7 @@ require_once ($curpath.$b2inc.'/b2functions.php');
|
|||
require_once ($curpath.$b2inc.'/xmlrpc.inc');
|
||||
require_once ($curpath.$b2inc.'/xmlrpcs.inc');
|
||||
|
||||
$b2varstoreset = array('m','p','posts','w','c', 'cat','withcomments','s','search','exact', 'sentence','poststart','postend','preview','debug', 'calendar','page','paged','more','tb', 'pb','author','order','orderby', 'year', 'monthnum', 'day', 'name');
|
||||
$b2varstoreset = array('m','p','posts','w','c', 'cat','withcomments','s','search','exact', 'sentence','poststart','postend','preview','debug', 'calendar','page','paged','more','tb', 'pb','author','order','orderby', 'year', 'monthnum', 'day', 'name', 'category_nicename');
|
||||
|
||||
for ($i=0; $i<count($b2varstoreset); $i += 1) {
|
||||
$b2var = $b2varstoreset[$i];
|
||||
|
@ -289,7 +289,7 @@ $where .= ' AND (post_status = "publish"';
|
|||
|
||||
// Get private posts
|
||||
if (isset($user_ID) && ('' != intval($user_ID)))
|
||||
$where .= " OR post_author = $user_ID AND post_status != 'draft')";
|
||||
$where .= " OR post_author = $user_ID AND post_status != 'draft')";
|
||||
else
|
||||
$where .= ')';
|
||||
$request = " SELECT $distinct * FROM $tableposts WHERE 1=1".$where." ORDER BY post_$orderby $limits";
|
||||
|
@ -307,6 +307,7 @@ if ($preview) {
|
|||
// error_log("$request");
|
||||
// echo $request;
|
||||
$posts = $wpdb->get_results($request);
|
||||
|
||||
if (1 == count($posts)) {
|
||||
if ($p || $name) {
|
||||
$more = 1;
|
||||
|
|
|
@ -147,6 +147,20 @@ textarea, input, select {
|
|||
font-size: 14px;
|
||||
}
|
||||
|
||||
#categorydiv {
|
||||
float: right;
|
||||
width: 10%;
|
||||
line-height: 130%;
|
||||
}
|
||||
|
||||
#poststuff {
|
||||
width: 88%;
|
||||
}
|
||||
|
||||
#poststuff textarea {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#ed_button {
|
||||
padding: 1px;
|
||||
}
|
||||
|
@ -202,6 +216,7 @@ textarea, input, select {
|
|||
padding: 0 2px;
|
||||
display: block;
|
||||
margin-bottom: 1px;
|
||||
margin-top: 1px;
|
||||
border-bottom: 1px solid #666;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
@ -241,11 +256,12 @@ label input {
|
|||
text-align: right;
|
||||
}
|
||||
|
||||
#titlediv, #categorydiv, #poststatusdiv, #commentstatusdiv, #pingstatusdiv, #postpassworddiv {
|
||||
#titlediv, #poststatusdiv, #commentstatusdiv, #pingstatusdiv, #postpassworddiv {
|
||||
float: left;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
|
||||
#wphead {
|
||||
background: url(../b2-img/wp-small.png) no-repeat;
|
||||
border-bottom: 4px solid #333;
|
||||
|
|
|
@ -77,10 +77,8 @@ window.onload = focusit;
|
|||
<br />
|
||||
<input type="text" name="post_title" size="25" tabindex="1" style="width: 190px;" value="<?php echo $edited_post_title; ?>" id="title" />
|
||||
</div>
|
||||
<div id="categorydiv">
|
||||
<label for="category"><a href="http://wordpress.org/docs/reference/post/#category" title="Help on categories">Category</a>:</label>
|
||||
<br />
|
||||
<?php dropdown_categories($blog_ID, $default_post_cat); ?>
|
||||
<div id="categorydiv"> <a href="http://wordpress.org/docs/reference/post/#category" title="Help on categories">Categories</a>: <br />
|
||||
<?php dropdown_categories($default_post_cat); ?>
|
||||
</div>
|
||||
<div id="poststatusdiv">
|
||||
<a href="http://wordpress.org/docs/reference/post/#post_status" title="Help on post status">Post
|
||||
|
@ -107,7 +105,9 @@ window.onload = focusit;
|
|||
<br />
|
||||
<input name="post_password" type="text" id="post_password" value="<?php echo $post_password ?>" />
|
||||
</div>
|
||||
<br style="clear: both" />
|
||||
|
||||
|
||||
<div id="poststuff">
|
||||
<?php
|
||||
|
||||
} else {
|
||||
|
@ -145,14 +145,14 @@ window.onload = focusit;
|
|||
<?php
|
||||
if ($action != 'editcomment') {
|
||||
?>
|
||||
<p><a href="http://wordpress.org/docs/reference/post/#excerpt" title="Help with excerpts">Excerpt</a>:
|
||||
<p style="clear: both;" ><a href="http://wordpress.org/docs/reference/post/#excerpt" title="Help with excerpts">Excerpt</a>:
|
||||
<br />
|
||||
<textarea rows="3" cols="40" style="width:100%" name="excerpt" tabindex="4" wrap="virtual" id="excerpt"><?php echo $excerpt ?></textarea></p>
|
||||
<textarea rows="3" cols="40" name="excerpt" tabindex="4" wrap="virtual" id="excerpt"><?php echo $excerpt ?></textarea></p>
|
||||
|
||||
<?php
|
||||
} // if not a comment
|
||||
?>
|
||||
<table width="100%">
|
||||
<table style="width: 100%; ">
|
||||
<tr>
|
||||
<td>
|
||||
<?php
|
||||
|
@ -176,10 +176,10 @@ if ($use_quicktags) {
|
|||
<?php
|
||||
$rows = get_settings('default_post_edit_rows');
|
||||
if (($rows < 3) || ($rows > 100)) {
|
||||
$rows = 9;
|
||||
$rows = 10;
|
||||
}
|
||||
?>
|
||||
<textarea rows="<?php echo $rows; ?>" cols="40" style="width:100%" name="content" tabindex="4" wrap="virtual" id="content"><?php echo $content ?></textarea><br />
|
||||
<textarea rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="4" wrap="virtual" id="content"><?php echo $content ?></textarea><br />
|
||||
<?php
|
||||
if ($use_quicktags) {
|
||||
?>
|
||||
|
@ -236,3 +236,4 @@ if ('edit' == $action) echo "
|
|||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue