<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Courseware_Script_Form.aspx.cs"
    Inherits="RM.Web.Training.Courseware.Courseware_Script_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">
    <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/artDialog/artDialog.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/artDialog/iframeTools.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/Validator/JValidator.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/FunctionJS.js" type="text/javascript"></script>
    <title>脚本设计</title>
    <style type="text/css">
    #ofs{ width:500px;}
    </style>
    <script type="text/jscript">
        function CheckValid() {
            if ($("#Script_Type").val() == "提问") {
                //将问答信息给后台
                var options = "";
                $(".askoptions").each(function (i, myinput) {
                    var opticon = $(myinput).val();
                    if (opticon != "") {
                        var at = $(".asktime").eq(i).val();
                        options += opticon + "|" + at + ",";
                    }
                });
                if (options == "") {
                    showTipsMsg("您还没有填写问题", 500, 5);
                    return false;
                }
                else {
                    $("#Script_path").val(options);
                }
            }
            else if ($("#Script_Type").val() == "文档") {
                var op = $("#ofspage").val();
                if (op == "") {
                    showTipsMsg("页码必须填写", 500, 5);
                    return false;
                }
                else {
                    if (isNaN(op)) {
                        showTipsMsg("页码必须为数字", 500, 5);
                        return false;
                    }
                }

                var ofs = $("#ofs").val();
                $("#Script_path").val(ofs + "," + op);
            }
            else {
                //将富文本内容给后台
                editor.sync();

                if (!CheckDataValid('#ScriptTB')) {
                    return false;
                }

            }

        }
        function ask() {
            $("#zhishidian").hide();
            $("#wenda").show();
            $("#office").hide();
            $("#Script_Type").val("提问");
        }
        function zhishi() {
            $("#zhishidian").show();
            $("#wenda").hide();
            $("#office").hide();
            $("#Script_Type").val("知识点");
        }
        function officeshow() {
            $("#zhishidian").hide();
            $("#wenda").hide();
            $("#office").show();
            $("#Script_Type").val("文档");
        }
        $(function () {
            if ($("#Script_Type").val() == "提问") {
                var nei = $("#Script_path").val();
                if (nei != "") {
                    var opslist = nei.split(",");
                    for (var i = 0; i < opslist.length - 1; i++) {
                        var ops = opslist[i].split("|");
                        $(".askoptions").eq(i).val(ops[0]);
                        $(".asktime").eq(i).val(ops[1]);
                    }
                }
                $("#zhishidian").hide();
                $("#wenda").show();
                $("#tab0").hide();
                $("#tab2").hide();
            }
            else if ($("#Script_Type").val() == "文档") {
                var nei = $("#Script_path").val();
                var opslist=[];
                if (nei != "") {
                    opslist = nei.split(",");
                }
                $("#ofs").val(opslist[0]);
                $("#ofspage").val(opslist[1]);


                $("#zhishidian").hide();
                $("#office").show();
                $("#tab0").hide();
                $("#tab1").hide();
            }
            else {
                if (QueryString("key") != null) {
                    //alert(QueryString("key"));
                    // $("#tab1").hide();
                }
            }

        });
  
    </script>
