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

View File

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

View File

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

View File

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