Massive admin tweak commit. Improved consistency, numerous bug fixes, redesigned link forms, tweaked options more, left the ugly grey bar I didn't mean to add in the first place but tweaked it too.

git-svn-id: http://svn.automattic.com/wordpress/trunk@1100 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
saxmatt
2004-04-19 08:09:27 +00:00
parent 8546d782a6
commit 5cc3f8d3e1
19 changed files with 321 additions and 275 deletions

View File

@@ -10,14 +10,14 @@ $wpvarstoreset = array('action','standalone','cat', 'auto_toggle');
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
$wpvar = $wpvarstoreset[$i];
if (!isset($$wpvar)) {
if (empty($HTTP_POST_VARS["$wpvar"])) {
if (empty($HTTP_GET_VARS["$wpvar"])) {
if (empty($_POST["$wpvar"])) {
if (empty($_GET["$wpvar"])) {
$$wpvar = '';
} else {
$$wpvar = $HTTP_GET_VARS["$wpvar"];
$$wpvar = $_GET["$wpvar"];
}
} else {
$$wpvar = $HTTP_POST_VARS["$wpvar"];
$$wpvar = $_POST["$wpvar"];
}
}
}
@@ -31,43 +31,43 @@ switch ($action) {
if ($user_level < get_settings('links_minadminlevel'))
die ("Cheatin' uh ?");
$cat_name = addslashes($HTTP_POST_VARS['cat_name']);
$auto_toggle = $HTTP_POST_VARS['auto_toggle'];
$cat_name = addslashes($_POST['cat_name']);
$auto_toggle = $_POST['auto_toggle'];
if ($auto_toggle != 'Y') {
$auto_toggle = 'N';
}
$show_images = $HTTP_POST_VARS['show_images'];
$show_images = $_POST['show_images'];
if ($show_images != 'Y') {
$show_images = 'N';
}
$show_description = $HTTP_POST_VARS['show_description'];
$show_description = $_POST['show_description'];
if ($show_description != 'Y') {
$show_description = 'N';
}
$show_rating = $HTTP_POST_VARS['show_rating'];
$show_rating = $_POST['show_rating'];
if ($show_rating != 'Y') {
$show_rating = 'N';
}
$show_updated = $HTTP_POST_VARS['show_updated'];
$show_updated = $_POST['show_updated'];
if ($show_updated != 'Y') {
$show_updated = 'N';
}
$sort_order = $HTTP_POST_VARS['sort_order'];
$sort_order = $_POST['sort_order'];
$sort_desc = $HTTP_POST_VARS['sort_desc'];
$sort_desc = $_POST['sort_desc'];
if ($sort_desc != 'Y') {
$sort_desc = 'N';
}
$text_before_link = addslashes($HTTP_POST_VARS['text_before_link']);
$text_after_link = addslashes($HTTP_POST_VARS['text_after_link']);
$text_after_all = addslashes($HTTP_POST_VARS['text_after_all']);
$text_before_link = addslashes($_POST['text_before_link']);
$text_after_link = addslashes($_POST['text_after_link']);
$text_after_all = addslashes($_POST['text_after_all']);
$list_limit = $HTTP_POST_VARS['list_limit'];
$list_limit = $_POST['list_limit'];
if ($list_limit == '')
$list_limit = -1;
@@ -85,7 +85,7 @@ switch ($action) {
$standalone = 1;
include_once('admin-header.php');
$cat_id = $HTTP_GET_VARS['cat_id'];
$cat_id = $_GET['cat_id'];
$cat_name=get_linkcatname($cat_id);
$cat_name=addslashes($cat_name);
@@ -104,7 +104,7 @@ switch ($action) {
case 'Edit':
{
include_once ('admin-header.php');
$cat_id = $HTTP_GET_VARS['cat_id'];
$cat_id = $_GET['cat_id'];
$row = $wpdb->get_row("SELECT cat_id, cat_name, auto_toggle, show_images, show_description, "
. " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, "
. " text_after_all, list_limit FROM $tablelinkcategories WHERE cat_id=$cat_id");
@@ -122,40 +122,40 @@ switch ($action) {
</ul>
<div class="wrap">
<h3>Edit Link Category &#8220;<?php echo $row->cat_name?>&#8221;</h3>
<p>
<h2>Edit &#8220;<?php echo $row->cat_name?>&#8221; Category </h2>
<form name="editcat" method="post">
<input type="hidden" name="action" value="editedcat" />
<input type="hidden" name="cat_id" value="<?php echo $row->cat_id ?>" />
<table border="0">
<tr>
<td align="right">Name:</td>
<td><input type="text" name="cat_name" size="25" value="<?php echo stripslashes($row->cat_name)?>" />&nbsp;&nbsp;&nbsp;
<label for="auto_toggle">
<input type="checkbox" name="auto_toggle" id="auto_toggle" <?php echo ($row->auto_toggle == 'Y') ? 'checked' : '';?> value="Y" />
auto-toggle?</label></td>
</tr>
<tr>
<td align="right">Show:</td>
<fieldset class="options">
<legend>Category Options</legend>
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
<tr>
<th width="33%" scope="row">Name:</th>
<td width="67%"><input name="cat_name" type="text" value="<?php echo stripslashes($row->cat_name)?>" size="30" /></td>
</tr>
<tr>
<th scope="row">Show:</th>
<td>
<label for="show_images">
<input type="checkbox" name="show_images" id="show_images" <?php echo ($row->show_images == 'Y') ? 'checked' : '';?> value="Y" />
images</label>&nbsp;
<label for="show_description">
<input type="checkbox" name="show_description" id="show_description" <?php echo ($row->show_description == 'Y') ? 'checked' : '';?> value="Y" />
description</label> &nbsp;
<label for="show_rating">
<input type="checkbox" name="show_rating" id="show_rating" <?php echo ($row->show_rating == 'Y') ? 'checked' : '';?> value="Y" />
rating</label> &nbsp;
<label for="show_updated">
<input type="checkbox" name="show_updated" id="show_updated" <?php echo ($row->show_updated == 'Y') ? 'checked' : '';?> value="Y" />
updated</label>
</td>
</tr>
<tr>
<td align="right">Sort by:</td>
<td>
<select name="sort_order" size="1">
<label>
<input type="checkbox" name="show_images" value="Y" <?php checked('Y', $row->show_images); ?> />
Image</label> <br />
<label>
<input type="checkbox" name="show_description" value="Y" <?php checked('Y', $row->show_description); ?> />
Description</label>
(shown in <code>title</code> regardless)<br />
<label>
<input type="checkbox" name="show_rating" value="Y" <?php checked('Y', $row->show_rating); ?> />
Rating</label> <br />
<label>
<input type="checkbox" name="show_updated" value="Y" <?php checked('Y', $row->show_updated); ?> />
Updated</label>
(shown in <code>title</code> regardless)</td>
</tr>
<tr>
<th scope="row">Sort order:</th>
<td>
<select name="sort_order" size="1">
<option value="name" <?php echo ($row->sort_order == 'name') ? 'selected' : ''?>>Name</option>
<option value="id" <?php echo ($row->sort_order == 'id') ? 'selected' : ''?>>Id</option>
<option value="url" <?php echo ($row->sort_order == 'url') ? 'selected' : ''?>>URL</option>
@@ -163,39 +163,48 @@ updated</label>
<option value="updated" <?php echo ($row->sort_order == 'updated') ? 'selected' : ''?>>Updated</option>
<option value="rand" <?php echo ($row->sort_order == 'rand') ? 'selected' : ''?>>Random</option>
<option value="length" <?php echo ($row->sort_order == 'length') ? 'selected' : ''?>>Name Length</option>
</select>&nbsp;&nbsp;
<input type="checkbox" name="sort_desc" <?php echo ($row->sort_desc == 'Y') ? 'checked' : '';?> value="Y" /> Descending?<br />
</td>
</tr>
<tr>
<td align="center">Text/HTML</td>
<td>&nbsp;</td>
</tr>
<tr>
<td align="right">Before:</td>
<td><input type="text" name="text_before_link" size="45" value="<?php echo stripslashes($row->text_before_link)?>" /></td>
</tr>
<tr>
<td align="right">Between:</td>
<td><input type="text" name="text_after_link" size="45" value="<?php echo stripslashes($row->text_after_link)?>" /></td>
</tr>
<tr>
<td align="right">After:</td>
<td><input type="text" name="text_after_all" size="45" value="<?php echo stripslashes($row->text_after_all)?>" /></td>
</tr>
<tr>
<td align="right">Limit:</td>
<td><input type="text" name="list_limit" size="5" value="<?php echo $row->list_limit?>"/> (How many links are shown. Empty for unlimited.)</td>
</tr>
<tr>
<td align="center" colspan="2">
<input type="submit" name="submit" value="Save" class="search" />&nbsp;
<input type="submit" name="submit" value="Cancel" class="search">
</td>
</tr>
</table>
</form>
</p>
</select>
<label>
<input type="checkbox" name="sort_desc" value="Y" <?php checked('Y', $row->sort_desc); ?> />
Descending</label>
</td>
</tr>
<tr>
<th scope="row">Limit:</th>
<td>
<input type="text" name="list_limit" size="5" value="<?php echo $row->list_limit ?>" />
(Leave empty for no limit to number of links shown)
</td>
</tr>
<tr>
<th scope="row">Toggle:</th>
<td><label>
<input type="checkbox" name="auto_toggle" value="Y" <?php checked('Y', $row->auto_toggle); ?> />
When new link is added toggle all others to be invisible</label></td>
</tr>
</table>
</fieldset>
<fieldset class="options">
<legend>Formatting</legend>
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
<tr>
<th width="33%" scope="row">Before Link:</th>
<td width="67%"><input type="text" name="text_before_link" size="45" value="<?php echo stripslashes($row->text_before_link)?>" /></td>
</tr>
<tr>
<th scope="row">Between Link and Description:</th>
<td><input type="text" name="text_after_link" size="45" value="<?php echo stripslashes($row->text_after_link)?>" /></td>
</tr>
<tr>
<th scope="row">After Link:</th>
<td><input type="text" name="text_after_all" size="45" value="<?php echo stripslashes($row->text_after_all)?>"/></td>
</tr>
</table>
</fieldset>
<p class="submit"><input type="submit" name="submit" value="Save Category Settings &raquo;" /></p>
</form>
</div>
<?php
} // end if row
@@ -209,48 +218,48 @@ updated</label>
if ($user_level < get_settings('links_minadminlevel'))
die ("Cheatin' uh ?");
$submit=$HTTP_POST_VARS["submit"];
if (isset($submit) && ($submit == "Save")) {
$submit=$_POST["submit"];
if (isset($submit)) {
$cat_id=$HTTP_POST_VARS["cat_id"];
$cat_id=$_POST["cat_id"];
$cat_name=addslashes($HTTP_POST_VARS["cat_name"]);
$auto_toggle = $HTTP_POST_VARS["auto_toggle"];
$cat_name=addslashes(stripslashes($_POST["cat_name"]));
$auto_toggle = $_POST["auto_toggle"];
if ($auto_toggle != 'Y') {
$auto_toggle = 'N';
}
$show_images = $HTTP_POST_VARS["show_images"];
$show_images = $_POST["show_images"];
if ($show_images != 'Y') {
$show_images = 'N';
}
$show_description = $HTTP_POST_VARS["show_description"];
$show_description = $_POST["show_description"];
if ($show_description != 'Y') {
$show_description = 'N';
}
$show_rating = $HTTP_POST_VARS["show_rating"];
$show_rating = $_POST["show_rating"];
if ($show_rating != 'Y') {
$show_rating = 'N';
}
$show_updated = $HTTP_POST_VARS["show_updated"];
$show_updated = $_POST["show_updated"];
if ($show_updated != 'Y') {
$show_updated = 'N';
}
$sort_order = $HTTP_POST_VARS["sort_order"];
$sort_order = $_POST["sort_order"];
$sort_desc = $HTTP_POST_VARS["sort_desc"];
$sort_desc = $_POST["sort_desc"];
if ($sort_desc != 'Y') {
$sort_desc = 'N';
}
$text_before_link = addslashes($HTTP_POST_VARS["text_before_link"]);
$text_after_link = addslashes($HTTP_POST_VARS["text_after_link"]);
$text_after_all = addslashes($HTTP_POST_VARS["text_after_all"]);
$text_before_link = addslashes($_POST["text_before_link"]);
$text_after_link = addslashes($_POST["text_after_link"]);
$text_after_all = addslashes($_POST["text_after_all"]);
$list_limit = $HTTP_POST_VARS["list_limit"];
$list_limit = $_POST["list_limit"];
if ($list_limit == '')
$list_limit = -1;
@@ -290,36 +299,33 @@ updated</label>
<li class="last"><a href="link-import.php">Import Blogroll</a></li>
</ul>
<div class="wrap">
<form name="cats" method="post" action="link-categories.php">
<strong>Edit</strong> a link category:<?php echo gethelp_link($this_file,'edit_link_category');?><br />
<h2>Link Categories:<?php echo gethelp_link($this_file,'edit_link_category');?></h2>
<table width="100%" cellpadding="5" cellspacing="0" border="0">
<tr>
<th rowspan="2" valign="bottom">Name</th>
<th rowspan="2" valign="bottom">Id</th>
<th rowspan="2" valign="bottom">Auto<br />Toggle?</th>
<th rowspan="2" valign="bottom">ID</th>
<th rowspan="2" valign="bottom">Toggle?</th>
<th colspan="4" valign="bottom">Show</th>
<th rowspan="2" valign="bottom">Sort Order</th>
<th rowspan="2" valign="bottom">Desc?</th>
<th colspan="3" valign="bottom">Text/HTML</th>
<th colspan="3" valign="bottom">Formatting</th>
<th rowspan="2" valign="bottom">Limit</th>
<th rowspan="2" colspan="2">&nbsp;</th>
</tr>
<tr>
<th valign="top">images?</th>
<th valign="top">desc?</th>
<th valign="top">rating?</th>
<th valign="top">updated?</th>
<th valign="top">before</th>
<th valign="top">between</th>
<th valign="top">after</th>
<th valign="top">Images</th>
<th valign="top">Desc.</th>
<th valign="top">Rating</th>
<th valign="top">Updated</th>
<th valign="top">Before</th>
<th valign="top">Between</th>
<th valign="top">After</th>
</tr>
<input type="hidden" name="cat_id" value="" />
<input type="hidden" name="action" value="" />
<?php
$results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle, show_images, show_description, "
. " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, "
. " text_after_all, list_limit FROM $tablelinkcategories ORDER BY cat_id");
$i = 1;
foreach ($results as $row) {
if ($row->list_limit == -1) {
$row->list_limit = 'none';
@@ -348,66 +354,88 @@ foreach ($results as $row) {
}
?>
</table>
</form>
<p>These are the defaults for when you call a link category with no additional arguments. All of these settings may be overwritten.</p>
</div>
<div class="wrap">
<form name="addcat" method="post">
<input type="hidden" name="action" value="addcat" />
<h3>Add a Link Category:<?php echo gethelp_link($this_file,'add_link_category');?></h3>
<table width="100%" cellpadding="5" cellspacing="0" border="0">
<tr>
<td align="right">Name:</td>
<td><input type="text" name="cat_name" size="25" />&nbsp;&nbsp;&nbsp;
<input type="checkbox" name="auto_toggle" value="Y" /> auto-toggle?</td>
</tr>
<tr>
<td align="right">Show:</td>
<h2>Add a Link Category:<?php echo gethelp_link($this_file,'add_link_category');?></h2>
<fieldset class="options">
<legend>Category Options</legend>
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
<tr>
<th width="33%" scope="row">Name:</th>
<td width="67%"><input type="text" name="cat_name" size="30" /></td>
</tr>
<tr>
<th scope="row">Show:</th>
<td>
<input type="checkbox" name="show_images" value="Y" /> images&nbsp;&nbsp;
<input type="checkbox" name="show_description" value="Y" /> description&nbsp;&nbsp;
<input type="checkbox" name="show_rating" value="Y" /> rating&nbsp;&nbsp;
<input type="checkbox" name="show_updated" value="Y" /> updated</td>
</tr>
<tr>
<td align="right">Sort order:</td>
<td>
<select name="sort_order" size="1">
<option value="name">Name</option>
<option value="id">Id</option>
<option value="url">URL</option>
<option value="rating">Rating</option>
<option value="updated">Updated</option>
<option value="rand">Random</option>
</select>&nbsp;&nbsp;
<input type="checkbox" name="sort_desc" value="N" /> Descending?<br />
</td>
</tr>
<tr>
<td align="center">Text/HTML</td>
<td>&nbsp;</td>
</tr>
<tr>
<td align="right">before:</td>
<td><input type="text" name="text_before_link" size="45" value="&lt;li&gt;"/></td>
</tr>
<tr>
<td align="right">between:</td>
<td><input type="text" name="text_after_link" size="45" value="&lt;br /&gt;" /></td>
</tr>
<tr>
<td align="right">after:</td>
<td><input type="text" name="text_after_all" size="45" value="&lt;/li&gt;"/></td>
</tr>
<tr>
<td align="right">limit:</td>
<td><input type="text" name="list_limit" size="5" value=""/> (leave empty for no limit)</td>
</tr>
<tr>
<td align="center" colspan="2"><input type="submit" name="submit" value="Add Category!" class="search" /></td>
</tr>
</table>
<label>
<input type="checkbox" name="show_images" value="Y" />
Image</label> <br />
<label>
<input type="checkbox" name="show_description" value="Y" />
Description</label>
(shown in <code>title</code> regardless)<br />
<label>
<input type="checkbox" name="show_rating" value="Y" />
Rating</label> <br />
<label>
<input type="checkbox" name="show_updated" value="Y" />
Updated</label>
(shown in <code>title</code> regardless)</td>
</tr>
<tr>
<th scope="row">Sort order:</th>
<td>
<select name="sort_order" size="1">
<option value="name">Name</option>
<option value="id">Id</option>
<option value="url">URL</option>
<option value="rating">Rating</option>
<option value="updated">Updated</option>
<option value="rand">Random</option>
</select>
<label>
<input type="checkbox" name="sort_desc" value="Y" />
Descending</label>
</td>
</tr>
<tr>
<th scope="row">Limit:</th>
<td>
<input type="text" name="list_limit" size="5" value="" /> (Leave empty for no limit to number of links shown)
</td>
</tr>
<tr>
<th scope="row">Toggle:</th>
<td><label>
<input type="checkbox" name="auto_toggle" value="Y" />
When new link is added toggle all others to be invisible</label></td>
</tr>
</table>
</fieldset>
<fieldset class="options">
<legend>Formatting</legend>
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
<tr>
<th width="33%" scope="row">Before Link:</th>
<td width="67%"><input type="text" name="text_before_link" size="45" value="&lt;li&gt;" /></td>
</tr>
<tr>
<th scope="row">Between Link and Description:</th>
<td><input type="text" name="text_after_link" size="45" value="&lt;br /&gt;" /></td>
</tr>
<tr>
<th scope="row">After Link:</th>
<td><input type="text" name="text_after_all" size="45" value="&lt;/li&gt;"/></td>
</tr>
</table>
</fieldset>
<p class="submit"><input type="submit" name="submit" value="Add Category &raquo;" /></p>
</form>
</div>
<div class="wrap">