From e9818e8b4208bc67c7728260af05698ed6bdb365 Mon Sep 17 00:00:00 2001 From: Zach Hall Date: Sun, 28 Feb 2010 12:05:12 -0800 Subject: [PATCH] Lite theme updates. Incorporated more Danbooru custom themes to get the aligning right. --- themes/lite/custompage.class.php | 9 +++ themes/lite/layout.class.php | 71 ++++++++++-------- themes/lite/style.css | 62 +++++++++------- themes/lite/themelet.class.php | 2 +- themes/lite/user.theme.php | 119 +++++++++++++++++++++++++++++++ themes/lite/view.theme.php | 44 ++++++++++++ 6 files changed, 251 insertions(+), 56 deletions(-) create mode 100644 themes/lite/custompage.class.php create mode 100644 themes/lite/user.theme.php create mode 100644 themes/lite/view.theme.php diff --git a/themes/lite/custompage.class.php b/themes/lite/custompage.class.php new file mode 100644 index 00000000..1e71720b --- /dev/null +++ b/themes/lite/custompage.class.php @@ -0,0 +1,9 @@ +left_enabled = false; + } +} +?> diff --git a/themes/lite/layout.class.php b/themes/lite/layout.class.php index 37254441..022eb9fd 100644 --- a/themes/lite/layout.class.php +++ b/themes/lite/layout.class.php @@ -12,7 +12,7 @@ class Layout { * turns the Page into HTML */ public function display_page(Page $page) { - global $config; + global $config, $user; $theme_name = $config->get_string('theme', 'lite'); $site_name = $config->get_string('title'); @@ -31,7 +31,11 @@ class Layout { // Custom links: These appear on the menu. $custom_links = ""; - $custom_links .= $this->navlinks(make_link('user'), "Account", array("user", "setup", "admin", "profile")); + if($user->is_anonymous()) { + $custom_links .= $this->navlinks(make_link('user_admin/login'), "Account", array("user", "user_admin", "setup", "admin", "profile")); + } else { + $custom_links .= $this->navlinks(make_link('user'), "Account", array("user", "setup", "user_admin", "admin", "profile")); + } $custom_links .= $this->navlinks(make_link('post/list'), "Posts", array("post", "view")); $custom_links .= $this->navlinks(make_link('comment/list'), "Comments", array("comment")); $custom_links .= $this->navlinks(make_link('tags'), "Tags", array("tags")); @@ -42,6 +46,31 @@ class Layout { } $menu .= "$custom_links"; + $left_block_html = ""; + $main_block_html = ""; + $sub_block_html = ""; + $user_block_html = ""; + + foreach($page->blocks as $block) { + switch($block->section) { + case "left": + $left_block_html .= $this->block_to_html($block, true, "left"); + break; + case "main": + $main_block_html .= $this->block_to_html($block, false, "main"); + break; + case "user": + $user_block_html .= $block->body; + break; + case "subheading": + $sub_block_html .= $this->block_to_html($block, false, "main"); + break; + default: + print "

error: {$block->header} using an unknown section ({$block->section})"; + break; + } + } + $custom_sublinks = "

"; $cs = null; // hack @@ -53,7 +82,7 @@ class Layout { // php sucks switch($qp[0]) { default: - $cs = null; + $cs = $user_block_html; break; case "": # FIXME: this assumes that the front page is @@ -105,29 +134,7 @@ class Layout { } if(is_null($cs)) {$custom_sublinks = "";} else { $custom_sublinks .= "$cs
";} - $left_block_html = ""; - $main_block_html = ""; - $sub_block_html = ""; - foreach($page->blocks as $block) { - switch($block->section) { - case "left": - $left_block_html .= $this->block_to_html($block, true, "left"); - break; - case "main": - $main_block_html .= $this->block_to_html($block, false, "main"); - break; - case "user": - $user_block_html .= $block->body; - break; - case "subheading": - $sub_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(); @@ -138,6 +145,13 @@ class Layout { if(strlen($page->heading) > 100) { $wrapper = ' style="height: 3em; overflow: auto;"'; } + if($page->left_enabled==false) { + $left_block_html = ""; + $main_block_html = "

$main_block_html
"; + } else { + $left_block_html = ""; + $main_block_html = "
$main_block_html
"; + } print << @@ -152,11 +166,12 @@ class Layout { $menu $custom_sublinks - $subheading + $sub_block_html - -
$main_block_html
+ $left_block_html + $main_block_html +