Index: anches/0.4/web/addons/job_monarch/header.php
===================================================================
--- /branches/0.4/web/addons/job_monarch/header.php	(revision 752)
+++ 	(revision )
@@ -1,174 +1,0 @@
-<?php
-/*
- *
- * This file is part of Jobmonarch
- *
- * Copyright (C) 2006  Ramon Bastiaans
- *
- * Jobmonarch 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 2 of the License, or
- * (at your option) any later version.
- *
- * Jobmonarch 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * SVN $Id$
- */
-
-# Check if this context is private.
-include_once "$GANGLIA_PATH/auth.php";
-checkcontrol();
-checkprivate();
-
-if ( $context == "control" && $controlroom < 0 )
-      $header = "header-nobanner";
-else
-      $header = "header";
-
-$tpl = new TemplatePower( "templates/header.tpl" );
-$tpl->prepare();
-
-# Maintain our path through the grid tree.
-$me = $self . "@" . $grid[$self][AUTHORITY];
-if ($initgrid)
-   {
-      $gridstack = array();
-      $gridstack[] = $me;
-   }
-else if ($gridwalk=="fwd")
-   {
-      # push our info on gridstack, format is "name@url>name2@url".
-      if (end($gridstack) != $me)
-         {
-            $gridstack[] = $me;
-         }
-   }
-else if ($gridwalk=="back")
-   {
-      # pop a single grid off stack.
-      if (end($gridstack) != $me)
-         {
-            array_pop($gridstack);
-         }
-   }
-$gridstack_str = join(">", $gridstack);
-$gridstack_url = rawurlencode($gridstack_str);
-
-if ($initgrid or $gridwalk)
-   {
-      # Use cookie so we dont have to pass gridstack around within this site.
-      # Cookie values are automatically urlencoded. Expires in a day.
-      setcookie("gs", $gridstack_str, time() + 86400);
-   }
-
-# Invariant: back pointer is second-to-last element of gridstack. Grid stack never
-# has duplicate entries.
-list($parentgrid, $parentlink) = explode("@", $gridstack[count($gridstack)-2]);
-
-# Setup a redirect to a remote server if you choose a grid from pulldown menu. Tell
-# destination server that we're walking foward in the grid tree.
-if (strstr($clustername, "http://"))
-   {
-      $tpl->assign("refresh", "0");
-      $tpl->assign("redirect", ";URL=$clustername?gw=fwd&gs=$gridstack_url");
-      echo "<h2>Redirecting, please wait...</h2>";
-      $tpl->printToScreen();
-      exit;
-   }
-$tpl->assign("refresh", $default_refresh);
-
-$tpl->assign( "date", date("r"));
-$tpl->assign( "page_title", $title );
-
-# The page to go to when "Get Fresh Data" is pressed.
-if (isset($page))
-      $tpl->assign("page",$page);
-else
-      $tpl->assign("page","./");
-
-# Templated Logo image
-$tpl->assign("images","./templates/$template_name/images");
-
-#
-# Used when making graphs via graph.php. Included in most URLs
-#
-$sort_url=rawurlencode($sort);
-$get_metric_string = "m=$metric&r=$range&s=$sort_url&hc=$hostcols";
-if ($jobrange and $jobstart)
-        $get_metric_string .= "&jr=$jobrange&js=$jobstart";
-
-# Set the Alternate view link.
-$cluster_url=rawurlencode($clustername);
-$node_url=rawurlencode($hostname);
-
-# Make some information available to templates.
-$tpl->assign("cluster_url", $cluster_url);
-
-# Build the node_menu
-$node_menu = "";
-
-if ($parentgrid)
-   {
-      $node_menu .= "<B><A HREF=\"$parentlink?gw=back&gs=$gridstack_url\">".
-         "$parentgrid $meta_designator</A></B> ";
-      $node_menu .= "<B>&gt;</B>\n";
-   }
-
-# Show grid.
-$mygrid =  ($self == "unspecified") ? "" : $self;
-$node_menu .= "<B><A HREF=\"./?$get_metric_string\">$mygrid $meta_designator</A> ";
-$node_menu .= "<B>&gt;</B>\n";
-
-if ($physical)
-   $node_menu .= hiddenvar("p", $physical);
-
-if ( $clustername )
-   {
-      $url = rawurlencode($clustername);
-      $node_menu .= "<B><A HREF=\"./?c=$url&$get_metric_string\">$clustername</A></B> ";
-      //$node_menu .= "<B>&gt;</B>\n";
-      $node_menu .= hiddenvar("c", $clustername);
-   }
-else
-   {
-      # No cluster has been specified, so drop in a list
-      $node_menu .= "<SELECT NAME=\"c\" OnChange=\"ganglia_form.submit();\">\n";
-      $node_menu .= "<OPTION VALUE=\"\">--Choose a Source\n";
-      ksort($grid);
-      foreach( $grid as $k => $v )
-         {
-            if ($k==$self) continue;
-            if ($v[GRID])
-               {
-                  $url = $v[AUTHORITY];
-                  $node_menu .="<OPTION VALUE=\"$url\">$k $meta_designator\n";
-               }
-            else
-               {
-                  $url = rawurlencode($k);
-                  $node_menu .="<OPTION VALUE=\"$url\">$k\n";
-               }
-         }
-      $node_menu .= "</SELECT>\n";
-   }
-
-$tpl->assign("node_menu", $node_menu);
-
-# Make sure that no data is cached..
-header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");    # Date in the past
-header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); # always modified
-header ("Cache-Control: no-cache, must-revalidate");  # HTTP/1.1
-header ("Pragma: no-cache");                          # HTTP/1.0
-
-$tpl->printToScreen();
-
-
-
-?>
Index: /branches/0.4/web/addons/job_monarch/index.php
===================================================================
--- /branches/0.4/web/addons/job_monarch/index.php	(revision 752)
+++ /branches/0.4/web/addons/job_monarch/index.php	(revision 753)
@@ -4,5 +4,5 @@
  * This file is part of Jobmonarch
  *
- * Copyright (C) 2006  Ramon Bastiaans
+ * Copyright (C) 2006-2013  Ramon Bastiaans
  *
  * Jobmonarch is free software; you can redistribute it and/or modify
@@ -29,4 +29,5 @@
 
 include_once "./libtoga.php";
+include_once "./dwoo/dwooAutoload.php";
 
 $r = escapeshellcmd( rawurldecode( $_GET["r"] ));
@@ -34,4 +35,15 @@
 if( !isset($range) or $range == '') $range= "job";
 
