advancedscheduleform2.jsp
来自「Java的框架」· JSP 代码 · 共 371 行 · 第 1/2 页
JSP
371 行
<%@ include file="/common/taglibs.jsp"%>
<%@ page import="java.util.Calendar" %>
<c:if test="${param.method == 'add'}">
<c:set var="title"><fmt:message key="addAdvancedSchedule.title"/></c:set>
<c:set var="heading"><fmt:message key="addAdvancedSchedule.heading"/></c:set>
<c:set var="message"><fmt:message key="addAdvancedSchedulePattern.message"/></c:set>
</c:if>
<c:if test="${param.method == 'edit'}">
<c:set var="title"><fmt:message key="editAdvancedSchedule.title"/></c:set>
<c:set var="heading"><fmt:message key="editAdvancedSchedule.heading"/></c:set>
<c:set var="message"><fmt:message key="editAdvancedSchedulePattern.message"/></c:set>
</c:if>
<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">
var oriEndTime = "<fmt:formatDate value="${advancedSchedule.endTime}" pattern="${dateformat}"/>";
// var oriAtTime = "<fmt:formatDate value="${advancedSchedule.endTime}" pattern="${dateformat}"/>";
// var oriFromTime = "<fmt:formatDate value="${advancedSchedule.endTime}" pattern="${dateformat}"/>";
// var oriTillTime = "<fmt:formatDate value="${advancedSchedule.endTime}" pattern="${dateformat}"/>";
//Copy the end time script to var for re-assignment of script when end time option is selected
</script>
<script type="text/javascript">
var gIsInit;
var gDoUpdate;
pUCImgDir = "<c:url value="/scripts/popupcalendar/" />";
drawPopUpCalendar ();
//Show the div based on the schedule pattern selected
//For first time, the default will be used if it is an add operation
//and the cron expression value will be populated if it is an edit operation
//gIsInit is set to true when the page was loaded the first time, navigation
//back and forth to this page that causes the page to be reloaded also considered
//as first time loading.
function show(i){
//If not gIsInit, always set the pattern choice to 0 (default)
//Reset the related controls and the temp values to default
if (!gIsInit){
document.forms[0].elements.tempPatternChoice.value = 0;
}
//Get the pattern choice to simulate a click on the pattern choice option button
//based on the pattern as denoted by i
var patternChoice = document.forms[0].elements.tempPatternChoice.value;
if (i == 0){
document.getElementById("main").innerHTML = dailyDiv;
document.forms[0].elements.dailyOption[patternChoice].click();
}else if (i == 1) {
document.getElementById("main").innerHTML = monthlyDiv;
document.forms[0].elements.monthlyOption[patternChoice].click();
}else if (i== 2) {
document.getElementById("main").innerHTML = yearlyDiv;
document.forms[0].elements.yearlyOption[patternChoice].click();
}
document.forms[0].elements.tempPattern.value = i;
//If not gIsInit, reset the related controls and the temp values to default
//This section of code shld not be moved up, because this has to be performed
//only after the particular div is loaded.
if (!gIsInit){
document.forms[0].elements.tempPatternChoice.value = 0;
if (i == 0){
resetDailyOptionVal(0);
resetDailyOptionCtls(0);
}
if (i == 1){
resetMonthlyOptionVal(0);
resetMonthlyOptionCtls(0);
}
if (i == 2){
resetYearlyOptionVal(0);
resetYearlyOptionCtls(0);
}
}
}
function isValidDayOfWeek(dow){
return (dow != null && dow.length > 0 && dow != "?" && dow != "*");
}
//Is called when any of the daily options is clicked
//Will set the value of the provided control(s) for the selected option to the temporary value
//The remaining value which are not provided in the form of control(s) will be set through the
//resetDailyOptionVal that will set it to the default value.
//The control(s) for unselected options will be resetted and disabled.
function dailyOptionClicked(ctl){
var val = ctl.value;
document.forms[0].elements.tempPatternChoice.value = val;
resetDailyOptionVal(val);
//If custom date option, get the day of week to set the check box
if (val == 3){
var dayOfWeek = document.forms[0].elements.tempDayOfWeekValue.value;
if (isValidDayOfWeek(dayOfWeek)){
if (dayOfWeek != "MON-FRI" && dayOfWeek != "SAT,SUN"){
var dayOfWeekAr = dayOfWeek.split(",");
var i;
for (i = 0; i < dayOfWeekAr.length; i++){
var dayOfWeekCtl = eval("document.forms[0].elements.dayOfWeek" + dayOfWeekAr[i]);
if (dayOfWeekCtl != null){
dayOfWeekCtl.checked = true;
}
}
}else{
//Set temp day of week to default value "?"
document.forms[0].elements.tempDayOfWeekValue.value = "?";
}
}else{
//Set temp day of week to default value "?"
document.forms[0].elements.tempDayOfWeekValue.value = "?";
}
}else{
}
resetDailyOptionCtls(val);
}
//Is called when any of the monthly options is clicked
//Will set the value of the provided control(s) for the selected option to the temporary value
//The remaining value which are not provided in the form of control(s) will be set through the
//resetMonthlyOptionVal that will set it to the default value.
//The control(s) for unselected options will be resetted and disabled.
function monthlyOptionClicked(ctl){
var val = ctl.value;
document.forms[0].elements.tempPatternChoice.value = val;
resetMonthlyOptionVal(val);
if (val == 0){
var dayOfMonth = document.forms[0].elements.tempDayOfMonthValue.value;
var index = 0;
if (dayOfMonth != null && dayOfMonth.length > 0 && dayOfMonth != "?" && dayOfMonth != "?"){
if (dayOfMonth > 0) index = dayOfMonth - 1;
document.forms[0].elements.dayOfMonth.options[index].selected = true;
}
}else{
var dayOfWeekVal = document.forms[0].elements.tempDayOfWeekValue.value;
if (isValidDayOfWeek(dayOfWeekVal)){
var dayOfWeek = dayOfWeekVal.substring(0,1);
var nthDayStr = dayOfWeekVal.substring(dayOfWeekVal.length-1);
if (nthDayStr == "L") nthDayStr = "5";
var nthDayIndex = nthDayStr - 1;
document.forms[0].elements.nthDay.options[nthDayIndex].selected = true;
document.forms[0].elements.dayOfWeek.options[dayOfWeek-1].selected = true;
}
}
resetMonthlyOptionCtls(val);
}
//Is called when any of the yearly options is clicked
//Will set the value of the provided control(s) for the selected option to the temporary value
//The remaining value which are not provided in the form of control(s) will be set through the
//resetYearlyOptionVal that will set it to the default value.
//The control(s) for unselected options will be resetted and disabled.
function yearlyOptionClicked(ctl){
var val = ctl.value;
document.forms[0].elements.tempPatternChoice.value = val;
resetYearlyOptionVal(val);
if (val == 0){
var dayOfMonth = document.forms[0].elements.tempDayOfMonthValue.value;
var month = document.forms[0].elements.tempMonthValue.value;
var index = 0;
if (dayOfMonth != null && dayOfMonth.length > 0 && dayOfMonth != "?" && dayOfMonth != "?"){
if (dayOfMonth > 0) index = dayOfMonth - 1;
document.forms[0].elements.dayOfMonth.options[index].selected = true;
}
index = 0;
if (month != null && month.length > 0 && month != "?" && month != "?"){
if (month > 0) index = month - 1;
document.forms[0].elements.monthOpt1.options[index].selected = true;
}
}else{
var dayOfWeekVal = document.forms[0].elements.tempDayOfWeekValue.value;
if (isValidDayOfWeek(dayOfWeekVal)){
var dayOfWeek = dayOfWeekVal.substring(0,1);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?