Templates for multiple pages

This commit is contained in:
Tony Garnock-Jones 2012-04-29 19:41:04 -04:00
parent 30834921d3
commit 6f750f88e9
7 changed files with 283 additions and 79 deletions

View File

@ -1,17 +1,27 @@
APP=ocamlmsg
TEMPLATES=$(wildcard web/bootstrap/templates/*.xml)
HTML=$(subst web/bootstrap/templates/,web/,$(subst .xml,.html,$(TEMPLATES)))
all: message.ml amqp_spec.ml $(APP).native web/bootstrap/css/bootstrap.css
all: message.ml amqp_spec.ml $(APP).native web/bootstrap/css/bootstrap.css webpages
webpages: $(HTML)
web/bootstrap/css/bootstrap.css: web/bootstrap/less/*.less
recess --compile web/bootstrap/less/bootstrap.less > $@
web/%.html: web/bootstrap/templates/%.xml web/bootstrap/template.xsl web/bootstrap/nav.xml
xsltproc web/bootstrap/template.xsl $< > $@
message.ml: messages.json codegen.py
python codegen.py > $@
amqp_spec.ml: amqp0-9-1.stripped.xml amqp_codegen.py
python amqp_codegen.py > $@
clean:
webclean:
rm -f $(HTML)
clean: webclean
ocamlbuild -clean
rm -f message.ml
rm -f amqp_spec.ml

67
web/about.html Normal file
View File

@ -0,0 +1,67 @@
<!DOCTYPE html><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<title>About Ocamlmsg</title>
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.css">
<style>
body {
padding-top: 60px; /* to make the container go all the way to the bottom of the topbar */
}
</style>
<link rel="stylesheet" type="text/css" href="ui.css">
<script type="text/javascript" src="jquery-1.7.2.min.js"></script><script type="text/javascript" src="jquery.stream-1.2.js"></script><script type="text/javascript" src="ui_main.js"></script><!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]
-->
</head>
<body>
<div class="navbar navbar-fixed-top"><div class="navbar-inner"><div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></a><a class="brand" href="http://github.com/tonyg/ocamlmsg/">Ocamlmsg</a><div class="nav-collapse"><ul class="nav">
<li class="btn-danger"><a href="about.html">About</a></li>
<li><a href="/">Main</a></li>
</ul></div>
</div></div></div>
<div class="container"><body>
<h1>About Ocamlmsg</h1>
<p>
Ocamlmsg is a prototype of a sensible recursive message broker.
</p>
<h2>Copyright &amp; Licence</h2>
<p>
Ocamlmsg is Copyright (C) 2012 Tony Garnock-Jones.
</p>
<p>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
</p>
<p>
You should have received a copy of the GNU General Public
License along with this program. If not, see <a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>.
</p>
<h2>No Warranty</h2>
<p>
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
</p>
<p>
<span class="label label-warning">Warning</span>
Ocamlmsg is <em>alpha</em> software!
</p>
<h2>Contact</h2>
<p>
Contact <a href="http://homepages.kcbbs.gen.nz/tonyg/contact.html">Tony Garnock-Jones</a>.
</p>
</body></div>
<script src="bootstrap/js/bootstrap-transition.js"></script><script src="bootstrap/js/bootstrap-alert.js"></script><script src="bootstrap/js/bootstrap-modal.js"></script><script src="bootstrap/js/bootstrap-dropdown.js"></script><script src="bootstrap/js/bootstrap-scrollspy.js"></script><script src="bootstrap/js/bootstrap-tab.js"></script><script src="bootstrap/js/bootstrap-tooltip.js"></script><script src="bootstrap/js/bootstrap-popover.js"></script><script src="bootstrap/js/bootstrap-button.js"></script><script src="bootstrap/js/bootstrap-collapse.js"></script><script src="bootstrap/js/bootstrap-carousel.js"></script><script src="bootstrap/js/bootstrap-typeahead.js"></script>
</body>
</html>

3
web/bootstrap/nav.xml Normal file
View File

@ -0,0 +1,3 @@
<navitems>
<navitem id="main" href="/">Main</navitem>
</navitems>

View File

