<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="subject.aspx.cs" Inherits="SearchEasy.SiteSearch.backend.subject" %>
<%@Register TagPrefix="Webdiyer" Namespace="Wuqi.Webdiyer" Assembly="aspnetpager"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>专题管理-搜易站内搜索引擎系统</title>
<link href="images/sdcms.css" rel="stylesheet" type="text/css" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<script language="javascript" src="images/sdcms.js" type="text/javascript"></script>
<script type="text/javascript" src="editor/xheditor/jquery.js"></script>
<script language="javascript" type="text/javascript">
function SelectAll(theBox)
{
    var elm=document.Form1.elements;
    for(i=0;i<elm.length;i++)
    if(elm[i].type=="checkbox" && elm[i].id!=theBox.id)
    {
        elm[i].checked=theBox.checked ;
    }
}

function CheckDeleteHandle(btn)
{
    var elm=document.Form1.elements;
    var flag = false ;
    for(i=0;i<elm.length;i++) 
    if(elm[i].type=="checkbox")
    {
        if (elm[i].checked)
        {
          flag = true ;
          break ;
        }
    }
    
    if (flag)
    { 
        return confirm('删除专题不可恢复，确认删除所选择的专题？') ;
    }
    else
    {
        alert("你没有选择任何专题，请选择！") ;
        return false ;
    }
}
</script>
</head>
<body>
<form id="Form1" runat="server">
<div class="sdcms_notice"><span>管理操作：
<asp:DropDownList runat="server" ID="ddlcategorys" DataTextField="categoryname" DataValueField="cid" /> <asp:TextBox ID="txtKeyword" runat="server"></asp:TextBox>&nbsp;<asp:Button ID="btnSearch" CssClass="bnt" runat="server" Text="搜索" onclick="btnSearch_Click" /> | 
    <asp:LinkButton runat="server" ID="lnkBuildIndexHtml" Text="生成专题首页" onclick="lnkBuildIndexHtml_Click" /> | <a href="buildsubject.aspx?t=2">批量生成新专题</a> | <a href="buildsubject.aspx?t=1">重新生成专题</a></span></div>
    
<div class="sdcms_notice">
<span style="color:Red">提示：模版在data/templates目录下；由于不同用户对专题的理解不同，暂不提供默认模版。具体请咨询<a href="http://www.searcheasy.net" target="_blank">搜易官方</a></span>
</div>
<br />
<ul id="sdcms_sub_title">
	<li class="sub"><a>专题</a></li>
