<html>
<head>
 <title><%$title%></title>
 <link href="styles.css" rel="stylesheet" type="text/css" />
  <!-- Changed by: Jim Mahoney, 08-Nov-2004 -->
</head>
<body><table width="99%">
<tr>
 <td colspan="2" id="title"><%$title%></td>
</tr>
<tr>
 <td id="left-menu">
 &nbsp;<br />
% for my $page (@pages){
 <% menu_link($page) %><br />
% }
 &nbsp;<br />
 </td>
 <td id="body">
% $m->call_next();
 </td>
</tr>
<tr>
 <td colspan="2" id="about">
 Jim Mahoney (mahoney@marlboro.edu)<br />
 November 2 2004
</td>
</tr>
</table></body>

<pre>
 -- Debugging --------------------------------------
  directory = <% $directory %>
  $ENV{PERL5LIB} = <% $ENV{PERL5LIB} %>
  @INC = <% "@INC" %>
 ---------------------------------------------------
</pre>

</html>
%#
%#====================================================
%#
<%init>

 # Set the path where perl looks for packages to include
 # the directory where this autohandler is, if we don't already have it
 my $directory = $m->current_comp->source_dir;
 push @INC, $directory unless grep(/$directory/,@INC);

 # Load the RegistrarData.pm file at run time.
 # (We can't say "use RegistrarData" here; that happens at compile time.)
 require RegistrarData;

 # Save the database object in a package global (i.e. "our") where
 # the other HTML::Mason components can get to it.
 our $registrar = new RegistrarData;

 my $title = "Registrar Database Demo";

 # These are the pages that show up in the menu on the left of the screen.
 # The URL for each is its name with .html appended.
 my @pages = qw( home add summary register search );

 # Given one of the entries in that @page list, 
 # return the HTML string that links to that page,
 # or a string that shows we're already visiting that page.
 sub menu_link {
   my ($page) = @_;
   return $m->base_comp->name =~ /$page/ ?
     qq{<span class="current-page">$page</span>} :
     qq{<a href="$page.html">$page</a>};
 }

</%init>

