<%@ page import="java.util.*, com.example.model.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<title>Lookup User Schedule</title>
<script type="text/javascript">
function setFlagGetSchedule()
{
var flag = document.getElementById("formflag");
flag.value=8;
}
function setFlagToMain()
{
var flag = document.getElementById("formflag");
flag.value=9;
}
function setFlagLogOut()
{
var flag = document.getElementById("formflag");
flag.value=4;
}
</script>
</head>
<body>
<h1 align="center">Lookup User Schedule</h1>
<form method="POST" action="Schedule.do">
<br/><br/>
<input type="hidden" name="formflag" value="-1" id="formflag">
User Name:
<br/><select name="username" size="1">
<%
  List users = (List)request.getAttribute("users");
  Iterator it = users.iterator();
  while(it.hasNext()) {
	String user = (String)it.next();
        out.print("<option value='" + user + "'>" + user + "</option>");
  }
%>
</select>
<br/><br/>
<input type="submit" name="get_schedule" value="Get User's Schedule" onclick="setFlagGetSchedule()">
<input type="submit" name="back" value="Back" onclick="setFlagToMain()">
<input type="submit" name="logout" value="Log Out" onclick="setFlagLogOut()">
<br/><br/><hr>
<p>Schedule For User: <font color=red>
<%
  String user1 = (String)request.getAttribute("user");
  String username = (String)request.getAttribute("username");
  out.println("<input type=hidden name=user value='" + user1 + "'>");
  out.println(username + "</font><br/>");
  List events = (List)request.getAttribute("events");
  it = events.iterator();
  Event e = null;
  while(it.hasNext()) {
	e = (Event)it.next();
        out.println(e.formatTime() + "<br/>");
  }
%>
<p>
    <br/>
        Created By Team F: Brian Hermann, Brian Johnson, Bill Meehan, Brian Sheehan, Graham Becker
  </p>

</form>
</body>
</html>
