From b30ed5b375371a25a9879fb423a9f7ff9163243d Mon Sep 17 00:00:00 2001 From: Shish Date: Thu, 23 Jul 2009 02:32:45 +0100 Subject: [PATCH] new theme --- themes/warm/bg.png | Bin 0 -> 186 bytes themes/warm/comment.theme.php | 51 ++++++++ themes/warm/layout.class.php | 144 +++++++++++++++++++++ themes/warm/setup.theme.php | 19 +++ themes/warm/style.css | 226 +++++++++++++++++++++++++++++++++ themes/warm/themelet.class.php | 103 +++++++++++++++ themes/warm/upload.theme.php | 12 ++ themes/warm/user.theme.php | 26 ++++ 8 files changed, 581 insertions(+) create mode 100644 themes/warm/bg.png create mode 100644 themes/warm/comment.theme.php create mode 100644 themes/warm/layout.class.php create mode 100644 themes/warm/setup.theme.php create mode 100644 themes/warm/style.css create mode 100644 themes/warm/themelet.class.php create mode 100644 themes/warm/upload.theme.php create mode 100644 themes/warm/user.theme.php diff --git a/themes/warm/bg.png b/themes/warm/bg.png new file mode 100644 index 0000000000000000000000000000000000000000..409491ff8698a9e0b23b30ee05e4ba5327869c6b GIT binary patch literal 186 zcmeAS@N?(olHy`uVBq!ia0vp^{2jKx9jP7LeL$-D$|*pj^6T^Rm@ z;DWu&Cj&(|3p^r=85p>QL70(Y)*K0-AbW|YuPggab}?~Qy|()LY@m>pr;B5V#`)ww z#l@=3JZ~(^ZXWd#=bzqLu~aW?m(LOH)P#ftr8rGyX6DUPH?mFil9Z5;aIdw@so`V@ W+Swjq&%pw+pTX1B&t;ucLK6T5dogYR literal 0 HcmV?d00001 diff --git a/themes/warm/comment.theme.php b/themes/warm/comment.theme.php new file mode 100644 index 00000000..ac41df22 --- /dev/null +++ b/themes/warm/comment.theme.php @@ -0,0 +1,51 @@ +"; + $html .= "
" . $this->build_thumb_html($image) . "
"; + $html .= "
" . $this->comments_to_html($comments) . "
"; + $html .= ""; + if($with_postbox) { + $html .= "
".($this->build_postbox($image->id))."
"; + } + else { + // $html .= "

You need to create an account before you can comment

"; + $html .= "

 

"; + } + + $page->add_block(new Block("{$image->id}: ".($image->get_tag_list()), $html, "main", $position)); + } + + protected function comment_to_html($comment, $trim=false) { + global $user; + + $tfe = new TextFormattingEvent($comment->comment); + send_event($tfe); + + $i_uid = int_escape($comment->owner_id); + $h_name = html_escape($comment->owner_name); + $h_poster_ip = html_escape($comment->poster_ip); + $h_comment = ($trim ? substr($tfe->stripped, 0, 50)."..." : $tfe->formatted); + $i_comment_id = int_escape($comment->comment_id); + $i_image_id = int_escape($comment->image_id); + + $h_userlink = "$h_name"; + $stripped_nonl = str_replace("\n", "\\n", $tfe->stripped); + $stripped_nonl = str_replace("\r", "\\r", $stripped_nonl); + $h_dellink = $user->is_admin() ? + "
($h_poster_ip, Del)" : ""; + $h_imagelink = $trim ? ">>>\n" : ""; + return " +
+
+
+
$h_userlink: $h_comment $h_imagelink $h_dellink
+
+
+
"; + } +} +?> diff --git a/themes/warm/layout.class.php b/themes/warm/layout.class.php new file mode 100644 index 00000000..cc57e6e2 --- /dev/null +++ b/themes/warm/layout.class.php @@ -0,0 +1,144 @@ +get_string('theme', 'default'); + $data_href = get_base_href(); + $contact_link = $config->get_string('contact_link'); + $version = "Shimmie-".VERSION; + + $header_html = ""; + foreach($page->headers as $line) { + $header_html .= "\t\t$line\n"; + } + + $left_block_html = ""; + $main_block_html = ""; + $head_block_html = ""; + + foreach($page->blocks as $block) { + switch($block->section) { + case "left": + $left_block_html .= $this->block_to_html($block, true, "left"); + break; + case "head": + $head_block_html .= "".$this->block_to_html($block, false, "head").""; + break; + case "main": + $main_block_html .= $this->block_to_html($block, false, "main"); + break; + default: + print "

error: {$block->header} using an unknown section ({$block->section})"; + break; + } + } + + $debug = get_debug_info(); + + $contact = empty($contact_link) ? "" : "
Contact"; + $subheading = empty($page->subheading) ? "" : "

