<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="js" uri="net.sourceforge.jsurveyor.jsurveyorlib" %>
<%@ page import="net.sourceforge.jsurveyor.*" %>
<%@ page import="java.util.ArrayList" %>
<js:noCache />
<js:login access="admin" />
<js:border title="JSurveyor" >
<c:if test="${param.button == 'Ok'}">
<%
ArrayList allQ = (ArrayList)session.getAttribute("allQ");
session.removeAttribute("allQ");
int tempQID;
for(int i = 0; i < allQ.size(); i++) {
	Questionnaire tempQ = (Questionnaire)allQ.get(i);
	tempQID = tempQ.getQuestionnaireID();
	DataAccess.deleteQuestionnaire(tempQID);
}
%>
<c:redirect url="admin_main.jsp">
</c:redirect>
</c:if>
<c:if test="${param.button == 'Cancel'}">
<%
session.removeAttribute("allQ");
%>
<c:redirect url="admin_main.jsp">
</c:redirect>
</c:if>
<form action='admin_delete.jsp' method='post'>
You have chosen to delete the following questionnaires:<br /><br />
<%
ArrayList allQ = new ArrayList();
%>
<c:forEach items="${paramValues.QuestionnaireID}" var="current">
		<%
		String current = (String)pageContext.getAttribute("current");
		Questionnaire tempQ = DataAccess.retrieveQuestionnaire(Integer.parseInt(current));
		allQ.add(tempQ);
		%>
		<%= tempQ.getQuestionnaireName() %><br />
</c:forEach> 
<%
session.setAttribute("allQ", allQ);
%>
<br />
This will also mean that all user submitted data for the following questionnaires will be deleted<br />
If you want to see (and possibly save) the results of the questionnaires press "cancel" to go back and do so.<br />
If you are sure you want to delete the above mentioned then press "ok" to continue with the deletion.<br />
<tr>
	  <td></td>
	  <td class='mainmenu_buttonline'><input class='stdbutton' name='button' type='submit' title='Click to delete this questionnaire' value='Ok'/> <input class='stdbutton' title='Click to return to Questionnaire list page without deleting' name='button' type='submit' value='Cancel'/></td>
    </tr>
</form>

</js:border>