<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true" Inherits="Kesion.NET.WebSite.Admin.Course.KS_LiveRoom" Codebehind="KS.LiveRoom.aspx.cs" %>

<%@ Import Namespace="Kesion.Cache" %>
<%@ Import Namespace="Kesion.BLL" %>
<%@ Import Namespace="Kesion.Course" %>
<%@ Import Namespace="Kesion.APPCode" %>
<%@ Import Namespace="Kesion.Publics" %>
<asp:Content ID="Content1" ContentPlaceHolderID="KSContent" runat="server">
    <KS:TopNav ID="TopNav2" runat="server" Text="云视频口管理" />

    <!--  直播房间的管理 -->
    <asp:Panel ID="ListPanel" runat="server" Width="100%">
        <div class="content-area">
            <div id="manage_top" class="menu_top_fixed">

                <ul>
                    <%if (KSCMS.S("livetype") == "-1")//百家云直播添加方式
                        { %>
                    <li id='p1'>&nbsp;<asp:LinkButton ID="AddLiveBJ" runat="server" OnClick="AddLiveBJ_Click"><b></b>添加直播间</asp:LinkButton></li>
                    <li id='p1'>&nbsp;<asp:LinkButton ID="RefreshLive" runat="server" OnClick="RefreshLive_Click"><b></b>同步直播间</asp:LinkButton></li>
                    <% } %>
                    <% if (KSCMS.S("livetype") == "5")    //拓课云直播添加房间
                        { %>
                    <li id='p1'>&nbsp;<asp:LinkButton ID="AddLiveRoom" runat="server" OnClick="AddLiveRoom_Click"><b></b>添加直播间</asp:LinkButton></li>
                    <%}
                        else if (KSCMS.S("livetype") != "6")
                        { %>
                    <li id='p1'>&nbsp;<asp:LinkButton ID="addclassbutton" runat="server" OnClick="addclassbutton_Click"><b></b>回收闲置直播间</asp:LinkButton></li>
                    <% if (KSCMS.S("livetype") == "1")
                        {//保利威视的同步方法%>
                    <li id='p1'>&nbsp;<asp:LinkButton ID="LinkButton3" runat="server" OnClick="LinkButton3_Click"><b></b>同步直播间</asp:LinkButton></li>
                    <% } %>
                    <%} %>
                    <%if (KSCMS.S("livetype") == "6")
                        { //CC视频直播同步信息%>
                    <li id='p1'>&nbsp;
                        <asp:LinkButton ID="LinkButton1" runat="server" OnClick="addccbutton_Click"><b></b>同步直播间</asp:LinkButton></li>
                    <%}%>
                    <div class="clear"></div>
                </ul>
            </div>

            <div class="tabs_header">
                <ul class="tabs">
                    <li <%=KSCMS.S("Type")==""?" class='active'":string.Empty %>><a href="KS.LiveRoom.Aspx?<%=UtilsQueryParam.Get("type") %>"><span>所有</span></a></li>
                    <li <%=KSCMS.S("Type")=="1"?" class='active'":string.Empty %>><a href="KS.LiveRoom.Aspx?Type=1&<%=UtilsQueryParam.Get("type") %>"><span>未审核</span></a></li>
                    <li <%=KSCMS.S("Type")=="2"?" class='active'":string.Empty %>><a href="KS.LiveRoom.Aspx?Type=2&<%=UtilsQueryParam.Get("type") %>"><span>已审核</span></a></li>
                </ul>
            </div>
            <KS:KSGV ID="ProListView" runat="server" AutoGenerateColumns="False" GridLines="None"
                PagerType="CustomNumeric" OnRowCreated="ProListView_RowCreated" OnRowDataBound="ProListView_RowDataBound" OnRowCommand="ProListView_RowCommand" Width="99%" EnableTheming="True" CssClass="CTable" EmptyDataText="没有记录!">
                <Columns>
                    <asp:TemplateField HeaderText="&lt;input type='checkbox' name='chkall' id='chkall' onClick='CheckAll(this.form);'/&gt;">
                        <ItemStyle HorizontalAlign="Center" Width="20px" />
                        <ItemTemplate>
                            <input type="checkbox" name="ids" id="ids" value="<%#Eval("id") %>" />
                        </ItemTemplate>
                    </asp:TemplateField>

                    <asp:TemplateField HeaderText="标题">
                        <ItemStyle HorizontalAlign="left" Width="160px" />
                        <ItemTemplate>
                            <%#Eval("title") %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="类型">
                        <ItemStyle HorizontalAlign="Center" Width="120px" />
                        <ItemTemplate>
                            <%#getTypeLiveType(Utils.StrToInt(Eval("livetype"))) %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="推流地址">
                        <ItemStyle HorizontalAlign="Center" Width="60px" />
                        <ItemTemplate>

                            <%#getliveRoom(Utils.StrToInt(Eval("livetype").ToString()),Utils.StrToInt(Eval("accountid").ToString()),Eval("Uid").ToString(),Eval("roomid").ToString()) %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="房间号">
                        <ItemStyle HorizontalAlign="Center" Width="60px" />
                        <ItemTemplate>
                            <%#Eval("roomid").ToString() %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="状态">
                        <ItemStyle HorizontalAlign="Center" Width="60px" />
                        <ItemTemplate>
                            <%#Utils.StrToInt(Eval("status"))==1?"<font color=green>直播中</font>":"未分配" %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="时间">
                        <ItemStyle HorizontalAlign="Center" Width="150px" />
                        <ItemTemplate>
                            <%#Eval("adddate") %>
                        </ItemTemplate>
                    </asp:TemplateField>

                    <asp:TemplateField HeaderText="管理操作">
                        <ItemStyle Width="130px" HorizontalAlign="Center" />
                        <ItemTemplate>
                            <%if (KSCMS.S("livetype") == "6")
                                { %>
                            <asp:LinkButton runat="server" ID="LinkButton2" CommandArgument='<%#Eval("id") %>' CommandName="del" CssClass="link-color">关闭</asp:LinkButton>
                            <%} else  { %>
                            <asp:LinkButton runat="server" ID="delete" CommandArgument='<%#Eval("id") %>' CommandName="del" CssClass="link-color">删除</asp:LinkButton>
                            <%} %>
                            <%if (KSCMS.S("livetype") == "5" || KSCMS.S("livetype") == "1"||KSCMS.S("livetype") == "-1")
                                { %>
                            <asp:LinkButton runat="server" ID="modify" CommandArgument='<%#Eval("id") %>' CommandName="modify" CssClass="link-color">修改</asp:LinkButton>
                            <%} %>
                        </ItemTemplate>
                    </asp:TemplateField>

                </Columns>
                <HeaderStyle CssClass="CTitle" />
                <EmptyDataRowStyle CssClass="emptycss" />
            </KS:KSGV>
            <KS:Page ID="Page1" runat="server" />
        </div>
    </asp:Panel>

    <!-- 添加直播间  -->
    <asp:Panel ID="Addlive" runat="server" Width="100%" Visible="false">
        <KS:TopNav ID="TopNav1" runat="server" Text="直播间管理" />
        <div class="content-area">

            <table width="99%" align="center" border="0" cellpadding="1" cellspacing="1" class="CTable">
                <tr>
                    <td class="lefttd" height="30" align="right" style="width: 198px"><strong>标题：</strong></td>
                    <td class="righttd">&nbsp;<asp:TextBox CssClass="textbox" ID="TxtTitle" runat="server"></asp:TextBox></td>
                </tr>
                <tr>
                    <td align="right" class="lefttd" height="30" style="width: 198px">
                        <strong><span style="background-color: #f0f9fe">类型</span>：</strong></td>
                    <td class="righttd">
                        <asp:DropDownList ID="LiveType" runat="server" onchange="getaccountlist(this.value)">
                        </asp:DropDownList>
                        <span id="showaccount" style="display: none">
                            <select name="accountid" id="accountlist">
                            </select></span>
                    </td>
                </tr>

                <tr>
                    <td align="right" class="lefttd" height="30" style="width: 198px">
                        <strong>状态：</strong>
                    </td>
                    <td class="righttd">
                        <asp:RadioButtonList ID="RdbStatus" runat="server" RepeatDirection="horizontal">
                            <asp:ListItem Value="1" Selected="true">正常</asp:ListItem>
                            <asp:ListItem Value="0">停用</asp:ListItem>
                        </asp:RadioButtonList>
                    </td>
                </tr>
            </table>
            <br />
            <KS:Foot ID="Foot1" runat="server" OnSubmit="Foot1_Submit" />
            <script>

                jQuery(document).ready(function () {

                    getaccountlist(0);

                });
                function getaccountlist(cid) {

                    var id = jQuery("#<%=this.LiveType.ClientID%> option:selected").val();
                    var pid ='<%=pid%>';
                    if (id != '0') {
                        jQuery.get("KS.LiveRoom.aspx", { a: "accountlist", id: id, pid: pid },
                            function (data) {

                                if (data != null && data != '') {
                                    jQuery("#showaccount").show();
                                    jQuery("#accountlist").empty().append("<option value='0'>请选择...</option>").append(data);
                                } else {
                                    jQuery("#showaccount").hide();
                                    jQuery("#accountlist").empty().append("<option value=''>请选择...</option>");
                                }
                            });
                    }
                }
            </script>


            <script type="text/javascript">
                showtips('<span class="state"><strong>说明：</strong><br /></span>所有直播间由后台统一管理!');
            </script>
        </div>
    </asp:Panel>

    <!-- 添加直播的房间信息  拓课云 -->
    <asp:Panel ID="AddRoom" runat="server" Visible="false">
        <div class="content-area">
            <div style="display: none;">&nbsp;<asp:TextBox ID="TextBox1" runat="server" Text="0"></asp:TextBox></div>
            <table width="99%" align="center" border="0" cellpadding="1" cellspacing="1" class="CTable">
                <tr>
                    <td class="lefttd" height="30" align="right" style="width: 198px"><strong>房间名：</strong></td>
                    <td class="righttd">&nbsp;<asp:TextBox CssClass="textbox" ID="LiveRoomName" runat="server"></asp:TextBox></td>
                </tr>
                <tr>
                    <td class="lefttd" height="30" align="right" style="width: 198px"><strong>班级类型：</strong></td>
                    <td class="righttd">&nbsp;<asp:RadioButtonList ID="ClassType" runat="server" RepeatDirection="Horizontal">
                        <asp:ListItem Value="0" Selected="True">小班课</asp:ListItem>
                        <asp:ListItem Value="1">中班课</asp:ListItem>
                    </asp:RadioButtonList></td>
                </tr>
                <tr>
                    <td class="lefttd" height="30" align="right" style="width: 198px"><strong>主席密码：</strong></td>
                    <td class="righttd">&nbsp;<asp:TextBox CssClass="textbox" ID="Pwd1" runat="server" Text="123456"></asp:TextBox></td>
                </tr>
                <tr>
                    <td class="lefttd" height="30" align="right" style="width: 198px"><strong>助教密码：</strong></td>
                    <td class="righttd">&nbsp;<asp:TextBox CssClass="textbox" ID="Pwd2" runat="server" Text="123456"></asp:TextBox></td>
                </tr>
                <tr>
                    <td class="lefttd" height="30" align="right" style="width: 198px"><strong>巡课密码：</strong></td>
                    <td class="righttd">&nbsp;<asp:TextBox CssClass="textbox" ID="Pwd4" runat="server" Text="123456"></asp:TextBox></td>
                </tr>
                <tr>
                    <td class="lefttd" height="30" align="right" style="width: 198px"><strong>学生密码是否需要：</strong></td>
                    <td class="righttd">&nbsp;<asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Horizontal">
                        <asp:ListItem Value="0" Selected="True">不需要</asp:ListItem>
                        <asp:ListItem Value="1">需要</asp:ListItem>
                    </asp:RadioButtonList></td>
                </tr>
                <tr>
                    <td class="lefttd" height="30" align="right" style="width: 198px"><strong>学生密码：</strong></td>
                    <td class="righttd">&nbsp;<asp:TextBox CssClass="textbox" ID="Pwd3" runat="server" Text="123456"></asp:TextBox>
                </tr>
                <tr>
                    <td class="lefttd" height="30" align="right" style="width: 198px"><strong>是否允许旁听用户参加：</strong></td>
                    <td class="righttd">&nbsp;<asp:RadioButtonList ID="RadioButtonList2" runat="server" RepeatDirection="Horizontal">
                        <asp:ListItem Value="0" Selected="True">不需要</asp:ListItem>
                        <asp:ListItem Value="1">需要</asp:ListItem>
                    </asp:RadioButtonList></td>
                </tr>
                <tr>
                    <td class="lefttd" height="30" align="right" style="width: 198px"><strong>旁听用户密码：</strong></td>
                    <td class="righttd">&nbsp;<asp:TextBox CssClass="textbox" ID="TextBox7" runat="server" Text="123456"></asp:TextBox></td>
                </tr>
                <tr>
                    <td class="lefttd" height="30" align="right" style="width: 198px"><strong>视频分辨率：</strong></td>
                    <td class="righttd">&nbsp;<asp:RadioButtonList ID="RadioButtonList4" runat="server" RepeatDirection="Horizontal">
                        <asp:ListItem Value="0" Selected="True">流畅</asp:ListItem>
                        <asp:ListItem Value="1">标清</asp:ListItem>
                        <asp:ListItem Value="2">高清</asp:ListItem>
                        <asp:ListItem Value="3">超清</asp:ListItem>
                    </asp:RadioButtonList></td>
                </tr>
                <tr>
                    <td class="lefttd" height="30" align="right" style="width: 198px"><strong>帧率：</strong></td>
                    <td class="righttd">&nbsp;<asp:TextBox CssClass="textbox" ID="TextBox9" runat="server" Text="10"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="lefttd" height="30" align="right" style="width: 198px"><strong>自动开启音视频：</strong></td>
                    <td class="righttd">&nbsp;<asp:RadioButtonList ID="RadioButtonList3" runat="server" RepeatDirection="Horizontal">
                        <asp:ListItem Value="0" Selected="True">不需要</asp:ListItem>
                        <asp:ListItem Value="1">需要</asp:ListItem>
                    </asp:RadioButtonList></td>
                </tr>
                <tr>
                    <td colspan="2">
                        <div class="tips">
                            注意信息：<br />
                            1.帧率10,15,20,25,30    范围
                        </div>
                    </td>
                </tr>
            </table>
            <div>
                <asp:Button ID="Button1" CssClass="button" runat="server" Text="确定保存" OnClick="Button1_Click" />
            </div>
        </div>
    </asp:Panel>

    <!-- 修改保利威视的房间密码信息 -->
    <asp:Panel ID="EditPlovyRoom" runat="server" Visible="false">
        <div class="content-area">
            <table width="99%" align="center" border="0" cellpadding="1" cellspacing="1" class="CTable">
                <tr>
                    <td class="lefttd" height="30" align="right" style="width: 198px"><strong>标题：</strong></td>
                    <td class="righttd">
                        <asp:TextBox CssClass="textbox" ID="TxtPolyvTitle" ReadOnly="true" runat="server"></asp:TextBox></td>
                </tr>
                <tr>
                    <td class="lefttd" height="30" align="right" style="width: 198px"><strong>房间号：</strong></td>
                    <td class="righttd">
                        <asp:TextBox CssClass="textbox" ID="TxtPolyvRoomID" ReadOnly="true" runat="server"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="lefttd" height="30" align="right" style="width: 198px"><strong>密码：</strong></td>
                    <td class="righttd">
                        <asp:TextBox CssClass="textbox" ID="TxtPolyvPass" runat="server"></asp:TextBox>
                    </td>
                </tr>
            </table>
            <div style="display: none;">
                <asp:TextBox CssClass="textbox" ID="TxtPolyvId" runat="server"></asp:TextBox>
            </div>
            <div>
                <asp:Button ID="Button2" CssClass="button" runat="server" Text="确定修改" OnClick="Button2_Click" />
            </div>
        </div>
    </asp:Panel>

    <!-- 添加/修改的直播房间信息   百家云 -->
    <asp:Panel ID="AddPanelBJY" runat="server" Visible="false">
        <div class="content-area">
            <span style="display:none;">
                <asp:TextBox ID="TxtHidden" runat="server" Text="0"></asp:TextBox></span>
            <table width="99%" align="center" border="0" cellpadding="1" cellspacing="1" class="CTable">
                <tr>
                    <td class="lefttd" height="30" align="right" style="width: 198px"><strong>房间类型：</strong></td>
                    <td> 
                        <asp:RadioButtonList ID="RadioButtonList5" runat="server" RepeatDirection="Horizontal" >
                            <asp:ListItem Value="2" Text="普通大班课" Selected="True"></asp:ListItem>
                            <asp:ListItem Value="3" Text="小班课普通版"></asp:ListItem>
                            <asp:ListItem Value="1" Text="一对一课"></asp:ListItem>
                            <asp:ListItem Value="4" Text="小班课专业版"></asp:ListItem>
                        </asp:RadioButtonList>
                        <span class="tips">
                            普通大班课：主要适用于以单向宣讲为主的直播。如果直播中很少需要或不需要主讲与观众音视频互动，建议选用这种方式。<br />
                            其他课程：主要适用于以互动教学为主的小班直播。如果直播需要主讲与观众有较强互动，建议选择这种方式。小班课不可以超过 10 人，观众进入房间后即自动上麦。<br />
                            注意：小班课专业版（需开通相关权限才可以创建）
                        </span>
                    </td>
                </tr>

                <tr>
                    <td class="lefttd" height="30" align="right" style="width: 198px"><strong>房间名称：</strong></td>
                    <td class="righttd">&nbsp;<asp:TextBox CssClass="textbox" ID="TxtBJYName" runat="server"></asp:TextBox>
                        <span class="tips">
                            不超过50个字符或汉字，超过部分将进行截取
                        </span>
                    </td>
                </tr>
                <tr>
                    <td class="lefttd" height="30" align="right" style="width: 198px"><strong>房间容量：</strong></td>
                    <td class="righttd">&nbsp;<asp:TextBox CssClass="textbox" ID="TxtMax_users" Text="0" runat="server" Width="180px"></asp:TextBox>
                        <span class="tips">
                            房间最大人数, 不传或传0表示不限制<br />
                            注：一对一是1人，互动小班课人数不能超过10人，普通大班课可以不设置人数上限.
                        </span>
                    </td>
                </tr>
                <tr>
                    <td class="lefttd" height="30" align="right" style="width: 198px"><strong>开课时间：</strong></td>
                    <td class="righttd">&nbsp;<asp:TextBox CssClass="textbox" ID="TxtStart_time" runat="server" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'});"></asp:TextBox></td>
                </tr>
                <tr>
                    <td class="lefttd" height="30" align="right" style="width: 198px"><strong>下课时间：</strong></td>
                    <td class="righttd">&nbsp;<asp:TextBox CssClass="textbox" ID="TxtEnd_time" runat="server"  onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'});" ></asp:TextBox></td>
                </tr>
                <tr>
                    <td class="lefttd" height="30" align="right" style="width: 198px"><strong>老师是否启用设备检测：</strong></td>
                    <td class="righttd">
                        <asp:RadioButtonList ID="RdbTeacherDevice" runat="server" RepeatDirection="Horizontal">
                            <asp:ListItem Value="1" Text="不启用" Selected="True"></asp:ListItem>
                            <asp:ListItem Value="2" Text="启用"></asp:ListItem>
                        </asp:RadioButtonList>
                    </td>
                </tr>
                <tr>
                    <td class="lefttd" height="30" align="right" style="width: 198px"><strong>学生是否启用设备检测：</strong></td>
                    <td class="righttd">
                        <asp:RadioButtonList ID="RdbStudentDevice" runat="server" RepeatDirection="Horizontal">
                            <asp:ListItem Value="1" Text="不启用" Selected="True"></asp:ListItem>
                            <asp:ListItem Value="2" Text="启用"></asp:ListItem>
                        </asp:RadioButtonList>
                    </td>
                </tr>


                
            </table>
            <div class="main-button" style="text-align: center;">
                <asp:Button ID="SaveButtonBJY" CssClass="button" runat="server" Text="确定保存" OnClick="SaveButtonBJY_Click" />
                <a href="KS.liveroom.aspx?livetype=<%=KSCMS.S("livetype") %>&accountid=<%=KSCMS.S("accountid")%>" type="button" class="button" >取消返回</a>
            </div>
        </div>
    </asp:Panel>

</asp:Content>
