lots of zebras!

This commit is contained in:
Shish 2009-01-16 20:24:43 -08:00
parent 34857c4d25
commit a2e5ad707b
4 changed files with 39 additions and 29 deletions

View File

@ -22,12 +22,14 @@ class ImageBanTheme extends Themelet {
*/
public function display_image_hash_bans(Page $page, $page_number, $bans) {
$h_bans = "";
$n = 0;
foreach($bans as $ban) {
$oe = ($n++ % 2 == 0) ? "even" : "odd";
$h_bans .= "
<tr>
<td>{$ban['hash']}</td>
<tr class='$oe'>
<td width='30%'>{$ban['hash']}</td>
<td>{$ban['reason']}</td>
<td>
<td width='10%'>
<form action='".make_link("image_hash_ban/remove")."' method='POST'>
<input type='hidden' name='hash' value='{$ban['hash']}'>
<input type='submit' value='Remove'>
@ -37,16 +39,16 @@ class ImageBanTheme extends Themelet {
";
}
$html = "
<table border='1'>
<thead><td>Hash</td><td>Reason</td><td>Action</td></thead>
<table class='zebra'>
<thead><th>Hash</th><th>Reason</th><th>Action</th></thead>
$h_bans
<tr>
<tfoot><tr>
<form action='".make_link("image_hash_ban/add")."' method='POST'>
<td><input type='text' name='hash'></td>
<td><input type='text' name='reason'></td>
<td><input type='submit' value='Ban'></td>
</form>
</tr>
</tr></tfoot>
</table>
";

View File

@ -14,15 +14,17 @@ class IPBanTheme extends Themelet {
public function display_bans(Page $page, $bans) {
global $user;
$h_bans = "";
$n = 0;
foreach($bans as $ban) {
$end_human = date('Y-m-d', $ban['end_timestamp']);
$oe = ($n++ % 2 == 0) ? "even" : "odd";
$h_bans .= "
<tr>
<td>{$ban['ip']}</td>
<tr class='$oe'>
<td width='10%'>{$ban['ip']}</td>
<td>{$ban['reason']}</td>
<td>{$ban['banner_name']}</td>
<td>{$end_human}</td>
<td>
<td width='10%'>{$ban['banner_name']}</td>
<td width='15%'>{$end_human}</td>
<td width='10%'>
<form action='".make_link("ip_ban/remove")."' method='POST'>
<input type='hidden' name='id' value='{$ban['id']}'>
<input type='submit' value='Remove'>
@ -32,10 +34,10 @@ class IPBanTheme extends Themelet {
";
}
$html = "
<table border='1'>
<thead><td>IP</td><td>Reason</td><td>By</td><td>Until</td><td>Action</td></thead>
<table class='zebra'>
<thead><th>IP</th><th>Reason</th><th>By</th><th>Until</th><th>Action</th></thead>
$h_bans
<tr>
<tfoot><tr>
<form action='".make_link("ip_ban/add")."' method='POST'>
<td><input type='text' name='ip'></td>
<td><input type='text' name='reason'></td>
@ -43,7 +45,7 @@ class IPBanTheme extends Themelet {
<td><input type='text' name='end'></td>
<td><input type='submit' value='Ban'></td>
</form>
</tr>
</tr></tfoot>
</table>
";
$page->set_title("IP Bans");

View File

@ -9,7 +9,7 @@ class AliasEditorTheme extends Themelet {
*/
public function display_aliases(Page $page, $aliases, $is_admin) {
if($is_admin) {
$action = "<td>Action</td>";
$action = "<th width='10%'>Action</th>";
$add = "
<tr>
<form action='".make_link("alias/add")."' method='POST'>
@ -26,10 +26,13 @@ class AliasEditorTheme extends Themelet {
}
$h_aliases = "";
$n = 0;
foreach($aliases as $old => $new) {
$h_old = html_escape($old);
$h_new = html_escape($new);
$h_aliases .= "<tr><td>$h_old</td><td>$h_new</td>";
$oe = ($n++ % 2 == 0) ? "even" : "odd";
$h_aliases .= "<tr class='$oe'><td>$h_old</td><td>$h_new</td>";
if($is_admin) {
$h_aliases .= "
<td>
@ -43,8 +46,8 @@ class AliasEditorTheme extends Themelet {
$h_aliases .= "</tr>";
}
$html = "
<table border='1'>
<thead><td>From</td><td>To</td>$action</thead>
<table class='zebra'>
<thead><th>From</th><th>To</th>$action</thead>
$add
$h_aliases
$add

View File

@ -54,25 +54,28 @@ class SetupTheme extends Themelet {
public function display_advanced(Page $page, $options) {
$rows = "";
$n = 0;
foreach($options as $name => $value) {
$h_value = html_escape($value);
$len = strlen($h_value);
$oe = ($n++ % 2 == 0) ? "even" : "odd";
$box = "";
if($len < 50) {
$box .= "<input type='text' name='_config_$name' value='$h_value'>";
}
else {
if(strpos($value, "\n") > 0) {
$box .= "<textarea cols='50' rows='4' name='_config_$name'>$h_value</textarea>";
}
else {
$box .= "<input type='text' name='_config_$name' value='$h_value'>";
}
$box .= "<input type='hidden' name='_type_$name' value='string'>";
$rows .= "<tr><td>$name</td><td>$box</td></tr>";
$rows .= "<tr class='$oe'><td>$name</td><td>$box</td></tr>";
}
$table = "
<form action='".make_link("setup/save")."' method='POST'><table>
<tr><th width='25%'>Name</th><th>Value</th></tr>
$rows
<tr><td colspan='2'><input type='submit' value='Save Settings'></td></tr>
<form action='".make_link("setup/save")."' method='POST'><table class='zebra'>
<thead><tr><th width='25%'>Name</th><th>Value</th></tr></thead>
<tbody>$rows</tbody>
<tfoot><tr><td colspan='2'><input type='submit' value='Save Settings'></td></tr></tfoot>
</table></form>
";