<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="java.util.*" %>
<%@ page import="net.sz600.basicdata.*" %>
<%@ page import="net.sz600.tool.SzConvert" %>
<%@ page import="net.sz600.database.SzPageInfo" %>
<%@ page import="net.sz600.system.SzProperties" %>
<%@ page import="net.sz600.system.SzPageHelp" %>
<%@ page import="net.sz600.formEngine2.*" %>
<%@ page import="net.sz600.formEngine.*" %>
<%@ page import="net.sz600.formCreate.*" %>
<%@ include file="sessionInfo2.jsp"%>
<html>
<head>
<BASE target=_self>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="<%=strSkin_SESSION%>/css2007.css" rel="stylesheet" type="text/css">
</head>
<body>
<%
	String moduleNameObject = SzConvert.toSpaceStr(request.getParameter("moduleNameObject"));
	String formNameObject = SzConvert.toSpaceStr(request.getParameter("formNameObject"));
	
	String moduleName = SzConvert.strWriteData(request.getParameter("moduleName"));
  String formName = SzConvert.strWriteData(request.getParameter("formName"));

    BdForm bdForm = new BdForm();
    String XML_str[] = bdForm.getXMLModuleList();    
    //根据moduleName获取响应的表单信息
    
    BdModule bdModule = new BdModule();	  
	  ArrayList list = bdModule.getModuleList();
	  String str_module[] = null;
	    
		String cate_pro = SzConvert.strWriteData(request.getParameter("cate_pro") );
		String cate_fun = SzConvert.strWriteData(request.getParameter("cate_fun") );	 
    
%>    
<table width="100%">
  <form name="formUpdate" method="post" action="form_select.jsp">
  <input type="hidden" name="moduleNameObject" value="<%=moduleNameObject%>">
  <input type="hidden" name="formNameObject" value="<%=formNameObject%>">
    <input type="hidden" name="navigator" value="<%=sNavigator_SESSION%>" >
  <tr>
    <td width="80">按行业分类</td>
    <td>
    	<%
    		BdCategory bdCategory = new BdCategory();
    		ArrayList listCategory = bdCategory.getProfessionList();
    		String s_name[] = new String[listCategory.size()];
    		listCategory.toArray(s_name);
    		out.println(SzPageHelp.idSelectArrayFunc(s_name, s_name, "cate_pro", cate_pro, "txtClass200", "this.form.submit()"));
    		//out.println(SzPageHelp.selectArrayFunc(listCategory, 0, 0,"cate_pro", cate_pro, "txtClass2", ""));
    	%>    
    </td>
  </tr> 
    <td width="80">按功能分类</td>
    <td>
    	<%    		
    		listCategory = bdCategory.getFunctionList();
      	s_name = new String[listCategory.size()];
    		listCategory.toArray(s_name);
    		out.println(SzPageHelp.idSelectArrayFunc(s_name, s_name, "cate_fun", cate_fun, "txtClass200", "this.form.submit()"));
    		//out.println(SzPageHelp.selectArrayFunc(listCategory, 0, 0,"cate_pro", cate_pro, "txtClass2", ""));
    	%>      
    </td>
  </tr>       
  <tr>
    <td width="80">选择模块</td>
    <td>
    	<%    		
    		out.println(SzPageHelp.selectArrayFunc(list, 0, 0,1,8,"moduleName", moduleName, "txtClass200","simpleform.xml", 5, cate_pro,6, cate_fun, "this.form.submit()"));
    	%>     
    </td>
  </tr>    
  <tr>
    <td>选择表单</td>
    <td><select name="formName" style="width:200;" onChange="this.form.submit();">
    <option value="">===请选择===</option>
<%
    //根据
    Iterator iterForm = null;
    String sFormName = "";
    BdFormInfo bdFormInfo = null;      
    if (!moduleName.equals("")) {
    	iterForm = bdForm.getFormInfoList(moduleName).iterator();
    }
    while (iterForm != null && iterForm.hasNext()) {
      	bdFormInfo = (BdFormInfo)iterForm.next();        
      	sFormName = bdFormInfo.getFormName();    	  
%>
	<option value="<%=sFormName%>" <%if(formName.equals(sFormName)) {%>selected<%}%> ><%=bdFormInfo.getFormDesc()%></option>
<%    	  
    }
%></select>
	</td>
  </tr>
  <tr>
    <td colspan="2" align="center"  class="trClassTitle">                        
      <input type="button" value="确定" class="btnClass" OnClick="Ok();">
      <input type="button" value="关闭" class="btnClass" OnClick="window.close();">
    </td>  
  </tr>    
  </form>
</table>
</body>
</html>
<script language="javascript">
  function Ok() {
	var vModuleNameObject = formUpdate.moduleNameObject.value;
	var vFormNameObject = formUpdate.formNameObject.value;
	
	var navigator = formUpdate.navigator.value;
	

	//var oWindow = window.dialogArguments;
	var oWindow = null;

	if (navigator == "MSIE") {
	  oWindow = window.dialogArguments;
	} else {
	  oWindow = window.opener;
	}
	//把表单名称，模块名称也填写过去。
	if (vModuleNameObject != "" && vModuleNameObject != "undefined" ) {
		eval("oWindow." + vModuleNameObject + ".value='" + formUpdate.moduleName.value + "';");
  	}	
	if (vFormNameObject != "" && vFormNameObject != "undefined" ) {
		eval("oWindow." + vFormNameObject + ".value='" + formUpdate.formName.value + "';");
  	}	  
	window.close();
  }
</script>

