<%@ include file="/includes.jsp"%>
<%@ taglib prefix="smvc" uri="http://www.springframework.org/tags/form"%>
<tiles:importAttribute />
<%--This imports all tiles atributes to page --%>
<c:set var="fieldWritable" value="true"/>
<c:set var="readOnly" value="false"/>
<input type="hidden" id="styleId" value="<c:out value="${field.style}"/>" />
<c:choose>
	<c:when test="${fieldWritable != 'true'}">
		<c:set var="disabled" value="true"/>
	</c:when>
	<c:otherwise>
		<c:set var="disabled" value="false"/>
	</c:otherwise>
</c:choose>
<c:if test="${field.defaultValueMode==4 || consultationNoteForm.view.note.locked eq true}">
	<c:set var="readOnly" value="true" />
</c:if>
<tr title='<c:out value="${field.description }"/>'>
	<c:if test="${field.inputType eq 0}">
		<td class="label" colspan="2" height="1" align="<c:out value="${field.labelAlign }"/>">
		<c:if test="${not empty field.labelUrl}">
			<a href="<c:out value="${field.labelUrl }"/>">
		</c:if> 
		<c:if test="${field.labelType eq 'text'}">
			<c:out value="${field.label}"/>
		</c:if>
		<c:if test="${field.labelType eq 'separator'}">
			<hr height="1" width="95%" />
		</c:if> <c:if test="${not empty field.labelUrl}">
			</a>
		</c:if></td>
	</c:if>
	<c:if test="${field.inputType ne 0}">
		<td class="label" align="<c:out value="${field.labelAlign }"/>"><c:if test="${not empty field.labelUrl}">
			<a target="_blank" href="<c:out value="${field.labelUrl }"/>">
		</c:if> 
		<c:if test="${field.inputType ne 8}">
			<c:if test="${field.labelType eq 'text'}">
				<c:out value="${field.label}"/></c:if>
		</c:if>
		<c:if test="${field.labelType eq 'separator'}">
			<hr height="1" width="95%" />
		</c:if> <c:if test="${not empty field.labelUrl}">
			</a>
		</c:if></td>
		<td class="input">
		<tiles:insertTemplate template="/emdt/tiles/forms/fieldRenderer${field.inputType }.jsp">
			<tiles:putAttribute name="field" value="${field}" />
			<tiles:putAttribute name="fieldWritable" value="${fieldWritable}" />
			<c:choose>
				<c:when test="${webapp.roleReferrals and 'Response' eq consultationNoteForm.view.formName}">
					<tiles:putAttribute name="disabled" value="true" />
					<tiles:putAttribute name="readOnly" value="true" />
				</c:when>
				<c:otherwise>
					<tiles:putAttribute name="disabled" value="${disabled}" />
					<tiles:putAttribute name="readOnly" value="${readOnly}" />

				</c:otherwise>
			</c:choose>
			<tiles:putAttribute name="parentPage" value="${parentPage}" />
		</tiles:insertTemplate> <%-- START EDIT LIST BUTTON --%> <sec:authorize access="hasRole('ADMIN')">
			<c:if
				test="${field.optionsMapName != null and fn:length(field.optionsMapName) gt 0}">
				<webapp:namedList id="nl" domain="${field.optionsMapDomain}"
					name="${field.optionsMapName}" />
				<c:if test="${nl != null and nl.editable == true }">
						&nbsp;<a style="color: blue;"
						href="javascript:editList('<c:out value="${nl.domain}"/>', '<c:out value="${nl.name}"/>')"
						title="Edit list"><img src="../images/16x16/edit.png"
						alt="Edit list" border="0" /></a>
				</c:if>
			</c:if>
		</sec:authorize> <%-- END EDIT LIST BUTTON --%></td>
	</c:if>
</tr>