<%@ Page Language="c#" Inherits="Web.User.auditSiteContribute" CodeBehind="auditSiteContribute.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/head.htm" -->
    <!--#include file = "../Css/userCssEdit.htm" -->
</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="input-md">
                        </asp:DropDownList>
                        &nbsp;<span class="lgrey">当前文章的投稿去向</span>
                    </td>
                </tr>
                <tr>
                    <th>
                        文章标题：
                    </th>
                    <td>
                        <asp:TextBox ID="intactTitle" runat="server" notNull="true" msgName="文章标题" class="input-md w3"
                            MaxLength="250"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="*"
                            ControlToValidate="intactTitle"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <th>
                        相关信息：
                    </th>
                    <td>
                        <asp:TextBox ID="about" runat="server" regex="[^&quot;^'^\*^\?^,^\.^(^)]+" regexMsg="相关信息格式不正确"
                            MaxLength="50" class="input-md w3"></asp:TextBox>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="非法字符串！"
                            ControlToValidate="about" ValidationExpression="[^&quot;^'^\*^\?^,^\.^(^)]+"></asp:RegularExpressionValidator>
                        <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-md" MaxLength="50" Width="60"></asp:TextBox>
                        作者信箱：<asp:TextBox ID="authorMail" runat="server" regex="/^(\w)+(\.\w+)*@(\w)+((\.\w{2,3}){1,3})$/" regexMsg="信箱格式不正确" class="input-md" MaxLength="50" Width="108"></asp:TextBox>
                        &emsp;来源：<asp:TextBox ID="copyFrom" runat="server" class="input-md" MaxLength="50" Width="108"></asp:TextBox>
                        来源地址：
                        <asp:TextBox ID="copyFromLink" runat="server" class="input-md" MaxLength="50" Width="108"></asp:TextBox>
                        &emsp;内容分页：
                                <asp:DropDownList ID="pageType" runat="server" CssClass="input-md" Width="80" onchange="ShowPageTag(this.selectedIndex);">
                                    <asp:ListItem Value="0">不分页</asp:ListItem>
                                    <asp:ListItem Value="2">手动分页</asp:ListItem>
                                </asp:DropDownList>
                                &nbsp; <a id="pageTagA" href="javascript:void(0);" onclick="InsertPagingTag();" data-toggle="tooltip" data-placement="bottom" 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 name="content" style="width: 100%; height: 480px; visibility: hidden;"></textarea>
                        <asp:Label ID="ContentLabel" runat="server" Visible="False"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <th>
                        <span class="blue">审核状态</span>：
                    </th>
                    <td>
                        <asp:RadioButtonList ID="StateRadioButtonList" runat="server" RepeatDirection="Horizontal"
                            onclick="javascript:call(4)" CssClass="pull-left" RepeatLayout="Flow">
                            <asp:ListItem Value="0">未审核&emsp;</asp:ListItem>
                            <asp:ListItem Value="1">审核通过&emsp;</asp:ListItem>
                            <asp:ListItem Value="2">审核未通过</asp:ListItem>
                        </asp:RadioButtonList>
                        &emsp;&emsp;
                        <asp:CheckBox ID="CBdownfile" runat="server" Text="审核通过后将内容中的附件保存到本地" />
                    </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-md w3"></asp:TextBox>
                                        <a href="javascript:void(0);" id="select" style="cursor: hand"><span class="blue">选择抄送栏目</span></a>
                                        &nbsp; <a href="javascript:void(0);" onclick="clearDuplicate();" style="cursor: hand">
                                            <span class="blue">取消抄送</span></a>
                                    </td>
                                </tr>
                                <tr>
                                    <th>
                                        副标题：
                                    </th>
                                    <td colspan="3">
                                        <asp:TextBox ID="subheading" runat="server" class="input-md 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-md w3" MaxLength="200">http://</asp:TextBox>
                                        </span>
                                    </td>
                                </tr>
                                <tr>
                                    <th>
                                        文章模板：
                                    </th>
                                    <td>
                                        <asp:DropDownList ID="itemType" runat="server" DataTextField="name" DataValueField="pkId"
                                            class="input-md">
                                        </asp:DropDownList>
                                    </td>
                                    <th>
                                    </th>
                                    <td style="min-width: 360px;">
                                    </td>
                                </tr>
                                <tr>
                                    <th>
                                        所属专题：
                                    </th>
                                    <td>
                                        <asp:DropDownList ID="special1" runat="server" DataTextField="name" DataValueField="pkId"
                                            class="input-md">
                                        </asp:DropDownList>
                                    </td>
                                    <th>
                                        部门：
                                    </th>
                                    <td>
                                        <asp:DropDownList ID="department" 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>
                                    <th>
                                        显示等级：
                                    </th>
                                    <td>
                                        <asp:DropDownList ID="grade" runat="server" DataTextField="name" DataValueField="pkId"
                                            class="input-md">
                                        </asp:DropDownList>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                        <table class="edit-table" id="submenu1">
                            <tbody>
                                <tr>
                                    <th>
                                        投稿批注：
                                    </th>
                                    <td>
                                        <asp:TextBox ID="RemarkTextBox" runat="server" class="input-md w3 h3" MaxLength="250"></asp:TextBox>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </td>
                </tr>
            </table>
        </div>
        <div class="ft">
            <div class="action-field text-center">
                <asp:Button ID="ok" runat="server" Text="保 存" OnClick="ok_Click" CommandName="add"
                    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 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>
    </form>
    <!--#include file = "../Css/foot.htm" -->
      <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>
</body>
</html>

<script type="text/javascript">
    
    KindEditor.ready(function(K) {
//				var editor = K.create('textarea[name="content"]',{
//				width : '850'//防止首次打开样式错乱
//				});
				var editor = K.create('textarea[name="content"]');
				
				//编辑时加载内容
                var initcontxt=document.getElementById("content1");
                    editor.insertHtml(initcontxt.value);
                    
                    contentTxt=editor;
			});
			
</script>

<script 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 < 3; 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 == 2)
                {
                    $(".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 < 3; i++) {
            
                    if(document.getElementById("StateRadioButtonList_" + i).checked && document.getElementById("StateRadioButtonList_" + i).value == 2)
                    {
                        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 ;
        }
    }


    //若是选择使用列表标题 则加载列表标题显示 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>

