<%@ include file="/includes.jsp" %>
<c:set var="type" value="${formObject.type}"/>
<c:set var="id" value="${formObject.id}"/>
<c:set var="title" value="${formObject.childName}"/>
<table width="500">
	<tr>
		<td>
			<div class="table">
			<div class="tableTitleBar">Edit <c:out value="${title}"/></div>
			<div class="tableContent">
				<table class="table">
					<tr>
						<th width="1">&nbsp;</th>
						<th >Name</th>
						<th >Label   <a href="../help/form-admin.html#NamesAndLabels" title="Help - Form Editor - Names and Labels" target="_help"><img src="../images/16x16/help.png" alt="Help icon" border="0"/></a></th>
						<th width="1">&nbsp;</th>
					</tr>
					<webapp:forEach id="child" items="${formObject.children}" statusId="s">
					<c:if test="${child != null}">
					<c:choose>
					<c:when test="${child['class'].name == 'com.ardeo.entities.autoforms.FormDefinition'}">
						<c:choose>
							<c:when test="${child.liveStatus != 0}">
								<%@include file="listFormObjectPopulate.jsp" %>
							</c:when>
							<c:otherwise>
								<c:if test="${child.liveStatus eq 0 and emdt.currentUser.username eq child.owner }">
									<%@include file="listFormObjectPopulate.jsp" %>
								</c:if>
							</c:otherwise>
						</c:choose>
					</c:when>
					<c:otherwise>
						<%@include file="listFormObjectPopulate.jsp" %>
					</c:otherwise>
					</c:choose>
					</c:if>
					</webapp:forEach>
					<c:if test="${empty formObject.children }">
						<tr>
							<td align="center" colspan="4">-- There are currently no <c:out value="${fn:toLowerCase(title)}"/>s --</td>
						</tr>
					</c:if>
				</table>
			</div>
			</div>
		</td>
	</tr>
	<tr>
		<td colspan="4" align="right">
			<c:if test="${not empty formObject.children }">
				<c:if test="${'2' eq type}">
					<input type="button" value="Reorder Pages" onclick="goToReOrderScr('<c:out value="${type}"/>','<c:out value="${id}"/>');"/>
				</c:if>
				<c:if test="${'3' eq type}">
					<input type="button" value="Reorder Sections" onclick="goToReOrderScr('<c:out value="${type}"/>','<c:out value="${id}"/>');"/>
				</c:if>
				<c:if test="${'4' eq type}">
					<input type="button" value="Reorder Fields" onclick="goToReOrderScr('<c:out value="${type}"/>','<c:out value="${id}"/>');"/>
				</c:if>
				<input type="submit" id="removeSelected" value="Remove Selected" onclick="return confirmAndDispatch('removeChildren', 'Are you sure you wish to remove the selected items?')"
				disabled="disabled" />
			</c:if>
		</td>
	</tr>					
</table>