
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>

<%@ page import="com.calendar.*, java.util.*, java.lang.String.*" %>
<%! String newEntry; %>
<%! ArrayList<String> calendarAL = new ArrayList<String>(); %>
<% String Mon = request.getParameter("Mon"); 
   String Tue = request.getParameter("Tue");
   String Wed = request.getParameter("Wed");
   String Thu = request.getParameter("Thu");
   String Fri = request.getParameter("Fri");
   String username = request.getParameter("username");
   String clear = request.getParameter("clear");
   if (request.getParameter("clear") == null)  {
     clear = "off";  // checkboxes return null if not checked
   } 
   //now process the input and store the calculated free and 
  // busy times in the static array HTML[]
   newEntry = 
    "M:"+ Parser.doParse(Mon) + ";" + 
    "T:"+ Parser.doParse(Tue) + ";" +
    "W:"+ Parser.doParse(Wed) + ";" +
    "T:"+ Parser.doParse(Thu) + ";" +
    "F:"+ Parser.doParse(Fri) + ";" ;
    
 

//==========================begin HTML ============================
%>

<html>
<head>


<title>
Set schedule for one user
</title>
</head>
<body bgcolor="white"  text="#400040" link="blue" alink="black" vlink="red">


<h2>Schedule changed for username = ${param.username}</h2>

<sql:setDataSource 
 driver="com.mysql.jdbc.Driver"
 url="${initParam.DBconn_string}"
 user="${initParam.DBusername}"
 password="${initParam.DBpassword}" />
 

   
 
<sql:update >
  update calendar set sched = '<%=newEntry%>' where username = '${param.username}'
</sql:update>

 

  
   <sql:query var="result" >
     Select username from calendar
     
 
   </sql:query>
   
   <h3>Combined calendar for: 
	<c:forEach items="${result.rows}" var="row">
	${row.username} </c:forEach> 
   </h3>
   
<jsp:include page = "showSched.jsp"/>


</body>
</html>