</head>
<body>
    <form id="ScriptTB" runat="server">
    <div class="frmtop">
        <input id="Script_path" type="hidden" runat="server" value="" />
        <div>
            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Courseware_Script_Form_fjjb")%>：<%=option %>
            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Courseware_Script_Form_title")%>:&nbsp;<input
                id="Script_Title" type="text" runat="server" class="txt" datacol="yes" err="标题"
                checkexpession="NotNull" />
            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Courseware_Script_Form_dspbfd")%>
            <input id="Script_Time" type="text" runat="server" class="txt" datacol="yes" style="width: 20px;"
                checkexpession="Num" err="设定时间" /><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Courseware_Script_Form_mscfyxjb")%>
            ：<input id="Script_Type" type="hidden" runat="server" value="知识点" />
        </div>
        <table style="padding: 0px; margin: 0px; height: 100%;" cellpadding="0" cellspacing="0">
            <tr>
                <td id="menutab" style="vertical-align: bottom; ">
                    <div id="tab0" class="Tabsel" onclick="GetTabClick(this);zhishi()">
                        <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Courseware_Script_Form_zszs")%></div>
                    <div id="tab1" class="Tabremovesel" onclick="GetTabClick(this);ask()">
                        <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Courseware_Script_Form_kttw")%></div>
                    <div id="tab2" class="Tabremovesel" onclick="GetTabClick(this);officeshow()">
                        <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Courseware_wendang")%></div>
                </td>
            </tr>
        </table>
    </div>
    <div class="div-frm" style="height: 250px;">
        <div class="zhishidian" id="zhishidian">
            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Courseware_Script_Form_zybfdtdsj")%><br />
            <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('#Script_Content', {
                        allowFileManager: true,
                        allowUpload: true,
                        uploadJson: '/WeiXin/UploadImage.ashx',
                        minHeight: 160
                    });
                });
            </script>
            <textarea id="Script_Content" style="width: 98%; height: 150px;" runat="server" class="txt"
                datacol="yes" err="脚本内容" checkexpession="NotNull"></textarea>
        </div>

        <div id="wenda" style="display: none;">
            <table id="asktitle">
                <tr>
                    <td colspan="2">
                        说明：题目标题再↑写，跳转时间为空位不跳转
                    </td>
                </tr>
                <tr>
                    <td>
                        A、
                    </td>
                    <td>
                        <input type="text" value="" class="askoptions" style="width: 400px" />
                    </td>
                    <td>
                        选择后跳转<input type="text" value="0" class="asktime" style="width: 30px" />秒
                    </td>
                </tr>
                <tr>
                    <td>
                        B、
                    </td>
                    <td>
                        <input type="text" value="" class="askoptions" style="width: 400px" />
                    </td>
                    <td>
                        选择后跳转<input type="text" value="0" class="asktime" style="width: 30px" />秒
                    </td>
                </tr>
                <tr>
                    <td>
                        C、
                    </td>
                    <td>
                        <input type="text" value="" class="askoptions" style="width: 400px" />
                    </td>
                    <td>
                        选择后跳转<input type="text" value="0" class="asktime" style="width: 30px" />秒
                    </td>
                </tr>
                <tr>
                    <td>
                        D、
                    </td>
                    <td>
                        <input type="text" value="" class="askoptions" style="width: 400px" />
                    </td>
                    <td>
                        选择后跳转<input type="text" value="0" class="asktime" style="width: 30px" />秒
                    </td>
                </tr>
                <tr>
                    <td>
                        E、
                    </td>
                    <td>
                        <input type="text" value="" class="askoptions" style="width: 400px" />
                    </td>
                    <td>
                        选择后跳转<input type="text" value="0" class="asktime" style="width: 30px" />秒
                    </td>
                </tr>
                <tr>
                    <td>
                        F、
                    </td>
                    <td>
                        <input type="text" value="" class="askoptions" style="width: 400px" />
                    </td>
                    <td>
                        选择后跳转<input type="text" value="0" class="asktime" style="width: 30px" />秒
                    </td>
                </tr>
                <tr>
                    <td>
                        G、
                    </td>
                    <td>
                        <input type="text" value="" class="askoptions" style="width: 400px" />
                    </td>
                    <td>
                        选择后跳转<input type="text" value="0" class="asktime" style="width: 30px" />秒
                    </td>
                </tr>
                <tr>
                    <td>
                        H、
                    </td>
                    <td>
                        <input type="text" value="" class="askoptions" style="width: 400px" />
                    </td>
                    <td>
                        选择后跳转<input type="text" value="0" class="asktime" style="width: 30px" />秒
                    </td>
                </tr>
            </table>
        </div>

        <div id="office" style="display: none; padding:10px;">
                <%=officeoption%> 跳转
                <input type="text" value="1" style=" width:20px" id="ofspage"  />页 
        </div>
    </div>
    <div class="frmbottom">
        <asp:LinkButton ID="Save" runat="server" class="l-btn" OnClientClick="return CheckValid();"
            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>
</body>
</html>
