<%@ page contentType="text/html;charset=gbk" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.Collection" %>
<%@ 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.flow.*" %>
<%@ page import="net.sz600.online.*" %>
<%@ page import="net.sz600.formEngine2.*" %>
<%@ page import="net.sz600.formEngine.*" %>
<%@ page import="net.sz600.weboffice.*" %>
<%//@ page import="net.fckeditor.*"%>
<%//@ taglib uri="http://java.fckeditor.net" prefix="FCK" %>
<%@ include file="/sessionInfo.jsp"%>
<% 
  String strLevel = "../../"; 
%> 
<%
    //获取提交的参数
    String sType = SzConvert.toZeroStr(request.getParameter("type"));
    String sPage = SzConvert.toZeroStr(request.getParameter("page"));
    String sSearch = SzConvert.strWriteData(request.getParameter("txtSearch"));
    String sPKEY = SzConvert.toZeroStr(request.getParameter("PKEY"));
    String sOPERATOR = request.getParameter("OPERATOR");
    String sKEY =  SzConvert.toZeroStr(request.getParameter("KEY"));
    String from =  SzConvert.toZeroStr(request.getParameter("from"));
    String buttonid =  SzConvert.toZeroStr(request.getParameter("buttonid"));
    
    int iFormID = SzConvert.toInt(request.getParameter("FormID"));
    //取得表单的信息
    String moduleName = "";
    String formName = "";
		LcForm lcForm = new LcForm();
		LcFormInfo lcFormInfo = null;    
    if (iFormID == 0) {
    	moduleName = SzConvert.toSpaceStr(request.getParameter("moduleName"));
    	formName = SzConvert.toSpaceStr(request.getParameter("formName")); 
    	//
    	iFormID = lcForm.getKeyByCond(moduleName, formName); 
    } else {
    	lcFormInfo = (LcFormInfo)lcForm.getInfoByKey(iFormID);    
    	if (lcFormInfo != null) {
    		moduleName = lcFormInfo.getBDLJ();
    		formName = lcFormInfo.getBDBY1();  
    	}
    } 	
    //System.out.println("moduleName=" + moduleName);
    //System.out.println("formName=" + formName);
    if (moduleName.equals("") || formName.equals("")) {
    	out.println("还没有设置相关表单信息！");
    	return;
    }   
    
    //2010-2-21
    BdPopedom bdPopedom = new BdPopedom();        
    String strDenyField = bdPopedom.getDenyField(iFormID, 0, iDLID_SESSION);
    String strDenyField2 = bdPopedom.getDenyField(iFormID, SzConvert.toInt(sKEY), iDLID_SESSION);
    bdPopedom.read(iFormID, SzConvert.toInt(sKEY), iDLID_SESSION);
    
    BdFormControl bdFormControl = new BdFormControl();
    //取得关联的名称
    BdTrigger bdTrigger = new BdTrigger();
    String sTriggerName = bdFormControl.getTriggerName(moduleName, formName);    
  	//根据名称取得关联的条件控件
    //String sRelateObject = bdFormControl.getRelateObject(sTriggerName);    
    
    String sHTML = "";    
	BdValueControl bdValueControl = new BdValueControl(moduleName, formName);	
	sHTML = bdValueControl.getHTML();
	String sTable = bdValueControl.getTableName();
	String sFieldID = bdValueControl.getKeyField();
	
	//获取附件名
	String assistant = bdValueControl.getAssistant();
	String sTableAnnex = bdValueControl.getTableAnnex();
	String sEditor    = bdValueControl.getEditor();
	String sWeboffice = bdValueControl.getWebOffice();
	String sTemplateSelect = bdValueControl.getTemplateSelect();
	String printTemp = bdValueControl.getPrintTemp();
	String printTempRelate = bdValueControl.getPrintTempRelate();
	String allograph = bdValueControl.getAllograph();
	//System.out.println("allograph==" + allograph);
	
	boolean hasFlow   = bdValueControl.getHasFlow();
	boolean hasAnnex  = false;
	if (!sTableAnnex.equals("")) {
		hasAnnex = true;
	}
	
%>
<%
    SzData szData = null;
    SzDataInfo szDataInfo = null;

    String sReadonly = "";
    boolean bReadonly = false;
    if (sOPERATOR.startsWith("detail")) {
        sReadonly = "readonly";
        bReadonly = true;
    }
    if (sOPERATOR.equals("detailPass")) {
    	LcFlowControl.readPass(iFormID, iDLID_SESSION, Integer.parseInt(sKEY));
        sReadonly = "readonly";
        bReadonly = true;    	
    }
    //读取数据
		String value_str[] = null;
    if (!sKEY.equals("0")) {
    	value_str = (String[])bdValueControl.getInfoByKey(Integer.parseInt(sKEY));
    }
    String loginID2 = SzConvert.toSpaceStr(bdValueControl.getLoginID2(value_str));
    String loginName2 = SzConvert.toSpaceStr(bdValueControl.getLoginName2(value_str));
    String loginID = SzConvert.toSpaceStr(bdValueControl.getLoginID(value_str));
    if (loginID.equals("")) {
    	loginID = Integer.toString(iDLID_SESSION);
    }
    
%>
<%    
	boolean canModifyForm = false;;
	boolean canDraftSave = true;
  sReadonly = "readonly";
  bReadonly = true;    		
%>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<link href="<%=strSkin_SESSION%>/css2007.css" rel="stylesheet" type="text/css">
<body onload="javascript:this.focus();" >