</ul>
<div id="sdcms_right_b">
  <asp:DataGrid runat="server" ID="dgSubjectManager" AutoGenerateColumns="false" 
            BorderWidth="0" HorizontalAlign="Center" CellPadding="3" CellSpacing="1" 
            CssClass="table_b" HeaderStyle-CssClass="title_bg" 
            FooterStyle-BackColor="#ffffff" FooterStyle-HorizontalAlign="Center" FooterStyle-Height="33"
            UseAccessibleHeader="true" ShowFooter="false" ShowHeader="true" 
            DataKeyField="sid" onitemcommand="dgSubjectManager_ItemCommand" 
        onitemcreated="dgSubjectManager_ItemCreated">
     <Columns>
        <asp:TemplateColumn HeaderText="选择" ItemStyle-Height="33" ItemStyle-HorizontalAlign="Center">
           <ItemTemplate>
              <asp:CheckBox runat="server" ID="chkIsSelect" CssClass="input" />
           </ItemTemplate>
        </asp:TemplateColumn>
        <asp:TemplateColumn HeaderText="ID" ItemStyle-Height="33" ItemStyle-HorizontalAlign="Center">
           <ItemTemplate>
              <%# DataBinder.Eval(Container.DataItem, "sid")%>
           </ItemTemplate>
        </asp:TemplateColumn>
        <asp:TemplateColumn HeaderText="专题名称" ItemStyle-Height="33" ItemStyle-HorizontalAlign="Center">
           <ItemTemplate>
              <a href="<%# (bool)DataBinder.Eval(Container.DataItem, "isbuild") ? "/zt/" + DataBinder.Eval(Container.DataItem, "sid") + ".html" : "#"%>" target="_blank"><%# DataBinder.Eval(Container.DataItem, "subjectname")%></a>
           </ItemTemplate>
        </asp:TemplateColumn>
        <asp:TemplateColumn HeaderText="专题关键词" ItemStyle-Height="33" ItemStyle-HorizontalAlign="Center">
           <ItemTemplate>
              <%# DataBinder.Eval(Container.DataItem, "searchword")%>
           </ItemTemplate>
        </asp:TemplateColumn>
        <asp:TemplateColumn HeaderText="生成记录数" ItemStyle-Height="33" ItemStyle-HorizontalAlign="Center">
           <ItemTemplate>
              <%# DataBinder.Eval(Container.DataItem, "topiccount")%>
           </ItemTemplate>
        </asp:TemplateColumn>
        <asp:TemplateColumn HeaderText="所属分类" ItemStyle-Height="33" ItemStyle-HorizontalAlign="Center">
           <ItemTemplate>
              <%# GetCategoryName(DataBinder.Eval(Container.DataItem, "cid").ToString())%>
           </ItemTemplate>
        </asp:TemplateColumn>
        <asp:TemplateColumn HeaderText="创建时间" ItemStyle-Height="33" ItemStyle-HorizontalAlign="Center">
           <ItemTemplate>
              <%# DataBinder.Eval(Container.DataItem, "createdate")%>
           </ItemTemplate>
        </asp:TemplateColumn>
        <asp:TemplateColumn HeaderText="生成状态" ItemStyle-Height="33" ItemStyle-HorizontalAlign="Center">
           <ItemTemplate>
              <%# (bool)DataBinder.Eval(Container.DataItem, "isbuild") ? "已生成" : "未生成"%>
           </ItemTemplate>
        </asp:TemplateColumn>
        <asp:TemplateColumn HeaderText="浏览次数" ItemStyle-Height="33" ItemStyle-HorizontalAlign="Center">
           <ItemTemplate>
              <%# DataBinder.Eval(Container.DataItem, "hits")%>
           </ItemTemplate>
        </asp:TemplateColumn>
        <asp:TemplateColumn HeaderText="操作" ItemStyle-HorizontalAlign="Center">
             <ItemTemplate>
               <a href="subjectedit.aspx?sid=<%# DataBinder.Eval(Container.DataItem, "sid")%>&action=edit">编辑</a> | <asp:LinkButton runat="server" ID="lnkBuildHtml" CommandArgument="BuildHtml" Text="生成Html" /> | <asp:LinkButton runat="server" ID="lnkDelete" CommandArgument="DeleteInfo" Text="删除" />
             </ItemTemplate>
        </asp:TemplateColumn>
     </Columns>
  </asp:DataGrid> 
  <table border="0" align="center" cellpadding="3" cellspacing="1" class="table_b">
  <tr>
    <td colspan="9" class="tdbg" align="left">
    <asp:CheckBox runat="server" ID="chkSelectAll" ToolTip="全选/否选" />全选/否选 
        <asp:Button runat="server" ID="btnBatchDelete" Text="删除所选专题" onclick="btnBatchDelete_Click" /> 
     </td>
  </tr>
  </table>
  <table border="0" align="center" cellpadding="3" cellspacing="1" class="table_b">
   <tr>
     <td colspan="9" class="tdbg">
     <webdiyer:AspNetPager id="pager" runat="server" AlwaysShow="True" 
             ShowCustomInfoSection="Left" Width="80%"  ShowSelectBox="Never" 
             onpagechanged="pager_PageChanged"></webdiyer:AspNetPager>
      <asp:Literal runat="server" ID="ltlLicenceTips" />
     </td>
   </tr>
  </table>
  
</div>
</form>
</body>
</html>
