<%@ Page Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true" Inherits="Kesion.NET.WebSite.Admin_ContentManage" Title="模型文档管理" Codebehind="KS.ContentManage.aspx.cs" %>
<%@ Import Namespace="Kesion.Cache" %>
<%@ Import Namespace="Kesion.BLL" %>
<%@ Import Namespace="Kesion.Publics"%>
<asp:Content ID="Content1" ContentPlaceHolderID="KSContent" Runat="Server">

<script type="text/javascript">
 <!--
   jQuery(document).ready(function(){
     jQuery("body").keydown(function()
     {
        if (event.ctrlKey)
		  switch  (event.keyCode)
		  {      
		  }
     });
   });

function GetMyIds() {
    var sid = null;
    for (var i = 0; i < document.getElementsByName("ids").length; i++) {
        var KS = document.getElementsByName("ids")[i];
        if (KS.checked == true) {
            if (sid == null)
                sid = KS.value;
            else
                sid += "," + KS.value;
        }
    }
    return sid;
 }
 function ContentAddSpecial(){
        var sid = GetMyIds();
        if (sid != null) parent.openWin("<%=itemName %>加入专题", "<%=KSCMS.GetInstallDir() + MyCache.GetCacheConfig(4)%>/Content/KS.ContentAddSpecial.aspx?ContentID=" + sid + "&ChannelID=<%=ChannelID%>", false,450, 400);
 }
function SetManageMenu(){
       parent.openWin("<%=itemName %>管理菜单项", "<%=KSCMS.GetInstallDir() + MyCache.GetCacheConfig(4)%>/Model/KS.FieldStatus.aspx?ChannelID=<%=ChannelID%>", true,550,200);
 }
 function doDelete() {
        var sid = GetMyIds();
        if (sid == null) {
            KesionJS.Alert("请选择要删除的<%=itemName%>");
            return false;
        } else {
            KesionJS.Confirm("确定删除选的<%=itemName%>?", 'location.href = "<%=KSCMS.GetInstallDir() + MyCache.GetCacheConfig(4)%>/content/KS.ContentManage.aspx?action=del&channelid=<%=ChannelID%>&classid=<%=ClassID%>&page=<%=CurrPage%>&ids=' + sid + "\";", "");
        }
    }
 function ContentSetAttribute(){
      var sid = GetMyIds();
      if (sid != null) parent.openWin("批量设置<%=itemName %>属性", "<%=KSCMS.GetInstallDir() + MyCache.GetCacheConfig(4)%>/Content/KS.ContentBatch.Aspx?ContentID=" + sid + "&ChannelID=<%=ChannelID %>", true,980,600);

}
function RefreshItem() {
    var sid = GetMyIds();
    if (sid != null) parent.openWin("批量生成<%=itemName %>HTML操作", "<%=KSCMS.GetInstallDir() + MyCache.GetCacheConfig(4)%>/Refresh/KS.RefreshHtml.Aspx?ChannelID=<%=ChannelID %>&refreshtype=itemids&action=content&ids=" + sid, false, 650, 250);
}
function ContentMove() {
    var sid = GetMyIds();
    if (sid != null) parent.openWin("<%=itemName %>批量移动", "<%=KSCMS.GetInstallDir() + MyCache.GetCacheConfig(4)%>/Content/KS.ClassMove.aspx?ContentID=" + sid + "&ChannelID=<%=ChannelID%>", true, 800, 360);

}
function keyWordFocus() {
    if (jQuery("#<%=this.KeyWord.ClientID %>").val() == '请输入关键字！') {
        jQuery("#<%=this.KeyWord.ClientID %>").val('');
    }
}
function keyWordBlur() {
    if (jQuery("#<%=this.KeyWord.ClientID %>").val() == '') {
        jQuery("#<%=this.KeyWord.ClientID %>").val('请输入关键字！');
    }
}
function doRejection(id) {
    top.openWin("退稿处理", "Content/KS.ContentRejection.aspx?infoid=" + id, false,700, 400);
}
function doBatchRejection() {
    var sid = GetMyIds();
    if (sid != '') top.openWin("批量退稿处理", "<%=KSCMS.GetInstallDir() + MyCache.GetCacheConfig(4)%>/Content/KS.ContentRejection.aspx?infoid=" + sid, true, 700, 400);
}
function SetDate() {
    var today = new Date();
    if ($("#showdate").is(":hidden")) {
        $("#showdate").show();
        $('#<%=TxtBeginDate.ClientID%>').val(today.getFullYear() + '-' + (today.getMonth() + 1) + '-01');
        $('#<%=TxtEndDate.ClientID%>').val(today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate());
    }
    else {
        $("#showdate").hide();
        $('#<%=TxtBeginDate.ClientID%>').val('');
        $('#<%=TxtEndDate.ClientID%>').val('');
    }
}
   $(function () {
        top.initialPrettyPhoto();
    })
  //-->    
