<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
	  
<logic:notEmpty name="JobDefinitionEditForm" property="name">
	<h1><bean:message key="prompt.jobDefinitionEditForm.title1"/></h1>
</logic:notEmpty>	
<logic:empty name="JobDefinitionEditForm" property="name">
	<h1><bean:message key="prompt.jobDefinitionEditForm.title2"/></h1>
</logic:empty>
<logic:messagesPresent>
	<ul>
	<bean:message key="errors.header"/>
	<html:messages id="error">
		<li><bean:write name="error"/></li>
	</html:messages>
	</ul>
	<hr>
</logic:messagesPresent>

<html:form action="/scheduler/jobDefinitionEditAction" focus="name" onsubmit="return validateJobDefinitionEditForm(this);">

<div id="EDITTAG" align="left">

    <table width="100%">
    	<tr>
			<td class="title"><bean:message key="prompt.jobDefinitionEditForm.jobName"/></strong><img src="images/4_dot.gif"/></td>
			<td>
				<html:text styleClass="inputtext" name="JobDefinitionEditForm" property="name"  size="60" maxlength="32"/>
			</td>
		</tr>
		<tr>
			<td class="title"><bean:message key="prompt.jobDefinitionEditForm.className"/></strong><img src="images/4_dot.gif"/></td>
			<td>
				<html:text styleClass="inputtext" name="JobDefinitionEditForm" property="className"  size="60"/>
			</td>
		</tr>
		<tr>
			<td class="title"><bean:message key="prompt.jobDefinitionEditForm.jobDescription"/></strong><img src="images/4_dot.gif"/></td>
			<td>
				<html:textarea styleClass="inputtext" name="JobDefinitionEditForm" property="description" rows="5" cols="60"/>
			</td>
		</tr>
	</table>
</div>

<div id="COMMANDTAG">
    <table width="100%">
      <tr>
        <td height="50" width="5%">
			&nbsp;
        </td>
        <td align="center" width="20%">
　　      <html:submit styleClass="button" property="submit" onclick="bCancel=false;">&nbsp;&nbsp;&nbsp;&nbsp;<bean:message key="prompt.scheduler.ok"/>&nbsp;&nbsp;&nbsp;&nbsp;</html:submit>
        </td>
        <td align="center" width="20%">
　　      <html:cancel styleClass="button" onclick="bCancel=true;"><bean:message key="prompt.scheduler.cancel"/></html:cancel>
		</td>
        <td align="center" width="20%">
　　　    <html:reset styleClass="button">&nbsp;&nbsp;<bean:message key="prompt.scheduler.reset"/>&nbsp;&nbsp;</html:reset>
        </td>
        <td height="50">
			&nbsp;
        </td>
      </tr>
    </table>
</div>
</html:form>

<div id="DISPLAYTAG">
	<logic:notEmpty name="JobDefinitionEditForm" property="name">
		<h2><bean:message key="prompt.jobDefinitionEditForm.parameter"/></h2>
        <html:form action="/scheduler/parameterAddAction">
			<table width="100%">
			  <thead>
				<tr>
					<th width="20%"><bean:message key="prompt.jobDefinitionEditForm.parameterName"/></th>
					<th width="50%"><bean:message key="prompt.jobDefinitionEditForm.parameterDescription"/></th>
					<th width="10%" align="center"><bean:message key="prompt.jobDefinitionEditForm.parameterRequired"/></th>
					<th align="center">&nbsp;</th>
				</tr>
			  </thead>
			  <tbody>	
				<tr class="odd">
					<td>
						<html:hidden name="JobDefinitionEditForm" property="name"/>
						<html:hidden name="JobDefinitionEditForm" property="className"/>
						<html:hidden name="JobDefinitionEditForm" property="description"/>
						<html:text name="JobDefinitionEditForm" property="parameterName" size="20" maxlength="32"/></td>
					<td><html:text name="JobDefinitionEditForm" property="parameterDescription" size="60"/></td>
					<td align="center"><html:checkbox name="JobDefinitionEditForm" property="required"/>
					</td>
					<td align="center">
					    <html:submit property="cmdAddParameter" onclick="bCancel=false;"><bean:message key="prompt.jobDefinitionEditForm.addParameter"/></html:submit>
					</td>
				</tr>
				<logic:iterate id="parameter" name="JobDefinitionEditForm" property="parameters">
				    <tr class="even">
				    	<td><bean:write name="parameter" property="name"/></td>
				    	<td><bean:write name="parameter" property="description"/></td>
				    	<td align="center"><bean:write name="parameter" property="required"/>
				    	</td>
				    	<td align="center">
				    		<a href="parameterRemove.do?name=<bean:write name="JobDefinitionEditForm" property="name"/>&parameterName=<bean:write name="parameter" property="name"/>"><bean:message key="prompt.jobDefinitionEditForm.deleteParameter"/></a>
				    	</td>
				   	
				    </tr>
				</logic:iterate>
			  </tbody>
			</table>
		</html:form>
	</logic:notEmpty>

</div>
<html:javascript formName="jobDefinitionEditForm"/>