+global $context;
+
+#$context = 'cluster';
+
+#chdir( $GANGLIA_PATH );
+
+#include "./ganglia.php";
+#include "./get_ganglia.php";
+
+#chdir( $my_dir );
+
 if ( !empty( $_GET ) ) 
 {
@@ -41,5 +53,5 @@
 global $GANGLIA_PATH;
 
-include_once "./class.TemplatePower.inc.php";
+//include_once "./class.TemplatePower.inc.php";
 
 $httpvars = new HTTPVariables( $HTTP_GET_VARS, $_GET );
@@ -99,6 +111,5 @@
 function makeHeader( $page_call, $title, $longtitle ) 
 {
-
-    global $tpl, $grid, $context, $initgrid;
+    global $dwoo, $grid, $context, $initgrid;
     global $jobrange, $jobstart;
     global $page, $gridwalk, $clustername;
@@ -109,4 +120,17 @@
     global $JOB_ARCHIVE, $period_start, $period_stop, $h, $id;
     global $job_start, $job_stop, $range, $r, $metricname;
+    global $conf;
+    try
+       {
+          //$dwoo = new Dwoo($conf['dwoo_compiled_dir'], $conf['dwoo_cache_dir']);
+          $dwoo = new Dwoo( 'dwoo/compiled', 'dwoo/cache' );
+       }
+    catch (Exception $e)
+       {
+       print "<H4>There was an error initializing the Dwoo PHP Templating Engine: ".
+          $e->getMessage() . "<br><br>The compile directory should be owned and writable by the apache user.</H4>";
+          exit;
+       }
+
     
     if( isset($conf['default_metric']) and !isset($m) )
@@ -157,30 +181,22 @@
     list($parentgrid, $parentlink) = explode("@", $gridstack[count($gridstack)-2]);
 
-    # Setup a redirect to a remote server if you choose a grid from pulldown menu. Tell
-    # destination server that we're walking foward in the grid tree.
-    if (strstr($clustername, "http://")) 
-    {
-        $tpl->assign("refresh", "0");
-        $tpl->assign("redirect", ";URL=$clustername?gw=fwd&gs=$gridstack_url");
-        echo "<h2>Redirecting, please wait...</h2>";
-        $tpl->printToScreen();
-        exit;
-    }
-    $tpl->gotoBlock( "_ROOT" );
+    $tpl = new Dwoo_Template_File("templates/header.tpl");
+    echo $tpl;
+    $tpl_data = new Dwoo_Data();
 
     if( $view != "search" )
     {
-        $tpl->assign( "refresh", $default_refresh );
-    }
-
-    $tpl->assign( "date", date("r") );
-    $tpl->assign( "longpage_title", $longtitle );
-    $tpl->assign( "page_title", $title );
+        $tpl_data->assign( "refresh", $default_refresh );
+    }
+
+    $tpl_data->assign( "date", date("r") );
+    $tpl_data->assign( "longpage_title", $longtitle );
+    $tpl_data->assign( "page_title", $title );
 
     # The page to go to when "Get Fresh Data" is pressed.
-    $tpl->assign("page","./");
+    $tpl_data->assign("page","./");
 
     # Templated Logo image
-    $tpl->assign("images","./templates/$template_name/images");
+    $tpl_data->assign("images","./templates/$template_name/images");
 
     #
@@ -198,5 +214,5 @@
 
     # Make some information available to templates.
-    $tpl->assign("cluster_url", $cluster_url);
+    $tpl_data->assign("cluster_url", $cluster_url);
     # Build the node_menu
     $node_menu = "";
@@ -303,7 +319,5 @@
     }
 
-    $tpl->gotoBlock( "_ROOT" );
-    $tpl->assignGlobal("view", $view);
-
+    $tpl_data->assign("view", $view);
 
     if( array_key_exists( "id", $filter ) or isset($hostname) ) 
@@ -334,9 +348,9 @@
         }
 
-        $tpl->assign("metric_menu", $metric_menu );
+        $tpl_data->assign("metric_menu", $metric_menu );
 
         if( $view == "search" or $view == "host" or $view == "overview-host" ) 
         {
-            $tpl->newBlock("timeperiod");
+            $tpl_data->assign("timeperiod", "yes" );
             if( is_numeric( $period_start ) ) 
             {
@@ -347,13 +361,13 @@
                 $period_stop = epochToDatetime( $period_stop );
             }
-            $tpl->assign("period_start", $period_start );
-            $tpl->assign("period_stop", $period_stop );
-            $tpl->assign("hostname", $hostname );
+            $tpl_data->assign("period_start", $period_start );
+            $tpl_data->assign("period_stop", $period_stop );
+            $tpl_data->assign("hostname", $hostname );
 
             if( $view == "host" or $view == "overview-host" ) 
             {
-                $tpl->newBlock("hostview");
-                $tpl->assign("job_start", $job_start );
-                $tpl->assign("job_stop", $job_stop );
+                $tpl_data->assign("hostview", "yes");
+                $tpl_data->assign("job_start", $job_start );
+                $tpl_data->assign("job_stop", $job_stop );
             }
         } 
@@ -381,5 +395,5 @@
         $range_menu .= "</SELECT>\n";
 
-        $tpl->assign("range_menu", $range_menu);
+        $tpl_data->assign("range_menu", $range_menu);
 
     }
@@ -391,5 +405,5 @@
         $node_menu .= "<B>Jobarchive</B> ";
         $form_name = "archive_search_form";
-        $tpl->assignGlobal("form_name", $form_name );
+        $tpl_data->assign("form_name", $form_name );
 
     } 
@@ -397,72 +411,50 @@
     {
         $form_name = "toga_form";
-        $tpl->assignGlobal("form_name", $form_name );
+        $tpl_data->assign("form_name", $form_name );
     }
 
     if( $JOB_ARCHIVE && $page_call == 'overview' ) 
     {
-        $tpl->newBlock( "search" );
-        $tpl->assignGlobal( "cluster_url", rawurlencode($clustername) );
-        $tpl->assignGlobal( "cluster", $clustername );
-    }
-    $tpl->gotoBlock( "_ROOT" );
-    $tpl->assignGlobal( "cluster", $clustername );
-    $tpl->assign("node_menu", $node_menu);
+        $tpl_data->assign( "search", "yes" );
+        $tpl_data->assign( "cluster_url", rawurlencode($clustername) );
+        $tpl_data->assign( "cluster", $clustername );
+    }
+    $tpl_data->assign( "cluster", $clustername );
+    $tpl_data->assign("node_menu", $node_menu);
 
     # Make sure that no data is cached..
