<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="MediaList.aspx.vb" Inherits="Dingtai.Website.MediaList" %>
<%@ Register src="../../App_Data/Controls/PageControl.ascx" tagname="PageControl" tagprefix="uc1" %>

<!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 runat="server">
    <title>鼎太播客 &gt; 后台管理 &gt; 资源管理列表</title>    
</head>
<body onload="setTableBg();">
    <form id="form1" runat="server">
    <div id="body">
        <div id="title">                
            <div id="Div1">                 
              <h5>您现在的位置：<a href="#">后台管理</a> &gt; 资源列表</h5>
              <p><asp:LinkButton ID="LBAll" runat="server">所有</asp:LinkButton> | <asp:LinkButton ID="LBIsAppYes" runat="server">已审核</asp:LinkButton> | <asp:LinkButton ID="LBIsAppNot" runat="server">未审核</asp:LinkButton> | <asp:LinkButton ID="LBIsBest" runat="server">首页推荐</asp:LinkButton> | <asp:LinkButton ID="LBHot" runat="server">人气</asp:LinkButton> | <asp:LinkButton ID="LBIsConverted" runat="server">未转换</asp:LinkButton> | <asp:LinkButton ID="LBYin" runat="server">音频</asp:LinkButton></p>
              <asp:DropDownList ID="rpdHd" runat="server" CssClass ="list" AutoPostBack="True"></asp:DropDownList>
           </div>
        </div>
        <div id="box">
            <div id="an_box">
                <ul>
                    <li><a href ="#" ><div class="qx" alt="全选" onclick="SelectAll()"  /></a> </li>
                    <li><a href ="#" ><div class="fx" alt="反选"   onclick="Inverse()"/></a> </li>
                    <li><a href ="#" ><div class="dels" alt="批量删除" onclick="delMedias()"  /></a> </li>
                    <li><a href ="#" ><div class="plsh" alt="批量审核" onclick="isappsMedia(true)"  /></a> </li>
                    <li><a href ="#" ><div class="qxplsh" alt="取消审核" onclick="isappsMedia(false)"  /></a> </li>
                    <li><a href ="#" ><div class="pltj" alt="批量推荐"  onclick="isBestsMedia(true)" /></a> </li>
                    <li><a href ="#" ><div class="qxpltj" alt="取消推荐"  onclick="isBestsMedia(false)" /></a> </li>
                    <li><a href ="#" ><div class="plzd" alt="批量顶置"  onclick="UserTops(true)" /></a> </li>
                    <li><a href ="#" ><div class="qxplzd" alt="取消置顶"   onclick="UserTops(false)"/></a> </li>
                     <li><a href ="#"><div class="zxzh" alt="重新转换"  onclick="Converteds()" /></a> </li>
                </ul>
                <div class="search_box">
                     <asp:DropDownList ID="DrpWhere" runat="server" CssClass ="list" style="border:solid 1px #589210;">
                          <asp:ListItem Value="0">按标题</asp:ListItem>
                          <asp:ListItem Value="1">按用户</asp:ListItem>
                    </asp:DropDownList>
                    <asp:TextBox ID="txtWhere"  CssClass ="wbk" runat="server"></asp:TextBox>
                    <asp:ImageButton ID="imgSumbit" runat="server" ImageUrl ="/Skins/default/images/yl_an.gif" /> 
                </div>               
            </div> 
            <div class="body_box" id="body_box">
                <asp:Repeater ID="Repeater1" runat="server">
                   <HeaderTemplate >
                        <table id="t" class="table_bg" onclick="clickto()" onmousemove="fmove()" onmouseout="fout()" >
                            <tr  class="table_border">
                            <th>选择</th>
                            <th>下载</th>
                            <th>标题</th>
                            <th>用户</th>
                            <th>上传时间</th>
                            <th>点击数</th>
                            <th>属性</th>
                            <th>状态</th>
                            <th>操作</th>
                            </tr>
                   </HeaderTemplate>
                   <ItemTemplate>                                  
                            <tr  class="table_border2">
                            <td align ="center"><input type="checkbox" name="checkboxid" id="checkboxid" value="<%#Eval("ID") %>" /></td>
                             <td align ="center"><a  href ="<%#loadDownFile(Eval("ID").toString()) %>"><img alt=""  width ="15" height ="15" src="/Skins/default/images/JT.jpg" /></a></td>
                            <td align ="center" style="text-align:left; padding-left:5px;width: 50%;">[<asp:HyperLink ID="hlChannel" runat="server" Text ='<%#getChanNameByid(Eval("ChannelID").toString()) %>' style="color:red;"></asp:HyperLink>][<b style="color:Green"><%#getUploadType(Eval("UploadType"))%></b>]  <a href='<%#Dingtai.Output.Items.Cache_New.GetPagePath(Eval("ID").ToString(),False) %>' target="_blank"><%#Eval("Name")%></a></td>          
                            <td align ="center"><%#Eval("UserName")%></td>
                            
                             <td align ="center"><%#Eval("UploadDate")%></td>
                            <td align ="center"><%#Eval("TotalView")%></td>
                            <td align ="center"><asp:HyperLink ID="lblUserBest" runat="server" NavigateUrl="#"></asp:HyperLink>  <asp:HyperLink ID="lblUserTop" runat="server" NavigateUrl="#"></asp:HyperLink></td>
                            <td align ="center"><asp:HyperLink ID="hlAuthent" runat="server" NavigateUrl="#"></asp:HyperLink></td>
                            <td align ="center">
                                 <a href="#" onclick="delMedia('<%#Eval("ID") %>');" ><img alt="删除" src="/Skins/default/images/box_an6.gif"/></a>    
                                 <a href="MediaUpdate.aspx?id=<%#Eval("ID") %>"  ><img alt="编辑" src="/Skins/default/images/box_an9.gif"/></a>                           
                            </td>
                            </tr>
                   </ItemTemplate>
                   <FooterTemplate>
                       </table>
                   </FooterTemplate>
               </asp:Repeater>
               
                <uc1:PageControl ID="Page2" runat="server" ShowFirstLast="true" ShowPrevNext="true" 
                FirstPageText="首 页" LastPageText="末 页" PrevPageText="上一页" NextPageText="下一页" AlwaysShow="true" 
                ShowCustomInfoSec="left" NumericButtonCount="5" PagingButtonSpacing="15px" 
                CustomInfoHTML="当前 %CurrentPageIndex% 页 共 %PageCount% 页" />
            </div>           
        </div>
    </div>
    </form>
</body>
<script type = "text/javascript" language = "javascript">
 function delMedia(id){
//        M("aaa","body_box");
//        return;
        if (id == "") {
            M1("无参数传递!");
            return;
        }
        
        if (C("确认删除此视频?") == false)
        {
            return;
        }
        var ret = MediaList.DelMedia(id).value;
        if (ret == true)
        {
            M1("Success!");
            refreshPage(0);  
        }
    }
    function isappMedia(id,app)
    {
            if (id == "") {
            M1("无参数传递!");
            return;
        }
        var ret = MediaList.isappMedia(id,app).value;
        if (ret == true)
        {
            M1("Success!");
            refreshPage(0);  
        }
    }
    function Converted(id)
    {
            if (id == "") {
            M1("无参数传递!");
            return;
        }
        var ret = MediaList.Converted(id).value;
        if (ret == true)
        {
            M1("Success!");
            refreshPage(0);  
        }
    }
     function isappsMedia(lock){
        var ids = "";
//        alert(ids);  
        for (var i=0;i<document.form1.checkboxid.length;i++) {
            var e=document.form1.checkboxid[i];
            if ( e.checked) {
                ids = ids + e.value + ","
            }
        }      
        
        if (ids == ""){
            M1("请选择需要审核的视频!");
            return;
        }
       
        if (ids != "" && ids.lastIndexOf(",") == ids.length -1 ){
            ids = ids.substring(0,ids.length - 1)
        }
        
        ids = ids.split(",");
//        alert(ids);
        var ret = MediaList.isappsMedia(ids,lock ).value;
        if (ret == true)
        {
            M1("Success!");            
            refreshPage(0);  
        }
        else{
            M1("Faild!");            
        }        
    }
    
     function isBestsMedia(lock){
        var ids = "";
        for (var i=0;i<document.form1.checkboxid.length;i++) {
            var e=document.form1.checkboxid[i];
            if ( e.checked) {
                ids = ids + e.value + ","
            }
        }        
        if (ids == ""){
            M1("请选择需要推荐的视频!");
            return;
        }
       
        if (ids != "" && ids.lastIndexOf(",") == ids.length -1 ){
            ids = ids.substring(0,ids.length - 1)
        }
        
        ids = ids.split(",");
//        alert(ids);
        var ret = MediaList.isBestsMedia(ids,lock).value;
        if (ret == true)
        {
            M1("Success!");            
            refreshPage(0);  
        }
        else{
            M1("Faild!");            
        }        
    }
    
      function UserTops(lock){
        var ids = "";
        for (var i=0;i<document.form1.checkboxid.length;i++) {
            var e=document.form1.checkboxid[i];
            if ( e.checked) {
                ids = ids + e.value + ","
            }
        }        
        if (ids == ""){
            M1("请选择需要推荐的视频!");
            return;
        }
       
        if (ids != "" && ids.lastIndexOf(",") == ids.length -1 ){
            ids = ids.substring(0,ids.length - 1)
        }
        
        ids = ids.split(",");
//        alert(ids);
        var ret = MediaList.UserTops(ids,lock).value;
        if (ret == true)
        {
            M1("Success!");            
            refreshPage(0);  
        }
        else{
            M1("Faild!");            
        }        
    }
      function Converteds(){
        var ids = "";
        for (var i=0;i<document.form1.checkboxid.length;i++) {
            var e=document.form1.checkboxid[i];
            if ( e.checked) {
                ids = ids + e.value + ","
            }
        }        
        if (ids == ""){
            M1("请选择需要推荐的视频!");
            return;
        }
       
        if (ids != "" && ids.lastIndexOf(",") == ids.length -1 ){
            ids = ids.substring(0,ids.length - 1)
        }
        
        ids = ids.split(",");
//        alert(ids);
        var ret = MediaList.Converteds(ids,true ).value;
        if (ret == true)
        {
            M1("Success!");            
            refreshPage(0);  
        }
        else{
            M1("Faild!");            
        }        
    }
    function isBest(id,best)
    {
            if (id == "") {
            M1("无参数传递!");
            return;
        }
        var ret = MediaList.isBest(id,best ).value;
        if (ret == true)
        {
            M1("Success!");
            refreshPage(0);  
        }
    }
     function UserTop(id,top)
    {
            if (id == "") {
            M1("无参数传递!");
            return;
        }
        var ret = MediaList.UserTop(id,top ).value;
        if (ret == true)
        {
            M1("Success!");
            refreshPage(0);  
        }
    }
    
    function delMedias(){
        var ids = "";
        for (var i=0;i<document.form1.checkboxid.length;i++) {
            var e=document.form1.checkboxid[i];
            if ( e.checked) {
                ids = ids + e.value + ","
            }
        }        
        if (ids == ""){
            M1("请选择需要删除的视频!");
            return;
        }
        if (C("确认删除这些视频?") == false)
        {
            return;
        }
        if (ids != "" && ids.lastIndexOf(",") == ids.length -1 ){
            ids = ids.substring(0,ids.length - 1)
        }
        
        ids = ids.split(",");
//        alert(ids);
        var ret = MediaList.DelMedias(ids).value;
        if (ret == true)
        {
            M1("Success!");            
            refreshPage(0);  
        }
        else{
            M1("Faild!");            
        }        
    }
</script>
</html>
