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

<!DOCTYPE html>
<!--[if lt IE 9]><html class="lte-ie8"><![endif]-->
<!--[if gt IE 8]><!-->
<html>
<!--<![endif]-->
<head>
    <title>投稿</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!--#include file = "../Css/userCssEdit.htm" -->
    <script type="text/javascript">
        //声明编辑器
        var contentTxt;
    </script>
</head>
<body>
    <form method="post" runat="server">
        <div class="edit-func-box func-box">
            <div class="hd">投稿编辑</div>
            <div class="bd">
                <table class="edit-table" id="Table1">
                    <tr>
                        <th>投稿栏目：
                        </th>
                        <td>
                            <asp:DropDownList ID="contributeClass" runat="server" DataTextField="name" DataValueField="bigClassId" CssClass="drop-txt">
                            </asp:DropDownList>
                            &nbsp;<span class="lgrey">请选择当前文章的投稿去向</span>
                        </td>
                    </tr>
                    <tr>
                        <th>文章标题：
                        </th>
                        <td>
                            <asp:TextBox ID="intactTitle" runat="server" notNull="true" msgName="文章标题" class="input-txt w3" MaxLength="250"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <th>相关信息：
                        </th>
                        <td>
                            <asp:TextBox ID="about" runat="server" regex="[^&quot;^'^\*^\?^,^\.^(^)]+" regexMsg="相关信息格式不正确"
                                MaxLength="50" class="input-txt w3"></asp:TextBox>&nbsp;<span class="lgrey">用来查找相关文章，中间用“|”隔开；不能出现""'*?,.()等字符</span>
                        </td>
                    </tr>
                    <tr>
                        <th></th>
                        <td>
                            <div class="more-edit">
                                <div class="more-edit-fn">
                                    <label class="fn-mr20">
                                        作者：
                                        <asp:TextBox ID="author" runat="server" class="input-txt" MaxLength="50" Width="60px"></asp:TextBox>
                                        作者信箱：
                        <asp:TextBox ID="authorMail" runat="server" regex="/^(\w)+(\.\w+)*@(\w)+((\.\w{2,3}){1,3})$/" regexMsg="信箱格式不正确" class="input-txt" MaxLength="50" Width="108px"></asp:TextBox>
                                        &emsp;来源：<asp:TextBox ID="copyFrom" runat="server" class="input-txt" MaxLength="50" Width="108"></asp:TextBox>
                                         来源地址：<asp:TextBox ID="copyFromLink" runat="server" class="input-txt" MaxLength="50" Width="108"></asp:TextBox>
                                        &emsp;内容分页：
                                    <asp:DropDownList ID="pageType" runat="server" onchange="ShowPageTag(this.selectedIndex);" class="drop-txt" Width="80px">
                                        <asp:ListItem Value="0">不分页</asp:ListItem>
                                        <asp:ListItem Value="2">分页</asp:ListItem>
                                    </asp:DropDownList>
                                        &nbsp;
                                    <a id="pageTagA" href="javascript:void(0);" onclick="InsertPagingTag();" title="插入文章内容分页标记" style="display: none;"><span class="blue">插入分页标记</span></a>
                                        <asp:TextBox ID="autoPageCharNum" runat="server" Visible="False">10000</asp:TextBox>
                                        <asp:Panel ID="ReadPointPanel" runat="server" Visible="False">
                                            文章阅读点数：<asp:TextBox ID="readPoint" runat="server">0</asp:TextBox>
                                        </asp:Panel>
                                    </label>
                                </div>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <th>文章内容：
                        </th>
                        <td>
                            <textarea name="content" style="width: 100%; height: 380px; visibility: hidden;"></textarea>
                        </td>
                    </tr>
                </table>
            </div>
            <div class="ft">
                <div class="action-field txt-c">
                    <asp:Button ID="ok" runat="server" class="btn" Text="保 存" OnClientClick="return checkAll();" OnClick="ok_Click" CommandName="add"></asp:Button>
                    &nbsp;
                <asp:Button ID="ok1" runat="server" class="btn" CommandName="contribute" OnClientClick="return checkAll();" OnClick="ok_Click" Text="保存并投稿"></asp:Button>
                    &nbsp;
                <asp:Button ID="cancel" runat="server" class="btn" Text="取 消" CausesValidation="False" OnClick="cancel_Click"></asp:Button>
                </div>
                <!--/action-field-->
            </div>
            <div>
                <input id="content1" type="hidden" name="content1" runat="server" />
            </div>
        </div>
        <script type="text/javascript" language="javascript">

            KindEditor.ready(function (K) {
                var WpEditor = K.create('textarea[name="content"]');

                var initcontxt = document.getElementById("content1");
                WpEditor.insertHtml(initcontxt.value);

                //编辑时加载内容
                contentTxt = WpEditor;
            });

        </script>
        <script type="text/javascript" language="javascript">

            // 显示分页标记
            function ShowPageTag(selectedIndex) {
                if (selectedIndex != 1) {
                    document.getElementById("pageTagA").style.display = "none";
                }
                else {
                    document.getElementById("pageTagA").style.display = "";
                }
            }
            //插入文章内容分页标记
            function InsertPagingTag() {
                contentTxt.focus();
                contentTxt.insertHtml("<button id=\"ZDSOFTPAGINGTAG\">分页标记</button>");
                contentTxt.focus();
            }

            //在保存之前,验证输入是否正确；将有效日期值转换成相应的有效天数
            function checkAll() {
                //验证
                if (checkAllValidate()) {
                    //判断内容是否为空
                    var etxtisempty = contentTxt.isEmpty();
                    if (etxtisempty) {
                        alert("文章内容不能为空！");
                        return false;
                    } else {
                        //获取文章内容
                        var gettxttitle = contentTxt.html();
                        var contxt = document.getElementById("content1");
                        contxt.value = gettxttitle;
                    }
                    return true;
                } else {
                    return false;
                }
            }

            ShowPageTag(document.all.pageType.selectedIndex);
        </script>
    </form>
</body>
</html>
