<%@ page import="org.thdl.lex.*,org.thdl.lex.component.*"  %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<!--definitionForm.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="definition" value="" />
		<c:set var="metaId" 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="definition" value="${ component.definition }" />
		<c:set var="metaId" value="${ component.metaId }" />
		
	</c:when>
	<c:otherwise>
		<c:set var="updateMode" value="${ false }" />		
		<c:set var="newCmd" value="" />
		<c:set var="definition" 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="originalDefinition" 
				 value="Original Definition: ${ original.definition } <br /> Translation " />
		<c:set var="metaId" value="${ component.metaId }" />
</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="definition" />
<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="${ originalDefinition }" escapeXml='false' />

Definition: <br />

<textarea name="definition" rows="8" cols="90"><c:if test="${ param.cmd != 'getTranslationForm'}"><c:out value='${ definition }' escapeXml='false' /></c:if></textarea>
<br />

<jsp:include page="metaForm.jsf" />

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