<%@ page import="org.thdl.lex.*,org.thdl.lex.component.*"  %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<!--subdefinitionForm.jsf-->
<c:out value='<a name="${ component }" ></a>' escapeXml="false" />
<c:choose>
	<c:when test="${ ! empty param.formMode && param.formMode == 'insert'}">
		<c:set var="updateMode" value="${ false }" />		
		<c:set var="newCmd" value="insert" />
		<c:set var="subdefinition" value="" />
		<c:set var="id" value="" />
		<c:set var="note" value="" />
	</c:when>
	<c:when test="${ ! empty param.formMode && param.formMode == 'update'}">
		<c:set var="updateMode" value="${ true }" />		
		<c:set var="newCmd" value="update" />
		<c:set var="subdefinition" value="${ component.subdefinition }" />
		<c:set var="id" value="${ component.id }" />
		<c:set var="note" value="${ component.note }" />
	</c:when>
	<c:otherwise>
		<c:set var="updateMode" value="${ false }" />		
		<c:set var="newCmd" value="" />
		<c:set var="subdefinition" value="ERROR" />
		<c:set var="precedence" value="ERROR" />
		<c:set var="note" value="ERROR" />
	</c:otherwise>
</c:choose>

<c:set var="translateMode" value="${ false }" />
<c:if test="${ component.translationOf > 0 }">
	<c:set var="translateMode" value="${ true }" />
	<c:set var="originalSubdefinition" 
			 value="Original Subdefinition: ${ original.subdefinition } <br /> Translation " />
	<c:set var="subdefinition" value="" />
</c:if>

<form id="newCompForm" action="/lex/action" method="post">
<p>
<c:if test="${ translateMode }">
	<c:out value='<input type="hidden" name="translationOf" value="${ component.translationOf }" />' escapeXml="false" />
</c:if>

<input type="hidden" name="comp" value="subdefinition" />
<c:if test="${ updateMode }">
<c:out value='<input type="hidden" name="id" value="${id}" />' escapeXml="false" />
</c:if>
<c:out value='<input type="hidden" name="cmd" value="${newCmd}" />' escapeXml='false' />
<c:out value='<input type="hidden" name="parentId" value="${ param.parentId }" />' escapeXml='false' />

<c:out value="${ originalSubdefinition }" escapeXml='false'/>
Subdefinition: <br />
<textarea name="subdefinition" rows="8" cols="90"><c:out value='${ subdefinition }' escapeXml='false' /> </textarea>
<br />

<%-- Precedence: <c:out value='<input type="text" value="${ precedence }" name="precedence" size="3"/>' escapeXml='false' /> <br />
 --%>
<jsp:include page="metaForm.jsf" />

<input type="submit" value="Submit Subdefinition" />
</p>
</form>
