<%@ include file="/includes.jsp" %>
<%@ taglib prefix="smvc" uri="http://www.springframework.org/tags/form"%>
<%-- THIS FILE IS INCLUDED FROM editFormObjectLayout.jsp --%>
<tr>
	<td class="label">Colour</td>
	<td class="input">
		<smvc:input path="formObject.colourCode" id="colour"/>
		<a onclick="javascript:openColorPickerPopup('colour');" id="pick"> <img src="../images/16x16/colorpicker.png"/> </a>
	</td>
</tr>
<tr>
	<td class="label"><b>Speciality</b></td>
	<td class="input">
		<webapp:selectAndEditList path="formObject.tumourGroup" domain="EMDT" list="Speciality" includeEmpty="true"/>
	</td>
</tr>
<tr>
	<td class="label">Primary Key Field</td>
	<td class="input">
		<smvc:select path="formDefinition.primaryKeyField">
			<smvc:option  value=""></smvc:option >
			<smvc:options path="fieldNames"/>
		</smvc:select>
	</td>
</tr>
<tr>
	<td class="label">Status</td>
	<td class="input">
		<smvc:radiobutton path="liveStatus" value="0"/>Test mode: Form is only visible to you
		<br/>
		<smvc:radiobutton path="liveStatus" value="1"/>Live: Form is generally available
		<br/>
		<smvc:radiobutton path="liveStatus" value="2"/>Retired: New forms should not be created
	</td>
</tr>
<tr>
	<td class="label">Owner</td>
	<td class="input">
		<smvc:select path="owner">
			<smvc:options path="userNames" />
		</smvc:select>
	</td>
</tr>
<tr>
	<td class="label">Export data</td>
	<td class="input"><input type="submit" value="Export data" onclick="return dispatch('exportData')"/></td>
</tr>
<tr>
	<td class="label">Expression</td>
	<td class="input"><smvc:textarea cols="40" rows="2" path="formDefinition.expression" /><img src="../images/16x16/help.png" title="Show help on expressions" id="show_expr_help" style="cursor: pointer;"/>
	<br/>
	<div class="helpmessage" id="help_expr" style="display: none; margin: 0;">Form Expressions are optional, small expressions or macros.<br/>
	If entered, they will be evaluated and displayed to the user in Patient History to provide a synopsis of the information within a form.<br/>
	They consist of:
	<ul>
	<li>text to display, which is contained in single quotes &apos;&nbsp;&apos;</li>
	<li>form field names, which are contained in square brackets [ ] </li>
	<li> the ampersand &amp; which is used as a separator. </li>
	</ul>
	Example: If there are fields called Stage, Cyclenbr and Daynbr, and they have values 'Baseline', '3' and '1', then the expression<br/>
	 <code>[Stage]&amp;' C'&amp;[Cyclenbr]&amp;' D'&amp;[Daynbr]</code> will be displayed as <code>Baseline C3 D1</code>
	</div>
	<script type="text/javascript">
	$("#show_expr_help").click(function() {
	  $("#help_expr").toggle(100);
	});
	</script>
	
	</td>
</tr>
<tr>
	<td class="label">Notes</td>
	<td class="input"> 
		<smvc:checkbox path="formDefinition.showNotes" id="showNotes" onchange="setCheckBoxes();"/> Show the Notes panel below this form
		<input type="hidden" name="showNotesName" id="showNotesName"/>
	</td>
</tr>
<tr>
	<td class="label"></td>
	<td class="input"> 
		<smvc:checkbox path="formDefinition.allowNotesAttachment" id="allowNotesAttachment" onchange="setCheckBoxes();"/> Users may attach files to Notes
		<input type="hidden" name="allowNotesAttachmentName" id="allowNotesAttachmentName"/>
	</td>
</tr>

<tr>
	<td class="label"></td>
	<td class="input"> 
		<smvc:checkbox path="formDefinition.allowNotification" onchange="setCheckBoxes();" id="allowNotification" /> Notifications for this form can be sent to other users
		<input type="hidden" name="allowNotificationName" id="allowNotificationName"/>
	</td>
</tr>
<c:if test="${formObjectForm.formDefinition.allowNotification}">
	<tr>
		<td>&nbsp;</td>
		<td>
			Show users: <smvc:select path="formDefinition.notifingUsers" id="notifyingUsers">
				<smvc:option  value=""></smvc:option >
				<c:forEach var="namedList" items="${webapp.userCategory }">
					<% com.ardeo.entities.NamedList namedList= (com.ardeo.entities.NamedList) pageContext.getAttribute("namedList");%>
					<smvc:option  value="<%=namedList.getName()%>"><%=namedList.getName()%></smvc:option >
				</c:forEach>
			</smvc:select>
		</td>
	</tr>
</c:if>