</script>

		 
 <div class="listedit">
      
    <ul> 
<div class="floatLeft allCheck">
               <input type="checkbox" name="chkall" id="chkall" onclick="CheckAll(this.form);"/><label for="chkall">全选</label>
       </div>
        <%if (KSSecurity.CheckPower("content", MyCache.GetCacheModel(ChannelID, 1), 2)) { %> 
        	<li id='p3' class="fl"><a href="javascript:;" onclick="doDelete()" class="button">删除</a></li>
        <%} %>
       		<li id='p2' class="fl"><asp:LinkButton ID="batchMove" runat="server" CssClass="button">移动</asp:LinkButton></li>
       		<li id='p15' class="fl"><asp:LinkButton ID="LinkButton1" runat="server" OnClientClick="RefreshItem();return(GetIDS());" CssClass="button">生成HTML</asp:LinkButton></li> 
       	<%if (MyCache.GetCacheModel(ChannelID, 4) == "3") {%>
       		<li id='p5' class="fl"><a href="KS.DownServer.aspx" class="button">下载服务器</a></li> 
       	<%} %>
       	<%if (MyCache.GetCacheModel(ChannelID, 30) == "1")
           { %>
       		<li id='p3' class="fl"><a href="KS.RecycleBin.aspx" class="button">回收站</a></li> 
       	<%} %>
    </ul>
 </div>  

 <div class="content-area mt20">
          
    <div class="myTitle">
		<div class="fr headOperation">
        	<ul>
            	<%if (KSSecurity.CheckPower("content", KSSecurity.RemovePowerBadChar("Content/KS.Class.aspx"), 0)) { %>      
                    <li class="fl"><a href="javascript:;" onclick="SetManageMenu();" class="button">管理菜单</a></li>
              	<%} %>
				<%if (KSSecurity.CheckPower("content", MyCache.GetCacheModel(ChannelID, 1), 3) && Utils.StrToInt(KSCMS.GetCookie("Admin", "Role")) > 1) { %>
                    <li id="p14" class="fl"><asp:LinkButton ID="LkbVerify" OnClientClick="return(GetIDS());" runat="server" OnClick="Button1_Click" CssClass="button">批量<%=verifyName %></asp:LinkButton></li>
                    <li id="p13" class="fl"><asp:LinkButton ID="LkbUnVerify" OnClientClick="return(GetIDS());" runat="server" OnClick="Button2_Click" CssClass="button">取消<%=verifyName %></asp:LinkButton></li>
                <%} %>
                <%if (KSSecurity.CheckPower("content", MyCache.GetCacheModel(ChannelID, 1), 4)) { %>
                   <li id="p12" class="fl"><asp:LinkButton ID="LinkButton4" OnClientClick="return(GetIDS());" runat="server" OnClick="Button6_Click" CssClass="button">克隆</asp:LinkButton></li>
                <%} %>
                <%if (KSSecurity.CheckPower("", "Content/KS.ContentBatch.Aspx")) { %>
                   <div onmouseover="jQuery('#topcd').show();" onmouseout="jQuery('#topcd').hide();" class="fl liwrap">
                       <li id='p5' class="button">设置</li>
                       <div id="topcd" class="topcd" style="display:none">
                          	<asp:LinkButton ID="batchset" runat="server">按文档设置</asp:LinkButton>
                           	<a href="KS.ContentBatch.Aspx?channelid=<%=ChannelID %>">按模型设置</a>
                       </div>
                   </div>
                <%} %>
                <%if (KSSecurity.CheckPower("content", MyCache.GetCacheModel(ChannelID, 1), 5)) { %>
                    <li id='p4' class="fl"><asp:LinkButton ID="addspecial" runat="server" CssClass="button">加入专题</asp:LinkButton></li>
                <%} %>
            </ul>
        </div>
		
		<%=itemName %>管理   
          <% if (MyCache.GetModelSetting(ChannelID,22)=="1"&&!string.IsNullOrEmpty(Tp))
              {
                  int totalNum = Utils.StrToInt(DataFactory.GetOnlyValue("select count(1) From " + MyCache.GetCacheModel(ChannelID, 3)));
                  int recordNum = Utils.StrToInt(this.Page1.RecordCount);
          %>
         <span class="filterTips">数据库共有 <span class="num"><%=totalNum %></span> 条记录&nbsp;&nbsp;&nbsp;&nbsp; 
             <%if (recordNum < totalNum)
                 { %>筛选出 <span class="num"><%=this.Page1.RecordCount %> </span>条记录
             <%} %>
         </span>
           <% }
         %> 
    </div>
    <% if (MyCache.GetModelSetting(ChannelID, 22) == "1" && !string.IsNullOrEmpty(Tp))
        {
            KSCMS.W(@"<section class=""filterbox""><div class=""filtermore"">" + (GetFilterBoxStatus() == 1 ? "关闭" : "展开") + @">></div><ul>" + Tp + "</ul></section>");
     %>
    <script>
        var vHeight = 50;
        var boxHeight = 0;
        $(function () {
           
            boxHeight = $(".filterbox").height();
            if (boxHeight > vHeight) {
                $(".filtermore").show();
                
                $(".filtermore").click(function () {
                      initialFilterMore();
                    }
                );
            }
            if ("<%=GetFilterBoxStatus()%>" != "0") {
                $(".filterbox").height(boxHeight);
            } else {
                $(".filterbox").attr("style", "height:" + vHeight + "px;overflow:hidden");
            }
        });

        function initialFilterMore() {
            var v = $(".filtermore").html();
          
            var t = $(".filtermore");
            if (v.indexOf("关闭") ==-1) {
                $(".filterbox").height(boxHeight);
                    $(t).html("关闭>>");
                    SaveFilterValue(1);
            } else {
                $(".filterbox").attr("style", "height:" + vHeight + "px;overflow:hidden"); 
                    $(t).html("展开>>");
                    SaveFilterValue(0);
            }
        }
        function SaveFilterValue(v) {
           
            jQuery.ajax({
                type: "POST",
                url: "KS.ContentManage.aspx",
                data: "action=filterboxstatus&v="+v,
                success: function (data) {
                }
            });
        }
    </script>
     <%} %>