-    header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");    # Date in the past
-    header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); # always modified
-    header ("Cache-Control: no-cache, must-revalidate");  # HTTP/1.1
-    header ("Pragma: no-cache");                          # HTTP/1.0
+    //header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");    # Date in the past
+    //header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); # always modified
+    //header ("Cache-Control: no-cache, must-revalidate");  # HTTP/1.1
+    //header ("Pragma: no-cache");                          # HTTP/1.0
+
+    $dwoo->output($tpl, $tpl_data);
 }
 
 function makeFooter() 
 {
-    global $tpl, $version, $parsetime, $monarchversion;
-
-    $tpl->gotoBlock( "_ROOT" );
-    $tpl->assign("webfrontend-version",$version["webfrontend"]);
-    $tpl->assign("monarch-version", $monarchversion);
+    global $dwoo, $version, $parsetime, $monarchversion;
+
+    $tpl = new Dwoo_Template_File("templates/footer.tpl");
+    $tpl_data = new Dwoo_Data();
+
+    $tpl_data->assign("webfrontendversion",$version["webfrontend"]);
+    $tpl_data->assign("monarchversion", $monarchversion);
 
     if ($version["gmetad"]) 
     {
-        $tpl->assign("webbackend-component", "gmetad");
-        $tpl->assign("webbackend-version",$version["gmetad"]);
+        $tpl_data->assign("webbackendcomponent", "gmetad");
+        $tpl_data->assign("webbackendversion",$version["gmetad"]);
     } 
     else if ($version["gmond"]) 
     {
-        $tpl->assign("webbackend-component", "gmond");
-        $tpl->assign("webbackend-version", $version["gmond"]);
-    }
-
-    $tpl->assign("parsetime", sprintf("%.4f", $parsetime) . "s");
-}
-
-function includeSearchpage() 
-{
-    global $tpl;
-
-    $tpl->assignInclude( "main", "templates/search.tpl" );
-
-}
-
-function includeOverview() 
-{
-    global $tpl;
-
-    $tpl->assignInclude( "main", "templates/overview.tpl" );
-}
-
-function includeHostPage() 
-{
-
-    global $tpl;
-
-    $tpl->assignInclude( "main", "templates/host_view.tpl" );
-}
-
-$tpl = new TemplatePower( "templates/index.tpl" );
-
-$tpl->assignInclude( "header", "templates/header.tpl" );
+        $tpl_data->assign("webbackendcomponent", "gmond");
+        $tpl_data->assign("webbackendversion", $version["gmond"]);
+    }
+
+    $tpl_data->assign("parsetime", sprintf("%.4f", $parsetime) . "s");
+
+    $dwoo->output($tpl, $tpl_data);
+}
 
 if( isset( $h ) and $h != '' ) 
@@ -471,40 +463,12 @@
 }
 
-switch( $view ) 
-{
-
-    case "overview":
-
-        includeOverview();
-        break;
-
-    case "search":
-
-        includeSearchPage();
-        break;
-
-    case "host":
-
-        includeHostPage();
-        break;
-
-    case "overview-host":
-
-        includeHostPage();
-        break;
-
-    default:
-
-        includeOverview();
-        break;
-}
-
-$tpl->assignInclude( "footer", "templates/footer.tpl" );
-$tpl->prepare();
+//$tpl_data->assign( "footer", template( "templates/footer.tpl" ) );
 
 $longtitle = "Batch Report :: Powered by Job Monarch!";
 $title = "Batch Report";
-$tpl->assign("cluster_url", rawurlencode($clustername) );
-$tpl->assign("cluster", $clustername );
+//$tpl_data->assign("cluster_url", rawurlencode($clustername) );
+//$tpl_data->assign("cluster", $clustername );
+
+#makeHeader();
 
 switch( $view ) 
@@ -537,4 +501,5 @@
     default:
 
+        include "./overview.php";
         makeOverview();
         break;
@@ -542,4 +507,3 @@
 
 makeFooter();
-$tpl->printToScreen();
 ?>
Index: /branches/0.4/web/addons/job_monarch/overview.php
===================================================================
--- /branches/0.4/web/addons/job_monarch/overview.php	(revision 752)
+++ /branches/0.4/web/addons/job_monarch/overview.php	(revision 753)
@@ -23,13 +23,20 @@
  */
 
-global $GANGLIA_PATH, $clustername, $tpl, $filter, $cluster, $get_metric_string, $cluster_url, $sh;
+global $GANGLIA_PATH, $clustername, $tpl_data, $filter, $cluster, $get_metric_string, $cluster_url, $sh;
 global $hosts_up, $m, $start, $end, $filterorder, $COLUMN_REQUESTED_MEMORY, $COLUMN_QUEUED, $COLUMN_NODES, $hostname, $piefilter;
 global $longtitle, $title, $range;
 
-$tpl->assign( "clustername", $clustername );
+include_once "./dwoo/dwooAutoload.php";
+
+global $dwoo;
+
+$tpl = new Dwoo_Template_File("templates/overview.tpl");
+$tpl_data = new Dwoo_Data();
+
+$tpl_data->assign( "clustername", $clustername );
 
 if( $JOB_ARCHIVE )
 {
-    $tpl->assign( "cluster_url", rawurlencode($clustername) );
+    $tpl_data->assign( "cluster_url", rawurlencode($clustername) );
 }
 
@@ -52,13 +59,11 @@
 {
 
-    global $tpl, $filter, $clustername, $piefilter, $data_gatherer, $myxml_data, $filterorder;
+    global $tpl_data, $filter, $clustername, $piefilter, $data_gatherer, $myxml_data, $filterorder, $_SESSION;
 
     $filter_image_url = "";
 
-    $tpl->gotoBlock( "_ROOT" );
-
     foreach( $filter as $filtername => $filtervalue ) 
     {
-        $tpl->assign( $filtername, $filtervalue );
+        $tpl_data->assign( $filtername, $filtervalue );
 
         $filter_image_url    .= "&$filtername=$filtervalue";
@@ -78,11 +83,10 @@
     $ic->draw();
 
-    $tpl->assign( "clusterimage", "./image.php?". session_name() . "=" . session_id() ."&c=".rawurlencode($clustername)."&j_view=big-clusterimage".$filter_image_url );
-
-    $tpl->newBlock( "node_clustermap" );
-    $tpl->assign( "node_area_map", $ic->getImagemapArea() );
-    $tpl->gotoBlock( "_ROOT" );
-
-    $tpl->assign( "order", $filterorder );
+    $tpl_data->assign( "clusterimage", "./image.php?". session_name() . "=" . session_id() ."&c=".rawurlencode($clustername)."&j_view=big-clusterimage".$filter_image_url );
+
+    $tpl_data->assign( "node_clustermap", "yes" );
+    $tpl_data->assign( "node_area_map", $ic->getImagemapArea() );
+
+    $tpl_data->assign( "order", $filterorder );
 
     if( array_key_exists( "id", $filter ) ) 
@@ -101,5 +105,5 @@
     $pie    = drawPie();
 
-    $tpl->assign("pie", $pie );
+    $tpl_data->assign("pie", $pie );
 }
 
@@ -504,5 +508,5 @@
 function makeOverview() 
 {
-    global $jobs, $nodes, $heartbeat, $clustername, $tpl;
+    global $dwoo, $tpl, $tpl_data, $jobs, $nodes, $heartbeat, $clustername, $tpl_data;
     global $sortorder, $sortby, $filter, $sh, $hc, $m, $range;
     global $cluster_url, $get_metric_string, $host_url, $metrics;
@@ -520,6 +524,6 @@
             $metricname = "load_one";
 
-    $tpl->assign("sortorder", $sortorder );
-    $tpl->assign("sortby", $sortby );
+    $tpl_data->assign("sortorder", $sortorder );
+    $tpl_data->assign("sortby", $sortby );
 
     $sorted_jobs        = sortJobs( $jobs, $sortby, $sortorder );
@@ -565,5 +569,5 @@
     if( $COLUMN_REQUESTED_MEMORY ) 
     {
-        $tpl->newBlock( "column_header_req_mem" );
+        $tpl_data->assign( "column_header_req_mem", "yes" );
     }
 
@@ -572,5 +576,5 @@
     if( $COLUMN_NODES ) 
     {
-        $tpl->newBlock( "column_header_nodes" );
+        $tpl_data->assign( "column_header_nodes", "yes" );
     }
 
@@ -579,5 +583,5 @@
     if( $COLUMN_QUEUED ) 
     {
-        $tpl->newBlock( "column_header_queued" );
+        $tpl_data->assign( "column_header_queued", "yes" );
     }
 
@@ -609,4 +613,5 @@
     }
 
+    $node_list = array();
 
     foreach( $sorted_jobs as $jobid => $sortdec ) 
@@ -711,13 +716,15 @@
             }
 
