<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Questions_Form.aspx.cs"
    Inherits="RM.Web.Training.TrainingTest.Questions_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 id="Head1" 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/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.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/FunctionJS.js" type="text/javascript"></script>
    <style type="text/css">
        #uploadForm { position: absolute; bottom: 46px; left: 120px; }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <table border="0" cellpadding="0" cellspacing="0" class="frm" id="editTable">
        <tr>
            <th>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Question_tm")%>:
            </th>
            <td>
                <input id="Questions_Title" runat="server" type="text" class="txt" datacol="yes"
                    err="题目名称" checkexpession="NotNull" style="width: 222px" />
            </td>
            <th>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Ques_fenzhi")%>:
            </th>
            <td>
                <input id="Questions_DefaultScore" checkexpession="Num" runat="server" type="text"
                    class="txt" style="width: 222px" value="0" />
            </td>
        </tr>
        <tr>
            <th>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Exam_level")%>:
            </th>
            <td>
                <select id="Questions_Level" class="select" runat="server" style="width: 230px;">
                </select>
            </td>
            <th>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Ques_tixing")%>:
            </th>
            <td>
                <input id="QuestionTypes_Name" runat="server" type="text" class="txt" disabled="disabled"
                    style="width: 222px" maxlength="35" />
                <select id="Questions_QtId" class="select" runat="server" style="width: 230px;">
                </select>
            </td>
        </tr>
        <tr>
            <th>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Question_item1")%>:
            </th>
            <td>
                <input id="Questions_OptionOne" maxlength="400" runat="server" type="text" class="txt"
                    datacol="yes" err="选项1" style="width: 222px" />
            </td>
            <th>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Question_item2")%>:
            </th>
            <td>
                <input id="Questions_OptionTwo" maxlength="400" runat="server" type="text" class="txt"
                    datacol="yes" err="选项2" style="width: 222px" />
            </td>
        </tr>
        <tr>
            <th>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Question_item3")%>:
            </th>
            <td>
                <input id="Questions_OptionThree" maxlength="400" runat="server" type="text" class="txt"
                    datacol="yes" err="选项3" style="width: 222px" />
            </td>
            <th>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Question_item4")%>:
            </th>
            <td>
                <input id="Questions_OptionFour" maxlength="400" runat="server" type="text" class="txt"
                    datacol="yes" err="选项4" style="width: 222px" />
            </td>
        </tr>
        <tr>
            <th>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Question_item5")%>:
            </th>
            <td>
                <input id="Questions_OptionFive" maxlength="400" runat="server" type="text" class="txt"
                    datacol="yes" err="选项5" style="width: 222px" />
            </td>
            <th>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Question_item6")%>:
            </th>
            <td>
                <input id="Questions_OptionSix" maxlength="400" runat="server" type="text" class="txt"
                    datacol="yes" err="选项6" style="width: 222px" />
            </td>
        </tr>
        <tr>
            <th>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Question_item7")%>:
            </th>
            <td>
                <input id="Questions_OptionSeven" maxlength="400" runat="server" type="text" class="txt"
                    datacol="yes" err="选项7" style="width: 222px" />
            </td>
            <th>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Question_item8")%>:
            </th>
            <td>
                <input id="Questions_OptionEight" maxlength="400" runat="server" type="text" class="txt"
                    datacol="yes" err="选项8" style="width: 222px" />
            </td>
        </tr>
        <tr>
            <th>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Question_item9")%>:
            </th>
            <td>
                <input id="Questions_OptionNine" maxlength="400" runat="server" type="text" class="txt"
                    datacol="yes" err="选项9" style="width: 222px" />
            </td>
            <th>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Question_item10")%>:
            </th>
            <td>
                <input id="Questions_OptionTen" maxlength="400" runat="server" type="text" class="txt"
                    datacol="yes" err="选项10" style="width: 222px" />
            </td>
        </tr>
        <tr>
            <th>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("answer_date")%>
            </th>
            <td>
                <input id="Questions_Time" maxlength="4" runat="server" type="text" value="0" class="txt" /><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Learn_miao")%>
            </td>
            <th>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Tags")%>
            </th>
            <td>
                <input id="Questions_Tags" maxlength="400" runat="server" type="text" class="txt"
                    style="width: 222px" />
            </td>
        </tr>
        <tr>
            <th>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Question_Typezsd")%>
            </th>
            <td colspan="3">
                <select id="Questions_ReferencePoint" class="select" runat="server" style="width: 230px;">
                </select>
                <span style="color: Red">
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Question_xgzs")%></span>
            </td>
        </tr>
        <tr>
            <th>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("answer")%>:
            </th>
            <td colspan="3">
                <textarea id="Questions_Answer" class="txtRemark" runat="server" style="width: 596px;
                    height: 100px;" checkexpession="NotNull"></textarea>
            </td>
        </tr>
        <tr>
            <th>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("ChapterList_zssm")%>:
            </th>
            <td colspan="3">
                <textarea id="Questions_Discription" class="txtRemark" runat="server" style="width: 596px;
                    height: 100px;"></textarea>
            </td>
        </tr>
        <tr>
            <th>
                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Ques_uploadImg")%>:
            </th>
            <td colspan="3">
            </td>
        </tr>
    </table>
    <div class="frmbottom">
        <asp:LinkButton ID="Save" runat="server" class="l-btn" OnClientClick="return setques();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>
    <form method="post" action="" id="uploadForm" enctype="multipart/form-data">
    <input type="file" id="uploadImg" name="imgFile" /><span style="color: Red;">&nbsp;&nbsp;<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Question_selImg")%></span>
    </form>
