<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="LiveTelecastFrom.aspx.cs" Inherits="RM.Web.Training.LiveTelecast.LiveTelecastFrom" %>

<!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 id="Head1" runat="server">
    <title><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("LiveTelecast_Form")%></title>
    <link href="/Themes/Styles/xenon-components.css" rel="stylesheet" type="text/css" />
    <%--<link href="/Themes/Styles/xenon-core.css" rel="stylesheet" type="text/css" />--%>
    <link href="/Themes/Styles/Site.css" rel="stylesheet" type="text/css" />
    <script src="/Themes/Scripts/jquery-1.8.2.min.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/jquery.form.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/Validator/JValidator.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/artDialog/artDialog.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/artDialog/iframeTools.source.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/FunctionJS.js" type="text/javascript"></script>
    
    <style type="text/css">
        .fudongceng { width:500px; height:300px;position:absolute; background-color:#F7F7F7;top:15%;left:25%;  z-index:999; border-radius:8px;}
        .formImg { position: relative; top: -305px; left: 610px; }
        .coverName { height: 90px; width: 120px; margin-top: 30px; }
        .frm th{ padding-right:0px;}
        .page-err{padding:50px;  }
        .page-err h2{ font-size: 35px;  margin-bottom: 20px;}
    </style>
    
</head>
<body>
    <div  id="mask" style="display:none;width: 100%; height: 100%; position: fixed; z-index: 995; top: 0px; left: 0px; overflow: hidden;"><div style="height: 100%; opacity: 0.1; background: rgb(0, 0, 0);"></div></div>
    <div class="fudongceng" style="display:none;" id="msgedu">
        <div class="page-err centered text-center Absolute-Center">  
        <h2 class=''>
                您需要联系第三方开通直播服务
        </h2>
        联系他们来帮助您: <a href="http://www.edu-paas.com/" target="_blank"> http://www.edu-paas.com/</a>
        </div>
        <div class="page-error-search centered">
            <a href="javascript:void(0);" onclick="OpenClose();" class="go-back"><i class="fa-angle-left"></i>关闭 </a>
        </div>
    </div>
    <form id="form1" runat="server">
    <table id="tablebody" border="0" cellpadding="0" cellspacing="0" class="frm">
        <tr>
            <th style="width: 80px;">
                <span style="color: Red;">*</span><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("ExamPlan_zhiboName")%>:
            </th>
            <td>
                <input id="LiveTelecast_Name" runat="server" maxlength="40" type="text" class="txt"
                    datacol="yes" err="直播名称" checkexpession="NotNull" style="width: 200px" />
            </td>
            <th>
                <span style="color: Red;">*</span><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Mall_Info_ZhuJiang")%>:
            </th>
            <td>
                <input id="LiveTelecast_Teacher" runat="server" type="hidden" maxlength="40" class="txt" style="width: 200px;" />
                    <select id="LiveTelecast_TeacherId" runat="server" style="width: 206px" class="select"  ></select>
            </td>
        </tr>
        <tr>
            <th style="display:none;">
                <span style="color: Red;">*</span><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("LiveTelecast_Form_rs")%>:
            </th>
            <td style="display:none;">
                <input id="LiveTelecast_MaxCount" runat="server" type="text" class="txt" datacol="yes"
                    err="允许的最大人数" checkexpession="Num" style="width: 200px" value="0" />
            </td>
            <th>
                <span style="color: Red;">*</span><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("LiveTelecast_Form_cy")%>:
            </th>
            <td>
                <select id="LiveTelecast_IsOpen" class="select" maxlength="35" runat="server" onchange="UserDivShow(this);" style="width: 206px;">
                    <option  value="0" runat="server">No</option>
                    <option  value="1" runat="server">Yes</option>
                </select>
            </td>
            <th>
                <span style="color: Red;">*</span><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Mall_Info_FuJiang")%>:
            </th>
            <td>
                <input id="LiveTelecast_AssTeacher" runat="server" type="hidden" maxlength="40" class="txt" style="width: 200px;" />
                    <select id="LiveTelecast_AssTeacherid" runat="server" style="width: 206px" class="select"  ></select>
            </td>
        </tr>
        <tr>
            <th>
                <span style="color: Red;">*</span><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("live_Room_cy")%>:
            </th>
            <td id="UserDiv">
                <script src="/Themes/Scripts/GetuserControl.js" type="text/javascript"></script>
            </td>
            <th>
                <span style="color: Red;">*</span><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("LiveTelecast_Form_fm")%>:
            </th>
            <td>
                <img src="/Training/LiveTelecast/Img/TestImg.jpg" alt="" id="converImg" class="coverName" runat="server" />
                <input type="hidden" id="LiveTelecast_CoverName" runat="server" />
            </td>
        </tr>
        <tr>
        </tr>
        <tr>
            <th>
                <span style="color: Red;">*</span><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("live_Room_fl")%>
            </th>
            <td>
                <select id="LiveTelecast_InType" class="select" runat="server" style="width: 206px;">
                </select>
            </td>
            <th>
                <span style="color: Red;">*</span><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Mylearn-kssj")%>:
            </th>
            <td>
                <input id="LiveTelecast_StartDate" runat="server" type="text" class="txt" datacol="yes"
                    err="直播开始时间" checkexpession="DateTime" onclick="WdatePicker({dateFmt:'yyyy/MM/dd HH:mm:ss'})" style="width: 200px;" />
            </td>
        </tr>

        <tr>
            <th><span style="color: Red;">*</span><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("LiveTelecast_Form_Livemode")%></th>
            <td>
                <select id="LiveTelecast_Modle" class="select" runat="server" style="width: 206px;">
                <option value="复合直播"></option>
               <%-- <option value="视频直播"></option>--%>
                </select> 
            </td>
            <th style="display:none;"><span style="color: Red;">*</span><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("LiveTelecast_Form_dz")%>:</th>
            <td style="display:none;">
                <select id="LiveTelecast_RedUrl" class="select" runat="server" style="width: 206px;">
                </select> 
             </td>
             <th ><span style="color: Red;">*</span><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("LiveTPwd")%>:</th>
             <td>
                 <input id="LiveTelecast_pwd" runat="server" maxlength="40" type="text" class="txt"
                    datacol="yes" err="直播密码" checkexpession="Null" style="width: 200px" />
             </td>
        </tr>
        
          
       
        
        <tr>
            <th>
                <span style="color: Red;">*</span><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("LiveTMsgSFMF")%>:
            </th>
            <td>
                <select id="LiveTelecast_CollectFees" runat="server" class="select" style="width: 206px;">
                    <option  value="1" runat="server">付费</option>
                    <option  value="0" runat="server">免费</option>
                </select>
            </td>
            <th>
                <span style="color: Red;">*</span><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Mall_price")%>:
            </th>
            <td>
                <input id="LiveTelecast_Price" runat="server" type="text" class="txt" datacol="yes"
                    err="直播价格" checkexpession="Numl" style="width: 200px" />
            </td>           
        </tr>
        <tr>           
            <th>
                <span style="color: Red;">*</span><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Courseware_wxxzlx")%>:
            </th>
            <td>
                <select id="LiveTelecast_IsShow" runat="server" class="select" style="width: 206px;">
                    <option value="1" runat="server">显示</option>
                    <option value="0" runat="server">不显示</option>
                </select>
            </td>
            <th>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("LiveTelecast_Form_lx")%>
            </th>
            <td>
                <select id="IsVideo" class="select" runat="server" style="width: 206px;">
                    <option value="0">No</option>
                    <option value="1">Yes</option>
                </select>
            </td>
        </tr>
        <tr>
            <th>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("live_Room_ms")%>:
            </th>
            <td colspan="3">
               <input type="text" id="LiveTelecast_Discription" runat="server" class="txtRemark" style="width:800px;"  />
               <%--<textarea id="LiveTelecast_Discription" class="txtRemark" runat="server" style="width: 687px;  height: 80px;"></textarea>--%>
                <%--<script src="/Themes/Scripts/kindeditor/kindeditor-min.js" type="text/javascript"></script>
                <script type="text/javascript">
                    var editor;
                    KindEditor.ready(function (K) {
                        editor = K.create('#LiveTelecast_Discription', {
                            resizeType: 0,                   
                            allowFileManager: true,
                            allowUpload: true,
                            uploadJson: '/WeiXin/UploadImage.ashx',
                            minHeight: 150                            
                        });
                    });
                </script>
                <textarea id="LiveTelecast_Discription" name="LiveTelecast_Discription" style="width: 670px;
                    height: 150px;" runat="server"></textarea>--%>
            </td>
        </tr>
    </table>
    <div class="frmbottom">
        <asp:LinkButton ID="Save" runat="server" class="l-btn" OnClientClick="return saveForm();"
            OnClick="Save_Click"><span class="l-btn-left">
            <img src="/Themes/Images/disk.png" alt="" /><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Save")%></span></asp:LinkButton>
        <a class="l-btn" href="javascript:void(0)" onclick="OpenClose();"><span class="l-btn-left">
            <img src="/Themes/Images/cancel.png" alt="" /><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Close")%></span></a>
    </div>    
    </form>
    <form id="formImg" method="post" action="" class="formImg" enctype="multipart/form-data">
    <input id="uploadImg" runat="server" class="imgFile" type="file" name="uploadImg" />
    </form>
</body>
<script type="text/javascript">
    function UserDivShow(obj)
    {
        var value=$(obj).val();
        if (value=="1") {
            $("#UserDiv").find("div").each(function(){
            $(this).hide();
            });
        }else {
            $("#UserDiv").find("div").each(function(){
            $(this).show();
            });
        }
    }
        function saveForm() {
            var number = 0;
            var r = document.getElementsByName("users");
            for (var i = 0; i < r.length; i++) {
                if (r[i].checked) { number++; }
            }
            if (number == 0 && $("#LiveTelecast_IsOpen").val() != 1) {
                showTipsMsg('<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("least_groups")%>,<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("LiveTelecast_Form_bx")%><label style="color:red;"><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("LiveTelecast_Form_cy")%></label> <label style="color:red;">Yes</label>！', 5000, 3);
                return false;
            }
            if ($("#LiveTelecast_CoverName").val().length < 1) {
                showTipsMsg('<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("LiveTelecast_Form_cfm")%>');
                return false;
            }
            
             jQuery("#LiveTelecast_Teacher").val(jQuery("#LiveTelecast_TeacherId").find("option:selected").text()); 
             jQuery("#LiveTelecast_AssTeacher").val(jQuery("#LiveTelecast_AssTeacherid").find("option:selected").text());  
            if (!CheckDataValid('#form1')) return false;
            return true;
        }

        $(function () {
            document.getElementById('uploadImg').onchange = function () {
                //上传图片
                var fileName = $(this).val(); //文件名
                if (fileName.length < 1) {//不合法
                    showTipsMsg("<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("LiveTelecast_Form_cfm")%>", 2000, 3);
                } else {
                    var extension = fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length).toLowerCase(); //获取扩展名
                    if (extension == "bmp" || extension == "jpg" || extension == "jpeg" || extension == "gif" || extension == "png") {//合法
                        $("#formImg").ajaxSubmit({
                            type: "post",
                            url: "/LiveTelecast/UploadImg.ashx",
                            success: function (data) {
                                if (data) {
                                    switch (data) {
                                        case "1":
                                            showTipsMsg("<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("File_not")%>", 2000, 3);
                                            return;
                                        case "2":
                                            showTipsMsg("<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("File_size")%>", 2000, 3);
                                            return;
                                        case "3":
                                            showTipsMsg("<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("File_format")%>", 2000, 3);
                                            return;
                                        case "4":
                                            showTipsMsg("<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("File_Exam")%>", 2000, 5);
                                            return;
                                        default:
                                            //插入图片
                                            $("#converImg").attr('src', '/LiveTelecast/UserImg/' + data); //给图片赋值
                                            $("#LiveTelecast_CoverName").val(data); //给隐藏域赋值
                                            break;
                                    }
                                } else {
                                    showTipsMsg("<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("File_Exam")%>", 3000, 5);
                                }
                            }
                        });
                    } else {
                        showTipsMsg("<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("File_format")%>", 2000, 3);
                    }
                }

            };
            <%=getuserlist %>
        });

      
    </script>
</html>