+
             if( $display_job ) 
             {
-                $tpl->newBlock( "node" );
-                $tpl->assign( "clustername", $clustername );
-                $tpl->assign( "id", $jobid );
+                $job_loop = array();
+                $job_loop["clustername"] = $clustername;
+
+                $job_loop["id"] = $jobid;
 
                 $last_displayed_job     = $jobid;
 
-                $tpl->assign( "state", $jobs[$jobid]['status'] );
+                $job_loop["state"] = $jobs[$jobid]['status'];
 
                 $fullstate         = '';
@@ -732,13 +739,13 @@
                 }
 
-                $tpl->assign( "fullstate", $fullstate );
+                $job_loop["fullstate"] = $fullstate;
                 
-                $tpl->assign( "owner", $jobs[$jobid]['owner'] );
-                $tpl->assign( "queue", $jobs[$jobid]['queue'] );
+                $job_loop["owner"] = $jobs[$jobid]['owner'];
+                $job_loop["queue"] = $jobs[$jobid]['queue'];
 
                 $fulljobname         = $jobs[$jobid]['name'];
-                $shortjobname         = '';
-
-                $tpl->assign( "fulljobname", $fulljobname );
+                $shortjobname        = '';
+
+                $job_loop["fulljobname"] = $fulljobname;
 
                 $fulljobname_fields    = explode( ' ', $fulljobname );
@@ -753,6 +760,6 @@
                 if( $capjobname ) 
                 {
-                    $tpl->newBlock( "jobname_hint_start" );
-                    $tpl->gotoBlock( "node" );
+                    //$tpl_data->assign( "jobname_hint_start", "yes" );
+                    $job_loop[ "jobname_hint_start" ] = "yes";
 
                     $shortjobname     = substr( $fulljobname, 0, 10 ) . '..';
@@ -763,21 +770,21 @@
                 }
                 
-                $tpl->assign( "name", $shortjobname );
+                $job_loop["name"] = $shortjobname;
 
                 if( $capjobname ) 
                 {
-                    $tpl->newBlock( "jobname_hint_end" );
-                    $tpl->gotoBlock( "node" );
+                    //$tpl_data->assign( "jobname_hint_end", "yes" );
+                    $job_loop[ "jobname_hint_end" ] = "yes";
                 }
 
                 $domain         = $jobs[$jobid]['domain'];
 
-                $tpl->assign( "req_cpu", makeTime( timeToEpoch( $jobs[$jobid]['requested_time'] ) ) );
+                $job_loop["req_cpu"] = makeTime( timeToEpoch( $jobs[$jobid]['requested_time'] ) );
 
                 if( $COLUMN_REQUESTED_MEMORY ) 
                 {
-                    $tpl->newBlock( "column_req_mem" );
-                    $tpl->assign( "req_memory", $jobs[$jobid]['requested_memory'] );
-                    $tpl->gotoBlock( "node" );
+                    //$tpl_data->assign( "column_req_mem", "yes" );
+                    $job_loop[ "column_req_mem" ] = "yes";
+                    $job_loop["req_memory"] = $jobs[$jobid]['requested_memory'];
                 }
 
@@ -785,12 +792,13 @@
                 if( $COLUMN_QUEUED ) 
                 {
-                    $tpl->newBlock( "column_queued" );
-                    $tpl->assign( "queued", makeDate( $jobs[$jobid]['queued_timestamp'] ) );
-                    $tpl->gotoBlock( "node" );
+                    //$tpl_data->assign( "column_queued", "yes" );
+                    $job_loop[ "column_queued" ] = "yes";
+                    $job_loop["queued"] = makeDate( $jobs[$jobid]['queued_timestamp'] );
                 }
                 if( $COLUMN_NODES ) 
                 {
-                    $tpl->newBlock( "column_nodes" );
-                    $tpl->gotoBlock( "node" );
+                    //$tpl_data->assign( "column_nodes", "yes" );
+                    $job_loop[ "column_nodes" ] = "yes";
+                    //echo "colum nodes";
                 }
 
@@ -798,6 +806,6 @@
                 $cpus      = $nodes * $ppn;
 
-                $tpl->assign( "nodes", $nodes );
-                $tpl->assign( "cpus", $cpus );
+                $job_loop["nodes"] = $nodes;
+                $job_loop["cpus"] = $cpus;
 
                 $start_time= (int) $jobs[$jobid]['start_timestamp'];
@@ -827,5 +835,6 @@
                     if( $COLUMN_NODES ) 
                     {
-                        $tpl->gotoBlock( "column_nodes" );
+                        //$tpl_data->assign( "column_nodes", "yes" );
+                        $job_loop[ "column_nodes" ] = "yes";
 
                         $mynodehosts         = array();
@@ -843,6 +852,5 @@
                         $nodes_hostnames    = implode( " ", $mynodehosts );
 
-                        $tpl->assign( "nodes_hostnames", $nodes_hostnames );
-                        $tpl->gotoBlock( "node" );
+                        $job_loop["nodes_hostnames"] = $nodes_hostnames;
                     }
                 } 
@@ -854,5 +862,5 @@
                 if( $even ) 
                 {
-                    $tpl->assign( "nodeclass", "even" );
+                    $job_loop["nodeclass"] = "even";
 
                     $even         = 0;
@@ -860,5 +868,5 @@
                 else 
                 {
-                    $tpl->assign( "nodeclass", "odd" );
+                    $job_loop["nodeclass"] = "odd";
 
                     $even         = 1;
@@ -870,8 +878,10 @@
                     $job_runningtime    = $heartbeat - $start_time;
 
-                    $tpl->assign( "started", makeDate( $start_time ) );
-                    $tpl->assign( "runningtime", $runningtime );
-                }
-            }
+                    $job_loop["started"] = makeDate( $start_time );
+                    $job_loop["runningtime"] = $runningtime;
+                }
+                $node_list[] = $job_loop;
+            }
+            $tpl_data->assign("node_list", $node_list );
         }
     }
@@ -895,7 +905,5 @@
         $rjqj_str .= "</A>";
 