{$page->subheading}
"; + + $wrapper = ""; + if(strlen($page->heading) > 100) { + $wrapper = ' style="height: 3em; overflow: auto;"'; + } + + print << + + + {$page->title} + + + +$header_html + + + + + + + $head_block_html + + + + + +
$main_block_html
+ + + + +EOD; + } + + /** + * A handy function which does exactly what it says in the method name + */ + private function block_to_html($block, $hidable=false, $salt="") { + $h = $block->header; + $b = $block->body; + $html = ""; + $i = str_replace(' ', '_', $h) . $salt; + if($hidable) $html .= " + + "; + if(!is_null($h)) $html .= " +
+
+

$h

+
+
+ "; + if(!is_null($b)) { + if(strpos($b, "rrcontent")) { + $html .= "
$b
"; + } + else { + $html .= " +
+
+
$b
+
+
+ "; + } + } + + return $html; + } +} +?> diff --git a/themes/warm/setup.theme.php b/themes/warm/setup.theme.php new file mode 100644 index 00000000..1da9c867 --- /dev/null +++ b/themes/warm/setup.theme.php @@ -0,0 +1,19 @@ + +
+
{$block->header}
{$block->body}
+
+ + "; + } +} +?> diff --git a/themes/warm/style.css b/themes/warm/style.css new file mode 100644 index 00000000..20822739 --- /dev/null +++ b/themes/warm/style.css @@ -0,0 +1,226 @@ + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +3 things common to all pages * +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +BODY { + background: url(bg.png); + font-family: "Arial", sans-serif; + font-size: 14px; + margin: 0px; +} +#header { + border-bottom: 1px solid #B89F7C; + margin-top: 0px; + margin-bottom: 16px; + padding: 8px; + background: #FCD9A9; + text-align: center; +} +H1 { + font-size: 5em; + margin: 0px; + padding: 0px; +} +H1 A { + color: black; +} +H3 { + text-align: center; + margin: 0px; +} +THEAD { + font-weight: bold; +} +TD { + vertical-align: top; + text-align: center; +} +CODE { + background: #DEDEDE; + font-size: 0.8em; +} +#subtitle { + width: 256px; + font-size: 0.75em; + margin: auto; + margin-top: -16px; + text-align: center; + border: 1px solid black; + border-top: none; + background: #DDD; +} +#body SELECT {width: 150px;} +TD>INPUT[type="submit"] {width: 100%;} +TD>INPUT[type="text"] {width: 100%;} +TD>INPUT[type="password"] {width: 100%;} +TD>SELECT {width: 100%;} + +TABLE.zebra {border-spacing: 0px; border: 1px solid #B89F7C; } +TABLE.zebra TD, TABLE.zebra TH {vertical-align: middle; padding: 4px;} +TABLE.zebra THEAD TD, TABLE.zebra THEAD TH {border-bottom: 2px solid #B89F7C;} +TABLE.zebra TFOOT TD, TABLE.zebra TFOOT TH {border-top: 2px solid #B89F7C;} +TABLE.zebra TD {border-top: 1px solid #B89F7C;} +TABLE.zebra TR.odd {background: #FCD9A9;} +TABLE.zebra TR.even {background: #DABC92;} + +#footer { + clear: both; + padding: 8px; + font-size: 0.7em; + text-align: center; + border-top: 1px solid #B89F7C; + background: #FCD9A9; +} + +*[onclick] {cursor: pointer;} +IMG {border: none;} +FORM {margin: 0px;} +A {color: #665844; text-decoration: none; font-weight: bold;} +A:hover {color: #665844; text-decoration: underline;} +A:visited {color: #665844; text-decoration: none} +A:active {color: #665844; text-decoration: underline;} + +BLOCKQUOTE { + border: 1px solid black; + padding: 8px; + background: #DDD; +} + +UL { + text-align: left; +} + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* the navigation bar, and all its blocks * +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#nav { + width: 250px; + float: left; + text-align: center; + margin-left: 16px; +} +#nav .blockbody { + font-size: 0.85em; + text-align: center; +} +#nav TABLE { + width: 150px; +} +#nav TD { + vertical-align: middle; +} +#nav INPUT { + width: 100%; + padding: 0px; +} +#nav SELECT { + width: 100%; + padding: 0px; +} + +#comments P { + text-align: left; + width: 150px; + max-width: 150px; + overflow: hidden; +} +.comment { + text-align: left; +} + +.more:after { + content: " >>>"; +} + +.tag_count:before { + content: "("; +} +.tag_count:after { + content: ")"; +} + +.paginator { + clear: both; + padding: 4px; + margin-bottom: 32px; +} + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* the main part of each page * +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#body { + margin-left: 276px; + margin-right: 16px; + text-align: center; + height: 1%; +} +#body TABLE { + width: 90%; + margin: auto; +} + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* specific page types * +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#pagelist { + margin-top: 32px; +} + +#tagmap A { + padding: 8px 4px 8px 4px; +} + +.rr {text-align: left; background: #FCD9A9; margin: 8px; border: 1px solid #B89F7C;} +.rrtop, .rrtop div, .rrbot, .rrbot div {height: 8px; width: 100%;} +.rrcontent {margin: 0px 8px; text-align: center;} + +.hrr {text-align: left; background: #DABC92; margin: 8px; border: 1px solid #B89F7C;} +.hrrtop, .hrrtop div, .hrrbot, .hrrbot div {height: 8px; width: 100%;} +.hrrcontent {margin: 0px 8px;} + +.setupblock { + text-align: center; + margin: 16px; + width: 350px; +} +.setupblock TEXTAREA { + width: 300px; + font-size: 0.75em; +} + +.helpable { + border-bottom: 1px dashed gray; +} + +.ok { + background: #AFA; +} +.bad { + background: #FAA; +} + +#nav .thumbblock { + float: none; + height: auto; +} +#nav .thumb { + margin-bottom: 0px; +} +.thumbblock { + width: 220px; + height: 220px; + display: inline-block; + float: left; +} +.thumb { + display: inline-block; + text-align: center; + margin-bottom: 32px; +} + diff --git a/themes/warm/themelet.class.php b/themes/warm/themelet.class.php new file mode 100644 index 00000000..3a2a2db4 --- /dev/null +++ b/themes/warm/themelet.class.php @@ -0,0 +1,103 @@ +set_title($title); + $page->set_heading($title); + $page->add_block(new NavBlock()); + $page->add_block(new Block("Error", $message)); + } + + + /** + * A specific, common error message + */ + public function display_permission_denied(Page $page) { + header("HTTP/1.0 403 Permission Denied"); + $this->display_error($page, "Permission Denied", "You do not have permission to access this page"); + } + + + /** + * Generic thumbnail code; returns HTML rather than adding + * a block since thumbs tend to go inside blocks... + */ + public function build_thumb_html(Image $image, $query=null) { + global $config; + $i_id = int_escape($image->id); + $h_view_link = make_link("post/view/$i_id", $query); + $h_tip = html_escape($image->get_tooltip()); + $h_image_link = $image->get_image_link(); + $h_thumb_link = $image->get_thumb_link(); + $tsize = get_thumbnail_size($image->width, $image->height); + return " +
+
+
+
+ + $h_tip + +
+
+
+
+ "; + } + + + /** + * Add a generic paginator + */ + public function display_paginator(Page $page, $base, $query, $page_number, $total_pages) { + if($total_pages == 0) $total_pages = 1; + $body = $this->build_paginator($page_number, $total_pages, $base, $query); + $page->add_block(new Block(null, $body, "main", 90)); + } + + private function gen_page_link($base_url, $query, $page, $name) { + $link = make_link("$base_url/$page", $query); + return "$name"; + } + + private function gen_page_link_block($base_url, $query, $page, $current_page, $name) { + $paginator = ""; + if($page == $current_page) $paginator .= ""; + $paginator .= $this->gen_page_link($base_url, $query, $page, $name); + if($page == $current_page) $paginator .= ""; + return $paginator; + } + + private function build_paginator($current_page, $total_pages, $base_url, $query) { + $next = $current_page + 1; + $prev = $current_page - 1; + $rand = rand(1, $total_pages); + + $at_start = ($current_page <= 1 || $total_pages <= 1); + $at_end = ($current_page >= $total_pages); + + $first_html = $at_start ? "First" : $this->gen_page_link($base_url, $query, 1, "First"); + $prev_html = $at_start ? "Prev" : $this->gen_page_link($base_url, $query, $prev, "Prev"); + $random_html = $this->gen_page_link($base_url, $query, $rand, "Random"); + $next_html = $at_end ? "Next" : $this->gen_page_link($base_url, $query, $next, "Next"); + $last_html = $at_end ? "Last" : $this->gen_page_link($base_url, $query, $total_pages, "Last"); + + $start = $current_page-5 > 1 ? $current_page-5 : 1; + $end = $start+10 < $total_pages ? $start+10 : $total_pages; + + $pages = array(); + foreach(range($start, $end) as $i) { + $pages[] = $this->gen_page_link_block($base_url, $query, $i, $current_page, $i); + } + $pages_html = implode(" | ", $pages); + + return "

$first_html | $prev_html | $random_html | $next_html | $last_html". + "
<< $pages_html >>

"; + } +} +?> diff --git a/themes/warm/upload.theme.php b/themes/warm/upload.theme.php new file mode 100644 index 00000000..6950e18a --- /dev/null +++ b/themes/warm/upload.theme.php @@ -0,0 +1,12 @@ +add_block(new Block("Upload", $this->build_upload_block(), "head", 20)); + } + + public function display_full(Page $page) { + $page->add_block(new Block("Upload", "Disk nearly full, uploads disabled", "head", 20)); + } +} +?> diff --git a/themes/warm/user.theme.php b/themes/warm/user.theme.php new file mode 100644 index 00000000..65763393 --- /dev/null +++ b/themes/warm/user.theme.php @@ -0,0 +1,26 @@ +name); + $html = join("\n | ", $parts); + $page->add_block(new Block("Logged in as $h_name", $html, "head", 90)); + } + public function display_login_block(Page $page) { + global $config; + $html = " +
+ + + + +
Name
Password
+
+ "; + if($config->get_bool("login_signup_enabled")) { + $html .= "Create Account"; + } + $page->add_block(new Block("Login", $html, "head", 90)); + } +} +?>