@ -0,0 +1,78 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'>
<xsl:output method="html" encoding="UTF-8" omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="/page">
<xsl:param name="active-section" select="section/text()"/>
<xsl:text disable-output-escaping="yes">&lt;</xsl:text>!DOCTYPE html<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
<html>
<head>
<meta charset="utf-8" />
<title><xsl:value-of select="title"/></title>
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.css" />
<style>
body {
padding-top: 60px; /* to make the container go all the way to the bottom of the topbar */
}
</style>
<link rel="stylesheet" type="text/css" href="ui.css" />
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="jquery.stream-1.2.js"></script>
<script type="text/javascript" src="ui_main.js"></script>
<xsl:comment>[if lt IE 9]<xsl:text disable-output-escaping="yes">&gt;
&lt;script src="http://html5shim.googlecode.com/svn/trunk/html5.js"&gt;&lt;/script&gt;
&lt;!</xsl:text>[endif]
</xsl:comment>
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="http://github.com/tonyg/ocamlmsg/">Ocamlmsg</a>
<div class="nav-collapse">
<ul class="nav">
<li class="btn-danger"><a href="about.html">About</a></li>
<xsl:for-each select="document('nav.xml')/navitems/navitem">
<li>
<xsl:if test="@id = $active-section">
<xsl:attribute name="class">active</xsl:attribute>
</xsl:if>
<a href="{@href}"><xsl:value-of select="text()"/></a>
</li>
</xsl:for-each>
</ul>
</div>
</div>
</div>
</div>
<div class="container">
<xsl:copy-of select="body" />
</div>
<xsl:copy-of select="script" />
<script src="bootstrap/js/bootstrap-transition.js"></script>
<script src="bootstrap/js/bootstrap-alert.js"></script>
<script src="bootstrap/js/bootstrap-modal.js"></script>
<script src="bootstrap/js/bootstrap-dropdown.js"></script>
<script src="bootstrap/js/bootstrap-scrollspy.js"></script>
<script src="bootstrap/js/bootstrap-tab.js"></script>
<script src="bootstrap/js/bootstrap-tooltip.js"></script>
<script src="bootstrap/js/bootstrap-popover.js"></script>
<script src="bootstrap/js/bootstrap-button.js"></script>
<script src="bootstrap/js/bootstrap-collapse.js"></script>
<script src="bootstrap/js/bootstrap-carousel.js"></script>
<script src="bootstrap/js/bootstrap-typeahead.js"></script>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,44 @@
<page>
<title>About Ocamlmsg</title>
<body>
<h1>About Ocamlmsg</h1>
<p>
Ocamlmsg is a prototype of a sensible recursive message broker.
</p>
<h2>Copyright &amp; Licence</h2>
<p>
Ocamlmsg is Copyright (C) 2012 Tony Garnock-Jones.
</p>
<p>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
</p>
<p>
You should have received a copy of the GNU General Public
License along with this program. If not, see <a
href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>.
</p>
<h2>No Warranty</h2>
<p>
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
</p>
<p>
<span class="label label-warning">Warning</span>
Ocamlmsg is <em>alpha</em> software!
</p>
<h2>Contact</h2>
<p>
Contact <a href="http://homepages.kcbbs.gen.nz/tonyg/contact.html">Tony Garnock-Jones</a>.
</p>
</body>
</page>

View File

@ -0,0 +1,30 @@
<page>
<title>Ocamlmsg</title>
<section>main</section>
<body>
<h2>Server statistics</h2>
<table class="table">
<tr>
<th class="span6">Server Status</th>
<td class="span6" id="server_ok">OK</td>
</tr>
<tr>
<th class="span6">Connection count</th>
<td class="span6" id="server_stats_connection_count"></td>
</tr>
<tr>
<th class="span6">Boot time</th>
<td class="span6" id="server_stats_boot_time"></td>
</tr>
<tr>
<th class="span6">Uptime</th>
<td class="span6" id="server_stats_uptime"></td>
</tr>
</table>
<h2>Debug</h2>
<pre id="debug_container"></pre>
</body>
<script>$(document).ready(ui_main);</script>
</page>

View File

