static.scripts.common.SemesterSelect.js Maven / Gradle / Ivy
// 缺省值
var defaultSemesterValues=new Object();
// 页面上所有的三级级联选择
var calendarSelects= new Array();
// 当前的三级级联选择
var yearSelectQueue=new Array();
var termSelectQueue=new Array();
var originalOnChanges=new Array();
var selectInited=new Object();
// 初始化校历选择框
function intCalendarSelect(calendars){
if(null==selectInited[this.calendarSelectId]){
selectInited[this.calendarSelectId]=true;
}else{
return;
}
if( null==document.getElementById(this.calendarSelectId)) return;
defaultSemesterValues[this.calendarSelectId]=document.getElementById(this.calendarSelectId).value;
dwr.util.removeAllOptions(this.calendarSelectId);
if(this.calendarDefaultFirst){
dwr.util.addOptions(this.calendarSelectId,calendars,'id','name');
if(this.calendarNullable){
dwr.util.addOptions(this.calendarSelectId,[{'id':'','name':'...'}],'id','name');
}
}else{
if(this.calendarNullable){
dwr.util.addOptions(this.calendarSelectId,[{'id':'','name':'...'}],'id','name');
}
dwr.util.addOptions(this.calendarSelectId,calendars,'id','name');
}
// 让非空的学生类别作为默认
if(""!=defaultSemesterValues[this.calendarSelectId])
setSelected(document.getElementById(this.calendarSelectId),defaultSemesterValues[this.calendarSelectId]);
var selfOnchange =document.getElementById(this.calendarSelectId).onchange;
document.getElementById(this.calendarSelectId).onchange=function (event){
if(event==null)
event=getEvent();
notifyYearChange(event);
if(selfOnchange!=null)
selfOnchange();
}
}
// 初始化学年度选择框
function initYearSelect(){
dwr.util.removeAllOptions(this.yearId);
var std= document.getElementById(this.calendarSelectId);
if(std.value!=""){
yearSelectQueue.push(this);
semesterDao.getYearsOrderByDistance(std.value,setYearOptions);
}
var originalOnChange=document.getElementById(this.yearId).onchange;
if(null==originalOnChange){
document.getElementById(this.yearId).onchange=function(event){notifyTermChange(event,null);}
}else{
originalOnChanges[originalOnChanges.length]=originalOnChange;
document.getElementById(this.yearId).onchange=
//function(event){alert(1);notifyTermChange(event,null);originalOnChanges[(originalOnChanges.length-1)]();}
new Function("event","notifyTermChange(event,null);originalOnChanges["+(originalOnChanges.length-1)+"]();");
}
}
// 通知学年度变化,填充学年度选择列表
function notifyYearChange(event){
if(event==null)return;
//alert("event in notifyYearChange"+event);
yearCalendarSelects = getMyCalendarSelects(getEventTarget(event).id);
//alert(yearCalendarSelects.length);
for(var i=0;i
© 2015 - 2025 Weber Informatics LLC | Privacy Policy