<%@ page contentType="text/html;charset=gbk" %>
<%@ page import="java.util.*" %>
<%@ page import="net.sz600.basicdata.*" %>
<%@ page import="net.sz600.tool.SzConvert" %>
<%@ page import="net.sz600.tool.SzDateHelp" %>
<%@ page import="net.sz600.system.*" %>
<%@ page import="net.sz600.formEngine.*" %>
<%@ page import="net.sz600.formEngine2.*" %>
<%@ page import="net.sz600.formCreate.*" %>
<%@ include file="/xml/formEngine2/sessionInfo2.jsp"%>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<link href="<%=strSkin_SESSION%>/css2007.css" rel="stylesheet" type="text/css">
</head>
<%
    //获取提交的参数
    String name = SzConvert.toSpaceStr(request.getParameter("name"));
    String readonly = "";
    String sOPERATOR = SzConvert.toSpaceStr(request.getParameter("OPERATOR"));
	  String moduleName = SzConvert.toSpaceStr(request.getParameter("moduleName"));
	  String formName = SzConvert.toSpaceStr(request.getParameter("formName"));
	  BdViewRelate bdViewRelate = new BdViewRelate();
    String str[] = bdViewRelate.getInfo(name);
    
		if (sOPERATOR.equals("add")) {
			str[1] = moduleName;
			str[2] = formName;
		} else if (sOPERATOR.equals("update")) {
			moduleName = str[1];
			formName = str[2];
		}
   	
%>
<body>

<!-----上面的工具栏------>
<form name="formUpdate" method="post">
  <input type="hidden" name="OPERATOR" value="<%=sOPERATOR%>">
<input type="hidden" name="moduleName1" value="<%=moduleName%>">
<input type="hidden" name="formName1" value="<%=formName%>">

<%@ include file="/xml/formEngine2/title.jsp"%>
<table width="100%">
  <tr>
    <td>
      <%=SzPageHelp.saveButton()%>
      <%=SzPageHelp.backButton()%>
    </td>
  </tr>
</table>

<!-----信息维护------>
<table width="750" border="1" bordercolorlight="#C0C0C0" bordercolordark="#FFFFFF" class="tableClass" cellpadding="3" cellspacing="0">
  <tr>
    <td class="tdClassTitle">名称</td>
    <td colspan="3"><input type="text" name="name" value="<%=str[0]%>" size="10" <%if (sOPERATOR.equals("update")){%> readonly class="txtClass1R"<%}else {%>class="txtClass1"<%} %>><font color="red">*</font>(可用字母、数字、下划线的组合，10个字以内) </td>
  </tr>
  <tr>
    <td class="tdClassTitle">说明</td>
    <td colspan="3"><input type="text" name="desc" class="txtClass1" value="<%=str[3]%>">(建议6个字以内)</td>
  </tr>  
  <tr>
    <td class="tdClassTitle"><a href="#" onClick="javascript:SelectWin('field', 'formUpdate.field', '', 'formUpdate.moduleName', 'formUpdate.formName');">(主)字段<img src="<%=strLevel_SESSION%>images/share2/select.gif" border="0" ></td>
    <td><input type="text" name="field" class="txtClass1R" value="<%=str[4]%>"  readonly><font color="red">*</font></td>    
    <td align="right"><a href="#" onClick="javascript:SelectWin('field','formUpdate.field2', '', 'formUpdate.moduleName2', 'formUpdate.formName2');">关联字段<img src="<%=strLevel_SESSION%>images/share2/select.gif" border="0" ></td>
    <td><input type="text" name="field2" class="txtClass1R" value="<%=str[7]%>" readonly><font color="red">*</font></td>
  </tr>     
  <tr>
    <td class="tdClassTitle">(主)模块名称</td>
    <td><input type="text" name="moduleName" class="txtClass1R" value="<%=str[1]%>"  readonly></td>
    <td  align="right">(主)表单名称</td>
    <td><input type="text" name="formName" class="txtClass1R" value="<%=str[2]%>"  readonly></td>
  </tr>
  <tr>
    <td class="tdClassTitle">关联模块</td>
    <td><input type="text" name="moduleName2" class="txtClass1R" value="<%=str[5]%>"  readonly></td>
    <td  align="right">关联表单</td>
    <td><input type="text" name="formName2" class="txtClass1R" value="<%=str[6]%>"  readonly></td>
  </tr>
  <tr>
  </tr>       

</table>

</form>

<!-----这里包含要提交的内容--->
<form name="formHidden" method="post">
</form>
<script language="javascript" src="../../../share/js/commonTool.js"></script>
<script language="javascript" src="../../../share/js/selectTool.js"></script>
<script language="javascript">

  function FormSave(formName, url) {
    if (!notSpace(formName.name, "名称")) {
      return false;
    }  
    if (!notSpace(formName.desc, "说明")) {
      return false;
    }      
    if (!notSpace(formName.field, "(主)字段")) {
      return false;
    } 
    if (!notSpace(formName.field2, "关联字段")) {
      return false;
    }            
    SelectAllOption(formName.field);
    SelectAllOption(formName.field2);    
    formName.action = "control.jsp";
    formName.submit();
  }
 
   function SelectWin(vType,  vObject, vTableObject, vModuleNameObject, vFormNameObject) {

    var moduleName1 = formUpdate.moduleName1.value;
    var formName1 = formUpdate.formName1.value;
    var moduleName2 = formUpdate.moduleName2.value;
    var formName2 = formUpdate.formName2.value;    
    
    var url = "../field_select.jsp?type=" + vType + "&object=" + vObject + "&tableobject=" + vTableObject
            + "&moduleName1=" + moduleName1 + "&formName1=" + formName1
            + "&moduleName2=" + moduleName2 + "&formName2=" + formName2
            + "&moduleNameObject=" + vModuleNameObject + "&formNameObject=" + vFormNameObject;
    window.showModalDialog(url,window,"status=no;dialogWidth=300px;dialogHeight=370px");  
  } 

</script>
</body>
