<%@ page contentType="text/html;charset=gbk" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="net.sz600.tool.SzConvert" %>
<%@ page import="net.sz600.system.SzPageHelp" %>
<%@ page import="net.sz600.system.SzOut" %>
<%@ page import="net.sz600.system.SzProperties" %>
<%@ page import="net.sz600.drivingSchool.*" %>
<%
    //获取提交的参数
    String sPage = SzConvert.toZeroStr(request.getParameter("page"));
    String sSearch = SzConvert.strWriteData(request.getParameter("txtSearch"));
    String sPKEY = SzConvert.toZeroStr(request.getParameter("PKEY"));
    String sSubjectOrder = SzConvert.strWriteData(request.getParameter("subjectOrder"));	 //科目
%>
<form name="formHidden" method="post">
  <input type="hidden" name="page" value="<%=sPage%>">
  <input type="hidden" name="txtSearch" value="<%=sSearch%>">
  <input type="hidden" name="PKEY" value="<%=sPKEY%>">
</form>
<%
    String sOPERATOR = SzConvert.toSpaceStr(request.getParameter("OPERATOR"));
    ToSetUpCourse toSetUpCourse = new ToSetUpCourse();
    boolean flag = false;
    String sUrl = "index.jsp?subjectOrder=" + sSubjectOrder;
    String sMessage = "";
    if (sOPERATOR.equals("delete")) {
    	sUrl = "courseList.jsp?subjectOrder=" + sSubjectOrder;
        String id_str[] = request.getParameterValues("chkId");
        flag = toSetUpCourse.delete(id_str);
    } else {
        if (sOPERATOR.equals("add") || sOPERATOR.equals("update")) {
        	flag = toSetUpCourse.control(request,session);
        } else if (sOPERATOR.equals("addFD")){
        	flag = toSetUpCourse.controlFD(request,session);
        }
    }
    sMessage = SzOut.getMessage();

    if (flag) {
        out.println(SzPageHelp.jsAlert("操作成功"));
        //out.println(SzPageHelp.jsGoUrl(sUrl));
        //out.println(SzPageHelp.jsFormSubmit("formHidden",sUrl));
        %>
        <script language='javascript'>
        	var oWindow = window.dialogArguments;
        	//oWindow.document.location.href="index.jsp";
        	//oWindow.document.URL = oWindow.document.location.href;	//可以刷新,但是没有参数 
        	oWindow.document.getElementById("btnSearch").click();
					window.close();		
				</script>        		
        	<%            
    } else {
        out.println(SzPageHelp.jsAlertBack(sMessage));
    }
%>