<%@ page contentType="text/html;charset=GBK" %>
<%@ 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.guide.*" %>
<%@ page import="net.sz600.weboffice.*" %>
<%@ 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 FirstMKBH = SzConvert.toZeroStr(request.getParameter("FirstMKBH"));
    String FirstMKBH2 = SzConvert.toZeroStr(request.getParameter("FirstMKBH2"));
    
    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;
    }
    //读取数据
    Guide guide = new Guide();
    GuideInfo guideInfo = null;
    if (!sKEY.equals("0")) {
    	guideInfo = (GuideInfo)guide.getInfoByKey(Integer.parseInt(sKEY));
    }
    if (guideInfo == null) {
    	guideInfo = new GuideInfo();
    	guideInfo.setZNSJ(SzDateHelp.getTimeStr());
    	guideInfo.setZNDLXM(szLoginInfo_SESSION.getDLXM());
    } else {
    }
    
    //是否用特定的图片路径？
	session.setAttribute("SzPicture" + iMKID_SESSION, "SZXT_CZZNFJ");
%>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<link href="<%=strSkin_SESSION%>/css2007.css" rel="stylesheet" type="text/css">

<script type="text/javascript" src="<%=strLevel%>share/ckeditor/ckeditor.js"></script>
</head>


<body >
<!-----上面的工具栏------>
<form name="formUpdate" method="post">
  <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="ZNID" value="<%=guideInfo.getZNID()%>">

  <input type="hidden" name="type" value="<%=sType%>">
  <!-- <input type="hidden" name="ZNNR">  -->
<%@ include file="/share/title.jsp"%>
<table width="100%">
  <tr>
    <td>
    <% 
    out.println(SzPageHelp.saveButton());
    %>
      <%=SzPageHelp.backButton()%>
    </td>
  </tr>
</table>

<!-----信息维护------>
<table width="750" border="1" bordercolorlight="#C0C0C0" bordercolordark="#FFFFFF" class="tableClass" cellpadding="3" cellspacing="0">
  <tr>
    <td width="120">上级</td>
    <td colspan="3">
    <input type="hidden" name="ZNBH" value="<%=guideInfo.getZNBH()%>" >
    <input type="hidden" name="FirstMKBH" value="<%=FirstMKBH%>">
    <input type="hidden" name="FirstMKBH2" value="<%=FirstMKBH2%>">          
      <select name="ZNBH_SJ" class="txtClass2">
        <option value="">===请选择===</option>
<%
    String ZNBH_SJ = SzLevelNumber.getParentNumber(guideInfo.getZNBH());
		if (sOPERATOR.equals("add")) {			
			if (!FirstMKBH2.equals("0")) {
				ZNBH_SJ = FirstMKBH2;
			} else {
				ZNBH_SJ = FirstMKBH;	
			}
		}
    Iterator iter = guide.getArrayList("1=1 order by ZNBH ASC").iterator();
    GuideInfo guideInfo2 = null;
    while (iter != null && iter.hasNext()) {
    	guideInfo2 = (GuideInfo)iter.next();
%>
        <option value="<%=guideInfo2.getZNBH()%>" <% if (guideInfo2.getZNBH().equals(ZNBH_SJ)) {%>selected<%}%> >
          <%=SzLevelNumber.getLevelSpace(guideInfo2.getZNBH())%><%=guideInfo2.getZNBT()%>
        </option>
<%
    }
%>
      </select>
    </td>
  </tr>  
  <tr>
    <td>标题</td>
    <td colspan="3"><input type="text" name="ZNBT" class="txtClass2" value="<%=guideInfo.getZNBT()%>" <%=sReadonly%> ></td>
  </tr>
  <tr>
    <td>关键词</td>
    <td colspan="3"><input type="text" name="ZNGJC" class="txtClass2" value="<%=guideInfo.getZNGJC()%>" <%=sReadonly%> ></td>
  </tr>  
  <tr>
    <td>简介</td>
    <td colspan="3">
      <textarea name="ZNJJ" class="areaClass2" <%=sReadonly%> ><%=guideInfo.getZNJJ()%></textarea>
    </td>
  </tr>
  <tr>
    <td>发布时间</td>
    <td><input type="text" name="ZNSJ" class="txtClass1" value="<%=guideInfo.getZNSJ()%>" readonly>
    </td>
    <td>发布人员</td>
    <td><input type="text" name="ZNDLXM" class="txtClass1" value="<%=guideInfo.getZNDLXM()%>" readonly>
    </td>
  </tr>
  <tr>
    <td>关联的操作
    <% if (!bReadonly) {%>
      <input type="button" name="btnSelect" class="btnClassShort" value="选择" OnClick="javascript:OpenIdMultWin('SZXT_CZZN','formUpdate.ZNGLID','formUpdate.ZNGLMC');">
    <% } %>
    </td>
    <td colspan="3">
	  <input type="hidden" name="ZNGLID" class="txtClass2" value="<%=guideInfo.getZNGLID()%>" <%=sReadonly%> >    
	  <input type="text" name="ZNGLMC" class="txtClass2" value="<%=guideInfo.getZNGLMC()%>" <%=sReadonly%> >    
    </td>
  </tr>  
  <tr>
    <td>适用的模块
    <% if (!bReadonly) {%>
      <input type="button" name="btnSelect" class="btnClassShort" value="选择" OnClick="javascript:OpenIdMultWin('SZXT_MK','formUpdate.ZNMKID','formUpdate.ZNMKMC');">
    <% } %>
    </td>
    <td colspan="3">
	  <input type="hidden" name="ZNMKID" class="txtClass2" value="<%=guideInfo.getZNMKID()%>" <%=sReadonly%> >    
	  <input type="text" name="ZNMKMC" class="txtClass2" value="<%=guideInfo.getZNMKMC()%>" <%=sReadonly%> >    
    </td>
  </tr>
</table>
<table width="750" border="0" cellpadding="1" cellspacing="0">
  <tr>
    <td>
    <%
    String sTable = "SZXT_CZZN";
    String sFieldID = "ZNID";
    String sEditor = "ZNNR";
    SzData szData = new SzData();
    SzDataInfo szDataInfo = null;
    szData.setTableInfo(sTable, sFieldID, sEditor);
	  szDataInfo = (SzDataInfo)szData.getInfoByKey(Integer.parseInt(sKEY));		
	  String sValue = "";
	  if (szDataInfo != null) {
	        sValue = szDataInfo.getName();
	  }	      
		%>  
		 <textarea id="szContent" name="ZNNR"><%=sValue %></textarea>       
    </td>
  </tr>
</table>
	<script type="text/javascript">
    CKEDITOR.replace( 'ZNNR');
   </script>
</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="FirstMKBH" value="<%=FirstMKBH%>">
  <input type="hidden" name="FirstMKBH2" value="<%=FirstMKBH2%>">    
</form>
<script language="javascript" src="../../share/js/commonTool.js"></script>
<script language="javascript">
  function FormSave(formName, url) {
    //检查是否可以保存
    if (!notSpace(formName.ZNBT, "标题")) {
      return false;
    }
    //html内容
    //formName.ZNNR.value=tbContentElement.DocumentHTML;
            
    formName.action = url;
    formName.submit();
  }
</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");
  }

</script>
</body>
