<%@ Page Language="c#" Inherits="Web.User.auditContribute" CodeBehind="auditContribute.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" -->
    <link rel="stylesheet" href="../Editor/UserEditor/themes/default/default.css" />

    <script type="text/javascript" src="../Editor/UserEditor/kindeditor.js"></script>

    <script type="text/javascript" src="../Editor/UserEditor/lang/zh_CN.js" charset="utf-8"></script>

    <script type="text/javascript">
        //声明编辑器
        var listTxt;
        var contentTxt;
        jQuery(function ($) {
            //改用弹出层，因为201409发布的最新ghome开始不支持showModalDialog()
            $("#select").click(function () {
                return true;
            }).fancybox({
                'type': 'iframe',
                'width': 540,
                'height': 430,
                'hideOnOverlayClick': false,
                'href': 'selectBigClass.aspx?menuId=<%=menuId %>&bigClassId=<%=bigClassId %>'
            });
        })
    </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="Table2">
                    <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">
                                    作者：<asp:TextBox ID="author" runat="server" class="input-txt" MaxLength="50" Width="60"></asp:TextBox>
                                    作者信箱：<asp:TextBox ID="authorMail" runat="server" regex="/^(\w)+(\.\w+)*@(\w)+((\.\w{2,3}){1,3})$/"
                                        regexMsg="信箱格式不正确" class="input-txt" MaxLength="50" Width="108"></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="80">
                            <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>
                                </div>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <th>文章内容：</th>
                        <td>
                            <textarea id="eWebEditor1" name="content" style="width: 100%; height: 380px; visibility: hidden;" runat="server"></textarea>
                            <asp:Label ID="ContentLabel" runat="server"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <th><span class="blue">审核状态</span>：</th>
                        <td>
                            <asp:RadioButtonList ID="StateRadioButtonList" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow" onclick="javascript:call(4);" CssClass="fn-fl blue">
                            </asp:RadioButtonList>
                        </td>
                    </tr>
                    <tr>                        
                        <td colspan="2">
                            <table class="edit-table" id="submenu2">
                                <tbody>
                                    <tr>
                                        <th>抄送信息：
                                        </th>
                                        <td colspan="3">
                                            <asp:TextBox ID="txtDuplicateBigClass" runat="server" ReadOnly="True" class="input-txt w3"></asp:TextBox>
                                            <a href="javascript:void(0);" id="select"><span class="blue">选择抄送栏目</span></a>
                                            &nbsp;
                                    <a href="javascript:void(0);" onclick="clearDuplicate();"><span class="blue">取消抄送</span></a>
                                        </td>
                                    </tr>
                                    <tr>
                                        <th>副标题：
                                        </th>
                                        <td colspan="3">
                                            <asp:TextBox ID="subheading" runat="server" class="input-txt w3" MaxLength="250"></asp:TextBox>
                                            <asp:CheckBox ID="useSubHeading" runat="server" onclick="hiddenList();" Text="使用副标题" />
                                            <asp:CheckBox ID="useListTitle" runat="server" onclick="showsubmenu();" Text="使用链接标题" />&nbsp;&nbsp;
                                    <span id="spanzdyurl" style="display: none;">自定义网址：
                                    <asp:TextBox ID="txtZDYUrl" runat="server" class="input-txt w3" MaxLength="200">http://</asp:TextBox></span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <th>文章模板：
                                        </th>
                                        <td>
                                            <asp:DropDownList ID="itemType" runat="server" DataTextField="name" DataValueField="pkId" class="drop-txt">
                                            </asp:DropDownList>
                                        </td>
                                        <th>文章固顶：
                                        </th>
                                        <td style="min-width: 360px;">
                                            <asp:DropDownList ID="SetTop" runat="server" class="drop-txt">
                                            </asp:DropDownList>
                                            &nbsp;&nbsp;
                                    今日推荐：
                                    <asp:DropDownList ID="Setrecommand" runat="server" class="drop-txt">
                                    </asp:DropDownList>
                                        </td>
                                    </tr>
                                    <tr>
                                        <th>所属专题：
                                        </th>
                                        <td>
                                            <asp:DropDownList ID="special1" runat="server" DataTextField="name" DataValueField="pkId" class="drop-txt">
                                            </asp:DropDownList>
                                        </td>
                                        <th>部门：
                                        </th>
                                        <td>
                                            <asp:DropDownList ID="department" runat="server" DataTextField="name" DataValueField="pkId" class="drop-txt">
                                            </asp:DropDownList>
                                        </td>
                                    </tr>
                                    <tr>
                                        <th>浏览权限：
                                        </th>
                                        <td>
                                            <asp:DropDownList ID="gate" runat="server" class="drop-txt">
                                                <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>
                                        <th>显示等级：
                                        </th>
                                        <td>
                                            <asp:DropDownList ID="grade" runat="server" DataTextField="name" DataValueField="pkId" class="drop-txt">
                                            </asp:DropDownList>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                            <table class="edit-table" id="submenu1">
                                <tbody>
                                    <tr>
                                        <th>已有批注：
                                        </th>
                                        <td>
                                            <asp:DropDownList ID="ddlContributePostil" runat="server" DataTextField="title" DataValueField="content" onchange="javascript:InitContributePostil(this.value)">
                                            </asp:DropDownList>
                                        </td>
                                        <th>投稿批注：
                                        </th>
                                        <td style="min-width: 360px;">
                                            <asp:TextBox ID="RemarkTextBox" runat="server" class="input-txt w3 h3" MaxLength="250"></asp:TextBox>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </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>
                &emsp;
                <asp:Button ID="cancel" runat="server" class="btn" Text="取 消" CausesValidation="False"
                    OnClick="cancel_Click"></asp:Button>
            </div>
            <!--/action-field-->
        </div>
        <div align="center">
            <input id="content1" type="hidden" name="content1" runat="server" />
            <input id="hiddenName" runat="server" type="hidden" />
            <input id="hiddenValue" runat="server" type="hidden" />
        </div>
        </div>
        <script type="text/javascript">
            KindEditor.ready(function (K) {
                var editor = K.create('textarea[id="eWebEditor1"]');
                //编辑时加载内容
                var initcontxt = document.getElementById("content1");
                editor.insertHtml(initcontxt.value);
                contentTxt = editor;
            });

        </script>

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

            //显示列表标题
            function showsubmenu() {
                if (document.getElementById("useListTitle").checked == true) {
                    document.getElementById("useSubHeading").checked = false;
                    document.getElementById("spanzdyurl").style.display = "";
                }
                else {
                    document.getElementById("spanzdyurl").style.display = "none";
                }
            }
            //使用列表标题和使用副标题只能选一个
            function hiddenList() {
                if (document.getElementById("useSubHeading").checked == true) {
                    document.getElementById("useListTitle").checked = false;
                    document.getElementById("spanzdyurl").style.display = "none";
                }
            }

            // 显示分页标记
            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 ShowDialog(menuId, bigClassId)
            //	{
            //	    var arr = showModalDialog("./selectBigClass.aspx?menuId=" + menuId + "&bigClassId=" + bigClassId, window, "dialogWidth:30.5em; dialogHeight:22em;help:no;scroll:no;status:no");			
            //	}

            //取消抄送
            function clearDuplicate() {
                document.getElementById("txtDuplicateBigClass").value = "";
                document.getElementById("hiddenName").value = "";
                document.getElementById("hiddenValue").value = "";
            }

            //检查抄送栏目
            function checkform(optionName, optionValue) {
                if (optionName.LTrim().RTrim().length == 0) {
                    clearDuplicate();
                }
                if (optionName.indexOf("|") == 0) {
                    optionName = optionName.substring(1, optionName.length);
                    optionValue = optionValue.substring(1, optionValue.length);
                }
                document.getElementById("hiddenName").value = optionName;
                document.getElementById("hiddenValue").value = optionValue;
                document.getElementById("txtDuplicateBigClass").value = optionName;
            }

            String.prototype.Trim = function () {
                return this.replace(/(^\s*)|(\s*$)/g, "");
            }

            String.prototype.LTrim = function () {
                return this.replace(/(^\s*)/g, "");
            }

            String.prototype.RTrim = function () {
                return this.replace(/(\s*$)/g, "");
            }

            //审核状态判断
            function call(sid) {
                try {
                    for (var i = 0; i < 5; i++) {
                        //for (var i = 0; i < 4; i++) {
                        if (document.getElementById("StateRadioButtonList_" + i).checked && document.getElementById("StateRadioButtonList_" + i).value == 1) {
                            checkuserlisttitle();
                            //审核通过
                            $(".more-edit-data").toggle();
                            eval("submenu2.style.display=\"\";");
                            eval("submenu1.style.display=\"none\";");
                            break;
                        }
                        else if (document.getElementById("StateRadioButtonList_" + i).checked && (document.getElementById("StateRadioButtonList_" + i).value == 4 || document.getElementById("StateRadioButtonList_" + i).value == 3)) {
                            $(".more-edit-data").toggle();
                            eval("submenu2.style.display=\"none\";");
                            eval("submenu1.style.display=\"\";");
                            break;
                        }
                        else {

                            $(".more-edit-data").hide();
                            eval("submenu2.style.display=\"none\";");
                            eval("submenu1.style.display=\"none\";");
                        }
                    }
                    window.location.hash = "more-edit"   //  "more-edit" 为锚点的名字
                }
                catch (e) { }

                //        try {
                //            for (var i = 0; i < 5; i++) {
                //                if (document.getElementById("StateRadioButtonList_" + i).checked && (document.getElementById("StateRadioButtonList_" + i).value == 4 || document.getElementById("StateRadioButtonList_" + i).value == 3)) {
                //                    $(".more-edit-data").toggle();
                //                    eval("submenu2.style.display=\"none\";");
                //                    eval("submenu1.style.display=\"\";");
                //                    break;
                //                }
                //                else {
                //                    $(".more-edit-data").hide();
                //                    eval("submenu2.style.display=\"none\";");
                //                    eval("submenu1.style.display=\"none\";");
                //                }
                //            }
                //        }
                //        catch (e) { }

            }

            //在保存之前,验证输入是否正确；将有效日期值转换成相应的有效天数
            function checkAll() {
                //验证
                if (checkAllValidate()) {
                    //判断是否使用了副标题
                    if (document.getElementById("useSubHeading").checked == true) {
                        var usubhead = document.getElementById("subheading");
                        if (usubhead.value == "" || usubhead.value == null) {
                            alert("使用副标题时，副标题内容不能为空！");
                            return false;
                        }
                    }
                    //判断是否使用了链接标题
                    if (document.getElementById("useListTitle").checked == true) {
                        var uzdyurl = document.getElementById("txtZDYUrl");
                        if (uzdyurl.value == "" || uzdyurl.value == null) {
                            alert("使用链接标题时，自定义网址不能为空！");
                            return false;
                        }
                    }
                    try {
                        for (var i = 0; i < 5; i++) {

                            if (document.getElementById("StateRadioButtonList_" + i).checked && (document.getElementById("StateRadioButtonList_" + i).value == 4 || document.getElementById("StateRadioButtonList_" + i).value == 3)) {
                                var remarktxt = document.getElementById("<%= RemarkTextBox.ClientID%>").value;
                                if (remarktxt == "" || remarktxt == null) {
                                    alert("退稿或锁定退稿时，请添加原因批注！");

                                    return false;
                                }
                            }
                        }
                    }
                    catch (e) { }
                    //判断内容是否为空
                    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;
                }
            }

            //选择投稿批注同步添加批注内容
            function InitContributePostil(content) {
                document.getElementById("<%= RemarkTextBox.ClientID%>").value = content;
    }

    //若是选择使用列表标题 则加载列表标题显示 hezl
    function checkuserlisttitle() {
        var editult = document.getElementById("useListTitle");
        if (editult.checked == true) {
            document.getElementById("spanzdyurl").style.display = "";
        }
    }

    //判断页面是否加载完毕
    document.onreadystatechange = function () {
        if (document.readyState == "complete") {
            checkuserlisttitle();
            call(4);
        }
    }
    ShowPageTag(document.all.pageType.selectedIndex);
        </script>

    </form>
</body>
</html>
