<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ExaminationPaper_Form.aspx.cs"
    Inherits="RM.Web.Training.TrainingTest.ExaminationPaper_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("Exam_infoedit")%></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/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.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/FunctionJS.js" type="text/javascript"></script>
    <script src="/Learn/m/json2.js" type="text/javascript"></script>
    <style type="text/css">
        #promptBg ul, #promptBg li { padding: 0; margin: 0; list-style: none; }
        .promptLink { display: block; padding: 0 3px; font-size: 10pt; }
        .activeLink { background-color: #e0f5bc; }
        .activePrompt { background-color: #E0ECCC; }
    
        .promptLink span { float: right; font-size: 10pt; }
         .Cowdiv { width:730px; left: 5px; height: 400px; position: absolute; border: 1px solid #ccc; background-color: White; display: none; z-index:99999; }
        .cowtab { width: 100%; }
        .Page { bottom: 5px; position: absolute; left: 400px; }
        .grid td { text-align: left; }
        .livediv { width: 204; height: 204; margin: 5px 0; display: none; }
        .livediv ul, li { list-style-type: none; margin: 0; padding: 0; }
        .livediv li { width: 204px; text-indent: 1em; }
        .livediv li:hover { background: #E0ECCC; }
        .lightTreeview{ height:350px;}
        .strTree li ul{ display:none;}
    </style>

    <script type="text/javascript">
        var $ExamPlan_ExamId = $("#Examination_CsId"); //隐藏域对象
        var $promptBg = $("#promptBg"); //正在加载模板
        var isLoad = false; //是否正在异步加载

        $(function () {
            $ExamPlan_ExamId = $("#Examination_CsId"); //隐藏域对象
            $promptBg = $("#promptBg");


            //设置文本框键盘按键事件（按键事件不对数据处理，因为keyDown获取的值永远是上一次keyUp的数据，这里在keyDown里面处理特殊操作）
            $("#Courseware_CsName").keydown(function (e) {
                var event = e || event; //兼容性处理
                if (event.keyCode == 27) {
                    $promptBg.stop().hide(0, function () {
                        $promptBg.html("");
                    });
                    return;
                } else if (event.keyCode == 37 || event.keyCode == 39) return; //左右键
                else if (event.keyCode == 13) {//回车键
                    var $obj = $(".activePrompt");
                    if ($obj.length < 1) return false;
                    $ExamPlan_ExamId.val($obj.attr("data"));
                    $("#Courseware_CsName").val($obj.text());
                    $promptBg.stop().hide(0, function () {
                        $promptBg.html("");
                    });
                    return false;
                }
                if ($("#loadIcon").length < 1) {
                    if (event.keyCode == 38) { //向上
                        if ($(".activePrompt").length < 1) {//最后一个
                            $(".promptLink").last().addClass("activePrompt");
                            return false;
                        }
                        $currObj = $(".activePrompt").parent();
                        if ($currObj.prev().length < 1) return false; //第一个
                        var $nextObj = $currObj.prev().children("a");
                        $(".activePrompt").removeClass("activePrompt");
                        $nextObj.addClass("activePrompt");
                        return false;
                    }
                    if (event.keyCode == 40) { //向下
                        if ($(".activePrompt").length < 1) {//第一个
                            $(".promptLink").eq(0).addClass("activePrompt");
                            return false;
                        }
                        $currObj = $(".activePrompt").parent();
                        if ($currObj.next().length < 1) return false; //最后一个
                        var $nextObj = $currObj.next().children("a");
                        $(".activePrompt").removeClass("activePrompt");
                        $nextObj.addClass("activePrompt");
                        return false;
                    }
                }
            });
            function textChange() {
                if (isLoad) return;
                $("#promptBg").show(0);
                var inputvalue = $("#Courseware_CsName").val();
                isLoad = true;
                $.get("SearchCourseware.ashx", { key: inputvalue }, function (data) {
                    isLoad = false;
                    if (!data || parseInt(data) == -1) {
                        $promptBg.stop().hide(0);
                        return; //没有查询到数据或者异常
                    }
                    $("#promptBg").html(data);
                    $(".promptLink").hover(function () {//绑定事件
                        $(this).addClass("activeLink");
                    }, function () {
                        $(this).removeClass("activeLink");
                    });
                });
            }

            var examNameIsLoad = false;
            var editKey = QueryString('ExamKey');
            function checkExamName() {//检测试卷名是否存在
                if (examNameIsLoad) return;
                var inputValue = jQuery.trim($("#Examination_Name").val());
                if (inputValue == '') return;
                var promptObj = $("#promptExamName");
                promptObj.html('');
                examNameIsLoad = true;
                $.ajax({
                    url: "CheckExamNameIsExists.ashx",
                    type: "post",
                    dataType: 'text',
                    data: { "key": inputValue },
                    success: function (data) {
                        examNameIsLoad = false;
                        if (editKey == data) return;
                        if (!data || data.length < 4) return;
                        promptObj.html('<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Exam_tm")%>！');
                        showTipsMsg('<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Exam_nottm")%>', 2040, 5);
                    }
                });
            }
            if ($.browser.msie) {//根据兼容性绑定不同的文本改变事件
                $("#Examination_Name").bind("propertychange", checkExamName);
                $("#Courseware_CsName").bind("input propertychange", textChange);
            } else {
                $("#Courseware_CsName").bind("input", textChange);
                $("#Examination_Name").bind("input", checkExamName);
            }
            $("#Examination_SumScore").keydown(function () {
                if (parseInt($("#Examination_IsRandom").val()) == 1) {
                    showTipsMsg('<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Exam_radomzfs")%>', 2500, 5);                    
                    return false;
                }
            });
        });

        function choiseExam(obj) {
            $ExamPlan_ExamId.val($(obj).attr("data"));
            $("#Courseware_CsName").val($(obj).text());
            $promptBg.stop().hide(0, function () {
                $promptBg.html("");
            });
        }

        //选择试卷
        function CowtabShow(ctid) {
            $("#Cowtab").show();
            $.get("/Training/TrainingTest/ExaminationPaper_Form.aspx", { ctid: ctid, action: "getcourseware" },
            function (data) {
                $("#cwtbody").html(data);
            });
        }

        //分页
        function CowTabPage(index, typeid) {
            $.get("/Training/TrainingTest/ExaminationPaper_Form.aspx", { page: index, action: "getcourseware", ctid: typeid },
            function (data) {
                $("#cwtbody").html(data);
            });
        }
                 

        //div隐藏
        function CowtabHide() {
            $("#Cowtab").hide();
        }

        //选择提示内容
        function setcs(obj, id, name, Type) {
            if ($(obj).attr("checked")) {
                $("#cslist").show();
                $("#Examination_CsId").val(id);
                $("#Courseware_CsName").val(name);
            }
        }

    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div id="Cowtab" class="Cowdiv">
            <div style="width: 730px; height: 350px; position: relative; border: 1px solid #ccc;">
              <div style="width: 204px; height: 350px; border: 1px solid #ccc; float: left;">
<iframe class="iframe_left" name="target_left" id="target_left" scrolling="auto" frameborder="0" scrolling="yes" width="100%" src="/Training/plan/Plan_Courseware_CourType.aspx" height="100%"></iframe>
        </div>
            <div style="width:520px;float: left; padding-left:3px; " >
                <table class="grid cowtab">
                    <thead>
                        <tr>
                            <td>
                                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Plan_select")%>
                            </td>
                            <td>
                                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Learn_kechengname")%>
                            </td>
                            <td>
                                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("coursetype")%>
                            </td>
                        </tr>
                    </thead>
                    <tbody id="cwtbody">
                    </tbody>
                </table>
            </div>
        </div>
            <div style="position: absolute; bottom: 10px; padding-left: 450px;">
                <input type="button" value='<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Ques_dete")%>' onclick="CowtabHide()" />
                <input type="button" value='<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Close")%>' onclick="CowtabHide()" />
            </div>
        </div>

    <table border="0" cellpadding="0" cellspacing="0" class="frm">
        <tr>
            <th><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("exam_name")%>：</th>
            <td>
                <input id="Examination_Name" maxlength="35" runat="server" type="text" class="txt"
                    datacol="yes" err="试卷名称" checkexpession="NotNull" style="width: 204px" />
                <span id="promptExamName" style="color: Red;"></span>
            </td>
            <th><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("MyExamPlan-sjlx")%>：</th>
            <td>
                <select id="Examination_EpTypeId" class="select" maxlength="35" runat="server" style="width: 210px;">
                </select>
            </td>
        </tr>
        <tr>
            <th><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Exam_level")%>：</th>
            <td>
                <select id="Examination_Level" class="select" runat="server" style="width: 210px;"></select>
            </td>
            <th><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Exam_type")%>：</th>
            <td>
                <select id="Examination_ExamType" class="select" runat="server" style="width: 210px;">
                </select>
            </td>
        </tr>
        <tr>
            <th>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("MyExamPlan-jgfs")%>：
            </th>
            <td>
                <input id="Examination_PassScore" checkexpession="Num" datacol="yes" err="及格分数线"
                    runat="server" type="text" class="txt" style="width: 204px" maxlength="3" />
            </td>
            <th><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("DataList_zFen")%>：</th>
            <td>
                <input id="Examination_SumScore" maxlength="3" datacol="yes" err="总分" checkexpession="Num"
                    runat="server" type="text" class="txt" style="width: 204px" />
                <input id="Examination_IsRandom" type="hidden" runat="server" />
            </td>
        </tr>
        <tr>
            <th><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("answer_date")%>：</th>
            <td>
                <input id="Examination_QuestionDate" checkexpession="Num" datacol="yes" err="答题时间"
                    runat="server" type="text" class="txt" style="width: 204px" maxlength="4" />
            </td>
            <th>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Exam_kaoshimaxNum")%>：
            </th>
            <td>
                <input id="Examination_Count" checkexpession="Num" datacol="yes" err="考试最大次数" runat="server"
                    type="text" class="txt" style="width: 204px" maxlength="4" />
            </td>
        </tr>
        <tr>
        <th><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Exam_xuefen")%>：</th>
           <td ><input id="Examination_XueFen" checkexpession="Num" datacol="yes" err="学分" runat="server"
                    type="text" class="txt" style="width: 204px" value="0" maxlength="4"/>
           </td>
<th style="display:none;"><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Courseware_Kemu")%>：</th>
           <td style="display:none;"><select id="kemu" class="select" runat="server" style="width: 210px"></select></td>
<th><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Exam_iscensor")%>：</th>
            <td><select style="width: 210px" class="select" id="iscensor" runat="server" ></select></td>           

        </tr>
        <tr>
            <th><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Exam_quefrom")%>：</th>
            <td><select id="Examination_show" class="select" runat="server" style="width: 210px"></select></td>
            
        </tr>
                
        <tr>
            <th><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Exam_xgkj")%>：</th>
            <td colspan="3" >            
                <div style="position: relative;">
                    <input id="Courseware_CsName" runat="server" type="text" class="txt" style="width: 204px;
                        z-index: 0;" autocomplete="off" /><input type="botton" value='<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("exam_selcour")%>' class="button" style="height: 25px;" onclick="CowtabShow(null);" />
                    <input type="hidden" value="" runat="server" id="Examination_CsId" />
                    <div id="promptBg" style="display: none; cursor: pointer; position: absolute; width: 204px;
                        background-color: White;">
                        <div id="loadIcon" style="text-align: center; line-height: 18px;">
                            <img src="../../Themes/Images/loading1.gif" alt="" />
                            <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Mylearn-zzcx")%>...
                            
                        </div>
                    </div>
                </div>
                <div>
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Exam_sosopy")%><span style="color: Red; padding-left: 5px;"><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Exam_tishi")%></span>
                </div>
            </td>
        </tr>        
        <tr>
            <th>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Exam_updtype")%>：
            </th>
            <td colspan="3">
                <input type="checkbox" checked="checked" runat="server" id="ck_isUpdateQuestion" />
                <span style="color: Red;">*<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Exam_updtishi")%></span>
            </td>
        </tr>
        <tr>
            <th>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Exam_shouming")%>：
            </th>
            <td colspan="3">
                <textarea id="Examination_Discription" class="txtRemark" runat="server" style="width: 596px;
                    height: 100px;"></textarea>
            </td>
        </tr>
    </table>
    <div class="frmbottom">
        <asp:LinkButton ID="Save" runat="server" class="l-btn" OnClientClick="return CheckDataValid('#form1');"
            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>
