qmsk/irclogs/templates/layout.tmpl
changeset 143 154d2d8ae9c0
parent 131 67f5d2fdca1d
child 152 a2f622ca926f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/qmsk/irclogs/templates/layout.tmpl	Sun Sep 13 20:08:16 2009 +0300
@@ -0,0 +1,84 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<%def name="menu()">
+<ul>
+    <li><a href="${urls.index.build(req)}">Home</a></li>
+    <li><a href="${urls.preferences.build(req)}">Preferences</a></li>
+    
+    <li>
+        <span>Channel:</span>
+    </li><li class="join-left">
+        <form action="${urls.channel_select.build(req)}" method="GET">
+            <select name="channel">
+            ${h.select_options(((ch.id, ch.title) for ch in channel_list), channel.id if channel else None)}
+            </select><input type="submit" value="Go &raquo;" />
+        </form>
+    </li>
+</ul>
+</%def>
+
+<%def name="footer_right()">
+
+</%def>
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+    <head>
+        <title>irclogs.qmsk.net${(' :: ' + channel.title) if channel else ''}</title>
+        <link rel="Stylesheet" type="text/css" href="${req.site_root}/static/irclogs.css" />
+    ## timezone-autodetect
+    % if prefs and prefs.is_default('timezone') :
+        <script language="Javascript" type="text/javascript">
+/*
+ * Set a preference cookie
+ */
+function set_pref (name, value) {
+    // XXX: expire?
+    document.cookie = (name + "=" + value + "; path=/");
+}
+
+/*
+ * Set the timezone_offset cookie to the current Date's timezone offset
+ */
+function autodetect_tz_offset () {
+    // current datetime
+    var now = new Date();
+
+    // timezone offset from UTC in minutes
+    var timezone_offset = -now.getTimezoneOffset()
+    
+    // store cookie with offset in minutes
+    set_pref('timezone_offset', timezone_offset);
+}
+
+/*
+ * Autodetect at load
+ */
+window.onload = autodetect_tz_offset;
+        </script>
+    % endif
+    </head>
+    <body>
+        <div id="menu">
+            ${next.menu()}
+        </div>
+
+        <div id="content">
+            ${next.body()}
+        </div>
+
+        <div id="footer">
+            <div id="footer-right">
+                ${next.footer_right()}
+            </div>
+
+            <div id="footer-left">
+                <a href="http://projects.qmsk.net/irclogs2">irclogs2</a> version ${h.version_link()}
+            </div>
+
+            <div id="footer-center">
+                ${h.validation_notice(req.site_host)}
+            </div>
+        </div>
+    </body>
+</html>
+