2009-07-06 11:31:40 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class Layout {
|
|
|
|
function display_page($page) {
|
|
|
|
global $config;
|
|
|
|
|
|
|
|
$theme_name = $config->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 = "";
|
|
|
|
|
|
|
|
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;
|
|
|
|
default:
|
|
|
|
print "<p>error: {$block->header} using an unknown section ({$block->section})";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$debug = get_debug_info();
|
|
|
|
|
|
|
|
$contact = empty($contact_link) ? "" : "<br><a href='$contact_link'>Contact</a>";
|
|
|
|
$subheading = empty($page->subheading) ? "" : "<div id='subtitle'>{$page->subheading}</div>";
|
|
|
|
|
|
|
|
$wrapper = "";
|
|
|
|
if(strlen($page->heading) > 100) {
|
|
|
|
$wrapper = ' style="height: 3em; overflow: auto;"';
|
|
|
|
}
|
|
|
|
|
|
|
|
print <<<EOD
|
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>{$page->title}</title>
|
|
|
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
|
|
|
|
<link rel="stylesheet" href="$data_href/themes/$theme_name/style.css" type="text/css">
|
|
|
|
$header_html
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
<h1$wrapper>{$page->heading}</h1>
|
|
|
|
$subheading
|
|
|
|
|
|
|
|
<div id="nav">$left_block_html</div>
|
|
|
|
<div id="body">$main_block_html</div>
|
|
|
|
|
|
|
|
<div id="footer">
|
|
|
|
Images © their respective owners,
|
|
|
|
<a href="http://code.shishnet.org/shimmie2/">$version</a> ©
|
|
|
|
<a href="http://www.shishnet.org/">Shish</a> 2007-2009,
|
|
|
|
based on the Danbooru concept.
|
|
|
|
$debug
|
|
|
|
$contact
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
EOD;
|
|
|
|
}
|
|
|
|
|
|
|
|
function block_to_html($block, $hidable=false, $salt="") {
|
|
|
|
$h = $block->header;
|
|
|
|
$b = $block->body;
|
|
|
|
$html = "";
|
|
|
|
$i = str_replace(' ', '_', $h) . $salt;
|
2009-07-16 20:05:00 +00:00
|
|
|
if($hidable) $html .= "
|
2009-07-19 07:56:24 +00:00
|
|
|
<script><!--
|
2009-07-07 12:42:34 +00:00
|
|
|
$(document).ready(function() {
|
|
|
|
$(\"#$i-toggle\").click(function() {
|
2009-07-07 14:40:59 +00:00
|
|
|
$(\"#$i\").slideToggle(\"slow\", function() {
|
|
|
|
if($(\"#$i\").is(\":hidden\")) {
|
|
|
|
$.cookie(\"$i-hidden\", 'true', {path: '/'});
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$.cookie(\"$i-hidden\", 'false', {path: '/'});
|
|
|
|
}
|
|
|
|
});
|
2009-07-07 12:42:34 +00:00
|
|
|
});
|
2009-07-07 14:40:59 +00:00
|
|
|
if($.cookie(\"$i-hidden\") == 'true') {
|
2009-07-07 13:48:59 +00:00
|
|
|
$(\"#$i\").hide();
|
|
|
|
}
|
2009-07-07 12:42:34 +00:00
|
|
|
});
|
2009-07-19 07:56:24 +00:00
|
|
|
//--></script>
|
2009-07-16 20:05:00 +00:00
|
|
|
";
|
|
|
|
if(!is_null($h)) $html .= "
|
|
|
|
<div class='hrr' id='$i-toggle'>
|
2009-07-06 11:31:40 +00:00
|
|
|
<div class='hrrtop'><div></div></div>
|
2009-07-16 20:05:00 +00:00
|
|
|
<div class='hrrcontent'><h3>$h</h3></div>
|
2009-07-06 11:31:40 +00:00
|
|
|
<div class='hrrbot'><div></div></div>
|
|
|
|
</div>
|
|
|
|
";
|
|
|
|
if(!is_null($b)) {
|
|
|
|
if(strpos($b, "rrcontent")) {
|
|
|
|
$html .= "<div class='blockbody' id='$i'>$b</div>";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$html .= "
|
2009-07-06 11:47:42 +00:00
|
|
|
<div class='rr' id='$i'>
|
2009-07-06 11:31:40 +00:00
|
|
|
<div class='rrtop'><div></div></div>
|
2009-07-06 11:47:42 +00:00
|
|
|
<div class='rrcontent'><div class='blockbody'>$b</div></div>
|
2009-07-06 11:31:40 +00:00
|
|
|
<div class='rrbot'><div></div></div>
|
|
|
|
</div>
|
|
|
|
";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $html;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|