-        $tpl->gotoBlock( "_ROOT" );
-
-        $tpl->assign( "rjqj_graph", $rjqj_str );
+        $tpl_data->assign( "rjqj_graph", $rjqj_str );
     }
 
@@ -917,10 +925,10 @@
     $free_cpus          = ( $free_cpus >= 0 ) ? $free_cpus : 0;
 
-    $tpl->assignGlobal( "avail_nodes", $avail_nodes );
-    $tpl->assignGlobal( "avail_cpus", $avail_cpus );
-
-    $tpl->assignGlobal( "queued_nodes", $queued_nodes );
-    $tpl->assignGlobal( "queued_jobs", $queued_jobs );
-    $tpl->assignGlobal( "queued_cpus", $queued_cpus );
+    $tpl_data->assign( "avail_nodes", $avail_nodes );
+    $tpl_data->assign( "avail_cpus", $avail_cpus );
+
+    $tpl_data->assign( "queued_nodes", $queued_nodes );
+    $tpl_data->assign( "queued_jobs", $queued_jobs );
+    $tpl_data->assign( "queued_cpus", $queued_cpus );
 
     // Only display "Unavailable" in count overview there are any
@@ -928,32 +936,30 @@
     if( $na_nodes > 0 )
     {
-        $tpl->newBlock( "na_nodes" );
-
-        $tpl->assignGlobal( "na_nodes", $na_nodes );
-        $tpl->assignGlobal( "na_cpus", $na_cpus );
-
-        $tpl->gotoBlock( "_ROOT" );
-    }
-
-    $tpl->assignGlobal( "total_nodes", $total_nodes );
-    $tpl->assignGlobal( "total_jobs", $total_jobs );
-    $tpl->assignGlobal( "total_cpus", $total_cpus );
-
-    $tpl->assignGlobal( "running_nodes", $running_nodes );
-    $tpl->assignGlobal( "running_jobs", $running_jobs );
-    $tpl->assignGlobal( "running_cpus", $running_cpus );
-
-    $tpl->assignGlobal( "used_nodes", $used_nodes );
-    $tpl->assignGlobal( "used_jobs", $used_jobs );
-    $tpl->assignGlobal( "used_cpus", $used_cpus );
-
-    $tpl->assignGlobal( "free_nodes", $free_nodes );
-    $tpl->assignGlobal( "free_cpus", $free_cpus );
-
-    $tpl->assignGlobal( "view_nodes", $view_nodes );
-    $tpl->assignGlobal( "view_jobs", $view_jobs );
-    $tpl->assignGlobal( "view_cpus", $view_cpus );
-
-    $tpl->assignGlobal( "report_time", makeDate( $heartbeat) );
+        $tpl_data->assign( "na_nodes", "yes");
+
+        $tpl_data->assign( "na_nodes", $na_nodes );
+        $tpl_data->assign( "na_cpus", $na_cpus );
+    }
+
+    $tpl_data->assign( "total_nodes", $total_nodes );
+    $tpl_data->assign( "total_jobs", $total_jobs );
+    $tpl_data->assign( "total_cpus", $total_cpus );
+
+    $tpl_data->assign( "running_nodes", $running_nodes );
+    $tpl_data->assign( "running_jobs", $running_jobs );
+    $tpl_data->assign( "running_cpus", $running_cpus );
+
+    $tpl_data->assign( "used_nodes", $used_nodes );
+    $tpl_data->assign( "used_jobs", $used_jobs );
+    $tpl_data->assign( "used_cpus", $used_cpus );
+
+    $tpl_data->assign( "free_nodes", $free_nodes );
+    $tpl_data->assign( "free_cpus", $free_cpus );
+
+    $tpl_data->assign( "view_nodes", $view_nodes );
+    $tpl_data->assign( "view_jobs", $view_jobs );
+    $tpl_data->assign( "view_cpus", $view_cpus );
+
+    $tpl_data->assign( "report_time", makeDate( $heartbeat) );
 
     if( intval($view_jobs) == 1 and $start_time )
@@ -976,5 +982,5 @@
     if( intval($view_jobs) == 1 and $start_time ) 
     {
-        $tpl->newBlock( "showhosts" );
+        $tpl_data->assign( "showhosts", "yes" );
 
         # Present a width list
@@ -995,13 +1001,15 @@
         $cols_menu     .= "</SELECT>\n";
 
-        $tpl->assign( "metric","$metricname $units" );
-        $tpl->assign( "id", $filter['id'] );
+        $tpl_data->assign( "metric","$metricname $units" );
+        $tpl_data->assign( "id", $filter['id'] );
 
         # Host columns menu defined in header.php
-        $tpl->assign( "cols_menu", $cols_menu );
+        $tpl_data->assign( "cols_menu", $cols_menu );
 
         $showhosts     = isset($sh) ? $sh : $default_showhosts;
 
-        $tpl->assign( "checked$showhosts", "checked" );
+        $tpl_data->assign( "checked$showhosts", "checked" );
+
+        $sorted_list = array();
 
         if( $showhosts ) 
@@ -1096,8 +1104,7 @@
             $i = 1;
 
+            $metric_loop = array();
             foreach ( $sorted_hosts as $host=>$value  ) 
             {
-                $tpl->newBlock( "sorted_list" );
-
                 $host_url    = rawurlencode( $host );
                 $cluster_url = rawurlencode( $clustername );
@@ -1150,13 +1157,17 @@
                 }
 
-                $tpl->assign( "metric_image", $cell );
+                $metric_loop["metric_image"] = $cell;
 
                 if(! ($i++ % $hostcols) )
                 {
-                     $tpl->assign( "br", "</tr><tr>" );
-                }
-            }
-        }
-    }
+                     $metric_loop["br"] = "</tr><tr>";
+                }
+                $sorted_list[] = $metric_loop;
+            }
+            $tpl_data->assign("sorted_list", $sorted_list );
+        }
+    }
+    $dwoo->output($tpl, $tpl_data);
 }
+
 ?>
Index: /branches/0.4/web/addons/job_monarch/templates/footer.tpl
===================================================================
--- /branches/0.4/web/addons/job_monarch/templates/footer.tpl	(revision 752)
+++ /branches/0.4/web/addons/job_monarch/templates/footer.tpl	(revision 753)
@@ -2,10 +2,10 @@
 <CENTER>
 <FONT SIZE="-1" class=footer>
-<A HREF="https://oss.trac.surfsara.nl/jobmonarch/">Job Monarch</A> version {monarch-version}
+<A HREF="https://oss.trac.surfsara.nl/jobmonarch/">Job Monarch</A> version {$monarchversion}
 <A HREF="https://oss.trac.surfsara.nl/jobmonarch/">Check for Updates.</A><BR>
 
-Ganglia web version {webfrontend-version}<BR>
+Ganglia web version {$webfrontendversion}<BR>
 
-Downloading and parsing ganglia's XML tree took {parsetime}.<BR>
+Downloading and parsing ganglia's XML tree took {$parsetime}.<BR>
 Images created with <A HREF="http://www.rrdtool.org/">RRDTool</A>.<BR>
 </FONT>
