<%@ Page Language="c#" Inherits="Web.User.addpopWindow" CodeBehind="addpopwindow.aspx.cs" %>

<!DOCTYPE html>
<!--[if lt IE 9]><html class="lte-ie8"><![endif]-->
<!--[if gt IE 8]><!-->
<html>
<!--<![endif]-->
<head>
    <title>popWindow</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!--#include file = "../Css/head.htm" -->
    <!--#include file = "../Css/userCssEdit.htm" -->
</head>
<body>
    <form id="addNews" method="post" runat="server">
    <div class="edit-func-box func-box" style="height:720px;">
        <div class="hd">
            编辑</div>
        <div class="bd mb80">
            <table class="edit-table" id="Table1">
                <tr style="width:15%">
                    <th>
                        窗口标题：
                    </th>
                    <td>
                        <asp:TextBox ID="title" runat="server" CssClass="input-md" notNull="true" msgName="窗口标题" MaxLength="200"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="title"
                            ErrorMessage="标题不能为空！"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <th>
                        弹出顺序：
                    </th>
                    <td>
                        <asp:TextBox ID="order" runat="server" CssClass="input-md" notNull="true" dataType="integer" maxValue="30" minValue="0" msgName="弹出顺序" MaxLength="30">0</asp:TextBox>
                        <asp:CheckBox ID="isTop" runat="server" Text="固顶"></asp:CheckBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="order"
                            ErrorMessage="不能为空！"></asp:RequiredFieldValidator>
                        <asp:RangeValidator ID="RangeValidator1" runat="server" ErrorMessage="0--10000" Type="Integer"
                            MinimumValue="0" MaximumValue="10000" ControlToValidate="order"></asp:RangeValidator>
                    </td>
                </tr>
                <tr>
                    <th>
                        弹出天数：
                    </th>
                    <td>
                        <asp:TextBox ID="popDay" runat="server" CssClass="input-md" notNull="true" dataType="integer" maxValue="365" minValue="1" msgName="弹出天数" MaxLength="365"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="popDay"
                            ErrorMessage="不能为空！"></asp:RequiredFieldValidator>
                        <asp:RangeValidator ID="RangeValidator2" runat="server" ErrorMessage="0--10000" Type="Integer"
                            MinimumValue="0" MaximumValue="10000" ControlToValidate="popDay"></asp:RangeValidator>
                    </td>
                </tr>
                <tr>
                    <th>
                        窗口宽度：
                    </th>
                    <td>
                        <asp:TextBox ID="width" runat="server" CssClass="input-md" notNull="true" dataType="integer" maxValue="800" minValue="1" msgName="宽" MaxLength="800"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="width" ErrorMessage="不能为空！"></asp:RequiredFieldValidator>
                        <asp:RangeValidator ID="RangeValidator3" runat="server" ControlToValidate="width" MaximumValue="800" MinimumValue="1" Type="Integer" ErrorMessage="1--800"></asp:RangeValidator>
                    </td>
                </tr>
                <tr>
                    <th>
                        窗口高度：
                    </th>
                    <td>
                        <asp:TextBox ID="height" runat="server" CssClass="input-md" notNull="true" dataType="integer" maxValue="600" minValue="1" msgName="高" MaxLength="600"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="height" ErrorMessage="不能为空！"></asp:RequiredFieldValidator>
                        <asp:RangeValidator ID="RangeValidator4" runat="server" ControlToValidate="height" MaximumValue="600" MinimumValue="1" Type="Integer" ErrorMessage="1--600"></asp:RangeValidator>
                    </td>
                </tr>
                <tr>
                    <th>
                        显示等级：
                    </th>
                    <td>
                        <asp:DropDownList ID="grade" runat="server" DataTextField="name" DataValueField="pkId" class="input-md">
                        </asp:DropDownList>                        
                    </td>
                </tr>
                <tr>
                    <th>
                        浏览权限：
                    </th>
                    <td>
                        <asp:DropDownList ID="gate" runat="server" class="input-md">
                            <asp:ListItem Value="0">无限制</asp:ListItem>
                            <asp:ListItem Value="1">仅内网可见</asp:ListItem>
                            <asp:ListItem Value="2">仅登录可见</asp:ListItem>
                            <asp:ListItem Value="3">内网或登录可见</asp:ListItem>
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <th>
                        窗口内容：
                    </th>
                    <td style="width:85%;">
                    <textarea name="listcontent" style="width: 100%; height: 200px; visibility: hidden;"></textarea>
                    </td>
                </tr>
            </table>
        </div>
        <div class="ft ft02">
            <div class="action-field text-center">
                <asp:Button ID="ok" runat="server" Text="添 加" OnClick="ok_Click" OnClientClick="return checkAll();" CssClass="btn btn-sm btn-primary"></asp:Button>
                &nbsp;
                <asp:Button ID="cancel" runat="server" Text="取 消" CausesValidation="False" OnClick="cancel_Click" CssClass="btn btn-sm btn-primary">
                </asp:Button>
            </div>
            <!--/action-field-->
        </div>
    </div>
    <input id="content1" type="hidden" name="content1" runat="server" />
        <!--#include file="../Css/foot.htm"-->
    <script type="text/javascript">
        //声明编辑器
        var listTxt;
                    KindEditor.ready(function(K) {
				         var editor = K.create('textarea[name="listcontent"]', {
					        resizeType : 1,
					        allowPreviewEmoticons : false,
					        allowImageUpload : false,
					        items : [
						        'source','fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
						        'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', '|', 'link']
				        });
				        
				        var initlisttxt=document.getElementById("content1");
                        editor.insertHtml(initlisttxt.value);
                        //初始化加载列表标题编辑器
                        listTxt=editor;
			        });
			        
    </script>
                    
    <script type="text/javascript">
    function checkAll()
    {
        //验证
        if (checkAllValidate()){
            //保存
            //判断内容是否为空
        var etxtisempty = listTxt.isEmpty();
        if(etxtisempty){
                alert("文章内容不能为空！");
                return false ;
            }else{
                //获取文章内容
                var gettxttitle= listTxt.html();
                var contxt=document.getElementById("content1");
                contxt.value =gettxttitle;
                return true ;
            }
                
        }else{
            return false ;
        }
    }
    
    </script>
    </form>
</body>
</html>
