#! /usr/bin/perl

BEGIN { require "../../perl/lib/Sitedefs.pm"; }

use CGITracker;
use PageTemplate;
use SUDB;
use ErrorLog;

$q = new CGITracker;

# Determine if the locker is open or closed
my $name = SUDB::LookupUserId($q->GetClientId());
my $locker_open = ($name ne "");

$tpl = new PageTemplate();

$q->Print($tpl->Header("Science U Lockers"));
$q->Print($tpl->InsertFile("$Sitedefs::ROOTPATH/info/navigation.html"));
$q->Print( $tpl->ContentHeader("Science U Lockers") );

$q->Print(qq|
<table width="100%" cellpadding="0" cellspacing="0">
  <tr>
|);

if ($locker_open) {
    $q->Print(qq|
      <td align="center">
	The locker named $name is open.
      </td>
      <td align="center">
        <form method="POST" action="$Sitedefs::ROOT/locker/update.cgi">
	  <input type="image" src="$Sitedefs::ROOT/locker/pix/update.gif"
           width="81" height="112" border="0">
         </form>
      </td>
      <td align="center">
        <form method="POST" action="$Sitedefs::ROOT/locker/close.cgi">
          <input type="hidden" name="confirmed" value="1">
	  <input type="image" src="$Sitedefs::ROOT/locker/pix/close.gif"
           width="81" height="112" border="0">
         </form>
      </td>
      <td align="center">
        <form method="POST" action="$Sitedefs::ROOT/locker/open.cgi">
	  <input type="image" src="$Sitedefs::ROOT/locker/pix/another.gif"
           width="81" height="112" border="0">
         </form>
      </td>
      <td align="center">
        <form method="POST" action="$Sitedefs::ROOT/locker/new.cgi">
	  <input type="image" src="$Sitedefs::ROOT/locker/pix/new.gif"
           width="83" height="119" border="0">
         </form>
      </td>
    </form>
    |);
} else {
    $q->Print(qq|
    <td align="center">
        <form method="POST" action="$Sitedefs::ROOT/locker/open.cgi">
	  <input type="image" src="$Sitedefs::ROOT/locker/pix/opening1.gif"
           width="81" height="112" border="0">
         </form>
    </td>
    <td align="center">
        <form method="POST" action="$Sitedefs::ROOT/locker/new.cgi">
	  <input type="image" src="$Sitedefs::ROOT/locker/pix/new.gif"
           width="83" height="119" border="0">
         </form>
    </td>
    |);
}

$q->Print(qq|
  </tr>  
</table>

The Science U locker system is a way for you to save images that you
create and preferences that you set while visiting the Science U, so
that you can get these things back when you return to Science U later.
Think of your locker as a place where you store your stuff at Science
U.  To access your stuff, simply open your locker.  To store it safely
when you're done, close your locker.

<p>

Science U uses <i>cookies</i> to implement lockers; if you're
interested in knowing more about cookies, read our <a
href="$Sitedefs::ROOT/info/cookies.html">cookie policy</a>.

|);

# <img src="$Sitedefs::ROOT/locker/pix/opening0.gif" alt="Locker"
# align="bottom"> 

$q->Print($tpl->Footer(), "\n");
$q->EndPrint();
