<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="java.util.Iterator" %>
<%@ 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.tool.*" %>
<%@ page import="net.sz600.docEngine.*" %>
<%@ page import="net.sz600.weboffice.*" %>
<%@ page import="net.sz600.flow.*" %>
<%@ include file="/sessionInfoWeixin.jsp"%>
<%@ include file="/docEngine/docEngineSession.jsp"%>
<%
  String strLevel = "../../";
%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="format-detection" content="telephone=no" />
<%@ include file="/share/oa_app_title.jsp"%>
 <link href="<%=strLevel_SESSION%>app/images/soarwell_css.css" rel="stylesheet" type="text/css" />
<style type=text/css>
.detailTitle {
    height:30px;
    font-size:13pt;
}
</style>
</head>
<%
		//获取信息 以权限设置
		int DLID = Integer.parseInt(szDLID_SESSION);
		String DLXM = szLoginInfo_SESSION.getDLXM();
    //获取提交的参数
    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 sTable_type = "SZKC_CPFL";
    boolean canSeeAnnex = false;
    
    SzData szData = null;
    SzDataInfo szDataInfo = null;

    String sOPERATOR = request.getParameter("OPERATOR");
    String sKEY =  SzConvert.toZeroStr(request.getParameter("KEY"));
    String sReadonly = "";
    boolean bReadonly = false;
    if (sOPERATOR.equals("detail")) {
        sReadonly = "readonly";
        bReadonly = true;
    }
    //读取数据
    WdyqDocInfo wdyqDocInfo = null;
    WdyqDoc wdyqDoc = new WdyqDoc(moduleId);
    if (!sKEY.equals("0")) {
        wdyqDocInfo = (WdyqDocInfo)wdyqDoc.getInfoByKey(Integer.parseInt(sKEY));
        //增加阅读记录
        if (docEngineInfo.getHasReadRecord().equals("1")) {
            wdyqDoc.read(Integer.parseInt(sKEY), sBMMC_SESSION, iDLID_SESSION, sDLXM_SESSION);
        }
    }
    
    //String sContent = wdyqDocInfo.getXXNR();
    String sContent = "";

%>
<body  onload="javascript:ResizeFrame();">
<!-----上面的工具栏------>
<form name="formUpdate" method="post"  ENCTYPE="multipart/form-data">
  <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="KEY" value="<%=sKEY%>">
  <input type="hidden" name="type" value="<%=sType%>">
<%@ include file="/app/title.jsp"%>
<table width="100%">
  <tr>
    <td>
      <%=SzPageHelp.backButton()%>
      <%//=SzPageHelp.button("写进日程","javascript:WriteTask();")%>
    </td>
  </tr>
</table>

<!-----信息维护------>
<table width="100%" border="0" cellspacing="3" cellpadding="3" style="border:#D7D7D9 1px solid;">
  <tr>
    <td align="center" class="detailTitle"><font size="5"><b><%=wdyqDocInfo.getXXBT()%></b></font></td>
  </tr>

  <tr>
    <td align="center" class="detailTitle">
     <%  
       out.println("" + wdyqDocInfo.getXXDLXM());
       if (!wdyqDocInfo.getXXBMMC().equals("")) {
       	out.println("(" + wdyqDocInfo.getXXBMMC() + ")");
       }       
       out.println("&nbsp;" + wdyqDocInfo.getXXSJ());
     %>
   </td>    
  </tr> 
  <tr>
    <td height="8" align="left" background="../images/line.gif"></td>
  </tr>
  <tr>
    <td height="100">
<%  //文档是否带有word?
	if (docEngineInfo.getEditor().equals(".doc")
			|| docEngineInfo.getEditor().equals(".xls")
			|| docEngineInfo.getEditor().equals(".ppt")) {  		
	} else {
		out.println(wdyqDocInfo.getXXNR());	
	}
%>	                    
    </td>
  </tr>
