<%@ page language="VB" autoeventwireup="false" enabletheming="false" inherits="WebExam.Web.secure_editJudgetest, 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 getSYBox(){return document.getElementById('<%= D_SY.ClientID %>');}
       
       function getSNBox(){return document.getElementById('<%= D_SN.ClientID %>');}
       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 keyArr=new Array();keyArr[0]=0;keyArr[1]=0;keyArr[2]=0;
       var SB1=getSYBox();var SB2=getSNBox();
       if ((SB1.value != 1) && (SB2.value != 1)) { alert("必须至少有一个答案所占比值为100%！！"); SB1.focus(); return false; }
       keyArr[0]=SB1.value;keyArr[1]=SB2.value;
      
       
       var ps=_para[0];

       ps.saveJudgeTest(document.getElementById('<%= TB_note.ClientID %>').value, score, plain, test, keyArr, degreeBox().value, kpidstr, kpidname);
       
       //return true;
      }
       /*
       function setKey(scoreArr,keyArr){
         var SB1=getSYBox();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 keyArr=para[4];
     var fullScore=para[5];
     var scoreE=to2bits(keyArr[0]);
     var scoreR=to2bits(keyArr[1]);
     var note = para[6];
     setdata(note, scoreE, scoreR, fullScore, level, kpIdStr, keyArr);
       
     
  }
  
}
// Float数据四舍五入到2位小数; 
function to2bits(flt) { 
  var uu=String(flt);
  
  var dot=uu.indexOf(".",0);
  if(dot==-1)uu+=".00";else{
    
     while (uu.length-dot-1<2){
       uu+="0";
     
     }
  
  }
  return uu;
}

function setdata(note, scoreE, scoreR, fullScore, level, kpIdStr, keyArr) {
    if (note == null) note = "";
    document.getElementById('<%= TB_note.ClientID %>').value = note;

       getSNBox().value=to2bits(scoreE);getSYBox().value=to2bits(scoreR);
    
   
     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(note, fullScore, level, kpIdStr, keyArr, tests) {
  editorFrame.init(tests);
  var scoreE=keyArr[0];
     var scoreR=keyArr[1];

     setdata(note, scoreE, scoreR, fullScore, level, kpIdStr, keyArr)
   
}
    </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=d"
        frameborder="no" width="770" height="399" scrolling="no"></iframe>
   
    <table bgcolor="#99FF66"  width="100%" align="center">
    <tr><td>解析<asp:TextBox ID="TB_note" runat="server" Text="" Width="720"></asp:TextBox></td></tr>
        <tr>
            <td>
                满分<asp:TextBox ID="TB_score" runat="server" Text="1" Width="20"></asp:TextBox>
                
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                答案
                
                               
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
               
                是<asp:DropDownList ID="D_SY" runat="server">
                    <asp:ListItem Text="+100%" Value="1.00" Selected="True"></asp:ListItem>
                    <asp:ListItem Text="+90%" Value="0.90"></asp:ListItem>
                    <asp:ListItem Text="+80%" Value="0.80"></asp:ListItem>
                    <asp:ListItem Text="+70%" Value="0.70"></asp:ListItem>
                    <asp:ListItem Text="+60%" Value="0.60"></asp:ListItem>
                    <asp:ListItem Text="+50%" Value="0.50"></asp:ListItem>
                    <asp:ListItem Text="+40%" Value="0.40"></asp:ListItem>
                    <asp:ListItem Text="+30%" Value="0.30"></asp:ListItem>
                    <asp:ListItem Text="+20%" Value="0.20"></asp:ListItem>
                    <asp:ListItem Text="+10%" Value="0.10"></asp:ListItem>
                    <asp:ListItem Text="0%" Value="0.00"></asp:ListItem>
                    <asp:ListItem Text="-10%" Value="-0.10"></asp:ListItem>
                    <asp:ListItem Text="-20%" Value="-0.20"></asp:ListItem>
                    <asp:ListItem Text="-30%" Value="-0.30"></asp:ListItem>
                    <asp:ListItem Text="-40%" Value="-0.40"></asp:ListItem>
                    <asp:ListItem Text="-50%" Value="-0.50"></asp:ListItem>
                    <asp:ListItem Text="-60%" Value="-0.60"></asp:ListItem>
                    <asp:ListItem Text="-70%" Value="-0.70"></asp:ListItem>
                    <asp:ListItem Text="-80%" Value="-0.80"></asp:ListItem>
                    <asp:ListItem Text="-90%" Value="-0.90"></asp:ListItem>
                    <asp:ListItem Text="-100%" Value="-1.00"></asp:ListItem>
                </asp:DropDownList>
               
                
              
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
               
                否
              
                 <asp:DropDownList ID="D_SN" runat="server">
                     <asp:ListItem Text="+100%" Value="1.00"></asp:ListItem>
                    <asp:ListItem Text="+90%" Value="0.90"></asp:ListItem>
                    <asp:ListItem Text="+80%" Value="0.80"></asp:ListItem>
                    <asp:ListItem Text="+70%" Value="0.70"></asp:ListItem>
                    <asp:ListItem Text="+60%" Value="0.60"></asp:ListItem>
                    <asp:ListItem Text="+50%" Value="0.50"></asp:ListItem>
                    <asp:ListItem Text="+40%" Value="0.40"></asp:ListItem>
                    <asp:ListItem Text="+30%" Value="0.30"></asp:ListItem>
                    <asp:ListItem Text="+20%" Value="0.20"></asp:ListItem>
                    <asp:ListItem Text="+10%" Value="0.10"></asp:ListItem>
                    <asp:ListItem Text="0%" Value="0.00" Selected="True"></asp:ListItem>
                    <asp:ListItem Text="-10%" Value="-0.10"></asp:ListItem>
                    <asp:ListItem Text="-20%" Value="-0.20"></asp:ListItem>
                    <asp:ListItem Text="-30%" Value="-0.30"></asp:ListItem>
                    <asp:ListItem Text="-40%" Value="-0.40"></asp:ListItem>
                    <asp:ListItem Text="-50%" Value="-0.50"></asp:ListItem>
                    <asp:ListItem Text="-60%" Value="-0.60"></asp:ListItem>
                    <asp:ListItem Text="-70%" Value="-0.70"></asp:ListItem>
                    <asp:ListItem Text="-80%" Value="-0.80"></asp:ListItem>
                    <asp:ListItem Text="-90%" Value="-0.90"></asp:ListItem>
                    <asp:ListItem Text="-100%" Value="-1.00"></asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td valign="top">
                难度
                <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 type="button" value="保存" class="bigButton" onclick="return editorFrame.getTest();" />
            </td>
        </tr>
    </table>
    </form>
</body>
</html>
