<%@ Page Language="C#" AutoEventWireup="true" Inherits="System_InfoModel_SetInfoModel, QianboCMS" EnableEventValidation="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>模型设置</title>
    <link href="../Css/layout.css" type="text/css" rel="stylesheet" />
    <script type="text/javascript" src="../../Js/Common.js"></script>
    <script type="text/javascript" src="../../Js/ModelField.js"></script>
</head>

<body>
    <table cellspacing="1" cellpadding="0" class="wzdh" align="center">
        <tr>
            <td style="padding-left: 10px;">
                <img src="../Images/Skin/Default/you.gif" align="absmiddle" />
                您现在的位置：<a href="../SystemInfo.aspx">后台管理</a> &gt;&gt; <a href="ModelList.aspx">模型管理</a> &gt;&gt;
                <asp:Literal ID="Literal1" runat="server">新增</asp:Literal>模型
			</td>
        </tr>
    </table>
    <form id="SetInfoModelForm" runat="server">
        <table class="border" cellspacing="1" cellpadding="0" border="0" align="center">
            <tr class="tdbg">
                <td class="bqleft">模型名称：</td>
                <td class="bqright">
                    <asp:TextBox ID="txtModelName" MaxLength="50" runat="server"></asp:TextBox>
                    <font color="red">*</font>
				</td>
            </tr>
            <tr class="tdbg">
                <td class="bqleft">模型描述：</td>
                <td class="bqright">
                    <asp:TextBox ID="txtModelDesc" Columns="50" Rows="4" runat="server" TextMode="MultiLine"></asp:TextBox>
				</td>
            </tr>
            <tr class="tdbg">
                <td class="bqleft">模型类型：</td>
                <td class="bqright">
                    <asp:RadioButtonList ID="ModelSort" runat="server" RepeatDirection="Horizontal" onclick="SelModelType()">
                        <asp:ListItem Selected="True" Value="1">内容模型</asp:ListItem>
                    </asp:RadioButtonList>
				</td>
            </tr>
            <tr class="tdbg">
                <td class="bqleft">表名：</td>
                <td class="bqright">
                    <asp:TextBox ID="txtSysTabelName" runat="server" Columns="8">Qianbo_U_</asp:TextBox>
                    <asp:TextBox ID="txtTableName" runat="server" MaxLength="20" Columns="15"></asp:TextBox>
                    <font color="red">*</font>
				</td>
            </tr>
            <tr class="tdbg">
                <td class="bqleft">上传文件存放目录：</td>
                <td class="bqright">
					upload/<asp:TextBox ID="txtUploadPath" runat="server" MaxLength="50" Columns="12"></asp:TextBox>
                    <span style="color: red;">*</span> （必须以字母开头，由字母或数字组成。如修改此设置需要手动修改对应文件夹名称。）
				</td>
            </tr>
            <tr class="tdbg">
                <td class="bqleft">允许上传文件大小：</td>
                <td class="bqright">
					只能上传小于或等于
					<asp:TextBox ID="txtUploadSize" runat="server" MaxLength="15" Text="0" Columns="8"></asp:TextBox>
                    KB以内的文件（0KB表示不限制）
					<span style="color: red;">*</span>
				</td>
            </tr>
            <tr class="tdbg">
                <td class="bqleft">开启手动编辑录入界面：</td>
                <td class="bqright">
                    <asp:RadioButtonList ID="IsHtml" runat="server" RepeatDirection="Horizontal">
                        <asp:ListItem Value="True">开启</asp:ListItem>
                        <asp:ListItem Selected="True" Value="False">关闭</asp:ListItem>
                    </asp:RadioButtonList>
                    <span style="color: red;">*</span>
					选择开启后，新增、编辑、删除任何字段后，都需要手动更改模型录入Html界面。
				</td>
            </tr>
            <tr class="tdbg">
                <td class="bqleft"></td>
                <td class="bqright">
                    <asp:Button ID="btnSubmit" runat="server" Text="确定" OnClientClick="return CheckValidate()" CssClass="btn" OnClick="btnSubmit_Click" />
                    <input id="btnNo" type="button" value="取消" onclick="location.href = 'ModelList.aspx'" class="btn" />
				</td>
            </tr>
        </table>
    </form>
    <br />
</body>
</html>
<script type="text/javascript">
    function CheckValidate() {
        var txt = null;
        txt = $("txtModelName").value;
        if (txt.trim().length == 0) {
            alert('模型名称不能为空！');
            return false;
        }
        txt = $('txtTableName').value;
        if (txt.trim().length == 0) {
            alert('表名称不能为空！');
            return false;
        }
        var patt = /^[a-zA-Z0-9_]+$/
        if (!patt.test(txt)) {
            alert('表名称必须为字母、数字和下划线组合字符！');
            return false;
        }
        txt = $('txtUploadPath').value;
        if (txt.trim().length == 0) {
            alert('上传文件存放目录不能为空！');
            return false;
        }
        var patt = /^[a-zA-Z][a-zA-Z0-9]*$/
        if (!patt.test(txt)) {
            alert('上传文件存放目录必须以字母开头，并由字母或数字组成！');
            return false;
        }
        txt = $('txtUploadSize').value;
        if (!CheckNumber(txt)) {
            alert('允许上传文件大小必须为0或正整数！');
            return false;
        }
        return true;
    }
</script>