<%  
  if (docEngineInfo.getEditor().equals(".doc") || docEngineInfo.getEditor().equals(".xls")) {
  	OfficeRecordID officeRecordID = new OfficeRecordID();
  	String sFileLink = officeRecordID.getFileLink("docEngine", SzConvert.toInt(moduleId), wdyqDocInfo.getXXID(), docEngineInfo.getEditor());
  	if (!sFileLink.equals("")) {
    	out.println("	<tr>");
    	out.println("	<td height=\"5\" align=\"left\" background=\"../images/line.gif\"></td>");
    	out.println("	</tr>\n"); 
    	out.println("<tr><td>" + sFileLink + "</td></tr>");
  	}
  }
%>
<% if (docEngineInfo.getHasAnnex().equals("1")) {%>
  <tr>
    <td height="8" align="left" background="../images/line.gif"></td>
  </tr>
  <tr>
    <td>
    <%
    canSeeAnnex = true;
    String canSeeStr = SzPageHelp.detailAnnexNew2(readDocEngineXml.getAnnexTable(moduleId), sKEY, docEngineInfo.getPicture(),strLevel_SESSION);
    String cannotSeeStr = canSeeStr;
    //System.out.println(docEngineInfo.getAnnexHasUserLimit() + "======" + wdyqDocInfo.getXXFJCKDLID());
    if (isBarManager_SESSION){
    	canSeeAnnex = true;
    } else if(docEngineInfo.getUploadUserCanSeeAnnex().equals("1") && wdyqDocInfo.getXXDLID()==DLID){
    	canSeeAnnex = true;
    } else if(docEngineInfo.getAnnexHasUserLimit().equals("1")) {
		if ( (","+wdyqDocInfo.getXXFJCKDLID()+",").indexOf(","+DLID+",")>0
    	  || ("，"+wdyqDocInfo.getXXFJCKDLID()+"，").indexOf("，"+DLID+"，")>0) {
    		canSeeAnnex = true;
    	} else {
    		canSeeAnnex = false;
    	}
    }
    if (!canSeeAnnex) {
    	cannotSeeStr = cannotSeeStr.replaceAll("(?i)<a([^>]+)>","");
    	cannotSeeStr = cannotSeeStr.replaceAll("</a>", "");
    }

    %>
    <%=canSeeAnnex?canSeeStr:cannotSeeStr%>
    
    </td>
  </tr>
<% } %>  
</table>



</form>


<!-- 检查是否有归档 
--找到moduleName,formName,infoID

-->
<% 
  if (moduleId.equals("99910") || moduleId.equals("23")) { 
		LcPigonhole pigonhole = new LcPigonhole();
		out.println(pigonhole.printPigonholeDetail(moduleId, Integer.parseInt(sKEY)));
  } 
%>
<!-----这里包含要提交的内容--->
<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%>">
</form>
</body>
<script language="javascript" src="../../share/js/commonTool.js"></script>
<script language="javascript">
  //弹出窗口，选择人员。这里特定是流程里某个步骤的选择人员。
  function PrintWin(moduleName, formName, key) {
    var vUrl = "../../share/formEngine2/detail_win.jsp?moduleName=" + moduleName 
             + "&formName=" + formName 
             + "&OPERATOR=detail&KEY=" + key;
  	window.showModalDialog(vUrl,window,"status=no;dialogWidth=900px;dialogHeight=550px");
  }
  
  function ResizeFrame() {
  	var oFrame = document.getElementById("docDetail");
	if (oFrame != null) {
          var vHeight2 = oFrame.document.body.scrollHeight;
   	  var vHeight= document.frames("docDetail").document.body.scrollHeight + 20;  
	  //alert(vHeight2 + "==" + vHeight);
	  if (vHeight < 200) {
	    vheight = 200;
	  }
	
	  oFrame.height = vHeight;  
	}
  }
  
</script>
<script language="javascript"  defer>
  function ResizeFrame1() {
  	var oFrame = document.getElementById("docDetail");
  	var vHeight= document.frames("docDetail").document.body.scrollHeight;  	
	oFrame.height = vHeight;  
  }  
  
  function WriteTask() {
    formUpdate.action = "control.jsp";
	formUpdate.OPERATOR.value = "task";
	formUpdate.submit();
  }

  //ResizeFrame1();
</script>

