<%@ page contentType="text/html; charset=GBK" %>
<%@ page import = "zr.zrpower.common.util.SysPreperty" %>
<%@ page import = "zr.zrpower.entity.sys.SessionUser" %>
<%@ page import = "zr.zrpower.dbmanage.BPIP_TABLE"%>
<%@ page import = "zr.zrpower.ejb.sys.UIService" %>
<%@ page import = "zr.zrpower.dbmanage.service.TableService" %>

<%@ page import="zr.zrpower.dbmanage.service.FieldService"%>
<%@ page import = "zr.zrpower.dbmanage.service.TableSpaceService"%>
<%@ page import = "java.lang.Object"%>
<%@ page import = "java.util.*" %>
<%@ page import = "java.text.*" %>
<HTML>
<%
TableSpaceService Space = new TableSpaceService();

SessionUser user = (SessionUser)session.getAttribute("userinfo");
UIService userUI =new UIService();
TableService Table = new TableService();
String TABLEID=request.getParameter("SelectedItems");
FieldService Field = new FieldService();
BPIP_TABLE TC = Table.getTableID(TABLEID);
String Oldname = Field.GetTableName(TABLEID);
String strID = request.getParameter("ID");
String strchinesename = Space.GetSpaceCHINESENAME(strID);
%>
<HEAD>
<TITLE><%=SysPreperty.getProperty().SystemName%><%=SysPreperty.getProperty().Versoin%></TITLE>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META http-equiv="Content-Type" content="text/html; charset=GBK">
<LINK type="text/css" rel="stylesheet" href="../../zrsysmanage/css/<%=user.getUserCSS()%>">
<SCRIPT LANGUAGE="JavaScript" src="../../zrsysmanage/script/Public.js"></SCRIPT>
<script language="JavaScript" type="text/javascript">
function Check(theForm){
   if (theForm.TABLENAME.value == ""){

    <%if("6".equals(user.getUserWINDOWTYPE())){%>
    parent.layer.alert('表名不能为空！', {icon: 7});
    <%}else{%>
    alert("表名不能为空！");
    <%}%>
    theForm.TABLENAME.focus();
    return (false);
  }

  if (theForm.CHINESENAME.value == ""){

    <%if("6".equals(user.getUserWINDOWTYPE())){%>
    parent.layer.alert('中文名称不能为空！', {icon: 7});
    <%}else{%>
    alert("中文名称不能为空！");
    <%}%>
    theForm.CHINESENAME.focus();
    return (false);
  }
  if (theForm.TABLETYPE.value!="1")
  {
  if (theForm.PRIMARYKEY.value == ""){

    <%if("6".equals(user.getUserWINDOWTYPE())){%>
    parent.layer.alert('主键不能为空！', {icon: 7});
    <%}else{%>
    alert("主键不能为空！");
    <%}%>
    theForm.PRIMARYKEY.focus();
    return (false);
  }
  }

  theForm.TABLENAME.value=theForm.TABLENAME.value.toUpperCase();
  theForm.PRIMARYKEY.value=theForm.PRIMARYKEY.value.toUpperCase();
  RegForm.Act.value='edit';
  <%if("6".equals(user.getUserWINDOWTYPE())){%>
  document.RegForm.submit();
  window.parent.document.location.reload();
  <%}else{%>
  return (true);
  <%}%>
}
function Check1(theForm)
{
<%if("6".equals(user.getUserWINDOWTYPE())){%>
  parent.layer.confirm('确定要删除当前选中的字段吗？', {
      btn: ['确定','取消'] //按钮
      }, function(index){
         RegForm.Act.value='del';
         document.RegForm.submit();
         window.parent.document.location.reload();
      }, function(){
      });
  <%}else{%>
  if (confirm("确定要删除当前选中的表吗？"))
  {RegForm.Act.value='del';
  return true;}
  else
  {return false;}
  <%}%>

}
</script>
</HEAD>
<BODY class="BodyMain">
<FORM action="../../actiontable.do" method="post" name="RegForm" onsubmit="return Check(this);">
<input type="hidden" name="TABLEID" value='<%=TABLEID%>' >
<input type="hidden" name="Act" value="edit">
<input type="hidden" name="OLDTABLENAME" value='<%=Oldname%>' >
<input type="hidden" name="TABLESPACE" value='<%=TC.getTABLESPACE()%>'>

           <DIV id="divMessage" style='padding-left:0;padding-top:0;width:96%;height:99%;overflow:auto'>
           <fieldset>
           <legend><%=strchinesename%>表管理-编辑表信息</legend>
           <table border="0" class="inputTable" cellspacing="0" cellpadding="0" align="center">
            <tr>
               <td class="inputTdtitle">表名：</td>
               <td class="inputTd"><input class="text" type="text" name="TABLENAME" size="50" value="<%=TC.getTABLENAME()%>" maxlength="50"><Font class="WriteSign">*</Font></td>
           </tr>
           <tr>
               <td class="inputTdtitle">中文名称：</td>
               <td class="inputTd" ><input class="text" type="text" name="CHINESENAME" size="50" value="<%=TC.getCHINESENAME()%>"  maxlength="300"><Font class="WriteSign">*</Font></td>
          </tr>
          <tr>
               <td class="inputTdtitle">表类型：</td>
                <TD> <select name = "TABLETYPE" style = "width:320px">
                 	<option value = "0" <% if (TC.getTABLETYPE().equals("0")){%>selected<%}%>>系统表
                 	<option value = "1" <% if (TC.getTABLETYPE().equals("1")){%>selected<%}%>>字典表
                        <option value = "2" <% if (TC.getTABLETYPE().equals("2")){%>selected<%}%>>基础数据表
                        <option value = "3" <% if (TC.getTABLETYPE().equals("3")){%>selected<%}%>>审批表
                     </select>
                     <br>说明：只有基础数据表和审批表才能配置自定义表单和流程。
             </TD>
          </tr>

          <tr>
               <td class="inputTdtitle">主键：</td>
               <td class="inputTd" ><input class="text" type="text" name="PRIMARYKEY" value="<%=TC.getPRIMARYKEY()%>" size="50" maxlength="30"><Font class="WriteSign">*</Font></td>
             </tr>
            <tr>
               <td class="inputTdtitle">标题：</td>
               <td class="inputTd" ><input class="text" type="text" name="TITLE" value="<%=TC.getTITLE()%>" size="50" maxlength="30">
               <br>说明：设置有标题字段,在使用流程引擎时收到的提示中包括有标题。
               </td>
             </tr>


          <tr>
              <td class="inputTdtitle">描述：</td>
               <td class="inputTd" ><textarea name="DESCRIPTION" rows="3" cols="51"><%=TC.getDESCRIPTION()%></textarea></td>
           </tr>
          </table>
          <br>
          </fieldset>
                 <center><br>
                 <table cellspacing="0" cellpadding="0" border='0'><tr>
                 <%=userUI.ClickButton("保存","JavaScript:if(Check(document.RegForm)){document.RegForm.submit();}","buttonSave.gif",user.getUserImage())%>
                 <%=userUI.ClickButton("删除","JavaScript:if(Check1(document.RegForm)){document.RegForm.submit();}","buttonDelete.gif",user.getUserImage())%>
                 <%if("6".equals(user.getUserWINDOWTYPE())){%>
                 <%=userUI.ClickButton("关闭","JavaScript:parent.layer.closeAll();","buttonClose.gif",user.getUserImage())%>

                <%}else{ %>
                <%=userUI.ClickButton("关闭","JavaScript:window.opener.document.location.reload();window.close();","buttonClose.gif",user.getUserImage())%>

                <%} %>
                 </tr></table>
                 </center>
         </DIV>


</FORM>
</BODY>
</HTML>
<%
//清空相关对象
user = null;
userUI = null;
TC = null;
Space = null;
Table = null;
%>