<div class="quickSearch clearfix">
          <div class="longquickSearch">
              <div class="quickSelect">
                    <select name="classid" style="width:150px;" OnChange="location.href='<%=KSCMS.GetInstallDir() + MyCache.GetCacheConfig(4)%>/Content/KS.ContentManage.Aspx?channelid=<%=ChannelID %>&classid='+this.value;">
                        <option value=0>快速跳转到栏目...</option>
                        <%=ClassManage.GetClassOptionByPurview(Convert.ToInt32(ChannelID), ClassID.ToString())%>
                    </select>
                    
              </div>
              <div class="SearchBox fl"> 
                  <asp:DropDownList ID="Condition" runat="server" style="margin-right:8px;">
                      <asp:ListItem Value="1">标题</asp:ListItem>
                      <asp:ListItem Value="2">录入者</asp:ListItem>
                      <asp:ListItem Value="3">作者</asp:ListItem>
                      <asp:ListItem Value="4">来源</asp:ListItem>
                      <asp:ListItem Value="5">文档ID</asp:ListItem>
                   </asp:DropDownList>
                   <asp:TextBox onfocus="keyWordFocus();" onblur="keyWordBlur();" style="color:#ccc;" Text="请输入关键字！" Width="180px" CssClass="textbox"  ID="KeyWord" runat="server"></asp:TextBox>
                   <!--<asp:CheckBox ID="CkbIsPic" runat="server" Text="图文" />-->
                   <b onclick="SetDate()" class="link-color">日期范围？</b>
                   <span id="showdate" <%if (this.TxtBeginDate.Text==""){ %> style="display:none"<%} %>>
                       <asp:TextBox ID="TxtBeginDate" placeholder="格式：YYYY-MM-DD" Width="120px" runat="server"  onclick="WdatePicker({dateFmt:&#39;yyyy-MM-dd&#39;});" CssClass="textbox Wdate"></asp:TextBox>至
                       <asp:TextBox ID="TxtEndDate" placeholder="格式：YYYY-MM-DD" Width="120px" runat="server" onclick="WdatePicker({dateFmt:&#39;yyyy-MM-dd&#39;});"  CssClass="textbox Wdate"></asp:TextBox>
                   </span>
                   <asp:Button ID="Button4" runat="server" CssClass="button" Text="开始搜索" OnClick="Button4_Click" />
              </div>
              <div class="property">
                    <div class="name button ml15">筛选</div>
                    <div class="propertyBox">
                        <asp:CheckBoxList ID="Attribute" runat="server" RepeatLayout="Flow" RepeatDirection="Horizontal" AutoPostBack="True" OnSelectedIndexChanged="Arrtibute_SelectedIndexChanged">
                            <asp:ListItem Value="1">推荐</asp:ListItem>
                            <asp:ListItem Value="2">热点</asp:ListItem>
                            <asp:ListItem Value="3">精彩</asp:ListItem>
                            <asp:ListItem Value="4">头条</asp:ListItem>
                            <asp:ListItem Value="5">滚动</asp:ListItem>
                            <asp:ListItem Value="6">幻灯</asp:ListItem>
                            <asp:ListItem Value="-1">图文</asp:ListItem>
                        </asp:CheckBoxList>
                        <ul class="tabs clearfix">
                            <span class="screen fl">审核状态：</span>
                            <li<%=KSCMS.S("showType")==""?" class='active'":string.Empty %>><a href="KS.ContentManage.aspx?<%=UtilsQueryParam.Get("showtype") %>"><span>所有<%=itemName %></span></a></li>
                            <li<%=KSCMS.S("showType")=="1"?" class='active'":string.Empty %>><a href="KS.ContentManage.aspx?showType=1&<%=UtilsQueryParam.Get("showtype") %>"><span>未审核</span></a></li>
                            <% if (MyCache.GetModelSetting(ChannelID, 21) == "1")
                                { %>
                            <li<%=KSCMS.S("showType") == "5" ? " class='active'" : string.Empty %>><a href="KS.ContentManage.aspx?showType=5&<%=UtilsQueryParam.Get("showtype") %>"><span>初审</span></a></li>
                            <li<%=KSCMS.S("showType") == "2" ? " class='active'" : string.Empty %>><a href="KS.ContentManage.aspx?showType=2&<%=UtilsQueryParam.Get("showtype") %>"><span>终审</span></a></li>
                            <%}else { %>
                            <li<%=KSCMS.S("showType") == "2" ? " class='active'" : string.Empty %>><a href="KS.ContentManage.aspx?showType=2&<%=UtilsQueryParam.Get("showtype") %>"><span>已审核</span></a></li>
                            <%} %>
                            <li<%=KSCMS.S("showType")=="3"?" class='active'":string.Empty %>><a href="KS.ContentManage.aspx?showType=3&<%=UtilsQueryParam.Get("showtype") %>"><span>草稿</span></a></li>
                            <li<%=KSCMS.S("showType")=="4"?" class='active'":string.Empty %>><a href="KS.ContentManage.aspx?showType=4&<%=UtilsQueryParam.Get("showtype") %>"><span>被退回</span></a></li>
                        </ul>
                        
                    </div>
              </div>
          </div>
          <div class="fr liwrap longliwrap">
              <asp:DropDownList ID="Order" runat="server" AutoPostBack="true" OnSelectedIndexChanged="Order_SelectedIndexChanged">
                    <asp:ListItem Value="infoid desc">信息ID降序</asp:ListItem>
                    <asp:ListItem Value="infoid asc">信息ID升序</asp:ListItem>
                    <asp:ListItem Value="adddate desc">更新时间降序</asp:ListItem>
                    <asp:ListItem Value="adddate asc">更新时间升序</asp:ListItem>
                    <asp:ListItem Value="commentnum desc">总评论数降序</asp:ListItem>
                    <asp:ListItem Value="commentnum asc">总评论数升序</asp:ListItem>
                    <asp:ListItem Value="hits desc">总浏览数降序</asp:ListItem>
                    <asp:ListItem Value="hits asc">总浏览数升序</asp:ListItem>
                    <asp:ListItem Value="hitsbymonth desc">月浏览数降序</asp:ListItem>
                    <asp:ListItem Value="hitsbymonth asc">月浏览数升序</asp:ListItem>
                    <asp:ListItem Value="hitsbyweek desc">周浏览数降序</asp:ListItem>
                    <asp:ListItem Value="hitsbyweek asc">周浏览数升序</asp:ListItem>
                    <asp:ListItem Value="hitsbyday desc">日浏览数降序</asp:ListItem>
                    <asp:ListItem Value="hitsbyday asc">日浏览数升序</asp:ListItem>
                    <asp:ListItem Value="newid()">随机显示</asp:ListItem>
              </asp:DropDownList>
              <asp:LinkButton ID="addclass" runat="server" OnClick="addclass_Click" CssClass="button button_on ml15">添加栏目</asp:LinkButton>
              <%if (KSSecurity.CheckPower("content", MyCache.GetCacheModel(ChannelID, 1), 0)) { %>
                    <asp:LinkButton ID="addsubject" runat="server" OnClick="addsubject_Click" CssClass="button button_on ml15">添加信息</asp:LinkButton>
              <%} %> 
          </div>
