<%@ 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.*" %>
<%@ include file="/sessionInfo.jsp"%>
<%
  strSkin_SESSION = "../../images/skin2_blue2";
%>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<link href="<%=strSkin_SESSION%>/css2007.css" rel="stylesheet" type="text/css">
<style type="text/css">
  .readClass {
      background:#D4D0C8;
      readonly;
  }
  .selectClass {
      width:70;
  }  
</style>

</head>
<%
    //获取提交的参数
    String tableName = SzConvert.toSpaceStr(request.getParameter("tableName"));
    String readonly = "";
    String sOPERATOR = SzConvert.toSpaceStr(request.getParameter("OPERATOR"));
    
    ReadAnnexXml readAnnexXml = new ReadAnnexXml();
    String[] annexXml = null;
    
    //if (!tableName.equals("")) {
    	//fileSize,allowFileExt,savePath,id,desc,tableName
    	annexXml = readAnnexXml.getTableInfoFromXML(tableName);
    //} 
    
    if (annexXml == null){
    	annexXml = new String[9];
    	annexXml[0] = "10000000";
    	annexXml[1] = "txt,xls,doc,ppt,gif,jpg,jpeg,png";
    	annexXml[2] = "upload/";
    	annexXml[3] = "";
    	annexXml[4] = "";
    	annexXml[5] = "";
    	annexXml[6] = "0";	//附件属性
    	annexXml[7] = "100";
    	annexXml[8] = "100";
    }
    String strReadonly = "";
    if (sOPERATOR.equals("update") && !annexXml[3].equals("") && annexXml[5].equals("")) {
       strReadonly = "readonly";
    }
    int iM = 0;
    if (!annexXml[0].equals("")) {
			iM = SzConvert.toInt(annexXml[0])/1000/1000;
    }
    if (annexXml[7].equals("")) {
    	annexXml[7] = "100";
    }
    if (annexXml[8].equals("")) {
    	annexXml[8] = "100";
    }    
%>
<body>

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

<%@ include file="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">
  <input type="hidden" name="id" value="<%=annexXml[3]%>">
  <input type="hidden" name="tableNameOld" class="txtClass1" value="<%=annexXml[5]%>">
  <tr>
    <td class="tdClassTitle2" width="100">信息名称</td>
    <td><input type="text" name="desc" class="txtClass1" value="<%=annexXml[4]%>">
    <font color="red">*</font>
    </td>
  </tr>
  <% if (strReadonly.equals("readonly")) { %>
    <input type="hidden" name="tableName" class="txtClass1" value="<%=annexXml[5]%>" <%=strReadonly%>>
  <% } else {%>
  <tr>
    <td class="tdClassTitle2">附件表名</td>
    <td>
	<input type="text" name="tableName" class="txtClass1" value="<%=annexXml[5]%>" <%=strReadonly%>>
    <font color="red">*</font>
    </td>
  </tr>  
  <% } %>
  <tr>
    <td class="tdClassTitle2">附件大小</td>
    <td><input type="text" name="fileSize" class="txtClass1" value="<%=annexXml[0]%>">
    	<font color="red">*</font>(Byte)，(转换后为<%=iM%>M)
      <br><font color="#F02C56"><b>建议限制在10M以内，大附件的上传和下载影响OA服务的性能，不建议通过OA上传！</b></font> 
    </td>
  </tr>
  <tr>
    <td class="tdClassTitle2">附件类型</td>
    <td>
      <input type="text" name="allowFileExt" class="txtClass2" value="<%=annexXml[1]%>">
      <font color="red">*</font><span>(例：gif,jpeg,jpg,png)</span>
    </td>
  </tr>   
  <tr>
    <td class="tdClassTitle2">附件路径</td>
    <td>
	  <input type="text" name="savePath" class="txtClass2" value="<%=annexXml[2]%>">
	  <font color="red">*</font>(例：upload/)
    </td>    
  </tr>
  <tr>
    <td class="tdClassTitle2">图片显示属性</td>
    <td>
    	默认显示:<%=SzPageHelp.checkbox("displayPicture", annexXml[6]) %>
	  	显示宽度:<input type="text" name="displayWidth" class="txtClass100" value="<%=annexXml[7]%>">
	  	显示长度:<input type="text" name="displayHeight" class="txtClass100" value="<%=annexXml[8]%>">
	  	<font color="#F02C56">(为0按照图片大小展示)</font><span>
    </td>    
  </tr>  
</table>

</form>

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

  function FormSave(formName, url) {

    //检查是否可以保存
    if (!notSpace(formName.desc, "信息名称 ")) {
      return false;
    }
    if (!notSpace(formName.fileSize, "附件大小 ")) {
      return false;
    }
    if (formName.tableNameOld.value != "") {
      if (!notSpace(formName.tableName, "附件表名 ")) {
        return false;
      }
    }
    if (!notSpace(formName.allowFileExt, "附件类型 ")) {
      return false;
    }     
    if (!notSpace(formName.savePath, "附件路径 ")) {
      return false;
    }    
	if (isNaN(formName.fileSize.value) || formName.fileSize.value.indexOf(".")>0) {
	  alert("附件大小 必须为整数！");
      return false;
    }
    formName.action = "control.jsp";
    formName.submit();
  }
  
</script>
</body>