</body>
</html>
<script type="text/javascript">
    $(function () {
    var obj=null;
      //  var $currFocusObj = $("#Questions_Discription"); //当前有焦点的对象
        $("#editTable input:not(#uploadImg),#editTable textarea").focus(function () {
            obj = $(this);
        });

        $("#uploadImg").change(function () {
            var imgSrc = "";
            //上传图片
            var fileName = $(this).val(); //文件名
            if (fileName.length < 1) {//不合法
                showTipsMsg("<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("upload_pictures")%>", 2000, 3);
            } else {
                var extension = fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length).toLowerCase(); //获取扩展名
                if (extension == "bmp" || extension == "jpg" || extension == "jpge" || extension == "gif") {//合法
                    $("#uploadForm").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:

                            $(obj).val($(obj).val()+'<div class="qid"><img src=' + data + ' alt=""  /></div>');
                                        break;
                                }
                            } else {
                                showTipsMsg("<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("File_Exam")%>", 3000, 5);
                            }
                        }
                    });
                } else {
                    showTipsMsg("<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("File_format")%>", 2000, 3);
                }
            }
        });
        getques();
    });

    //构建属性对象
  function quesobjs(Level,qtid,ReferencePoint,Time,Questions_DefaultScore)
  {
var quesobj={"Questions_Level":Level,"Questions_QtId":qtid,"Questions_ReferencePoint":ReferencePoint,"Questions_Time":Time,"Questions_DefaultScore":Questions_DefaultScore};
  return quesobj;
  }
  //存储方法
    function setques(){
        var quesobj= quesobjs($("#Questions_Level").val(),$("#Questions_QtId").val(),$("#Questions_ReferencePoint").val(),$("#Questions_Time").val(),$("#Questions_DefaultScore").val());
        SetCookie("quesobj",JSON.stringify(quesobj));
  var qtid=$("#Questions_QtId").val();
  var qtitle = $("#Questions_Title").val();
  if(qtitle.length<=0){
  $("#Questions_Title").focus();
  showTipsMsg(lgqtitle, 3000, 3);
  return false;
  }
  
 if(qtid=="33404960-f317-4fdc-8d4b-ede53436afe3"||qtid=="67aczp53-a774-40fa-8cfa-d21e9cczpa43"||qtid=="czp67a53-a774-40fa-8cfa-d21e9ca43czp" || qtid=="bb393b43-9162-5e6b-8ae7-33c8z12"){
    return true;
 }else{
    var answer=$("#Questions_Answer").val();
    if(answer.length<=0){
    $("#Questions_Answer").focus();    
    showTipsMsg(lglgdaanbunengweikong, 3000, 3);
    return false;
    }else{
    return true;
    }
 }}
  //页面加载读取
  function getques()
  {
  var json=cookie("quesobj");
  json=eval('(' + json + ')');
   $("#Questions_Level").val(json.Questions_Level);
   $("#Questions_QtId").val(json.Questions_QtId);
   $("#Questions_ReferencePoint").val(json.Questions_ReferencePoint);
   $("#Questions_Time").val(json.QuestQuestions_Timeions_Level);
   $("#Questions_DefaultScore").val(json.Questions_DefaultScore);
  }
    
</script>