</div>   
    <KS:KSGV ID="List"  runat="server" AutoGenerateColumns="False" PagerType="CustomNumeric" Width="99%" OnRowCommand="list_RowCommand" EmptyDataText="还没有添加文档!" OnRowDataBound="list_RowDataBound" GridLines="None" OnRowCreated="List_RowCreated" CssClass="CTable">
        <Columns>
           
            <asp:TemplateField HeaderText="选择">
                <ItemStyle HorizontalAlign="Center"  Height="30px" Width="35px"/>
                <ItemTemplate>
               		<input type='checkbox'  name="ids" value="<%#Eval("Infoid") %>" />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="InfoID" HeaderText="ID号" Visible="false">
                <itemstyle horizontalalign="Center" width="40px" />
            </asp:BoundField>
            <asp:TemplateField HeaderText="标题">
                <itemtemplate>
                <a target="_blank" title="移动端URL" href="<%# Kesion.HtmlTags.BasicField.GetItemUrl(Utils.StrToInt(Eval("ChannelID")),Utils.StrToInt(Eval("InfoID")),Utils.StrToInt(Eval("ClassID"))) %>?f=m"><span class="<%# GetInfoPic(Convert.ToString(Eval("DefaultPic"))) %>_<%=MyCache.GetCacheModel(ChannelID,4) %>"></span></a>
                <a href="?channelid=<%# Eval("channelid") %>&classid=<%# Eval("classid") %>">[<%# MyCache.GetCacheClass(Convert.ToInt32(Eval("classid")),1) %>]</a>
                <a href="<%# Kesion.HtmlTags.BasicField.GetItemUrl(Utils.StrToInt(Eval("ChannelID")),Utils.StrToInt(Eval("InfoID")),Utils.StrToInt(Eval("ClassID"))) %>" target="_blank" title='<%# Eval("Title") %>' style='color:<%# Eval("titlefontcolor")%>'><%# Utils.CutStr(Convert.ToString(Eval("Title")),50) %></a>
                </itemtemplate>
            </asp:TemplateField> 
           
        </Columns>
        <EmptyDataRowStyle CssClass="emptycss" />
        <HeaderStyle CssClass="CTitle" />
    </KS:KSGV>
    <asp:Panel ID="Panel1" runat="server" Height="30px">
          <div style="margin-top:8px"></div>
            
        
             <span runat="server" id="showVerify" visible="false">

                  <%if (KSSecurity.CheckPower("content", MyCache.GetCacheModel(ChannelID, 1), 3))
                      {%>
                      <%
                          if (Utils.StrToInt(KSCMS.GetCookie("Admin", "Role")) == 2)
                          {
                           %>
                         <asp:Button ID="Button1" runat="server" Text="批量初审" OnClick="Button1_Click" />
                        <%}
                        else if (Utils.StrToInt(KSCMS.GetCookie("Admin", "Role")) == 3)
                        {%>
                        <asp:Button ID="Button2" CssClass="button" runat="server" Text="批量终审" OnClick="Button1_Click" />
                       <%}if (Utils.StrToInt(KSCMS.GetCookie("Admin", "Role")) > 1)
                           {%>
                        <asp:Button ID="Button9" OnClientClick="doBatchRejection()" runat="server" Text="批量退稿"/>
                 <%}
                 }%>
             </span>
             
   </asp:Panel>

     <KS:Page ID="Page1" runat="server" />

        <script type="text/javascript">
		showtips('<span class="state"><strong>说明：</strong><br /></span>属性中的各项含义：<font color=blue>荐</font>---推荐，<font color=red>热</font>---热门，<font color=#ff6600>彩</font>---精彩，头---头条，<font color=red>滚</font>---滚动，<font color=brown>幻</font>---幻灯，<font color=green>评</font>---允许评论<br />');
		</script>
    </div>    
</asp:Content>

