<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
<html>
  <head profile="<c:url value="/profile.txt"/>">
    <title><fmt:message key="setup.admin.title"/></title>
    <link media="screen" href="<c:url value="/css/global.css"/>" type="text/css" rel="stylesheet" />
  </head>
  <body>
    <h1><fmt:message key="setup.admin.title"/></h1>
    <p><fmt:message key="setup.admin.intro"/></p>
    
     <spring:hasBindErrors name="command">
    	<div class="error-intro">
			<spring:bind path="command.settings">
				<c:choose>
					<c:when test="${status.errors.errorCount > 1}">
						<ul>
							<c:forEach items="${status.errors.allErrors}" var="error">
								<li>
									<spring:message code="${error.code}" arguments="${error.arguments}"/><br />
								</li>
							</c:forEach>
						</ul>
					</c:when>
					<c:when test="${status.errors.errorCount == 1}">
						<c:set var="error" value="${status.errors.allErrors[0]}"/>
						<spring:message code="${error.code}" arguments="${error.arguments}"/><br />
					</c:when>
				</c:choose>
			</spring:bind>
    	</div>
    </spring:hasBindErrors>

	<form method="post" action="<c:url value="/setup/wizard.do"/>">
	
		<c:if test="${command.settings['setup.complete'] == 'true' or command.settings['setup.adminexists'] == 'true'}">
			<div>
				<spring:bind path="command.skipAdminUser">
					<input type="hidden" name="_${status.expression}"
						value="visible"/>
					<input type="checkbox" name="${status.expression}"
						value="true" <c:if test="${status.value == 'true'}">checked="checked"</c:if> />
				</spring:bind>
				<fmt:message key="setup.admin.skip.caption"/>
			</div>
			<br />
		</c:if>
		
		<spring:nestedPath path="command.user">
		
			<table class="form">
				<tr>
				  <th><fmt:message key="name.displayName"/></th>
				  <td>
					<spring:bind path="name">
						<input  type="text" maxlength="64" 
							value="${status.value}" 
							name="${status.expression}"/>
					</spring:bind>
					<div class="caption"><fmt:message key="name.caption"/></div>
				  </td>
				</tr>
				<tr>
				  <th><fmt:message key="email.displayName"/></th>
				  <td colspan="3">
					<spring:bind path="email">
						<input type="text" maxlength="128" 
							value="${status.value}" 
							name="${status.expression}"/>
					</spring:bind>
					<div class="caption"><fmt:message key="email.caption"/></div>
				  </td>
				</tr>
				<tr>
				  <th><fmt:message key="login.displayName"/></th>
				  <td colspan="3">
					<spring:bind path="login">
						<input type="text" maxlength="32" 
							value="${status.value}" 
							name="${status.expression}"/>
					</spring:bind>
					<div class="caption"><fmt:message key="login.caption"/></div>
				  </td>
				</tr>
				<tr>
				  <th><fmt:message key="password.displayName"/></th>
				  <td colspan="3">
					<spring:bind path="password">
						<input type="password" maxlength="64" 
							value="${status.value}" 
							name="${status.expression}"/>
					</spring:bind>
					<div class="caption"><fmt:message key="password.caption"/></div>
				  </td>
				</tr>
				<tr>
				  <th />
				  <td>
					<input type="submit" name="_target4" value="<fmt:message key="back.displayName"/>"/>
					<input type="submit" name="_target6" value="<fmt:message key="continue.displayName"/>"/>
				  </td>
				</tr>
			</table>
			
		</spring:nestedPath>
		
	</form>

  </body>
</html>