<!-----上面的工具栏------>
<% if (hasAnnex) { %>
<form name="formUpdate" method="post" ENCTYPE="multipart/form-data">
<% } else { %>
<form name="formUpdate" method="post">
<% } %>
  <!---使用流程的时候需要使用--->
  <input type="hidden" name="LCID_FLOW" value="0">
  <input type="hidden" name="BZID_FLOW" value="0">
  <input type="hidden" name="BZXH_FLOW" value="0">
  <input type="hidden" name="BZRYID_FLOW" value="0">  
  <input type="hidden" name="RYBLYJ_FLOW" value="">
  <input type="hidden" name="RYBLTP_FLOW" value="">
        
  
  <input type="hidden" name="PKEY" value="<%=sPKEY%>">
  <input type="hidden" name="page" value="<%=sPage%>">
  <input type="hidden" name="txtSearch" value="<%=sSearch%>">
  <input type="hidden" name="OPERATOR" value="<%=sOPERATOR%>">
  <input type="hidden" name="OPERATOR_SOURCE" value="<%=sOPERATOR%>">
  <input type="hidden" name="KEY" value="<%=sKEY%>">
  <input type="hidden" name="type" value="<%=sType%>">
  <input type="hidden" name="from" value="<%=from%>">
  <input type="hidden" name="detailCount" value="0">
  <input type="hidden" name="detailCount1" value="0">
  <input type="hidden" name="detailCount2" value="0">
  <input type="hidden" name="detailCount3" value="0">
  <input type="hidden" name="detailCount4" value="0">
  <input type="hidden" name="FormID" value="<%=iFormID%>">
  <input type="hidden" name="loginID" value="<%=loginID%>">  
 <!--  <input type="hidden" name="szContent" value="">   -->
  <input type="hidden" name="RecordID" value="">    
  <input type="hidden" name="hasFlow" value="<%=hasFlow %>">
  <input type="hidden" name="hiddenSave" value="not">
<%@ include file="title.jsp"%>
<table width="100%">
  <tr>
    <td>
    <% out.println(bdFormControl.printFormDesc(Integer.parseInt(sMKID_SESSION),iFormID));%>
    <% out.println( LcHelp.saveButton(canDraftSave, hasAnnex, "saveButtonUpdate")); %>    
    <% out.println( SzPageHelp.backButton() ); %>         
    </td>
  </tr>
</table>
<!-----信息维护------>
<div id="divForm">
<%=sHTML %>
</div>
<!-- 附件 -->
<% if (!sTableAnnex.equals("")) { %>
<table width="750" border="1" bordercolorlight="#C0C0C0" bordercolordark="#FFFFFF" class="tableClass" cellpadding="3" cellspacing="0"> 
  <tr> 
    <td class="tdClassTitle"><b>附件</b></td>  
    <td colspan="3">
    <%
    	out.println(SzPageHelp.detailAnnexNew2(sTableAnnex, sKEY, strLevel_SESSION));
    %>
    </td> 
  </tr> 
</table> 
<% } %>

</form>
<!-----这里包含要提交的内容--->
<form name="formHidden" method="post">
  <input type="hidden" name="page" value="<%=sPage%>">
  <input type="hidden" name="txtSearch" value="<%=sSearch%>">
  <input type="hidden" name="type" value="<%=sType%>">
  <input type="hidden" name="FormID" value="<%=iFormID%>"> 
</form>

<script language="javascript" src="../../share/js/commonTool.js"></script>
<script language="javascript" src="../../share/js/formTool.js"></script>
<%=bdValueControl.detailCheckJs()%>
<%=bdValueControl.updateJs(Integer.parseInt(sKEY), session, "detail", canModifyForm, strDenyField, strDenyField2)%>
<%=bdValueControl.detailJs(Integer.parseInt(sKEY), "detail", canModifyForm)%>

<%
	BdModifyButton bdModifyButton = new BdModifyButton();
	out.println(bdModifyButton.modifyButtonJs(buttonid));
%>
<%=bdValueControl.saveCheckJs()%>
<%=bdValueControl.saveJs()%>

<script language="javascript">
  <% if (sReadonly.equals("readonly")) {%>
    hideAll(formUpdate.btnSelect);
    hideAll(formUpdate.pop1);
  <% } %>

  function FormSave(formName, url, vOPERATOR) {
		if (!FormCheck(formName)) {
			return false;
		}
       
    if (vOPERATOR != "") {
    	formName.OPERATOR.value = vOPERATOR;
    }
    //取消其他按钮
    //alert(formName.OPERATOR.value);
    //alert(formName.RecordID.value);
    document.getElementById("divLine").style.display = "block";
    document.getElementById("saveButtonUpdate").disabled = true;
		//2012-01-11增加
		vBeforeFrameHtmlUnload = false;	
		    
		FormJsBeforeSave(formName);
    formName.action = url;
    formName.submit();      
  }   

  //document.all.['flowDraft'].style.height = vHeight;  

  
</script>
<div id="divLine" class="divLine" align="center" style="position:absolute;width:450;height:150px;left:150px;top:150px;padding:60px 0 0 0; margin:0px;overflow:auto;overflow:hidden;display:none; background-color:#dbdbdb;">
	<img src="<%=strSkin_SESSION%>/bar.gif">
</div><!---------------------------------------------------------------20120112 ting----------------------------------------->

</body>
<%
out.println(SzPageHelp.calendarFrame2());
out.println(SzPageHelp.calendar2Frame2());
%>

