<%@ page language="VB" autoeventwireup="false" enabletheming="false" inherits="WebExam.Web.secure_editAnswertest, App_Web_w5uoad04" %>
<%@ Register src="../modul/WebMsg.ascx" tagname="WebMsg" tagprefix="uc1" %>
<!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>编辑试题</title>

    <script src="../paperStyle/3.1/key.js" type="text/javascript"></script>

    <link href="../../style/main.css" type="text/css" rel="stylesheet" />
 <script src="/jslib/jquery/jquery-lastest.js" type="text/javascript"></script>
<link type="text/css" href="/jslib/jquery/plugins/SpinButton/JQuerySpinBtn.css" rel="stylesheet" />
    <script type="text/javascript" src="/jslib/jquery/plugins/SpinButton/JQuerySpinBtn.js"></script>
    

</head>
<body onload="return window_onload()"><script type="text/javascript">
                                          $().ready(
        function() {
            $("#<%= TB_score.ClientId() %>").SpinButton({ min: 0 });
        });
       function getScoreBox(){return document.getElementById('<%= TB_score.ClientID %>');}
      function getKPBox(){return document.getElementById('<%= LB_keyPoint.ClientID %>');}
     
       function degreeBox(){return document.getElementById('<%= DDLdi.ClientID %>');}
       
       function submitInfo(plain,tests) {
         var kpidstr="";
         var kpidname="";
         var kpBox=getKPBox();
         for(var i=0;i<kpBox.options.length;i++){
           if(kpBox.options[i].selected){
             kpidstr+=","+kpBox.options[i].value;
             kpidname+=","+kpBox.options[i].text;
           }
         }
         if(kpidname.length>0){kpidname =kpidname.substr(1)}
         if(kpidstr.length>0){kpidstr =kpidstr.substr(1)}
         var test=tests[0].content;
         if(test==""){alert("题目内容必须输入！");return false;};
       var score=getScoreBox().value;
       if(parseFloat(score) <=0){
       
         alert("满分不能为0");return false;
       }

       var key=tests[1].content;
       if(key==""){alert("请输入参考答案");return false;}
       
       var ps=_para[0];

       ps.saveAnswerTest(document.getElementById('<%= TB_note.ClientID %>').value, score, plain, test, key, degreeBox().value, kpidstr, kpidname);
       
       //return true;
      }
       /*
       function setKey(scoreArr,keyArr){
         var SB1=getScoreABox();var SB2=getScoreBBox();var SB3=getScoreCBox();var SB4=getScoreDBox();
         SB1.value=0;SB2.value=0;SB3.value=0;SB4.value=0;
         var KB1=getKBox1();var KB2=getKBox2();var KB3=getKBox3();var KB4=getKBox4();
         KB1.value="";KB2.value="";KB3.value="";KB4.value="";
         for(var i=0;i<keyArr.length;i++){
           switch(i){
             case 0:
               KB1.value=keyArr[i];SB1.value=scoreArr[i];
               break;
             case 1:
               KB2.value=keyArr[i];SB2.value=scoreArr[i];
               break;
             case 2:
               KB3.value=keyArr[i];SB3.value=scoreArr[i];
               break; 
             case 3:
               KB4.value=keyArr[i];SB4.value=scoreArr[i];
               break;
               
           }
         
         }
         
       }
       */
var tests;var _para;
function window_onload() {
  if((_para==null)&&(window.dialogArguments!=null)) {
     if(window.dialogArguments.length >0){_para=window.dialogArguments;}
        
  }
  
  tests=null;if(_para==null)return ;
  var para=_para;
  if(para.length>1){
     var level=para[1];
     var kpIdStr=para[2];
     tests=para[3];
     var key=para[4];
     var fullScore=para[5];
     var note = para[6];
     setdata(note, fullScore, level, kpIdStr);
       
     
  }
  
}
function setdata(note,fullScore,level,kpIdStr){
    if (note == null) note = "";
    document.getElementById('<%= TB_note.ClientID %>').value = note;
     getScoreBox().value=fullScore;
     degreeBox().value=level;
     var kpBox=getKPBox();
     var kpArr=kpIdStr.split(",");
     
     for(var i=0;i<kpBox.options.length;i++){
           var kpid=kpBox.options[i].value;
           var selected=false;
           for(var J=0;J<kpArr.length;J++){
             if(kpArr[J]==kpid){selected =true;break;}
     
           }
         
           kpBox.options[i].selected=selected;
         
    }

}
function initData(node, fullScore, level, kpIdStr, tests) {
  editorFrame.init(tests);

  setdata(node, fullScore, level, kpIdStr)
   
}
    </script>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager><uc1:WebMsg ID="WebMsg1" runat="server" />
    <iframe frameborder="0" id="editorFrame" align="center" name="mytext" marginwidth="0"
        marginheight="0" src="../../../richedit/_samples/html/richedit.htm?testclass=e"
        frameborder="no" width="770" height="399" scrolling="no"></iframe>
   
    <table bgcolor="#99FF66"  width="100%">
        <tr><td>解析<asp:TextBox ID="TB_note" runat="server" Text="" Width="720"></asp:TextBox></td></tr>
        <tr>
            <td valign="top">
            <div>
            满分<asp:TextBox ID="TB_score" runat="server" Text="" Width="20"></asp:TextBox></div>
                难度
                <asp:DropDownList ID="DDLdi" runat="server">
                    <asp:ListItem Value="0">0</asp:ListItem>
                    <asp:ListItem Value="1" Selected="True">1</asp:ListItem>
                    <asp:ListItem Value="2">2</asp:ListItem>
                    <asp:ListItem Value="3">3</asp:ListItem>
                    <asp:ListItem Value="4">4</asp:ListItem>
                    <asp:ListItem Value="5">5</asp:ListItem>
                </asp:DropDownList>
                &nbsp;&nbsp; 选择知识点
                <asp:ListBox ID="LB_keyPoint" runat="server" SelectionMode="Multiple" CssClass="FormText1">
                </asp:ListBox>
               
                <input class="bigButton" type="button" value="保存" onclick="return editorFrame.getTest();" />
            </td>
        </tr>
        
    </table>
    </form>
</body>
</html>