@ -1,79 +1,51 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Ocamlmsg</title>
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.css">
<style>
body {
padding-top: 60px; /* to make the container go all the way to the bottom of the topbar */
}
</style>
<link rel="stylesheet" type="text/css" href="ui.css">
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="jquery.stream-1.2.js"></script>
<script type="text/javascript" src="ui_main.js"></script>
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="/">Ocamlmsg</a>
<div class="nav-collapse">
<ul class="nav">
<li class="btn-danger"><a href="alpha.html">Alpha</a></li>
<li class="active"><a href="/">Main page</a></li>
</ul>
</div>
</div>
</div>
</div>
<!DOCTYPE html><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<title>Ocamlmsg</title>
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.css">
<style>
body {
padding-top: 60px; /* to make the container go all the way to the bottom of the topbar */
}
</style>
<link rel="stylesheet" type="text/css" href="ui.css">
<script type="text/javascript" src="jquery-1.7.2.min.js"></script><script type="text/javascript" src="jquery.stream-1.2.js"></script><script type="text/javascript" src="ui_main.js"></script><!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]
-->
</head>
<body>
<div class="navbar navbar-fixed-top"><div class="navbar-inner"><div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></a><a class="brand" href="http://github.com/tonyg/ocamlmsg/">Ocamlmsg</a><div class="nav-collapse"><ul class="nav">
<li class="btn-danger"><a href="about.html">About</a></li>
<li class="active"><a href="/">Main</a></li>
</ul></div>
</div></div></div>
<div class="container"><body>
<h2>Server statistics</h2>
<table class="table">
<tr>
<th class="span6">Server Status</th>
<td class="span6" id="server_ok">OK</td>
</tr>
<tr>
<th class="span6">Connection count</th>
<td class="span6" id="server_stats_connection_count"></td>
</tr>
<tr>
<th class="span6">Boot time</th>
<td class="span6" id="server_stats_boot_time"></td>
</tr>
<tr>
<th class="span6">Uptime</th>
<td class="span6" id="server_stats_uptime"></td>
</tr>
</table>
<div class="container">
<h2>Server statistics</h2>
<table class="table">
<tr>
<th class="span6">Server Status</th>
<td class="span6" id="server_ok">OK</td>
</tr>
<tr>
<th class="span6">Connection count</th>
<td class="span6" id="server_stats_connection_count"></td>
</tr>
<tr>
<th class="span6">Boot time</th>
<td class="span6" id="server_stats_boot_time"></td>
</tr>
<tr>
<th class="span6">Uptime</th>
<td class="span6" id="server_stats_uptime"></td>
</tr>
</table>
<h2>Debug</h2>
<pre id="debug_container"></pre>
</div>
<script>$(document).ready(ui_main);</script>
<script src="bootstrap/js/bootstrap-transition.js"></script>
<script src="bootstrap/js/bootstrap-alert.js"></script>
<script src="bootstrap/js/bootstrap-modal.js"></script>
<script src="bootstrap/js/bootstrap-dropdown.js"></script>
<script src="bootstrap/js/bootstrap-scrollspy.js"></script>
<script src="bootstrap/js/bootstrap-tab.js"></script>
<script src="bootstrap/js/bootstrap-tooltip.js"></script>
<script src="bootstrap/js/bootstrap-popover.js"></script>
<script src="bootstrap/js/bootstrap-button.js"></script>
<script src="bootstrap/js/bootstrap-collapse.js"></script>
<script src="bootstrap/js/bootstrap-carousel.js"></script>
<script src="bootstrap/js/bootstrap-typeahead.js"></script>
</body>
<h2>Debug</h2>
<pre id="debug_container"></pre>
</body></div>
<script>$(document).ready(ui_main);</script><script src="bootstrap/js/bootstrap-transition.js"></script><script src="bootstrap/js/bootstrap-alert.js"></script><script src="bootstrap/js/bootstrap-modal.js"></script><script src="bootstrap/js/bootstrap-dropdown.js"></script><script src="bootstrap/js/bootstrap-scrollspy.js"></script><script src="bootstrap/js/bootstrap-tab.js"></script><script src="bootstrap/js/bootstrap-tooltip.js"></script><script src="bootstrap/js/bootstrap-popover.js"></script><script src="bootstrap/js/bootstrap-button.js"></script><script src="bootstrap/js/bootstrap-collapse.js"></script><script src="bootstrap/js/bootstrap-carousel.js"></script><script src="bootstrap/js/bootstrap-typeahead.js"></script>
</body>
</html>