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

<!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><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("LiveTelecast_Form")%></title>
    <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">
        .formImg { position: relative; top: -295px; left: 628px; }
        .coverName { height: 110px; width: 150px; margin-top: 30px; }
        .frm th{ padding-right:0px;}
    </style>
    
</head>
<body>
    <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>
                <span style="color: Red;">*</span><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("LiveTelecast_Form_rs")%>:
            </th>
            <td>
                <input id="LiveTelecast_MaxCount" runat="server" type="text" class="txt" datacol="yes"
                    err="允许的最大人数" checkexpession="Num" style="width: 200px" />
            </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>
        </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="UserImg/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><span style="color: Red;">*</span><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("LiveTelecast_Form_dz")%>:</th>
            <td>
                <select id="LiveTelecast_RedUrl" class="select" runat="server" style="width: 206px;">
                </select> 
             </td>
        </tr>
        <tr>
            <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>
            <th></th>
            <td></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>--%>
            </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>
    <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());  
            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 == "jpge" || extension == "gif") {//合法
                        $("#formImg").ajaxSubmit({
                            type: "post",
                            url: "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>
</body>
</html>