Index: /branches/0.4/web/addons/job_monarch/templates/header.tpl
===================================================================
--- /branches/0.4/web/addons/job_monarch/templates/header.tpl	(revision 752)
+++ /branches/0.4/web/addons/job_monarch/templates/header.tpl	(revision 753)
@@ -2,7 +2,7 @@
 <HTML>
 <HEAD>
-<TITLE>Ganglia :: {longpage_title}</TITLE>
+<TITLE>Ganglia :: {$longpage_title}</TITLE>
 <META http-equiv="Content-type" content="text/html; charset=utf-8">
-<META http-equiv="refresh" content="{refresh}{redirect}" >
+<META http-equiv="refresh" content="{$refresh}{$redirect}" >
 <LINK rel="stylesheet" href="./styles.css" type="text/css">
 <SCRIPT LANGUAGE="javascript" SRC="ts_picker.js"></SCRIPT>
@@ -11,6 +11,6 @@
         function setPeriodTimestamps() {
 
-                document.{form_name}.period_start.value = document.{form_name}.period_start_pick.value;
-                document.{form_name}.period_stop.value = document.{form_name}.period_stop_pick.value;
+                document.{$form_name}.period_start.value = document.{$form_name}.period_start_pick.value;
+                document.{$form_name}.period_stop.value = document.{$form_name}.period_stop_pick.value;
         }
 
@@ -19,7 +19,7 @@
 <BODY BGCOLOR="#FFFFFF">
 
-<FORM ACTION="./" METHOD="GET" NAME="{form_name}">
-<INPUT TYPE="HIDDEN" NAME="c" VALUE="{cluster}">
-<INPUT TYPE="HIDDEN" NAME="view" VALUE="{view}">
+<FORM ACTION="./" METHOD="GET" NAME="{$form_name}">
+<INPUT TYPE="HIDDEN" NAME="c" VALUE="{$cluster}">
+<INPUT TYPE="HIDDEN" NAME="view" VALUE="{$view}">
 <TABLE WIDTH="100%">
 <TR>
@@ -35,5 +35,5 @@
      <TD BGCOLOR="#DDDDDD">
      <FONT SIZE="+1">
-     <B>{page_title} for {date}</B>
+     <B>{$page_title} for {$date}</B>
      </FONT>
      </TD>
@@ -45,33 +45,33 @@
   <TR>
      <TD COLSPAN=1>
-     {metric_menu} &nbsp;&nbsp;
-     {range_menu}&nbsp;&nbsp;
-     {sort_menu}&nbsp;&nbsp;
-<!-- START BLOCK : timeperiod -->
-    <INPUT TYPE="HIDDEN" NAME="period_start" VALUE="{period_start}">
-    <INPUT TYPE="HIDDEN" NAME="period_stop" VALUE="{period_stop}">
-    <INPUT TYPE="HIDDEN" NAME="h" VALUE="{hostname}">
+     {$metric_menu} &nbsp;&nbsp;
+     {$range_menu}&nbsp;&nbsp;
+     {$sort_menu}&nbsp;&nbsp;
+{if "$timeperiod" == "yes"}
+    <INPUT TYPE="HIDDEN" NAME="period_start" VALUE="{$period_start}">
+    <INPUT TYPE="HIDDEN" NAME="period_stop" VALUE="{$period_stop}">
+    <INPUT TYPE="HIDDEN" NAME="h" VALUE="{$hostname}">
     <BR><BR><B>Graph/ from
-    <INPUT TYPE="text" NAME="period_start_pick" VALUE="{period_start}" ALT="Start time" DISABLED="TRUE">
-    <a href="javascript:show_calendar('document.{form_name}.period_start_pick', document.{form_name}.period_start_pick.value);" alt="Click to select a date/time" title="Click to select a date/time">
+    <INPUT TYPE="text" NAME="period_start_pick" VALUE="{$period_start}" ALT="Start time" DISABLED="TRUE">
+    <a href="javascript:show_calendar('document.{$form_name}.period_start_pick', document.{$form_name}.period_start_pick.value);" alt="Click to select a date/time" title="Click to select a date/time">
     <img src="cal.gif" width="16" height="16" border="0"></a>
-    <a href="#" onClick="javascript: document.{form_name}.period_start_pick.value=''" alt="Click here to clear field" title="Click here to clear field">
+    <a href="#" onClick="javascript: document.{$form_name}.period_start_pick.value=''" alt="Click here to clear field" title="Click here to clear field">
     <IMG SRC="redcross.jpg" BORDER=0></A>
-    to <INPUT TYPE="text" NAME="period_stop_pick" VALUE="{period_stop}" ALT="Stop time" DISABLED="TRUE">
-    <a href="javascript:show_calendar('document.{form_name}.period_stop_pick', document.{form_name}.period_stop_pick.value);" alt="Click to select a date/time" title="Click to select a date/time">
+    to <INPUT TYPE="text" NAME="period_stop_pick" VALUE="{$period_stop}" ALT="Stop time" DISABLED="TRUE">
+    <a href="javascript:show_calendar('document.{$form_name}.period_stop_pick', document.{$form_name}.period_stop_pick.value);" alt="Click to select a date/time" title="Click to select a date/time">
     <img src="cal.gif" width="16" height="16" border="0"></a>
-    <a href="#" onClick="javascript: document.{form_name}.period_stop_pick.value=''" alt="Click here to clear field" title="Click here to clear field">
+    <a href="#" onClick="javascript: document.{$form_name}.period_stop_pick.value=''" alt="Click here to clear field" title="Click here to clear field">
     </B>
     <IMG SRC="redcross.jpg" BORDER=0></A>
 
-<!-- START BLOCK : hostview -->
-    <INPUT TYPE="HIDDEN" NAME="job_start" VALUE="{job_start}">
-    <INPUT TYPE="HIDDEN" NAME="job_stop" VALUE="{job_stop}">
-<!-- END BLOCK : hostview -->
+{if "$hostview" == "yes"}
+    <INPUT TYPE="HIDDEN" NAME="job_start" VALUE="{$job_start}">
+    <INPUT TYPE="HIDDEN" NAME="job_stop" VALUE="{$job_stop}">
+{/if}
     <INPUT TYPE="submit" onClick="setPeriodTimestamps();" VALUE="Refresh graphs">
-<!-- END BLOCK : timeperiod -->
+{/if}
      </TD>
      <TD>
-      <B>{alt_view}</B>
+      <B>{$alt_view}</B>
      </TD>
 
@@ -79,11 +79,11 @@
   </TABLE>
 
-<!-- START BLOCK : search -->
+{if "$search" == "yes"}
      <TD align="right"><CENTER>
-       <A HREF="./?c={cluster_url}&view=search">
+       <A HREF="./?c={$cluster_url}&view=search">
        <B><I>Jobarchive</I></B><BR>
