<%@ Page Language="C#" AutoEventWireup="True" Inherits="Kesion.NET.WebSite.Plus.Course.openliveRoom" Codebehind="openliveRoom.aspx.cs" %>
  <%@ Import Namespace="Kesion.Publics" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
        <script src="/KS_Inc/Jquery.js" type="text/javascript"></script>
    <script src="/KS_Inc/Kesion.Common.js" type="text/javascript"></script>
	<script src="/admin/include/comm.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link href="/admin/images/style.css" rel="stylesheet" type="text/css">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
       <asp:Panel ID="addpanel" runat="server" Visible="true">
      <table width="100%" align="center" border="0" cellpadding="1" cellspacing="1" class="CTable">
           <tr>
                <td class="lefttd" height="30" align="right" style="width: 102px"><b><font color="red">*</font>直播服务器：</b></td>
                <td class="righttd">
                  <%=title %>
                </td>
            </tr>
          <%if (courseType>0){ %>
           <tr>
                <td class="lefttd" height="30" align="right" style="width: 102px"><b>教师上课地址：</b></td>
                <td class="righttd">
                    <br />
                  <a href="<%=WebUrl %>" target="_blank" title="进入直播" class="button button_on">开始上课</a>
                  <%if (!string.IsNullOrEmpty(PhoneQrCode))
                      {
                          Response.Write("<br/>教师微信端上课：<br/><img src='" + PhoneQrCode + "' width='200'/>");
                      }%>
                </td>
            </tr>
          <tr>
                <td class="lefttd" height="30" align="right" style="width: 102px"><b>学生端测试：</b></td>
                <td class="righttd">
                    <%if (!string.IsNullOrEmpty(WebUrl1))
                        {
                            Response.Write(@"<a href='" + WebUrl1 + @"' target='_blank' title='进入直播' class='button button_on'>学生开始听课</a>
                  <div class='tips'>此链接为测试学生上课状态，不建议直接给学生使用。</div>");
                        }
                        if (!string.IsNullOrEmpty(QrCode))
                        {
                            Response.Write(@"<br />
                    <strong>学生使用微信扫码上课：</strong><br /><img src='" + QrCode + "' width='200' />");
                        }
                    %>
                    
                </td>
            </tr>
          <%}else{ %>
            <tr>
                <td class="lefttd" height="30" align="right" style="width: 102px"><b><font color="red">*</font>选择直播课时：</b></td>
                <td class="righttd">
                 <select name="pid" id="live" onchange="uplist(this.value)">
                   <%=sb.ToString() %>
                 </select>

                </td>
            </tr>
         <%if (livetype == 5||livetype == 6)
             { %>
         <tr>
             <td class="lefttd" height="30" align="right" style="width: 102px"><b>直播教室：</b></td>
             <td class="righttd"><asp:DropDownList ID="DrpRoomList" runat="server">
                                    <asp:ListItem Selected="True" >--请选择教室信息--</asp:ListItem>
                                 </asp:DropDownList></td>
         </tr>
         <%}
    else
    { %>
            <tr>
                <td class="lefttd" height="30" align="right" style="width: 102px"><b>直播间名称：</b></td>
                <td class="righttd">
                    <asp:TextBox ID="LiveTitle" CssClass="textbox" runat="server" ></asp:TextBox>
             <font color="red">自定义直播间名字,为空时取课时名称</font>
                </td>
            </tr>
      <%}
    if (livetype==1){ %>
              <tr >
                <td class="lefttd" height="30" align="right" style="width: 102px"><b>LOGO：</b></td>
                <td class="righttd">
                    <asp:TextBox ID="defaultPic" CssClass="textbox" runat="server" ></asp:TextBox>
                      <%=Kesion.APPCode.UploadAPI.EchoUpload("classpic",this.defaultPic.ClientID) %>     
                  <font color="red">上传图片为128*128格式只能为JPG、JPEG、PNG</font>
                </td>
            </tr>
         <%} %>
            <tr>
                <td class="lefttd" height="30" align="right" style="width: 102px">您要直播多少小时:</td>
				<td class="righttd"><input name="time"  style="width: 52px" class="textbox" value="1"/> <font color="red">不能超过24小时</font> </td>               
            </tr>
           <tr>
                <td class="lefttd" height="30" align="right" style="width: 102px"></td>
				<td class="righttd"><asp:Button ID="Button1" runat="server" Text="获取直播信息" OnClick="Button1_Click" CssClass="button"/></td>               
            </tr>
       <%} %>  
            <tr>
                <td class="lefttd" height="30" align="right" style="width: 102px"></td>
                <td class="righttd"> </td>    
            </tr>      

         </table>
        <script>
            function uplist(pid) {
                if (pid != 0) {
                    var courseid = '<%=KSCMS.S("courseid")%>';
                    location.href = "?a=showlist&costype=<%=KSCMS.S("costype")%>&livetype=<%=KSCMS.S("livetype")%>&courseid=" + courseid + "&pid=" + pid;
                }

            }
        </script>
        </asp:Panel>

       <asp:Panel ID="Panel1" runat="server" Visible="false">
          <table width="100%" align="center" border="0" cellpadding="1" cellspacing="1" class="CTable">

            <tr>  <td class="lefttd" height="30" align="right" style="width: 102px"><b>直播间名称：</b></td>
                 <td class="righttd" >                 
                <%=dr["title"].ToString() %>
                  </td>              
                </tr>
                <tr>  <td class="lefttd" height="30" align="right" style="width: 102px"><b>直播类型：</b></td>
                 <td class="righttd" >                 
                  <%=Kesion.Course.Live.getLiveType(Utils.StrToInt(dr["livetype"].ToString())) %> 
                       <%if (dr["livetype"].ToString()=="2") {%>
                     <a href="http://www.kesion.com/v-112-46353.aspx" class="button" style="margin-left:10px;" target="_blank">使用说明</a> 
                     <%}else if (dr["livetype"].ToString()=="1") { %>
                       <a href="http://www.kesion.com/v-112-46352.aspx" class="button" style="margin-left:10px;" target="_blank">使用说明</a> 
                     <%} else if (dr["livetype"].ToString() == "3"){ %>
                       <a href="http://www.kesion.com/v-112-46354.aspx" class="button" style="margin-left:10px;" target="_blank">使用说明</a> 
                       <%} else if (dr["livetype"].ToString() == "4") { %>
                       <a href="http://www.kesion.com/v-112-46355.aspx" class="button" style="margin-left:10px;" target="_blank">使用说明</a> 
                       <%} %>
                  </td>              
                </tr>
                 <%if (dr["livetype"].ToString() == "2")
                     {%>
                <tr>
				  <td class="lefttd" height="30" align="right" style="width: 102px"><b>启动页地址：</b></td>
                  <td class="righttd" >                 
                      <a href="<%=launchUrl %>" target="_blank">点击启动直播器</a>
                  </td>              
                </tr>
                <tr>
				   <td class="lefttd" height="30" align="right" style="width: 102px"><b>直播器下载地址：</b></td>
                   <td class="righttd" >                 
                      <a href="<%=downloadUrl %>" target="_blank">点击下载直播器</a>
                   </td>              
                </tr>
          
              <%}
    else if (dr["livetype"].ToString() == "1")
    { %>
                 <tr>  <td class="lefttd" height="30" align="right" style="width: 102px"><b>房间号：</b></td>
                 <td class="righttd" >   
                                   
                   <%=dr["roomid"].ToString() %>
                  </td>              
                </tr>
                <tr>  <td class="lefttd" height="30" align="right" style="width: 102px"><b>密码：</b></td>
                 <td class="righttd" >                 
                   <%=dr["channelPasswd"].ToString() %>
                  </td>              
                </tr>
                 <tr>  <td class="lefttd" height="30" align="right" style="width: 102px"><b>直播器地址：</b></td>
                 <td class="righttd" >                 
                 <a href="http://soft.polyv.net/soft/PolyvLiveSetup.exe">点击下载直播器</a>   
                  </td>              
                </tr>
           <%}
    else if (dr["livetype"].ToString() == "3" || dr["livetype"].ToString() == "4")
    {
                  %>
                <tr>  <td class="lefttd" height="30" align="right" style="width: 102px"><b>推流地址：</b></td>
                 <td class="righttd" >                 
                 <%=streamUrl %>  
                  </td>              
                </tr>
              <%}
    else if (dr["livetype"].ToString() == "5")
    {%>
                <tr>  <td class="lefttd" height="30" align="right" style="width: 102px"><b>房间信息：</b></td>
                 <td class="righttd" >                 
                 <%=streamUrl %>  
                  </td>              
                </tr>
              <%}
    else if (dr["livetype"].ToString() == "6")
    {%>
                <tr>
				  <td class="lefttd" height="30" align="right" style="width: 102px"><b>客户端启动页面：</b></td>
                  <td class="righttd" >                 
                      <a href="<%=ccStr[0] %>" target="_blank">点击启动直播器</a>
                  </td>              
                </tr>
                <tr>
				   <td class="lefttd" height="30" align="right" style="width: 102px"><b>直播器下载地址：</b></td>
                   <td class="righttd" >                 
                      <a href="http://dl.csslcloud.net/live/client/windows/CCLive4.7.3.exe" target="_blank">点击下载直播器</a>
                   </td>              
                </tr>
               <tr>  <td class="lefttd" height="30" align="right" style="width: 102px"><b>房间id：</b></td>
                 <td class="righttd" >                 
                 <%=ccStr[1] %>  
                  </td>              
                </tr>
               <tr>  <td class="lefttd" height="30" align="right" style="width: 102px"><b>主教登录密码：</b></td>
                 <td class="righttd" >                 
                 <%=ccStr[2] %>  
                  </td>              
                </tr>
               <tr>  <td class="lefttd" height="30" align="right" style="width: 102px"><b>副教登录密码：</b></td>
                 <td class="righttd" >                 
                 <%=ccStr[3] %>  
                  </td>              
                </tr>
              <%} %>
                  <tr>  <td class="lefttd" height="30" align="right" style="width: 102px"><b>直播状态：</b></td>
                 <td class="righttd" >    
                        <%=dr["status"].ToString()=="0"?"直播未开始":dr["status"].ToString()=="1"?"直播中":"已结束" %>       
                  
                  </td>              
                </tr>
               <tr>  <td class="lefttd" height="30" align="right" style="width: 102px"><b>直播状态：</b></td>
                 <td class="righttd" >    
                     
                     <% if (dr["livetype"].ToString() != "6")
                         { %>
                    <a href="?a=resetlive&flag=0&livetype=<%=KSCMS.S("livetype") %>&courseid=<%=KSCMS.S("courseid") %>&pid=<%=pid %>&costype=<%=KSCMS.S("costype")%>" class="button" style="margin-right:10px;">重新获取直播</a>
                   <%} %>
                     <a href="?a=resetlive&flag=1&livetype=<%=KSCMS.S("livetype") %>&courseid=<%=KSCMS.S("courseid") %>&pid=<%=pid %>&costype=<%=KSCMS.S("costype")%>" class="button">结束当前</a>
                  </td>              
                </tr>
              </table>          
       </asp:Panel>
        <script>
            function playlive(periodid,status)
            {
              
                $.ajax({
                    type: 'post',
                    datatype: 'text',
                    url: "?a=update&costype=<%=KSCMS.S("costype")%>&periodID=" + periodid + "&status="+status+"&rnd="+new Date(),
                    success: function (msg) {
                        alert(msg);
                        var courseid = '<%=KSCMS.S("courseid")%>';
                        location.href = "?a=showlist&costype=<%=KSCMS.S("costype")%>&courseid=" + courseid + "&pid=" + periodid;
                    }
                });
            }

        </script>
       
    </div>
    </form>
</body>
</html>
