skeleton and helloworld Mako templates
[invirt/packages/invirt-web.git] / code / templates / skeleton.mako
similarity index 61%
rename from code/templates/skeleton.tmpl
rename to code/templates/skeleton.mako
index e71348c..0fd67e3 100644 (file)
@@ -1,12 +1,9 @@
-#from functions import functions
-#extends functions
-
-#def full_body
+<%page expression_filter="h"/>
 <!DOCTYPE html
 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html>
-<head><title>$title &mdash; XVM</title>
+<head><title>${self.title()} &mdash; XVM</title>
   <link href="static/favicon.ico" type="image/x-icon" rel="shortcut icon">
   <link rel="stylesheet" href="static/style.css" type="text/css" />
   <link rel="stylesheet" href="static/layout.css" type="text/css" media="screen" />
@@ -30,51 +27,56 @@ function helppopup(name){
 </script>
 </head>
 <body id="body"
-#if hasattr($self, 'pageclass'):
-  class="$pageclass"
-#end if
+% if hasattr(self.attr, 'pageclass'):
+  class="${self.attr.pageclass}"
+% endif
   >
 
-#if False
+% if False:
 <div>
 <p>We are in the process of modifying the service.  Things likely will not work.</p>
 </div>
-#end if
+% endif
 
+% if error_text is not UNDEFINED:
 <div id="err">
-#if $varExists('error_text')
-<p>STDERR:</p><pre>$error_text</pre>
-#end if
+<p>STDERR:</p><pre>${error_text}</pre>
 </div>
+% endif
 
-#if not $varExists('simple') or not $simple
-<p class="loggedin">Welcome, <span class="name">$user</span>.</p>
+% if not simple:
+% if user:
+<p class="loggedin">Welcome, <span class="name">${user}</span>.</p>
+% endif
 
 <ul class="navigation">
 <li><a href="list">List</a></li>
-#if $varExists('machine')
-<li><a href="info?machine_id=$machine.machine_id">Info</a></li>
-<li><a href="vnc?machine_id=$machine.machine_id">Console</a></li>
-#end if
+% if machine:
+<li><a href="info?machine_id=${machine.machine_id}">Info</a></li>
+<li><a href="vnc?machine_id=${machine.machine_id}">Console</a></li>
+% endif
 <li><a href="help">Help</a></li>
 </ul>
-#end if
+
+% endif
+
 <div id="result" class="result">
-#if $varExists('result')
-$result
-#end if
+% if result:
+${result}
+% endif
 </div>
 
-#if not $varExists('simple') or not $simple
-<h1>$title &mdash; XVM</h1>
-#end if
-#filter None
-$body
-#end filter
-#if not $varExists('simple') or not $simple
+% if not simple:
+<h1>${self.title()} &mdash; XVM</h1>
+% endif
+${next.body()}
+% if not simple:
 <hr />
 Questions? Contact <a href="mailto:xvm@mit.edu">xvm@mit.edu</a>.
-#end if
+% endif
 </body>
 </html>
-#end def
+
+<%def name="title()">
+XVM
+</%def>