-       <IMG SRC="./document_archive.jpg" HEIGHT=100 ALT="Search the archive for {cluster}" TITLE="Search the archive for {cluster}" BORDER=0></A></CENTER>
+       <IMG SRC="./document_archive.jpg" HEIGHT=100 ALT="Search the archive for {$cluster}" TITLE="Search the archive for {$cluster}" BORDER=0></A></CENTER>
      </TD>
-<!-- END BLOCK : search -->
+{/if}
 
   </TD>
@@ -92,5 +92,5 @@
 
 <FONT SIZE="+1">
-{node_menu}
+{$node_menu}
 </FONT>
 
Index: /branches/0.4/web/addons/job_monarch/templates/index.tpl
===================================================================
--- /branches/0.4/web/addons/job_monarch/templates/index.tpl	(revision 752)
+++ /branches/0.4/web/addons/job_monarch/templates/index.tpl	(revision 753)
@@ -1,9 +1,3 @@
-<!-- TOGA SOB: <header> -->
-<!-- INCLUDE BLOCK : header -->
-<!-- TOGA EOB: </header> -->
-<!-- TOGA SOB: <main> -->
-<!-- INCLUDE BLOCK : main -->
-<!-- TOGA EOB: </main> -->
-<!-- TOGA SOB: <footer> -->
-<!-- INCLUDE BLOCK : footer -->
-<!-- TOGA EOB: </footer> -->
+{include(file="$header")}
+{include(file="$main")}
+{include(file="$footer")}
Index: /branches/0.4/web/addons/job_monarch/templates/overview.tpl
===================================================================
--- /branches/0.4/web/addons/job_monarch/templates/overview.tpl	(revision 752)
+++ /branches/0.4/web/addons/job_monarch/templates/overview.tpl	(revision 753)
@@ -20,5 +20,5 @@
 </TR>
 
-<!-- START BLOCK : na_nodes -->
+{if "$na_nodes" == "yes"}
 <TR class="overview">
 <TD class="gray">
@@ -26,15 +26,14 @@
 </TD>
 <TD class="gray">
-{na_jobs}
-</TD>
-<TD class="gray">
-{na_nodes}
-</TD>
-<TD class="gray">
-{na_cpus}
-</TD>
-</TR>
-<!-- END BLOCK : na_nodes -->
-
+{$na_jobs}
+</TD>
+<TD class="gray">
+{$na_nodes}
+</TD>
+<TD class="gray">
+{$na_cpus}
+</TD>
+</TR>
+{/if}
 
 <TR class="overview_line">
@@ -45,8 +44,8 @@
 </TD>
 <TD class="blue">
-{avail_nodes}
-</TD>
-<TD class="blue">
-{avail_cpus}
+{$avail_nodes}
+</TD>
+<TD class="blue">
+{$avail_cpus}
 </TD>
 </TR>
@@ -59,11 +58,11 @@
 </TD>
 <TD class="red">
-{running_jobs}
-</TD>
-<TD class="red">
-{running_nodes}
-</TD>
-<TD class="red">
-{running_cpus}
+{$running_jobs}
+</TD>
+<TD class="red">
+{$running_nodes}
+</TD>
+<TD class="red">
+{$running_cpus}
 </TD>
 </TR>
@@ -74,11 +73,11 @@
 </TD>
 <TD class="gray">
-{queued_jobs}
-</TD>
-<TD class="gray">
-{queued_nodes}
-</TD>
-<TD class="gray">
-{queued_cpus}
+{$queued_jobs}
+</TD>
+<TD class="gray">
+{$queued_nodes}
+</TD>
+<TD class="gray">
+{$queued_cpus}
 </TD>
 </TR>
@@ -89,11 +88,11 @@
 </TD>
 <TD class="brown">
-{total_jobs}
-</TD>
-<TD class="brown">
-{total_nodes}
-</TD>
-<TD class="brown">
-{total_cpus}
+{$total_jobs}
+</TD>
+<TD class="brown">
+{$total_nodes}
+</TD>
+<TD class="brown">
+{$total_cpus}
 </TD>
 </TR>
@@ -107,8 +106,8 @@
 </TD>
 <TD class="green">
-{free_nodes}
-</TD>
-<TD class="green">
-{free_cpus}
+{$free_nodes}
+</TD>
+<TD class="green">
+{$free_cpus}
 </TD>
 </TR>
@@ -119,11 +118,11 @@
 </TD>
 <TD>
-{view_jobs}
-</TD>
-<TD>
-{view_nodes}
-</TD>
-<TD>
-{view_cpus}
+{$view_jobs}
+</TD>
+<TD>
+{$view_nodes}
+</TD>
+<TD>
+{$view_cpus}
 </TD>
 </TR>
@@ -133,5 +132,5 @@
 <BR>
 <div id="monarchimage">
-{rjqj_graph}
+{$rjqj_graph}
 </div>
 
@@ -139,18 +138,18 @@
 <!-- INCLUDESCRIPT BLOCK : ci_script -->
     <div id="monarchimage">
-    <IMG SRC="{clusterimage}" USEMAP="#MONARCH_CLUSTER_BIG" BORDER="0">
+    <IMG SRC="{$clusterimage}" USEMAP="#MONARCH_CLUSTER_BIG" BORDER="0">
     </div>
     <MAP NAME="MONARCH_CLUSTER_BIG">
-<!-- START BLOCK : node_clustermap -->
-{node_area_map}
-<!-- END BLOCK : node_clustermap -->
+{if "$nodes_clustermap" == "yes"}
+{$node_area_map}
+{/if}
     </MAP>
     <BR>
-<FONT class="footer">Last updated: {report_time}</FONT></CENTER>
+<FONT class="footer">Last updated: {$report_time}</FONT></CENTER>
   </TD>
 
   </TD>
   <TD ALIGN="CENTER">
-    <IMG SRC="{pie}">
+    <IMG SRC="{$pie}">
   </TD>
 </TR>
@@ -162,12 +161,12 @@
 <NOSCRIPT><P>[Sorting by column header requires JavaScript]<BR><BR></P></NOSCRIPT>
 
-<INPUT TYPE="HIDDEN" NAME="sortby" VALUE="{sortby}">
-<INPUT TYPE="HIDDEN" NAME="sortorder" VALUE="{sortorder}">
-<INPUT TYPE="HIDDEN" NAME="c" VALUE="{clustername}">
-<INPUT TYPE="HIDDEN" NAME="queue" VALUE="{queue}">
-<INPUT TYPE="HIDDEN" NAME="state" VALUE="{state}">
-<INPUT TYPE="HIDDEN" NAME="owner" VALUE="{owner}">
-<INPUT TYPE="HIDDEN" NAME="id" VALUE="{id}">
-<INPUT TYPE="HIDDEN" NAME="filterorder" VALUE="{order}">
+<INPUT TYPE="HIDDEN" NAME="sortby" VALUE="{$sortby}">
+<INPUT TYPE="HIDDEN" NAME="sortorder" VALUE="{$sortorder}">
+<INPUT TYPE="HIDDEN" NAME="c" VALUE="{$clustername}">
+<INPUT TYPE="HIDDEN" NAME="queue" VALUE="{$queue}">
+<INPUT TYPE="HIDDEN" NAME="state" VALUE="{$state}">
+<INPUT TYPE="HIDDEN" NAME="owner" VALUE="{$owner}">
+<INPUT TYPE="HIDDEN" NAME="id" VALUE="{$id}">
+<INPUT TYPE="HIDDEN" NAME="filterorder" VALUE="{$order}">
 
 <TABLE WIDTH="100%" CELLPADDING="2" CELLSPACING="2" BORDER=0>
