simplescheduleform1.jsp

来自「Java的框架」· JSP 代码 · 共 518 行 · 第 1/2 页

JSP
518
字号
<%@ include file="/common/taglibs.jsp"%>
<%@ page import="java.util.Calendar" %>


<c:choose>
	<c:when test="${param.method == 'edit'}">
		<c:set var="title"><fmt:message key="editSimpleSchedule.title"/></c:set>
		<c:set var="heading"><fmt:message key="editSimpleSchedule.heading"/></c:set>
		<c:set var="message"><fmt:message key="editSimpleSchedule.message"/></c:set>
	</c:when>
	<c:otherwise>
		<c:set var="title"><fmt:message key="addSimpleSchedule.title"/></c:set>
		<c:set var="heading"><fmt:message key="addSimpleSchedule.heading"/></c:set>
		<c:set var="message"><fmt:message key="addSimpleSchedule.message"/></c:set>
	</c:otherwise>
</c:choose>
<c:set var="dateformat"><fmt:message key="date.format"/></c:set>
<html>
	<head>
		<title><c:out value="${title}"/></title>
		<content tag="heading">
			<c:out value="${heading}"/>
			</content>
    <script type="text/javascript" src="<c:url value='/scripts/selectbox.js'/>"></script>
	</head>
	<script type="text/javascript" src="<c:url value='/scripts/popupcalendar/popUpCal.js'/>"></script>
	<script type="text/javascript">
		pUCImgDir =  "<c:url value="/scripts/popupcalendar/" />";
		drawPopUpCalendar ();

		var oriEndTime = "<fmt:formatDate value="${simpleSchedule.endTime}" pattern="${dateformat}"/>";
		var oriRepeatCount = "<c:out value="${simpleSchedule.repeatCount}" />";
		var ori_RepeatInterval = "<c:out value="${_repeatInterval}" />";
		var ori_RepeatIntervalMeasurement = "<c:out value="${_repeatIntervalMeasurement}" />";
		
		function updateJobNameAndGrp(ctl){
			var str=ctl.value.split("[dot]");		
			document.forms[0].elements.jobGroup.value = str[0];
			document.forms[0].elements.job.value = str[1];
		}
		
		function updateRepeatCount(ctl){
			document.forms[0].elements.repeatCount.value = ctl.value;
		}
		
		function updateInterval(){
			if (validateRepeatInterval()){
				var repeatInterval;
				var intervalVal = document.forms[0].elements._repeatInterval.value;
				var intervalMeasurement = parseInt(document.forms[0].elements._repeatIntervalMeasurement.value);
				if (intervalMeasurement == 0){
					repeatInterval = intervalVal;
				}else if (intervalMeasurement == 1){
					repeatInterval = intervalVal * 1000;
				}else if (intervalMeasurement == 2){
					repeatInterval = intervalVal * 1000 * 60;
				}else if (intervalMeasurement == 3){
					repeatInterval = intervalVal * 1000 * 60 * 60;
				}else if (intervalMeasurement == 4){
					repeatInterval = intervalVal * 1000 * 60 * 60 * 24;
				}		
				document.forms[0].elements.repeatInterval.value = repeatInterval;
			}
		}
		
		function validateRepeatInterval(){
			if (document.forms[0].elements.repeatOption[0].checked) return true;
			var intervalVal = document.forms[0].elements._repeatInterval.value;
			if (!IsNumeric(intervalVal)){
				alert("Repeat Interval has to be a numeric value");
				document.forms[0].elements._repeatInterval.focus();
				return false;
			}
			var intervalMeasurement = parseInt(document.forms[0].elements._repeatIntervalMeasurement.value);
			if (intervalMeasurement == 0){
				if (intervalVal < 1 || intervalVal > 1000){
					alert("Please input only values ranging from 1-999");
					return false; 
				}
			}else if (intervalMeasurement == 1){
				if (intervalVal < 1 || intervalVal > 60){
					alert("Please input only values ranging from 1-59");
					return false;
				}
			}else if (intervalMeasurement == 2){
				if (intervalVal < 1 || intervalVal > 60){
					alert("Please input only values ranging from 1-59");
					return false;
				}
			}else if (intervalMeasurement == 3){
				if (intervalVal < 1 || intervalVal > 24){
					alert("Please input only values ranging from 1-23");
					return false;
				}
			}else if (intervalMeasurement == 4){
				if (intervalVal < 1 || intervalVal > 101){
					alert("Please input only values ranging from 1-100");
					return false;
				}
			}	
			return true;
		}
		
		function jobGrpSelectChange(ctl){
			if (ctl.value == "<new>"){
				document.forms[0].elements.jobGroupText.style.display = "inline";
				document.forms[0].elements.jobGroupText.focus();
			}else{
				document.forms[0].elements.jobGroupText.style.display = "none";
				document.forms[0].elements.jobGroup.value = ctl.value;
			}
		}
			
		function jobGrpTextChange(ctl){
			document.forms[0].elements.jobGroup.value = ctl.value;
		}

		function scheduleGrpSelectChange(ctl){
			if (ctl.value == "<new>"){
				document.forms[0].elements.groupText.style.display = "inline";
				document.forms[0].elements.groupText.focus();
			}else{
				document.forms[0].elements.groupText.style.display = "none";
				document.forms[0].elements.group.value = ctl.value;
			}
		}
			
		function scheduleGrpTextChange(ctl){
			document.forms[0].elements.group.value = ctl.value;
		}

	</script>
 	<body>
		<c:choose>
 			<c:when test="${param.method == 'edit' && !empty simpleSchedule && empty simpleSchedule.name}">
		    <div class="error">	
					<img src="<c:url value="/images/iconWarning.gif"/>"
               alt="<fmt:message key="icon.warning"/>" class="icon" />
          <fmt:message key="errors.schedule.notfound">
					 	<fmt:param value="${param.scheduleName}"/>
					 	<fmt:param value="${param.groupName}"/>
					 	<fmt:param value="${param.jobName}"/>
					 	<fmt:param value="${param.jobGroupName}"/>
					</fmt:message><br>
		    </div>
		    
				<c:choose>
		 			<c:when test="${!empty param.from}">
				  	<c:url var="backUrl" value="/schedules.action"/>
					</c:when>
					<c:otherwise>
				  	<c:url var="backUrl" value="/job.action">
							<c:param name="from" value="list"/>
							<c:param name="jobName" value="${param.jobName}"/>
				  		<c:param name="groupName" value="${param.jobGroupName}"/>
						</c:url>   
					</c:otherwise>
				</c:choose>
				<a href="<c:out value="${backUrl}"/>">&#171; Back</a>
 			</c:when>
 			<c:otherwise>
				<span id="message"><c:out value="${message}"/></span>
				<div class="separator"></div>
				<spring:bind path="simpleSchedule.*">
				    <c:if test="${not empty status.errorMessages}">
				    <div class="error">	
				        <c:forEach var="error" items="${status.errorMessages}">
				            <img src="<c:url value="/images/iconWarning.gif"/>"
				                alt="<fmt:message key="icon.warning"/>" class="icon" />
				            <c:out value="${error}" escapeXml="false"/><br />
				        </c:forEach>
				    </div>
				    </c:if>
				</spring:bind>
				<c:set var="pageButtons">
					<tr>
						<td width="20%" valign="top">&nbsp;
						</td>
						<td class="buttonBar" width="80%" valign="top">
				      <input type="submit" class="button" name="_target1" onclick="bCancel=false" value="<fmt:message key="button.next"/>" />		
			   			<input type="submit" class="button" name="_cancel" onclick="bCancel=true" value="<fmt:message key="button.cancel"/>" />
						</td>
					</tr>
				</c:set>
				<form method="post" action="<c:url value="/simpleScheduleForm.action"/>" id="simpleScheduleForm" name="simpleScheduleForm" onsubmit="return onFormSubmit(this)">
					<c:choose>
						<c:when test="${!empty param.method}">
							<input type="hidden" name="method" value="<c:out value="${param.method}"/>" />
						</c:when>
						<c:otherwise>
							<input type="hidden" name="method" value="add" />
				  	</c:otherwise>
				  </c:choose>
					<input type="hidden" name="from" value="<c:out value="${param.from}"/>" />
					<input type="hidden" name="jobName" value="<c:out value="${param.jobName}"/>" />			
					<input type="hidden" name="jobGroupName" value="<c:out value="${param.jobGroupName}"/>" />			
					<input type="hidden" name="scheduleName" value="<c:out value="${param.scheduleName}"/>" />			
					<input type="hidden" name="groupName" value="<c:out value="${param.groupName}"/>" />			
					<table class="detail">
						<!-- If param is empty, its is routed from schedules.action, entry for job name and group has to be added -->
						<c:choose>
							<c:when test="${empty param.jobName && empty param.jobGroupName}">
								<tr>
							  	<th width="15%">
							  		<b>* <fmt:message key="job.fullname"/></b>
							   	</th>
									<td width="75%">
										<select id="jobNameAndGrp" name="jobNameAndGrp" 
											onchange="javascript:updateJobNameAndGrp(this);">
											<c:forEach var="j" items="${jobList}">
												<c:set var="objectText">
													<c:out value="${simpleSchedule.jobGroup}"/>.<c:out value="${simpleSchedule.job}"/>
												</c:set>		  		
												<c:set var="optionText">
													<c:out value="${j.group}"/>.<c:out value="${j.name}"/>
												</c:set>		  		
												<c:set var="optionValue">
													<c:out value="${j.group}"/>[dot]<c:out value="${j.name}"/>
												</c:set>		  		
									  		<option name="<c:out value="${optionText}"/>" 
									  			value="<c:out value="${optionValue}"/>"
									  			<c:if test="${optionText==objectText}">
									  				selected
									  			</c:if> >				  		 
									  			<c:out value="${optionText}"/>
							      		</option>
									  	</c:forEach>
											<c:if test="${objectText == '.'}">
							      		<option name="." value="" selected>
							      		</option>
											</c:if>
									  </select>
										<spring:bind path="simpleSchedule.jobGroup">
											<input type="text" id="<c:out value="${status.expression}"/>" 
												name="<c:out value="${status.expression}"/>" 
									  		value="<c:out value="${status.value}"/>" style="visibility:hidden">
										</spring:bind> 
										<spring:bind path="simpleSchedule.job">
											<input type="text" id="<c:out value="${status.expression}"/>" 
												name="<c:out value="${status.expression}"/>" 
									  		value="<c:out value="${status.value}"/>" style="visibility:hidden">
										</spring:bind> 
									</td>					
								</tr>
							</c:when>
							<c:otherwise>
							<!-- Otherwise if it is routed from job page, job name and job group will be assigned -->
								<tr>
							  	<th width="15%">
							   		<mcaps:label key="simpleSchedule.jobGroup"/>
							   	</th>
									<td width="75%">
										<spring:bind path="simpleSchedule.jobGroup">
											<input type="hidden" id="<c:out value="${status.expression}"/>" 
												name="<c:out value="${status.expression}"/>" 
									  		value="<c:out value="${status.value}"/>">
											<c:out value="${status.value}"/>
										</spring:bind> 
									</td>					

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?