<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true" Inherits="Kesion.NET.WebSite.Admin.Course.KS_CosProp" Codebehind="KS.CosProp.aspx.cs" %>
<%@ Import Namespace="System.Text" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="Kesion.Publics" %>
<%@ Import Namespace="Kesion.Cache" %>
<%@ Import Namespace="Kesion.BLL" %>

<asp:Content ID="Content1" ContentPlaceHolderID="KSContent" runat="server">
 <!--  页面头部样式 -->
    
<link href="/admin/images/Main.css" rel="stylesheet" />
<link href="/admin/images/popup.css" rel="stylesheet" />
    <script>
        $(function () {
            //全选反选
            $("#selectAll").click(function () {
                if ($(this).is(":checked")) {
                    $(".courseList").find("input[type=checkbox]").attr("checked", true);//从父标签开始找
                }
                else {
                    $(".courseList").find("input[type=checkbox]").attr("checked", false);
                };
            }); 
        });
    </script>
     
    <asp:Panel ID="NewPanel2" runat="server"  Visible="true">
        <div id="manage_top" class="menu_top_fixed">
            <ul class="titleTab clearfix">
                <%if (Kesion.Cache.CommonJsonCache.CheckYunAPPHasAllow("plus.wenjuan"))
                { %>
	            <li id="p22"><a href="/Plus/Plus.wenjuan/KS.WJList.aspx">问卷题库</a></li>
                <%} %>
                <li id="p23"><a href="/<%=MyCache.GetCacheConfig(4) %>/exam/KS.SJ.aspx">试卷题库</a></li>
               <%if (Kesion.Cache.CommonJsonCache.CheckYunAPPHasAllow("plus.announce"))
                 { %>
	            <li id="p24"><a href="/Plus/Plus.Announce/KS.Announce.aspx">公告库</a></li>
                <%} %>
	            <li id="p25"><a href="/<%=MyCache.GetCacheConfig(4) %>/Course/KS.CosPropgame.aspx">游戏库</a></li>  
            </ul>
        </div>
 	 <div class="menu_top_fixed_height menu_top_fixed_height2"></div> 
        <asp:PlaceHolder ID="PlaceHolder1"  runat="server"></asp:PlaceHolder> 
         <div class="content-area">
             <div class="myTitle">
                  <div class="fr fd">
                 <span> 参与人数：<%=getzong(Utils.StrToInt(KSCMS.S("courseid"))) %> </span>
                 <span> 总参与率：<%=getcyl(Utils.StrToInt(KSCMS.S("courseid"))) %> </span></div>
                  道具管理<span class="titleTips">该课程下共<span id="zhangnum"></span>章，<span id="jienum"></span>节，<span id="shinum"></span>课时</span>
                 
                 <span class="look"><a href="?action=look&courseid=<%=KSCMS.S("courseid") %>">查看道具使用详情</a></span>
                 <span class="propOperat2 "> <a href="?action=deleteall&courseid=<%=KSCMS.S("courseid") %>" class="delebtn" onclick="return (confirm('确定清空道具么？此操作不可逆，请谨慎操作！'))">清空道具</a> </span>
                
             </div>
             <div class="courseKeshi">
        	    <div class="lineY"></div>
                <ul id="myloop">
            
        	    </ul>
            </div>
         </div>

        <script>
            $(document).ready(function(){
                getmyPeriod();
            });
            function getmyPeriod()
            {
                $.ajax({
                    type: 'Post',
                    datatype: 'text',
                    url: "?action=getperiod",
                    data: { courseID: <%=KSCMS.S("courseid")%>},
                    success: function (msg) {
                        msg=msg+"#&##&##&#";
                        $("#myloop").html(msg.split("#&#")[0]);
                        $("#zhangnum").html(msg.split("#&#")[1]);
                        $("#jienum").html(msg.split("#&#")[2]);
                        $("#shinum").html(msg.split("#&#")[3]);
                            
                        var num = $("#myloop li").length;
                        if(num==0){
                            $("#myloop").prev(".lineY").hide();
                            $("#myloop").html('<div class="empty">您还未添加任何课时</div>')
                        };
				
                        $("#myloop li").hover(function(){
                            $(this).find(".rButton").show();
                        },function(){
                            $(this).find(".rButton").hide();
                        });
				
                        $(".addButton").click(function(){
                            $(this).toggleClass("addOn");
                        });
				
                        $(".rButton .icon").hover(function(){
                            $(this).find("span").show();
                        },function(){
                            $(this).find("span").hide();
                        });
				
                        $(".rButton").click(function(){
                            doNone(click());
                        });
				        
                        $(".propOperat").each(function(){
                            var w = $(this).width()+10;
                            $(this).css("right","-"+w+"px");
                        })

                        //展开收缩
                        click();
                        function click(){
                            $(".chapter,.section").click(function(){
                                $(this).find(".menubtn").toggleClass("menubtn2");
                                $(this).next(".box").stop().slideToggle(300);
                            });
                        };
                        //是否添加按钮
                        $(".menubtn").each(function() {
                            var num = $(this).parent().next(".box").length;
                            if(num==0){
                                $(this).hide();
                            };
                        });
                        $(".chapterBox").each(function() {
                            var i = $(this).index()+1;
                            if(i>10){
                                $(this).find(".chapter .menubtn").addClass("menubtn2");
                                $(this).find(".chapter").siblings(".box").hide();
                            };
                        });
						
						
						
						$('.keshi').each(function (){
							var i = $(this).find(".tlBox").find(".sl").size();
							//console.log(i)
							var w = ($(this).find(".tlBox").width()-50)/i;
							$(this).find(".tlBox").children(".sl").width(w);
							$(this).find(".tlBox").children(".wu").width($(this).find(".tlBox").width());
						})	
						
                    }
                });
            }
        </script>
    </asp:Panel>
    
    <asp:Panel ID="PanelLook" runat="server" Visible="false">
        <div id="manage_top" class="menu_top_fixed">
             <%=title %>的使用记录
        </div>
        <div class="menu_top_fixed_height"></div>
        <div class="content-area">
            <table  width="99%" cellpadding="0" cellspacing="0" class="CTable">
                <tr class="CTitle">
                    <th></th>
                    <th>道具类型</th>
                    <th>学员名称</th>
                    <th>触发时间点(秒)</th>
                    <%--<th>获得奖励</th>--%>
                    <th>备注</th>
                    <th>添加时间</th>
                </tr>
                <asp:Repeater ID="Repeater1" runat="server">
                    <ItemTemplate>
                        <tr onmouseover="this.className=&#39;CtrMouseOver&#39;" onmouseout="this.className=&#39;CtrMouseOut&#39;">
                            <td class="Ctd"></td>
                            <td class="Ctd" align="center"><%#gettype(Utils.StrToInt(Eval("proptype"))) %></td>
                            <td class="Ctd" align="center"><%#Eval("username") %></td>
                            <td class="Ctd" align="center"><%#Eval("times") %></td>
                            <%--<td><%#Eval("award") %></td>--%>
                            <td class="Ctd"><%#Eval("remark") %></td>
                            <td class="Ctd" align="center"><%#Eval("adddate") %></td>
                        </tr>
                    </ItemTemplate>
                    <FooterTemplate>
                        <tr <%#Repeater1.Items.Count>0?"style='display:none'":"" %>>
                            <td colspan="6">
                                <div class="empty">
                                    暂无道具使用记录。
                                </div>
                            </td>
                        </tr>
                    </FooterTemplate>
                </asp:Repeater>
            </table>
            <KS:Page ID="Page1" runat="server" /> 
        </div>  
    </asp:Panel>

    <asp:Panel ID="LivePanel" runat="server" Visible="false">
        <div id="manage_top" class="menu_top_fixed">
            <ul>
              <%if (Kesion.Cache.CommonJsonCache.CheckYunAPPHasAllow("plus.wenjuan"))
                { %>
	            <li id="p22"><a href="/Plus/Plus.wenjuan/KS.WJList.aspx">问卷题库</a></li>
                <%} %>
                <li id="p23"><a href="/<%=MyCache.GetCacheConfig(4) %>/exam/KS.SJ.aspx">试卷题库</a></li>
               <%if (Kesion.Cache.CommonJsonCache.CheckYunAPPHasAllow("plus.announce"))
                 { %>
	            <li id="p24"><a href="/Plus/Plus.Announce/KS.Announce.aspx">公告库</a></li>
                <%} %>
	            <li id="p25"><a href="/<%=MyCache.GetCacheConfig(4) %>/Course/KS.CosPropgame.aspx">游戏库</a></li>  
            </ul>
        </div> 
 	 	<div class="menu_top_fixed_height menu_top_fixed_height2"></div> 
        <asp:PlaceHolder ID="PlaceHolder2"  runat="server"></asp:PlaceHolder>  
         
        <div class="content-area">
 
            <div class="myTitle">
                  <div class="fr fd">
                        <span> 总参与人数：<%=getzong(Utils.StrToInt(KSCMS.S("courseid"))) %> </span> 
                  </div> 
                  道具管理                  
                  <span class="titleTips"><%=title %></span>
                  <span class="look">
                        <a href="javascript:;"  onclick="parent.openWin('添加道具信息','course/KS.CosPropLive.aspx?courseid=<%=KSCMS.S("courseid") %>&periodid=<%=periodid %>',true,960,650)">选择道具信息</a>
                  </span>
                  <span class="propOperat2 "><a href="?action=deleteall&a=live&courseid=<%=KSCMS.S("courseid") %>&periodid=" class="delebtn" onclick="return (confirm('确定清空道具么？此操作不可逆，请谨慎操作！'))">清空道具记录信息</a></span>
 
            </div>
            <asp:Repeater ID="LivePropRepeater" runat="server">
                <HeaderTemplate> 
                    <table width="99%" cellpadding="0" cellspacing="0" class="CTable">
                       <tr class="CTitle">
                            <td>道具类型</td>
                            <td>所属课时信息</td>
                            <td>持续时间</td>
                            <td>绑定id/奖励信息</td>
                            <td>记录时间</td> 
                            <td>操作</td> 
                        </tr>
                </HeaderTemplate>
                <ItemTemplate> 
                    <tr onmouseover="this.className=&#39;CtrMouseOver&#39;" onmouseout="this.className=&#39;CtrMouseOut&#39;">
                        <td align="center"><%#   gettype(Utils.StrToInt(Eval("TYPE").ToString())) %></td>
                        <td align="center"><%# GetPeriodName(Utils.StrToInt(Eval("lessonids"))) %></td>
                        <td align="center"><%#Eval("times") %></td>
                        <td align="center"><%# GetBindInfo(Utils.StrToInt(Eval("bindid")),Utils.StrToInt(Eval("TYPE"))) %></td>
                        <td align="center"><%#Eval("addtime") %></td>
                        <td align="center">
                            <a href="?a=live&action=Enable&status=<%# Eval("Loadtype")%>&id=<%# Eval("propid")%>&courseid=<%#Eval("courseid") %>&periodid=<%#Eval("lessonids") %>"><%# Eval("Loadtype").ToString()=="0"?"启用操作":"关闭操作" %></a>
                            <a href="?a=live&action=delete&id=<%# Eval("propid")%>&courseid=<%#Eval("courseid") %>">删除</a>
                        </td>
                        
                    </tr>
                </ItemTemplate>
                <FooterTemplate>
                        <tr  <%#LivePropRepeater.Items.Count>0?"style='display:none'":"" %>>
                            <td colspan="4">
                                <div class="empty">
                                    暂无道具使用记录。
                                </div>
                            </td>
                        </tr>
                    </table>
                </FooterTemplate>
            </asp:Repeater>  
         	<KS:Page ID="Page2" runat="server" />  
        </div>
    </asp:Panel>

</asp:Content>
