<%@ page language="VB" autoeventwireup="false" enabletheming="false" inherits="WebExam.Web.editchoicetest, 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 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 getScoreABox(){return document.getElementById('<%= D_A.ClientID %>');}
       function getScoreBBox(){return document.getElementById('<%= D_B.ClientID %>');}
       function getScoreCBox(){return document.getElementById('<%= D_C.ClientID %>');}
       function getScoreDBox(){return document.getElementById('<%= D_D.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 arr=new Array();
         for(var i=0;i<tests.length;i++)
          {   
              
              switch (i){
              
               case 0:
                 if(tests[i].content==""){alert("选项A必须输入！");return false;};break;
               case 1:
                 if(tests[i].content==""){alert("选项B必须输入！");return false;};break;       
     
              }
             
             arr[i]=tests[i].content;
             
         }
       if((getScoreABox().value!=1)&&(getScoreBBox().value!=1)&&(getScoreCBox().value!=1)&&(getScoreDBox().value!=1))
       {alert("必须至少有一个答案所占比值为100%！");return false;}
       var score=getScoreBox().value;
       if(parseFloat(score) <=0){
       
         alert("满分不能为0");return false;
       }
       var ps=_para[0];
       ps.saveChoiceTest(document.getElementById('<%= TB_note.ClientID %>').value,score, plain, arr, getScoreABox().value, getScoreBBox().value, getScoreCBox().value, getScoreDBox().value, degreeBox().value, kpidstr, kpidname);
       
       //return true;
      }
       /*
       function setKey(sa,sb,sc,sd,se,sf){
         getScoreABox().value=sa;getScoreBBox().value=sb;getScoreCBox().value=sc;getScoreDBox().value=sd;getScoreEBox().value=se;getScoreFBox().value=sf;
         
       }
       */
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 scores=para[4];
     var fullScore = para[5];
     var note = para[6]; if (note == null) note = "";
     document.getElementById('<%= TB_note.ClientID %>').value = note;
     getScoreABox().value=to2bits(scores[0]);
     getScoreBBox().value=to2bits(scores[1]);
     getScoreCBox().value=to2bits(scores[2]);
     getScoreDBox().value=to2bits(scores[3]);
   
     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;
         
    }
     
  }
  
}
// 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 initData(note,fullScore, level, kpIdStr, scores, tests) {
  editorFrame.init(tests);
  if (note == null) note = "";
  document.getElementById('<%= TB_note.ClientID %>').value = note;
     getScoreBox().value=fullScore;
     getScoreABox().value=to2bits(scores[0]);
     getScoreBBox().value=to2bits(scores[1]);
     getScoreCBox().value=to2bits(scores[2]);
     getScoreDBox().value=to2bits(scores[3]);
    
     
     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;
         
    }
     

}
    </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=f"
        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>
                满分<asp:TextBox ID="TB_score" runat="server" Text="1" Width="20"></asp:TextBox>
                
                答案&nbsp; A比值<asp:DropDownList ID="D_A" 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>
                &nbsp; B比值<asp:DropDownList ID="D_B" 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>
                &nbsp; C比值<asp:DropDownList ID="D_C" 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>
                &nbsp; D比值<asp:DropDownList ID="D_D" 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" class="bigButton" value="保存" onclick="return editorFrame.getTest();" />
            </td>
        </tr>
    </table>
    </form>
</body>
</html>
