<%@ page import="org.thdl.lex.*,org.thdl.lex.component.*"  %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<!--modelSentenceForm.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="modelSentence" value="" />
		<c:set var="metaId" value="" />
		<%-- <c:set var="precedence" value="1" /> --%>
		
	</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="modelSentence" value="${ component.modelSentence }" />
		<c:set var="metaId" value="${ component.metaId }" />
		<%-- <c:set var="precedence" value="${ component.precedence }" /> --%>
		
	</c:when>
	<c:otherwise>
		<c:set var="updateMode" value="${ false }" />		
		<c:set var="newCmd" value="" />
		<c:set var="modelSentence" value="ERROR" />
		<%-- <c:set var="precedence" 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="originalModelSentence" 
			 value="Original Model Sentence: ${ original.modelSentence } <br /> Translation " />
</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="modelSentence" />
<c:if test="${ updateMode }">
<c:out value='<input type="hidden" name="metaId" value="${metaId}" />' escapeXml="false" />
</c:if>
<c:out value='<input type="hidden" name="cmd" value="${newCmd}" />' escapeXml='false' />

<c:out value="${ originalModelSentence }" escapeXml='false' />
Model Sentence: <br />
<textarea name="modelSentence" rows="8" cols="90"><c:out value='${ modelSentence }' /></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 Model Sentence" />
</p>
</form>