@@ -179,52 +178,52 @@
 <TH><B><A HREF="#" onClick="setSort( 'name' )" ALT="Jobname" TITLE="Jobname">Name</A></B></TH>
 <TH><B><A HREF="#" onClick="setSort( 'req_cpu' )" ALT="Requested CPU Time (walltime)" TITLE="Requested CPU Time (walltime)">Req. CPU time</A></B></TH>
-<!-- START BLOCK : column_header_req_mem -->
+{if "$column_header_req_mem" == "yes"}
 <TH><B><A HREF="#" onClick="setSort( 'req_mem' )" ALT="Requested Memory" TITLE="Requested Memory">Req. Memory</A></B></TH>
-<!-- END BLOCK : column_header_req_mem -->
+{/if}
 <TH><B><A HREF="#" onClick="setSort( 'nodes' )" ALT="Nodes" TITLE="Nodes">N</A>/<A HREF="#" onClick="setSort( 'cpus' )" ALT="Processors" TITLE="Processors">P</A></B></TH>
-<!-- START BLOCK : column_header_queued -->
+{if "$column_header_queued" == "yes"}
 <TH><B><A HREF="#" onClick="setSort( 'queued' )">Queued</A></B></TH>
-<!-- END BLOCK : column_header_queued -->
-<!-- START BLOCK : column_header_nodes -->
+{/if}
+{if "$column_header_nodes" == "yes"}
 <TH WIDTH="11%"><B><A HREF="#" onClick="setSort( 'nodes' )" ALT="Nodes" TITLE="Nodes">Nodes</A></B></TH>
-<!-- END BLOCK : column_header_nodes -->
+{/if}
 <TH><B><A HREF="#" onClick="setSort( 'start' )">Started</A></B></TH>
 <TH><B><A HREF="#" onClick="setSort( 'runningtime' )">Runningtime</A></B></TH>
 </TR>
 
-<!-- START BLOCK : node -->
-  <TR CLASS="{nodeclass}">
-    <TD><A HREF="#" onClick="setFilter( 'id', '{id}' )">{id}</A></TD>
-    <TD><A HREF="#" onClick="setFilter( 'state', '{state}' )" ALT="{fullstate}" TITLE="{fullstate}">{state}</A></TD>
-    <TD><A HREF="#" onClick="setFilter( 'owner', '{owner}' )">{owner}</A></TD>
-    <TD><A HREF="#" onClick="setFilter( 'queue', '{queue}' )">{queue}</A></TD>
-    <TD ALT="{fulljobname}" TITLE="{fulljobname}">
-<!-- START BLOCK : jobname_hint_start -->
+{loop $node_list}
+  <TR CLASS="{$nodeclass}">
+    <TD><A HREF="#" onClick="setFilter( 'id', '{$id}' )">{$id}</A></TD>
+    <TD><A HREF="#" onClick="setFilter( 'state', '{$state}' )" ALT="{$fullstate}" TITLE="{$fullstate}">{$state}</A></TD>
+    <TD><A HREF="#" onClick="setFilter( 'owner', '{$owner}' )">{$owner}</A></TD>
+    <TD><A HREF="#" onClick="setFilter( 'queue', '{$queue}' )">{$queue}</A></TD>
+    <TD ALT="{$fulljobname}" TITLE="{$fulljobname}">
+{if "$jobname_hint_start" == "yes"}
     <FONT CLASS="jobname_hint">
-<!-- END BLOCK : jobname_hint_start -->
-    {name}
-<!-- START BLOCK : jobname_hint_end -->
+{/if}
+    {$name}
+{if "$jobname_hint_end" == "yes"}
     </FONT>
-<!-- END BLOCK : jobname_hint_end -->
+{/if}
     </TD>
-    <TD>{req_cpu}</TD>
-<!-- START BLOCK : column_req_mem -->
-    <TD>{req_memory}</TD>
-<!-- END BLOCK : column_req_mem -->
-    <TD>{nodes}/{cpus}</TD>
-<!-- START BLOCK : column_queued -->
-    <TD>{queued}</TD>
-<!-- END BLOCK : column_queued -->
-<!-- START BLOCK : column_nodes -->
-    <TD>{nodes_hostnames}</TD>
-<!-- END BLOCK : column_nodes -->
-    <TD>{started}</TD>
-    <TD>{runningtime}</TD>
+    <TD>{$req_cpu}</TD>
+{if "$column_req_mem" == "yes"}
+    <TD>{$req_memory}</TD>
+{/if}
+    <TD>{$nodes}/{$cpus}</TD>
+{if "$column_queued" == "yes"}
+    <TD>{$queued}</TD>
+{/if}
+{if "$column_nodes" == "yes"}
+    <TD>{$nodes_hostnames}</TD>
+{/if}
+    <TD>{$started}</TD>
+    <TD>{$runningtime}</TD>
   </TR>
-<!-- END BLOCK : node -->
+{/loop}
 </TABLE>
 </CENTER>
 
-<!-- START BLOCK : showhosts -->
+{if "$showhosts" == "yes"}
 <TABLE BORDER="0" WIDTH="100%">
 <TR>
@@ -232,12 +231,12 @@
   <FONT SIZE="-1">
   Show Hosts:
-  yes<INPUT type=radio name="sh" value="1" OnClick="toga_form.submit();" {checked1}>
-  no<INPUT type=radio name="sh" value="0" OnClick="toga_form.submit();" {checked0}>
+  yes<INPUT type=radio name="sh" value="1" OnClick="toga_form.submit();" {$checked1}>
+  no<INPUT type=radio name="sh" value="0" OnClick="toga_form.submit();" {$checked0}>
   </FONT>
   |
-  job <strong>{id}</strong> metric <strong>{metric}</strong>
+  job <strong>{$id}</strong> metric <strong>{$metric}</strong>
   |
    <FONT SIZE="-1">
-   Columns&nbsp;&nbsp;{cols_menu}
+   Columns&nbsp;&nbsp;{$cols_menu}
    </FONT>
   </TD>
@@ -249,7 +248,7 @@
 <TABLE>
 <TR>
-<!-- START BLOCK : sorted_list -->
-{metric_image}{br}
-<!-- END BLOCK : sorted_list -->
+{loop $sorted_list}
+{$metric_image}{$br}
+{/loop}
 </TR>
 </TABLE>
@@ -260,3 +259,3 @@
 </CENTER>
 
-<!-- END BLOCK : showhosts -->
+{/if}
