<%@ taglib uri="/tags/struts-bean-el" prefix="bean-el"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html-el"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="/tags/esr-core" prefix="esrcore"%>
<%@ taglib uri="/tags/fw" prefix="fw"%>
<%@ taglib uri="/WEB-INF/treetag.tld" prefix="tree"%>

<c:set var="requiredText">
	<bean-el:message key="label.required" />
</c:set>
<c:set var="requiredFlag">
	<%=Boolean.TRUE.toString()%>
</c:set>
<c:set var ="edit" value="true"/>
<c:if test="${empty serviceRequestForm.requestId}">
  <c:set var ="edit" value="false"/>
</c:if>
<table width="100%" border="0" cellpadding="0" cellspacing="0"
	class="moduleShell" role="presentation">
	<html-el:form action="/serviceRequest.do" method="post">
     <%@ include file="/admin/csrfgentoken.jsp" %>
	
	<script type="text/javascript">
		function onClickSubmit(methodName, paramName, paramValue)	{
			serviceRequestForm.methodName.value=methodName;
			if ( paramName == 'expand' ) {
				serviceRequestForm.expand.value=paramValue;
			} else if (paramName == 'collapse' ) {
				serviceRequestForm.collapse.value=paramValue;
			} else if ( paramName == 'unSelectDescendantsAndSelf' ) {
				serviceRequestForm.unSelectDescendantsAndSelf.value=paramValue;
			} else if ( paramName == 'selectDescendantsAndSelf' ) {
				serviceRequestForm.selectDescendantsAndSelf.value=paramValue;
			}
			serviceRequestForm.submit();
			return true;
		}
	</script>
	
		<tr>
			<td>
			<table width="100%" border="0" cellpadding="0" cellspacing="0"
				class="moduleShellTable" role="presentation">
				<tr>
					<td>
					<table width="100%" border="0" cellpadding="0" cellspacing="0"
						class="moduleShellTableHead" role="presentation">
						<tr>
							<td class="moduleBlueBox">&nbsp;</td>
						 <c:choose>
               					 <c:when test="${edit == true}">
							<td class="moduleHeadline" nowrap><bean-el:message
								key="label.eeService.editrequest.mainHeader" /></td>
								<td width="100%"><img alt=""  src="../images/spacer.gif"/>
							<td nowrap class="moduleBlueLink"
								style="padding: 1px 8px 1px 8px"><fw:link
								action="/serviceRequest.do?methodName=displayNew">
								<bean-el:message key="text.serviceRequestNew" />
							</fw:link></td>
							 </c:when>
           					 <c:otherwise>
           						 <td class="moduleHeadline" nowrap><bean-el:message
								key="label.eeService.newrequest.mainHeader" /></td>
							</c:otherwise>  
            				</c:choose>
						</tr>
					</table>
					</td>
				</tr>
				<tr>
					<td>
					<table width="100%" border="0" cellspacing="0" cellpadding="0"
						class="moduleShellTableBody" role="presentation">
                        <tr>
                            <td colspan="2">
                              <%@ include file="/tiles/common/instructionalText.jsp" %>
                            </td>
                        </tr>
						<tr>
							<td colspan="2">&nbsp;</td>
						</tr>
						<tr>
							<td width="45%" class="moduleLabel">
								<fw:label	required="${requiredFlag}" property="name" forId="txtName">
								<bean-el:message key="label.eeServiceRequest.header.name" />:</fw:label>
							</td>
							<td width="55%" class="moduleValue">
								<c:set var="nameText">
									<bean-el:message key="label.eeServiceRequest.header.name" />
								</c:set> 
								<html-el:text title="${requiredText}${nameText}" property="name" styleClass="moduleEdit" styleId="txtName" size="40" maxlength="35" />
							</td>
						</tr>
						<tr>
							<td width="45%" class="moduleLabel">
								<fw:label	required="${requiredFlag}" property="description" forId="txtDescription">
								<bean-el:message key="label.eeServiceRequest.header.description" />:</fw:label>
							</td>
							<td width="55%" class="moduleValue">
								<c:set	var="descriptionText">
									<bean-el:message key="label.eeServiceRequest.header.description" />
								</c:set> 
								<html-el:text title="${requiredText} ${descriptionText}"	property="description" styleClass="moduleEdit" styleId="txtDescription" size="50" maxlength="100" />
								<html-el:hidden  property="requestId"/>							
								<input type=hidden name="methodName"/>								
								<input type=hidden name="expand"/>							
								<input type=hidden name="collapse"/>							
								<input type=hidden name="unSelectDescendantsAndSelf"/>							
								<input type=hidden name="selectDescendantsAndSelf"/>							
							</td>
						</tr>
						<td colspan="2" align="center">


						<table cellspacing="0" cellpadding="0" border="0" role="presentation">
							<tree:tree tree="tree.model" node="tree.node"
								includeRootNode="true">
								<tr>
									<td>
									<table cellspacing="0" cellpadding="0" border="0" role="presentation">
										<tr>
											<td class="moduleLabel">
												<tree:nodeIndent	node="tree.node" indentationType="type">
													<tree:nodeIndentVerticalLine indentationType="type">
														<img alt="" src="../images/tree/verticalLine.gif">
													</tree:nodeIndentVerticalLine>
													<tree:nodeIndentBlankSpace indentationType="type">
														<img alt="" src="../images/tree/blankSpace.gif">
													</tree:nodeIndentBlankSpace>
												</tree:nodeIndent>
											</td>
											<td class="moduleLabel">
												
												<tree:nodeMatch node="tree.node"	hasChildren="true" expanded="false" isLastChild="false">
													<img alt="collapse middle node"	src="../images/tree/collapsedMidNode.gif"	title="Expand Group <tree:nodeToolTip node="tree.node"/>"	border="0"
														onclick="return onClickSubmit('refreshTree', 'expand', '<tree:nodeId node="tree.node"/>');"> 
												</tree:nodeMatch>
												<tree:nodeMatch node="tree.node" hasChildren="true"	expanded="true" isLastChild="false">
													<img alt="expanded middle node"	src="../images/tree/expandedMidNode.gif"	title="Collapse Group <tree:nodeToolTip node="tree.node"/>"	border="0"
														onclick="return onClickSubmit('refreshTree', 'collapse', '<tree:nodeId node="tree.node"/>');"> 
												</tree:nodeMatch> 

												<tree:nodeMatch node="tree.node" hasChildren="true"	expanded="false" isLastChild="true">
													<img alt="collapsed last node"	src="../images/tree/collapsedLastNode.gif"	title="Expand Group <tree:nodeToolTip node="tree.node"/>"	border="0"
														onclick="return onClickSubmit('refreshTree', 'expand', '<tree:nodeId node="tree.node"/>');"> 
												</tree:nodeMatch> 
												<tree:nodeMatch node="tree.node" hasChildren="true"	expanded="true" isLastChild="true">
													<img alt="expanded last node"	src="../images/tree/expandedLastNode.gif"	title="Collapse Group <tree:nodeToolTip node="tree.node"/>"	border="0"
														onclick="return onClickSubmit('refreshTree', 'collapse', '<tree:nodeId node="tree.node"/>');"> 
												</tree:nodeMatch> 
												<tree:nodeMatch node="tree.node" hasChildren="false"	isLastChild="false">
													<img alt="No childred middle node" src="../images/tree/noChildrenMidNode.gif" border="0" />
												</tree:nodeMatch> 
												<tree:nodeMatch node="tree.node" hasChildren="false"	isLastChild="true">
													<img alt="No childred last node" src="../images/tree/noChildrenLastNode.gif" border="0" />
												</tree:nodeMatch>
											</td>
											<td class="moduleLabel">
												<tree:nodeMatch node="tree.node" selected="true">
													<img alt="Green Check Mark"	src="../images/check_green.gif"	title="Unselect <tree:nodeToolTip node="tree.node"/>"	border="0"
														onclick="return onClickSubmit('refreshTree', 'unSelectDescendantsAndSelf', '<tree:nodeId node="tree.node"/>');"> 
												</tree:nodeMatch> 
												<tree:nodeMatch node="tree.node" selected="false">
													<img alt="Red X Mark" src="../images/redX.gif"	title="Select <tree:nodeToolTip node="tree.node"/>"		border="0"
														onclick="return onClickSubmit('refreshTree', 'selectDescendantsAndSelf', '<tree:nodeId node="tree.node"/>');"> 
												</tree:nodeMatch> 
												<tree:nodeMatch node="tree.node" type="GROUP"	expanded="false">
													<img alt="Closed Folder" src="../images/tree/closedFolder.gif" 	title="Group <tree:nodeToolTip node="tree.node"/>"	border="0" />
												</tree:nodeMatch> 
												<tree:nodeMatch node="tree.node" type="GROUP"	expanded="true">
													<img alt="Opened Folder" src="../images/tree/openFolder.gif"	title="Group <tree:nodeToolTip node="tree.node"/>"	border="0" />
												</tree:nodeMatch> 
												<tree:nodeMatch node="tree.node" type="FIELD">
													<img alt="Non Folder" src="../images/tree/nonFolder.gif"	title="Field <tree:nodeToolTip node="tree.node"/>"	border="0" />
												</tree:nodeMatch> 
												<tree:nodeName node="tree.node" />
											</td>
										</tr>
									</table>
									</td>
								</tr>
							</tree:tree>
						</table>
						</td>
						<tr>
							<td>&nbsp;</td>
						</tr>
						<tr>
							<td colspan=2>
							<table border="0" align="center" cellspacing="3" cellpadding="0" role="presentation">
								<tr>
								 <c:choose>
               					 <c:when test="${edit == true}">
									<td><img alt="" src="../images/buttonEndLeft.gif" /><html-el:button
											property="dummy" style="width:90; vertical-align: top;"
											styleClass="buttonText" onclick="return onClickSubmit('Save', 'none', 'none');">
											<bean-el:message key="button.eeservicerequest.update" />
										</html-el:button><img alt="" src="../images/buttonEndRight.gif" />
									</td>
								</c:when>
                                  <c:otherwise>
									<td><img alt="" src="../images/buttonEndLeft.gif" /><html-el:button
											property="dummy" style="width:90; vertical-align: top;"
											styleClass="buttonText" onclick="return onClickSubmit('Save', 'none', 'none');">
											<bean-el:message key="button.eeservicerequest.add" />
										</html-el:button><img alt="" src="../images/buttonEndRight.gif" />
									</td>
								</c:otherwise>
                                </c:choose>
									<td><img alt="" src="../images/buttonEndLeft.gif" /><html-el:button
											property="dummy" style="width:90; vertical-align: top;"
											styleClass="buttonText" onclick="return onClickSubmit('reset', 'none', 'none');">
											<bean-el:message key="button.eeserviceUser.reset"/>
										</html-el:button><img alt="" src="../images/buttonEndRight.gif" />
									</td>
								
									<td>
										<img alt="" src="../images/buttonEndLeft.gif" /><html-el:button
											property="dummy" style="width:90; vertical-align: top;"
											styleClass="buttonText"    onclick="return onClickSubmit('Cancel', 'none', 'none');">
										<bean-el:message key="button.eeservicerequest.Cancel" />
										</html-el:button><img alt="" src="../images/buttonEndRight.gif" />
									</td>

								</tr>
							</table>
							</td>
						</tr>
						<tr>
							<td>&nbsp;</td>
						</tr>
					</table>
					</td>
				</tr>
			</table>
			</td>
		</tr>
	</html-el:form>
</table>
