All Downloads are FREE. Search and download functionalities are using the official Maven repository.

static.scripts.course.EcuplElectCourse.js Maven / Gradle / Ivy

There is a newer version: 0.41.3
Show newest version
    //视图
    var divs =[];
    divs[0]="courseTableDIV";
    divs[1]="teachclassDIV";
    divs[2]="courseListDIV";
    divs[3]="electRefereClassDIV";
    var viewNum=divs.length;
    //消息
    var errors={};
    errors.notOpen="没有开放选课";
    errors.noSuitableDate="不在选课开放时间";
    errors.needEvaluation="本次选课要求评教完成,你还没有完成。";
    errors.creditOvered="你已经到达学分上限";
    errors.stdCountOvered="该课程到达选课人数上限";
    errors.timeConfilict="该课程与你的课程安排有冲突";
    errors.notCancelable="该课程不允许退课";
    errors.underMinCount="低于人数下限,不允许退课";
    errors.notInScope="你不在该课程允许的选课范围内";
    errors.reStudiedNotAllowed="本轮选课不允许重修";
    errors.HSKNotSatisfied="HSK级别不足";
    errors.languageAbilityNotSatisfied="语言等级不匹配";
    errors.prerequisteCoursesNotMeeted="先修课程没有完成";
    errors.reStudyPassedCourseNotAllowed="这门课程你已经通过,无须重修";
    errors.reElected="重复选课";
    errors.reStudyElected="重修选课";
    var reStudy="3";
    var elective="2";
    var reExam="4";
    var electSuccessMsg="选课成功";
    var cancelSuccessMsg="退课成功";
    var emptyPrompt="该时间你没有课程,可双击查看该时间学校开设的课程。";
    var waiting="请稍后...";
    var operationTip="在我的课程中退课,在课程列表进行选课";
    var myCourseListTable="myCourseListTable";
    //正在处理的教学任务
    var curTask=new TeachTask();
    var electState = new ElectState();
    var processingTask ={};
    var operation="add";
    //课程表页面显示的列
    var displayColums=[];
    displayColums[0]="id";
    displayColums[1]="seqNo";
    displayColums[2]="course.code";
    displayColums[3]="course.name";
    displayColums[4]="courseType.name";
    displayColums[5]="arrangeInfo.teachers";
    displayColums[6]="arrangeInfo.weekUnits";
    displayColums[7]="credit";
    displayColums[8]="requirement.teachLangType";
    displayColums[9]="requirement.isGuaPai";
    var hiddenDisplayColums=[];
    hiddenDisplayColums[0]="electInfo.minStdCount";
    hiddenDisplayColums[1]="electInfo.isCancelable";
    hiddenDisplayColums[2]="teachclass.stdCount";

    // 教学任务
     function TeachTask(){
       this.id="";
       this.seqNo="";
       this.course = {};
       this.course.code="";
       this.course.name="";
       this.credit=null;
       this.courseType = {};
       this.courseType.name = "";
       this.arrangeInfo={};
       this.arrangeInfo.teachers="";
       this.arrangeInfo.weekUnits="";
       this.arrangeInfo.weekStart=1;
       
       this.requirement={};
       this.requirement.isGuaPai="";
       this.requirement.teachLangType="";
       this.electInfo={};
       this.electInfo.maxStdCount=0;
       this.electInfo.minStdCount=0;
       this.electInfo.isCancelable=0;
       this.electInfo.HskLevel=0;
       this.electInfo.prerequisteCoursesIds="";
       
       this.teachclass={};
       this.teachclass.stdCount=0;
       this.table=null;
       this.scopes=null;
     }
     
    // 显示选课系统状态    
    function displayElectState(){
       var div= document.getElementById("electStateDIV");
       if(div.style.display=="block"){
            div.style.display="none";
       }else{
         div.style.display="block"
       }
    }
    function searchTeacher(){
       window.open("teacherSearch.do",'','');
    }
    function searchCourse(){
       window.open("courseSearch.do",'','');
    }
    function searchClassTable(){
       window.open("courseTableForStd.do?method=stdHome",'','');
    }
    function setMessage(msg){ 
       document.getElementById("message").innerHTML=""+msg+"";       
    }
    function setSuccessMessage(msg){
       document.getElementById("message").innerHTML=""+msg+"";
    }
     // 辅助函数
     function getProperty(object,attr){
       var attrs =attr.split(".");
       var i=0;
       var obj=object;
       while(istate.maxCreditLimited){
          return errors.creditOvered;
        }
        // 检查人数上限
        if(!state.params.isOverMaxAllowed){
           if(task.teachclass.stdCount+1>task.electInfo.maxStdCount){
              return errors.stdCountOvered;
           }
        }
        //检查是否重修选课
        if(null!=state.hisCourses[task.course.id]){
           if(state.params.isRestudyAllowed){
              	return  errors.reStudyElected;
           }
           else {
              return  errors.reStudiedNotAllowed;
           }
        }
        //检查重复选课
        if(state.electedCourseIds[task.course.id]==true){
           return errors.reElected;
        }

	    //检查选课范围
        var isCheckScope=true;
        if(null!=state.hisCourses[task.course.id]){
           isCheckScope=state.params.isCheckScopeForReSturdy;
        }
        if(isCheckScope){
	        var inscope=false;
	        for(var i=0;i=scope.startNo)&&(state.std.stdNo<=scope.endNo)) return "";
       }else{
         if(""!=scope.adminClassIds){
             //alert("scope.adminClassIds:"+scope.adminClassIds);
             for(var j=0;j"
		                     +"";
		        td.className="select";
		    }
		    else{
		       td.innerHTML=getProperty(curTask,displayColums[j]);
		    }
	        tr.appendChild(td);
	    }
	    var inputDiv = document.createElement('div');
	    for(var j=0;j0){
			    for(var i=0;i0){
  			    var activites =new Array();
  			    var find=false;
			    for(var i=0;i";
      }
    }
    
    //todo
    function canSubmitElection(){
       if(document.getElementById("message").innerHTML!=""
          &&document.getElementById("message").innerHTML==""+waiting+""){
           return false;
       }
       else{
           return true;
       }
    }
    document.getElementById("message").innerHTML=""+operationTip+"";
    
    function closeElectResult(){
       document.getElementById("electResultDIV").style.display="none";
    }
    function openElectResult(url){
       electResultFrame.location=url;
       document.getElementById("electResultDIV").style.display="block";
    }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy