<%@ Control Language="C#" %>
<%@ Import Namespace="Kesion.Publics" %>
<%@ Import Namespace="Kesion.BLL" %>
<%@ Import Namespace="Kesion.Cache" %>
<%@ Import Namespace="Kesion.HtmlTags" %>
<%@ Import Namespace="Kesion.APPCode" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="Kesion.Course" %>
<%@ Import Namespace="Kesion.Components" %>
<script runat="server" type="text/C#">
	dynamic __user = HttpContext.Current.Items["user"];                //初始化用户信息，
	private static dynamic __info = new System.Dynamic.ExpandoObject();   //初始化当前页信息
	bool isLoadPage = true;  //定义页面是否加载
	    public int sjId = 0;
        public int hasXihao = 0;
        public int isRndSj = 0;
        public static int isRealTest = 0;
		public int count = 0;
		public string toptitle = "";
		public string toptitle2 = "";
		public StringBuilder sb = new StringBuilder();
		public string TxtClassID = "";
		public string TxtOrderID = "";
		public string LabTips = "";
	protected void Page_Load(object sender, EventArgs e)
	{
		sjId=Utils.StrToInt(KSCMS.S("sjid"));
		isRndSj = Utils.StrToInt(KSCMS.S("isrndsj"));
        if (KSCMS.S("dtfs") == "3")
        {
            count = Utils.StrToInt(DataFactory.GetOnlyValue("select top 1 count(*) From [KS_SJrndzj] Where SJID=" + sjId + ""));
        }
        else
        {
            count = Utils.StrToInt(DataFactory.GetOnlyValue("select top 1 count(*) From [KS_SJTMType] Where SJID=" + sjId + ""));
        }
		if (KSCMS.S("action").Equals("save"))
		{
			SaveChange();
		}
		string DoMethod =KSCMS.S("do");
		
		switch (DoMethod)
		{
			case "add":
			addclassbutton_Click(null, null);  
				break;
			case "delst":
				 delSt();
				break;
			case "deldt":
				delDT();
				break;
			case "saveth":
				SaveTH();
				break;
		}
		initialList();
		
	}
	protected void SaveChange()
	{
		if (KSCMS.S("TxtTypeName").Trim() == "")
		{
			Msg.Alert("试卷类别名称不能为空");
			return;
			
		}
        Utils.TipsDisabled();  //检查是否演示状态
		int tmType = Utils.StrToInt(KSCMS.S("DrpTmType"));

		if (KSCMS.S("do").Equals("add"))
		{
        
			int TypeID = 0;
			if (isRndSj == 1)   //往随机试题里加大题
			{
				Hashtable ht = new Hashtable();
				ht.Add("SJID", sjId);
				ht.Add("TmType", tmType);
				ht.Add("TmIds", 0);
				ht.Add("OrderID", Utils.StrToInt(KSCMS.S("TxtOrderID")));
				ht.Add("Title", KSCMS.S("TxtTypeName"));
				ht.Add("FS", Utils.StrToInt(KSCMS.S("TxtScore")));
				ht.Add("Num", Utils.StrToInt(KSCMS.S("TxtNum")));
				CommonData.Insert("KS_SJRndZJ", ht);
				TypeID = Utils.StrToInt(DataFactory.GetOnlyValue("Select Max(ID) From KS_SJRndZJ"));
			}
			else
			{
				TMTypeInfo __info = new TMTypeInfo();
				__info.TmType = tmType;
				__info.TypeName = KSCMS.S("TxtTypeName");
				if (tmType == 6 || tmType == 7)
				{
					__info.Intro = string.Empty;
				}
				else
				{
					__info.Intro = KSCMS.S("TxtTmIntro");

				}
				__info.SJID = sjId;
				__info.OrderID = Utils.StrToInt(KSCMS.S("TxtOrderID"));

				TypeID = SJManage.InsertSJTMType(__info);
			}


			if (tmType == 6 || tmType == 7)
			{

				#region 阅读分析及分录题 往主题库表和附题库表加试题

				int num = Utils.StrToInt(KSCMS.S("TxtNum"));

				SJTKInfo __info = new SJTKInfo();

				__info.TypeId = Utils.StrToInt(TypeID);
				__info.ClassId = Utils.StrToInt(KSCMS.S("TxtClassID"));
				__info.TmType = tmType;
				__info.Title = KSCMS.S("TxtTypeName").Trim();
				__info.Tmnr = KSCMS.S("TxtTmIntro").Trim();
				__info.DaJS = KSCMS.S("TxtDAJS").Trim();
				__info.Tmfs = Utils.StrToFloat(KSCMS.S("TxtScore")) * num;
				__info.Answer = string.Empty;
				__info.OptionNum = 0;
				__info.OrderID = Utils.StrToInt(KSCMS.S("TxtOrderID"));
				__info.IsRnd = 1;
				__info.IsMedia = 0;
				__info.MediaUrl = string.Empty;
				__info.MediaTxt = string.Empty;
				__info.DajsMedia = string.Empty;
				__info.Difficulty = 0;
				__info.KnowledgeId = 0;
				__info.KeyWords = string.Empty;
				SJManage.InsertSJTK(__info);
				int tmId = CommonData.GetMaxId("KS_SJTK", "tmid");
				if (isRndSj == 1)   //往随机试题里题目ID号
				{
					DataFactory.ExecuteNonQuery("Update KS_SJRndZJ Set Tmids='" + tmId + "' where ID=" + TypeID);
				}
				//加入到附题目表
				Hashtable ht = new Hashtable();
				int n = 0;
				for (int i = 1; i <= num; i++)
				{
					if (tmType == 6)
					{
						if (!string.IsNullOrEmpty(KSCMS.S("qus" + i)))
						{
							ht.Clear();
							//ht.Add("tmnr", KSCMS.S("qus" + i));
							ht.Add("answer", KSCMS.S("ans" + i));
							ht.Add("TMfs", Utils.StrToFloat(KSCMS.S("fs" + i)));
							ht.Add("tmtype", Utils.StrToInt(KSCMS.S("tmt" + i)));
							ht.Add("parentTmID", tmId);
							ht.Add("orderid", n++);
							ht.Add("optionnum", Utils.StrToInt(KSCMS.S("optionnum" + i)));
							ht.Add("dajs", KSCMS.S("dajs" + i));

                             #region APP考题部份
                            string appAnswer = string.Empty;
                            string apptmnr = string.Empty;
                            for (int j = 1; j <= Utils.StrToInt(KSCMS.S("optionnum" + i), 2); j++)
                            {

                                int asciiCode = 64;
                                System.Text.ASCIIEncoding asciiEncoding = new System.Text.ASCIIEncoding();
                                byte[] byteArray = new byte[] { (byte)(asciiCode + j) };
                                string strCharacter = asciiEncoding.GetString(byteArray);

                                if (!string.IsNullOrEmpty(KSCMS.S("appans" + i + j)))
                                {
                                    apptmnr += strCharacter + "." + KSCMS.S("appans" + i + j) + "<br />";
                                    appAnswer += Utils.ChkSQL(KSCMS.S("appans" + i + j)) + "$$$$";
                                }
                            }

                            if (!string.IsNullOrEmpty(Utils.ClearHtml(KSCMS.S("qus" + i))))
                            {
                                ht.Add("tmnr", KSCMS.S("qus" + i));
                            }
                            else
                            {
                                ht.Add("tmnr", apptmnr);
                            }
                            ht.Add("appanswer", appAnswer);
                            #endregion

							CommonData.Insert("KS_SJTKSub", ht);
						}
					}
					else if (tmType == 7)
					{
						ht.Clear();
						ht.Add("TMfs", Utils.StrToFloat(KSCMS.S("fs" + i)));
						ht.Add("tmtype", 7);
						ht.Add("parentTmID", tmId);
						ht.Add("orderid", n++);
						int numi = Utils.StrToInt(KSCMS.S("num" + i));
						if (Utils.StrToInt(KSCMS.S("isjst" + i)) == 1)
						{
							#region 分录题里的计算题
							string ans = string.Empty;
							string tm = string.Empty;
							for (int ii = 1; ii <= numi; ii++)
							{
								string tms = KSCMS.S("tm" + i + "" + ii);
								if (!string.IsNullOrEmpty(tms))
								{
									if (string.IsNullOrEmpty(tm))
									{
										tm = tms;
										ans = KSCMS.S("ans" + i + "" + ii);
									}
									else
									{
										tm += "§" + tms;
										ans += "§" + KSCMS.S("ans" + i + "" + ii);
									}
								}
							}
							ht.Add("tmnr", tm);
							ht.Add("answer", ans);
							#endregion
						}
						else
						{
							ht.Add("tmnr", string.Empty);
							string ans = string.Empty;
							for (int ii = 1; ii <= numi; ii++)
							{
								string qans = KSCMS.S("ans" + i + "" + ii + "1");
								if (!string.IsNullOrEmpty(qans))
								{
									if (string.IsNullOrEmpty(ans))
									{
										ans = KSCMS.S("ans" + i + "" + ii + "1") + "№" + KSCMS.S("ans" + i + "" + ii + "2") + "№" + KSCMS.S("ans" + i + "" + ii + "3");
									}
									else
									{
										ans += "§" + KSCMS.S("ans" + i + "" + ii + "1") + "№" + KSCMS.S("ans" + i + "" + ii + "2") + "№" + KSCMS.S("ans" + i + "" + ii + "3");
									}
								}
							}
							ht.Add("answer", ans);
						}
						CommonData.Insert("KS_SJTKSub", ht);

					}
				}
				#endregion

				//Msg.Alert("添加成功", BasicField.GetUserUrl("sj/TcSJAddST", "do-add,sjid-" + sjId));
             Msg.Alert("添加成功", BasicField.GetUserUrl("sj/TcSJAddST", "do-stmanage,sjid-"+sjId+",dtfs-"+Utils.StrToInt(KSCMS.S("dtfs"))));
			}
			else
			{
				string url = BasicField.GetUserUrl("sj/TcSJAddTm", "isrndsj-" + isRndSj + ",sjid-" + sjId + ",classid-" + KSCMS.S("TxtClassID") + ",tmtype-" + KSCMS.S("DrpTmType") + ",typeid-" + TypeID + ",num-" + KSCMS.S("TxtNum") + ",score-" + KSCMS.S("TxtScore") + ",xihao-" + KSCMS.S("xihao") + ",isrnd-" + KSCMS.S("CkbAddRnd"));
				Response.Redirect(url);
			}
		}
	}
	private void initialList()
	{
		using (DataTable dtt = DataFactory.GetDataTable("SELECT Top 1 Title,KSSJ,Score From KS_SJ Where id=" + sjId))
		{
			if (dtt.Rows.Count > 0)
			{
				toptitle2 = "试卷名称：" + dtt.Rows[0]["Title"].ToString() + "&nbsp;时间：" + dtt.Rows[0]["kssj"].ToString() + "&nbsp;试卷总分：" + dtt.Rows[0]["Score"].ToString() + "分。";
			}
		}
	}
	protected void addclassbutton_Click(object sender, EventArgs e)
	{
		
		DataTable dt = DataFactory.GetDataTable("select top 1 * from [KS_SJ] Where id=" + sjId);

		if (dt.Rows.Count > 0)
		{
			DataRow dr = dt.Rows[0];
			isRealTest = Utils.StrToInt(dr["realTest"].ToString());
			toptitle = string.Format(@"添加试题，试卷名称：{0} ", dr["title"].ToString());
			TxtClassID = dr["classid"].ToString();
		}
		else
		{
			Msg.Alert("试卷不存在",BasicField.GetUserUrl("sj/tcsjlist"));
			isLoadPage=false;
			return;
		}
		dt.Dispose();

		if (isRndSj == 1)
		{
			TxtOrderID = (Utils.StrToInt(DataFactory.GetOnlyValue("select max(orderid) from KS_SJRndZJ Where SJID=" + sjId)) + 1).ToString();
		}
		else
		{
			TxtOrderID = (Utils.StrToInt(DataFactory.GetOnlyValue("select max(orderid) from KS_SJTMType Where SJID=" + sjId)) + 1).ToString();
		}
		if (string.IsNullOrEmpty(KSCMS.S("xihao")))
		{
			hasXihao = Utils.StrToInt(DataFactory.GetOnlyValue("select max(a.orderid) from KS_SJTK a inner join KS_SJTMType b on a.typeid=b.typeid Where b.sjid=" + sjId));
		}
		int hasAddNum = 0;
		if (isRndSj == 1)
		{
			hasAddNum = Utils.StrToInt(DataFactory.GetOnlyValue("select count(1) From KS_SJRndZj Where SJID=" + sjId));
		}
		else
		{
			hasAddNum = Utils.StrToInt(DataFactory.GetOnlyValue("select count(1) From KS_SJTMType Where SJID=" + sjId));
		}
		if (hasAddNum > 0)
		{
			LabTips= string.Format(@"<strong>已经添加了 <span style=""color:red"">{0}</span> 个大题，正在添加第 <span style=""color:red"">{1}</span> 大题。</strong>", UtilsAutoID.CapitalFigures(hasAddNum - 1), UtilsAutoID.CapitalFigures(hasAddNum));
		}

	}
	private void delSt()
	{
		string ids = KSCMS.S("tmid");
		if (string.IsNullOrEmpty(ids))
		{
			ids = KSCMS.S("ids");
		}
		ids = Utils.FilterIDs(ids);

		if (ids != null)
		{
			ids = Utils.FilterIDs(ids);
			if (!string.IsNullOrEmpty(ids))
			{
				using (DataTable dt = DataFactory.GetDataTable("select TypeID From KS_SJTK Where (tmtype=6 or tmtype=7) and tmId in(" + ids + ")"))  //分析题删除对应的大题记录
				{
					if (dt.Rows.Count > 0)
					{
						foreach (DataRow dr in dt.Rows)
						{
							if (Utils.StrToInt(DataFactory.GetOnlyValue("select count(1) From KS_SJTK Where TypeID=" + dr["typeid"].ToString())) == 1)
							{
								DataFactory.ExecuteNonQuery("Delete From KS_SJTMType Where TypeID=" + dr["TypeID"].ToString());
							}
						}
					}
				}
				DataFactory.ExecuteNonQuery("Delete From KS_SJTK Where tmId in(" + ids + ")");
				DataFactory.ExecuteNonQuery("Delete From KS_SJTKSub Where parentTMId in(" + ids + ")");
				DataFactory.ExecuteNonQuery("Delete From KS_UploadFiles Where ChannelID=100007 and infoid in(" + ids + ")");
			}
		}
		Msg.Alert("恭喜，试题删除成功！", KSCMS.GetComeUrl());
		isLoadPage = false;
		return;
	}
	private void delDT()
	{
		int typeId = Utils.StrToInt(KSCMS.S("typeid"));
		DataFactory.ExecuteNonQuery("Delete From KS_UploadFiles Where ChannelID=100007 and infoid in(select tmid from KS_SJTK Where TypeID=" + typeId + " AND IsRnd=0)");
		DataFactory.ExecuteNonQuery("DELETE FROM KS_SJTK Where TypeID=" + typeId + " AND IsRnd=0");
		DataFactory.ExecuteNonQuery("DELETE FROM KS_SJTMType Where TypeID=" + typeId);
		Msg.Alert("恭喜，大题删除成功！", BasicField.GetUserUrl("sj/tcSJAddST","sjid-"+sjId));
		isLoadPage = false;
		return;
	}
	protected void SaveTH()
	{
		string ids = KSCMS.S("th");
		ids = Utils.FilterIDs(ids);
		foreach (string id in ids.Split(','))
		{
			DataFactory.ExecuteNonQuery("UPDATE KS_SJTK Set OrderID=" + Utils.StrToInt(KSCMS.S("orderid" + id)) + " WHERE TMID=" + id);
		}
		Msg.Alert("恭喜，批量修改题号成功！",BasicField.GetUserUrl("sj/TcSJAddST","sjid-"+sjId));
		isLoadPage = false;
		return;
	}
	
</script>
<%
    if (!isLoadPage) return;
	if (!KSCMS.S("do").Equals("modify") && !KSCMS.S("do").Equals("add")){
%>
<div style="padding-right:40px"><div id="Div1" class="toptitle menu_top_fixed"><%=toptitle2 %></div><div class="menu_top_fixed_height"></div> </div>
 <%if (Kesion.APPCode.EditorAPI.EditorTag("ExamEditorTag")=="UM"){ %>
<link rel="stylesheet" href="/UMEditor/third-party/mathquill/mathquill.css"/>

<script src="/UMEditor/third-party/mathquill/mathquill.min.js"></script>
<%} %>
	<script>
        var box ='';
        function openWin(title, url, isreload, width, height) {
            if (width == null) width = 760;
            if (height == null) height = 450;
            box = $.dialog.open(url, {
                id: 'topbox', lock: true, title: title, width: width, height: height, close: function () {
                    if (isreload) {
                        frames['main'].location.reload();
                    }
                }
            });
        }
    
        var purl="<%=BasicField.GetUserUrl("SJ/TcSjEditeSt")%>";
        function editSt(id) {
            purl+=",frame-no,do-modify,tmid-"+id;
            openWin('修改试题', purl, false, 900, 520);
        }
        function addSt(typeid) {
            purl+=",frame-no,do-add,typeid-"+typeid;
            openWin('添加试题', purl, false, 900,520);
        }
        function delDtt(typeid){
            if (confirm('删除大题，此大题下的试题将被清空，且此操作不可逆，确定执行删除操作吗？')){
                var url="<%=BasicField.GetUserUrl("SJ/TcSjAddST","do-del")%>";
                location.href=url+',sjid-<%=sjId %>&typeid-'+typeid;
        }
    }
    function editDtjj(typeid,t,dtfs) {
        var url="<%=BasicField.GetUserUrl("SJ/TcSjEditDT")%>";
        openWin('修改大题简介', url+',do-modify,frame-no,typeid-' + typeid+",dtfs-"+dtfs, false,850,450);
    }
        function checkZF(id) {
            var url="<%=BasicField.GetUserUrl("SJ/TcSJCheckZF")%>";
            openWin('检查试卷总分',url+ ',frame-no,id-' + id, false, 900, 520);
    }
    function showToggle(id) {
        if (jQuery('#xt' + id).html() == '') {
            jQuery('#xt' + id).append('<tr class="tdbg"><td height="30" align="center" colspan="4">本大题下还没有添加小题!</td></tr>');
        }
        var t = jQuery("#t" + id).html();
        if (t.indexOf('打开') != -1) {
            jQuery('#xt' + id).slideDown('fast');
            jQuery("#t" + id).html('<img border="0" src="/admin/images/icon_del_over.png" align="absmiddle"/>关闭')
        } else {
            jQuery('#xt' + id).slideUp('fast');
            jQuery("#t" + id).html('<img border="0" src="/admin/images/icon_add_normal.png" align="absmiddle"/>打开')
        }
    }
    jQuery(document).ready(function() {
                 <%if (KSCMS.S("action") == "modifyth") {%>
        jQuery(".toggleArea").html('<img border="0" src="/admin/images/icon_del_over.png" align="absmiddle"/>关闭');
        jQuery('.showArea').each(function(){
            if (jQuery(this).html()==''){
                jQuery(this).append('<tr class="tdbg"><td height="30" align="center" colspan="4">本大题下还没有添加小题!</td></tr>');
            }
        });
                     <%}else{ %>
        jQuery(".toggleArea").html('<img border="0" src="/admin/images/icon_del_over.png" align="absmiddle"/>关闭');
        // jQuery(".showArea").attr("style","display:none");
                     <%} %>
    });
        var currStatue=0;
        function openAll(){
            if (currStatue==1){ //展开
                currStatue=0
                jQuery(".toggleArea").html('<img border="0" src="/admin/images/icon_del_over.png" align="absmiddle"/>关闭');
                jQuery('.showArea').each(function(){
                    if (jQuery(this).html()==''){
                        jQuery(this).append('<tr class="tdbg"><td height="30" align="center" colspan="4">本大题下还没有添加小题!</td></tr>');
                    }
                });
                jQuery('.showArea').show();
                jQuery("#allstate").html('全部隐藏');
            }else{
                currStatue=1;
                jQuery(".toggleArea").html('<img border="0" src="/admin/images/icon_add_normal.png" align="absmiddle"/>打开');
                jQuery(".showArea").attr("style","display:none");
                jQuery("#allstate").html('全部展开');
            }
        }
        function submitchange(i)
        {
            if(i==1)
            {
                $("#myform").attr("action","<%=BasicField.GetUserUrl("SJ/TcSjaddSt","do-saveth") %>");
                $("#myform").submit();
            }
        }
    </script>
    <form name="myform" action="<%=BasicField.GetUserUrl("SJ/TcSjaddSt","do-delSt") %>" method="post" id="myform" >
        <div class="t_tybox">
            <div class="ty_title">试题管理</div>
            <input type="hidden" value="<%=KSCMS.S("sjid") %>" name="sjid" />
             <div style="margin:20px">
              
                 <%if (KSCMS.S("do") == "modifyth")
                   {%>
                
                   <input type="button" value="批量保存题号修改" class="ty_button" onclick="submitchange(1)" />
                  <%}
                   else if (count>0)
                   { %>
                  <div style="display:none"><input type="button" class="ty_button" value="批量修改题号" style="margin-left:0px;" onclick="location.href='<%=BasicField.GetUserUrl("SJ/TcSjAddST","do-modifyth,sjid-"+sjId+"")%> '" /></div>
                  <%} %>
                  <input type="button" class="ty_button" value="批量添加试题及答案" onclick="location.href='<%=BasicField.GetUserUrl("SJ/TcSjAddST","do-add,sjid-"+sjId+"")%>'" />
                  <% if (count > 0){ %>
                  <input type='button' value='检查试卷总分' onclick="checkZF(<%=sjId%>)" class='ty_button'/>
                  <%} %>
                  <a href="<%=BasicField.GetExamUrl("exam","do-ex,id-"+sjId) %>" class="ty_button" target="_blank">预览</a>
             </div>
              <div class="clear"></div>
              <table width="100%" align="center" border="0" cellpadding="0" cellspacing="0" class="border">
                  <tr class="title">
                   <td width="10%" align="center">序号</td>
                   <td width="76%" class="tag_left1">&nbsp;&nbsp;题目内容 &nbsp; <a href="javascript:;" onclick="openAll()" id="allstate" class="fontls">（全部隐藏）</a></td>
                   <td width="14%"><b>操作</b></td>
                  </tr>
           
                 <%  string sqlStr = "SELECT * From [KS_SJTMType] Where SJID=" + sjId;
                     if (KSCMS.S("dtfs") == "3")
                     {
                         sqlStr = "SELECT id as typeid,title as typename, * From [KS_SJRndZJ] Where SJID=" + sjId;
                     }
                     using (DataTable dt = DataFactory.GetDataTable(sqlStr))
                     {
                         if (dt.Rows.Count > 0)
                         {
                             int i = 1;
                             foreach (DataRow dr in dt.Rows)
                             {
                                 KSCMS.W("<TR class=\"tdbg sort bar\"><td align=\"center\" nowrap class=\"bottom_line\">" +
                             "<span style='cursor:pointer' id='t" + dr["typeid"].ToString() + "' class=\"toggleArea\" onclick=\"showToggle(" + dr["typeid"].ToString() + ");\"></span></td>" +
                         "<td class=\"tag_left1 bottom_line\">" +
                           " <font color=\"#00b2b9\">【第" + i + "大题】</font> &nbsp; <font class=\"fonths\">" + dr["typename"].ToString() + "</font>" +
                            "<div class=\"blank10\"></div><div class=\"exam_listimg\">" + ((Convert.ToString(dr["TmType"]) != "6" && Convert.ToString(dr["TmType"]) != "7") ? "<br/>" + Utils.CutStr(dr["intro"].ToString(),300) : "") + " </div></td>" +
                        "<td style=\"text-align:center;width:220px;padding-top:2px;\" nowrap valign=\"top\" class=\"bottom_line\">" +
                            "<div class=\"gl_btn gl_btn1\">" +
                                " <span class=\"span3\"><a href=\"javacript:void(0);\" onclick='addSt(" + dr["typeid"] + ")'><i class=\"iconfont\">&#xe61f;</i>添加</a></span>" +
                                " <span class=\"span4\"><a href=\"javacript:void(0);\" onclick='editDtjj(" + dr["typeid"] + ",0," + Utils.StrToInt(KSCMS.S("dtfs"),1) + ")'><i class=\"iconfont\">&#xe61d;</i>修改</a></span>" +
                                " <span class=\"span5\"><a href=\"" + BasicField.GetUserUrl("SJ/TcSjAddST", "do-deldt,sjid-" + dr["sjid"].ToString() + ",typeid-" + dr["typeid"].ToString() + "") + "\" onclick=\"return confirm('删除大题，此大题下的试题将被清空，且此操作不可逆，确定执行删除操作吗？');\"><i class=\"iconfont\">&#xe731;</i>删除</a></span>" +
                             "</div></td></TR>");
                                 KSCMS.W(" <tr class=\"tdbg tdline\" id='xt" + dr["typeid"].ToString() + "' >  <td colspan=\"3\"> <table class=\"showArea\" width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">");
                                 string tmids = Convert.ToString(dr["TmIds"]);                 
                                 string strSQL = string.Empty;
                                 if (string.IsNullOrEmpty(tmids) || tmids == "0")
                                 {
                                     strSQL = "Select top 300 * From KS_SJTK Where typeId=" + dr["typeid"].ToString() + " order by orderid,tmid desc";
                                 }
                                 else
                                 {
                                     strSQL = "Select top 300 * From KS_SJTK Where TmId in(" + tmids + ") order by orderid,tmid desc";
                                 }
                                 //string strSQL = "select top 300 * from KS_SJTK where typeid=" + dr["typeid"].ToString() + " order by orderid,tmid";
                                 if (KSCMS.S("dtfs") == "3")
                                 {
                                     if (!string.IsNullOrEmpty(dr["TmIds"].ToString()))
                                     {
                                         strSQL = "select top 300 * from KS_SJTK where tmid in (" + dr["TmIds"].ToString() + ") order by orderid,tmid";
                                     }
                                 }
                                 using (DataTable dts = DataFactory.GetDataTable(strSQL))
                                 {
                                     int k = 1;
                                     foreach (DataRow drs in dts.Rows)
                                     {
                                         KSCMS.W("<tr class=\"tdbg tdline\"><td style=\"text-align:center\" width=\"158\" class=\"bottom_line\">");
                                         if (KSCMS.S("do") == "modifyth")
                                         {
                                             KSCMS.W("<input type='hidden' name='th' value='" + drs["tmid"] + "'/>" +
                                             "<input class='textbox' type='text' style='text-align:center' name='orderid" + drs["tmid"] + "' value='" + k + "' size='2'/>");
                                         }
                                         else
                                         {
                                             KSCMS.W("<font color=red> <strong>" + k + ".</strong></font>");
                                         }
                                         KSCMS.W("<br/> <span class=\"tips\" style=\"padding-left:0px\">(" + drs["TMFS"] + "分)</span></td>" +
                                     "<td class=\"tag_left bottom_line\" style=\"padding:10px;word-break:break-all; line-height:24px;\">" +
                                       "<input type=\"checkbox\" class=\"fxinput\" name=\"ids\" value='" + drs["tmid"] + "' style=\"vertical-align: middle;\"/><span>" + drs["title"] + "</span><br />" +
                                        Kesion.Exam.Function.ReplaceTKTTags(Utils.replaceBR(Convert.ToString(drs["TMNR"])), 1, 1) +
                                          " <div style='height:20px;border-bottom:1px dashed #cccccc;overflow:hidden'></div>" +
                                           "<span class=\"tips\">" + ((Utils.StrToInt(drs["tmtype"]) != 6 && Utils.StrToInt(drs["tmtype"]) != 7) ? "<div>参考答案：" + Kesion.Exam.Function.GetCKDA(Utils.StrToInt(drs["tmtype"]), Utils.CutStr(Convert.ToString(drs["answer"]),100)) : "</div>")
                                              + (string.IsNullOrEmpty(Convert.ToString(drs["dajs"])) ? "" : "<br/>答案解释：") + Utils.replaceBR(Convert.ToString(drs["dajs"])) + "</span></td>" +
                                     "<td style=\"text-align:center;width:220px;padding-top:20px;\" nowrap valign=\"top\" class=\"bottom_line\">" +
                                        "<div class=\"gl_btn gl_btn2\">" +
                                          "<span class=\"span5\"><a href=\"javascript:;\" onClick=\"editSt(" + drs["tmid"] + ");\" class=\"texthref\"><i class=\"iconfont\">&#xe61d;</i>编辑</a></span>" +
                                          "<span class=\"span5\"><a href=\"" + BasicField.GetUserUrl("sj/TcsjAddST", "do-delst,tmid-" + drs["tmid"].ToString() + "") + "\" onClick=\"return confirm('您确定进行删除操作吗？')\" class=\"texthref\"><i class=\"iconfont\">&#xe731;</i>删除</a> </span>" +
                                        "</div></td></tr>");
                                         k++;
                                     }
        
                                 }
                                 KSCMS.W("</td></table></tr>");
                                 i++;
                             }
                         }
                         else
                         {
                             KSCMS.W("  <tr class=\"tdbg\"> <td class=\"Ctd\" style=\"text-align:center\" colspan=\"4\"><div class=\"empty\">暂无试题，<a href=\"" + BasicField.GetUserUrl("sj/TcSjAddST", "do-add,sjid-" + sjId) + "\">点此添加&raquo;</a></div></td></tr> ");
                         }
                     }
        
                      %>
                     
                  <script>
                    $(function(){
                        if($(".tdline td table").text()== ""){
                            $(this).parent(".tdline").css("background","none");
                        }
                    })
                 </script>
            
               </table>
        
             <div class="clearfix" style="margin:10px">
               <% if (count > 0)
                  { %>
         
                <div class="cz_btn">
                    <input type="hidden" value="del" name="" />
                    <span><input type="checkbox" name="chkall" class="checkbtn" id="chkall" onclick="CheckAll(this.form);"/><label for="chkall">全选</label></span>
                    <span><input type="submit" name="BtnDel" value="删除选中的试题" id="BtnDel" class="button" /></span>
                </div>
        
                <%}
               if (KSCMS.S("action") == "modifyth")
               {%>
                <input type="button" value="批量保存题号修改" class="ty_button" onclick="submitchange(1)" />
                <%}
               else if (count > 0)
               { %>
                <input type="button" class="button" style="display:none" value="批量修改题号" onclick="location.href='<%=BasicField.GetUserUrl("SJ/TcSjAddST","do-modifyth,sjid-"+sjId+"")%>'" />
                <%} %>
                <input type="button" class="ty_button" style="display:none" value="批量添加试题及答案" onclick="location.href='<%=BasicField.GetUserUrl("SJ/TcSjAddST","do-add,sjid-"+sjId+"")%>'" />
                <% if (count > 0)
                  { %>
                <input type='button' style='display:none' value='检查试卷总分' onclick='checkZF(<%=sjId%>)' class='button'/>
                <%} %>
             </div>     
        </div>      
    </form>
<%}else{ %>
	<script>
        function gettmType(s) {
            s=parseInt(s);
            switch (s) {
                case 1: document.getElementById("TxtTypeName").value = "主观题"; break;
                case 5: document.getElementById("TxtTypeName").value = "填空题"; break;
                case 2: document.getElementById("TxtTypeName").value = "单选题"; break;
                case 3: document.getElementById("TxtTypeName").value = "多选题"; break;
                case 4: document.getElementById("TxtTypeName").value = "判断题"; break;
                case 6: document.getElementById("TxtTypeName").value = "阅读分析"; break;
                case 7: document.getElementById("TxtTypeName").value = "会计分录题"; break;
            }
            if (s==6||s==7){
                currnum=1;
                jQuery("#kjfl").empty();
                jQuery("#ydlj").empty();
                if (s==6){
                    jQuery("#ydt").show();
                    jQuery("#kjflt").hide();
                    jQuery("#kjfl").hide();
                }else{
                    jQuery("#kjflt").show();
                    jQuery("#ydt").hide();
                    jQuery("#ydlj").hide();
                }
                jQuery("#showdajs").hide();
                jQuery("#showtmnr").show();
                jQuery("#showth").hide();
            }else{
                jQuery("#ydt").hide();
                jQuery("#kjflt").hide();
                jQuery("#showdajs").hide();
                    
                jQuery("#showth").show();
                    
            }
        }
        function CheckForm() {
           
            if (jQuery("#DrpTmType option:selected").val()=='0'){
                KesionJS.Alert( '请选择试卷类型！', "");
                return false;
            }
            if (jQuery("#TxtTypeName").val()==''){
                KesionJS.Alert( '请输入类型名称！', "jQuery('#TxtTypeName').focus();");
                return false;
            }
            if (jQuery("#DrpTmType option:selected").val()=='6'||jQuery("#DrpTmType option:selected").val()=='7'){
                   
                if (editor.hasContents()==false){
                     
                    //  KesionJS.Alert("请输入题目内容！","editor.focus();");
                    //  return false;
                }
                if (currnum<=1){
                    KesionJS.Alert( '请添加小题！', "");
                    return false;
                }
            }
        }
        function replaceEditor(id){
            editor1 = UE.getEditor(id,{toolbars:[  ['fullscreen', 'source', '|', 'undo', 'redo', '|','bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript','removeformat','|','insertimage', 'wordimage', 'emotion'] ],initialFrameWidth:700,initialFrameHeight:120,wordCount:false,autoHeightEnabled:false,minFrameHeight:80,elementPathEnabled:false });
        }
        var currnum = 1;
        function addxt() {
            var num = jQuery("#TxtNum").val();
            var fs = jQuery("#TxtScore").val();
            var defaultTm = jQuery("#defaultTm").val();
            var xttype = parseInt(jQuery("#xttype option:selected").val());
            var str = "";
            var denum=currnum;
            for (var i = currnum; i <= num; i++) {
                str += "<tr id='t"+i+"'><td valign='top' width='700'><i class='dot'></i>第 <font color=green><strong>" + i + "</strong></font> 小题  <strong>题目内容：</strong><br/><br/><textarea name='qus" + i + "' id='qus" + i + "' style='width:100%;height:120px'>" + defaultTm + "</textarea>";
                str += "<br/>题目类型：<select style='width:120px' onchange=setAns(this.value,"+i+") name='tmt" + i + "' id='tmt" + i + "'>";
                str +="<option value='2'";
                if (xttype==2) str+=" selected"
                str += ">单选题</option><option value='4'";
                if (xttype == 4) str += " selected"
                str += ">对错题</option><option value='5'";
                if (xttype == 5) str += " selected"
                str += ">填空题</option><option value='3'";
                if (xttype == 3) str += " selected"
                str += ">多选题</option><option value='1'";
                if (xttype == 1) str += " selected"
                str += ">主观题</option></select>";
                if (xttype == 1)
                    str += "<br/>参考答案:";
                else
                    str += "参考答案:";
                str += "<span id='sa"+i+"'>" +GetAns(xttype,i)+"</span>";
    
                str +="<br/><br/>答案解释：<input type='button' class='button' value='使用编辑器' onclick=\"replaceEditor('dajs" + i + "');\"/><br/><br/><textarea  style='width:100%;height:120px' name='dajs" + i + "' id='dajs" + i + "'/></textarea>"
    
                str +="</td><td align='left'>分数:<input type='text' name='fs" + i + "' class='textbox' value='" + fs + "' style='text-align:center;width:30px'/>分</td><td style='text-align:center'><a href='javascript:;' onclick='removeTr("+i+");return false;'>删除</a></td></tr>";
                str +="<tr><td colspan=10 style='height:0;border-bottom:1px solid #b9b9b9;padding:0'></td></tr>";
                currnum++;
            }
            if (str != '') {
                jQuery("#ydlj").show().append("<tr><td align='right' class='lefttd'><strong>小题：</strong><br/><br/><span class='tips'>如果是选择题在题目内容填写具体的选项,填空题在需要用户作答的地方放{#answer}标签。</span></td><td class='righttd'><table width='95%'>" + str + "</table></td></tr>");
                for (var i=denum;i<=num;i++){
                    replaceEditor('qus' + i);
                    if (xttype==1){
                        replaceEditor('ans' + i);
                    }
                }
            }
        }
        function showansweroption(v,type,i) {
            for (ii = 3; ii <= 9; ii++) {
                jQuery("#l"+type+""+i+"" + ii).hide();
            }
            for (var ii = 3; ii <= v; ii++) {
                jQuery("#l"+type+""+i+"" + ii).show();
            }
        }
        function GetAns(type,i) {
            var str ='';
            var defaultoptionnum=jQuery("#defaultoptionnum option:selected").val();
            switch (parseInt(type)) {
                case 2:
                    str += "选项个数：<select onchange='showansweroption(this.value,"+type+","+i+");' name='optionnum"+i+"' id='optionnum"+i+"'>";
                    for (var nn=2;nn<=9;nn++){
                        str +="<option value='"+nn+"'"
                        if (defaultoptionnum==nn) str+=" selected";
                        str +=">"+nn+"个</option>";
                    }
                    str += "</select><br/>"
    
                    str += "<input type='radio' name='ans" + i + "' value='A'/>A";
                    str += " <textarea style='width:480px;height:80px'   id='appans"+i+"1' name='appans"+i+"1'></textarea><br />";
    
                    str += "<input type='radio' name='ans" + i + "' value='B'/>B";
                    str += " <textarea style='width:480px;height:80px'   id='appans"+i+"2' name='appans"+i+"2'></textarea><br />";
    
                    str += "<label id='l2"+i+"3'";
                    if (defaultoptionnum<3) str+=" style='display:none'";
                    str +="><input type='radio' name='ans" + i + "' value='C'/>C<textarea style='width:480px;height:80px'   id='appans"+i+"3' name='appans"+i+"3'></textarea><br /></label>";
                    str += "<label id='l2"+i+"4'";
                    if (defaultoptionnum<4) str+=" style='display:none'";
                    str +="><input type='radio' name='ans" + i + "' value='D'/>D<textarea style='width:480px;height:80px'   id='appans"+i+"4' name='appans"+i+"4'></textarea><br /></label>";
                    str += "<label id='l2"+i+"5'";
                    if (defaultoptionnum<5) str+=" style='display:none'";
                    str +="><input type='radio' name='ans" + i + "' value='E'/>E<textarea style='width:480px;height:80px'   id='appans"+i+"5' name='appans"+i+"5'></textarea><br /></label>";
                    str += "<label id='l2"+i+"6'";
                    if (defaultoptionnum<6) str+=" style='display:none'";
                    str +="><input type='radio' name='ans" + i + "' value='F'/>F<textarea style='width:480px;height:80px'   id='appans"+i+"6' name='appans"+i+"6'></textarea><br /></label>";
                    str += "<label id='l2"+i+"7'";
                    if (defaultoptionnum<7) str+=" style='display:none'";
                    str +="><input type='radio' name='ans" + i + "' value='G'/>G<textarea style='width:480px;height:80px'   id='appans"+i+"7' name='appans"+i+"7'></textarea><br /></label>";
                    str += "<label id='l2"+i+"8'";
                    if (defaultoptionnum<8) str+=" style='display:none'";
                    str +="><input type='radio' name='ans" + i + "' value='H'/>H<textarea style='width:480px;height:80px'   id='appans"+i+"8' name='appans"+i+"8'></textarea><br /></label>";
                    str += "<label id='l2"+i+"9'";
                    if (defaultoptionnum<9) str+=" style='display:none'";
                    str +="><input type='radio' name='ans" + i + "' value='I'/>I<textarea style='width:480px;height:80px'   id='appans"+i+"9' name='appans"+i+"9'></textarea><br /></label>";
                    break;
                case 3:
                    str += "选项个数：<select onchange='showansweroption(this.value,"+type+","+i+");' name='optionnum"+i+"' id='optionnum"+i+"'>";
                    for (var nn=2;nn<=9;nn++){
                        str +="<option value='"+nn+"'"
                        if (defaultoptionnum==nn) str+=" selected";
                        str +=">"+nn+"个</option>";
                    }
                    str += "</select><br/>"
    
                    str += "<input type='checkbox' name='ans" + i + "' value='A'/>A";
                    str += " <textarea style='width:480px;height:80px'   id='appans" + i + "1' name='appans" + i + "1'></textarea><br />";
    
                    str += "<input type='checkbox' name='ans" + i + "' value='B'/>B";
                        str += " <textarea style='width:480px;height:80px'   id='appans"+i+"2' name='appans"+i+"2'></textarea><br />";
                    str += "<label id='l3"+i+"3'";
                    if (defaultoptionnum<3) str+=" style='display:none'";
                    str +="><input type='checkbox' name='ans" + i + "' value='C'/>C<textarea style='width:480px;height:80px'   id='appans"+i+"3' name='appans"+i+"3'></textarea><br /></label>";
                    str += "<label id='l3"+i+"4'";
                    if (defaultoptionnum<4) str+=" style='display:none'";
                    str +="><input type='checkbox' name='ans" + i + "' value='D'/>D<textarea style='width:480px;height:80px'   id='appans"+i+"4' name='appans"+i+"4'></textarea><br /></label>";
                    str += "<label id='l3"+i+"5'";
                    if (defaultoptionnum<5) str+=" style='display:none'";
                    str +="><input type='checkbox' name='ans" + i + "' value='E'/>E<textarea style='width:480px;height:80px'   id='appans"+i+"5' name='appans"+i+"5'></textarea><br /></label>";
                    str += "<label id='l3"+i+"6'";
                    if (defaultoptionnum<6) str+=" style='display:none'";
                    str +="><input type='checkbox' name='ans" + i + "' value='F'/>F<textarea style='width:480px;height:80px'   id='appans"+i+"6' name='appans"+i+"6'></textarea><br /></label>";
                    str += "<label id='l3"+i+"7'";
                    if (defaultoptionnum<7) str+=" style='display:none'";
                    str +="><input type='checkbox' name='ans" + i + "' value='G'/>G<textarea style='width:480px;height:80px'   id='appans"+i+"7' name='appans"+i+"7'></textarea><br /></label>";
                    str += "<label id='l3"+i+"8'";
                    if (defaultoptionnum<8) str+=" style='display:none'";
                    str +="><input type='checkbox' name='ans" + i + "' value='H'/>H<textarea style='width:480px;height:80px'   id='appans"+i+"8' name='appans"+i+"8'></textarea><br /></label>";
                    str += "<label id='l3"+i+"9'";
                    if (defaultoptionnum<9) str+=" style='display:none'";
                    str +="><input type='checkbox' name='ans" + i + "' value='I'/>I<textarea style='width:480px;height:80px'   id='appans"+i+"9' name='appans"+i+"9'></textarea><br /></label>";
                    break;
                case 4:
                    str += "<input type='radio' name='ans" + i + "' value='1'/>对";
                    str += "<input type='radio' name='ans" + i + "' value='0'/>错";
                    break;
                case 5:
                    str += "<input type='text' name='ans" + i + "' id='ans" + i + "' class='textbox'/>";
                    break;
                case 1:
                    str += "<textarea  style='width:100%;height:80px' name='ans" + i + "' id='ans" + i + "'/></textarea>";
                    break;
            }
            return str;
        }
        function setAns(v, i) {
            jQuery("#sa" + i).html(GetAns(v, i));
            if (v==1){
                replaceEditor('ans' + i);
            }
        }
        function removeTr(i){
            jQuery("#t"+i).remove();
        }
        //添加分录答案
        function addflt(){
            var num = jQuery("#TxtNum").val();
            var fs = jQuery("#TxtScore").val();
            var str = "";
            for (var i = currnum; i <= num; i++) {
                str += "<tr id='t"+i+"'><td valign='top' style='width:30px;'>(" + i + ")、</td><td valign='top' id='my"+i+"'>";
                str += oneDiv(i,1);
                str += oneDiv(i,2);
                str +="</td><td valign='top'><input type='hidden' name='num"+i+"' id='num"+i+"' value='2'/>分数：<input type='text' name='fs" + i + "' class='textbox' value='" + fs + "' style='text-align:center;width:30px'/>分</td></tr>";
                currnum++;
            }
            if (str != '') {
                jQuery("#kjfl").show().append("<tr><td align='right' class='lefttd'><strong>分录题参考答案：</strong><br/><br/></td><td class='righttd'><table width='90%'>" + str + "</table></td></tr>");
            }
        }
        //给分录题增加计算题
        function addJst(){
            var fs = jQuery("#TxtScore").val();
            var str = "";
            i = currnum
            jQuery("#TxtNum").val(i);
            // alert(i);
            str += "<tr id='t"+i+"'><td valign='top' style='width:30px;'>(" + i + ")、<input type='hidden' name='isjst"+i+"' value='1'/></td><td valign='top' id='my"+i+"'>";
            str += oneDivJST(i,1);
            str +="</td><td valign='top'><input type='hidden' name='num"+i+"' id='num"+i+"' value='1'/>分数：<input type='text' name='fs" + i + "' class='textbox' value='" + fs + "' style='text-align:center;width:30px'/>分</td></tr>";
            currnum++;
            if (str != '') {
                jQuery("#kjfl").show().append("<tr><td align='right' class='lefttd'><strong>计算题：</strong><br/><br/></td><td class='righttd'><table width='90%'>" + str + "</table></td></tr>");
            }
        }
    
        function oneDivJST(i,n){
            var str="<div id='s"+i+""+n+"'>题目：<input type='text' class='textbox' name='tm" + i + ""+n+"' style='width:300px;' value='计算金额：{#answer}'/>&nbsp;&nbsp;参考答案：<input name='ans" + i + ""+n+"' type='text' class='textbox' width='100px'/>";
            str += "&nbsp;&nbsp; <input type='button' class='button' onclick='cloneTrJS("+i+")' value='增加'/> <input class='button' type='button' class='del' onclick='removeDiv("+n+","+i+");' value='删除'/></div>";
            return str;
        }
    
        function oneDiv(i,n){
            var str="<div id='s"+i+""+n+"'>借贷方向：<input name='ans" + i + ""+n+"1' type='radio' value='借'>借 <input name='ans" + i + ""+n+"1' type='radio' value='贷'>贷";
            str += "&nbsp;&nbsp;&nbsp;&nbsp;会计科目：<input type='text' name='ans" + i + ""+n+"2' id='ans" + i + ""+n+"2' class='textbox'/> <input type='button' onclick=selectKM('ans" + i + ""+n+"2') class='button' value='...'/>";
            str += "&nbsp;&nbsp;&nbsp;&nbsp;金额：<input type='text' name='ans" + i + ""+n+"3' class='textbox'/>";
            str += "&nbsp;&nbsp; <input type='button' class='button' onclick='cloneTr("+i+")' value='增加'/> <input class='button' type='button' class='del' onclick='removeDiv("+n+","+i+");' value='删除'/></div>";
            return str;
        }
        function selectKM(FieldID){
            parent.openWin('选择科目','/exam/SelectKM.aspx?from=admin&fieldID='+FieldID,false,350,380);
        }
        function cloneTr(i){
            var n=parseInt(jQuery("#num"+i).val())+1;
            jQuery("#num"+i).val(n);
            jQuery("#my"+i).append(oneDiv(i,n));
    
        }
        function cloneTrJS(i){
            var n=parseInt(jQuery("#num"+i).val())+1;
            jQuery("#num"+i).val(n);
            jQuery("#my"+i).append(oneDivJST(i,n));
    
        }
        function removeDiv(n,i){
            if (jQuery("#my"+i).find("div").length==1){
                alert('不能删除了，最少需要一条记录!');
                return;
            }else{
                jQuery("#s"+i+""+n).remove();
            }
        }
        function chanageoption(v){
            if (v==2 || v==3){
                jQuery("#showoptionnum").show();
            }else{
                jQuery("#showoptionnum").hide();
            }
        }
    </script>	
    <form name="myform" action="<%=BasicField.GetUserUrl("sj/tcsjaddst","do-"+KSCMS.S("do")) %>" method="post" id="Form1" >
      <input name="action" value="save" type="hidden" />
      <input name="sjid"  type="hidden" value="<%=KSCMS.S("sjid") %>" />
      <input name="isrndsj" type="hidden" value="<%=KSCMS.S("isrndsj") %>" />
      <div class="t_tybox">
        <div class="ty_title">添加试题</div>
        <div id="manage_top" class="toptitle menu_top_fixed m20"><%=toptitle %> </div>
        <div class="menu_top_fixed_height"></div> 
        <div class="tips" style="padding:20px"><span><%=LabTips %></span></div>
        <table width="100%" align="center" border="0" cellpadding="1" cellspacing="1" class="border border-table"> 
            <tr>
                <td class="lefttd" height="30" align="right" width="120">题目类型：</td>
                <td class="tag_left">
                    <select name="DrpTmType" id="DrpTmType" onchange="gettmType(this.value)">
                            <option Value="0">--选择题目类型--</option>
                              <%
                              int i = 1;
                              foreach (string s in Kesion.Exam.Function.TMTypeArr)
                              {
                                  string selected = "";
                                 
                                  sb.AppendFormat("<option value=\"{0}\" {2}>{1}</option>", (i).ToString(), s, selected);
                                  i ++;
                              }
                              KSCMS.W(sb.ToString());
                              
                              %>
                    </select>
                    <span class="tips">除主观题不支持自动计分外，其它题型均支持自动计分。</span>
                </td>
            </tr>
            <tr>
                <td align="right" class="lefttd" height="30">类型名称：</td>
                <td class="tag_left">
                   <input name="TxtTypeName" type="text" id="TxtTypeName" class="textbox" /> <span class="tips">如判断题、简答时、论述题、单选题,填空题等</span>
                </td>
            </tr>
            <%if (KSCMS.S("Isrndsj") == "1")
              { %>
            <tr style="display:none" id="showtmnr">
            <%}
              else
            { %>
            <tr id="Tr1">
            <%} %>
                <td align="right" class="lefttd" height="30">题目简介：</td>
                <td class="righttd" valign="top">
                    <textarea name="TxtTmIntro" rows="2" cols="40" id="TxtTmIntro" style="width:620px;height:140px;"></textarea>
                    <%Kesion.APPCode.EditorAPI.EchoHead(); %>
                    <% Kesion.APPCode.EditorAPI.EchoEditor("editor", "TxtTmIntro", "Basic");%>
                </td>
            </tr>
            <tr>
                <td align="right" class="lefttd" height="30">此大题总共有：</td>
                <td class="tag_left"><input name="TxtNum" type="text" value="5" id="TxtNum" class="textbox nopadtext" style="width:50px;text-align:center" /> 道小题 &nbsp; &nbsp; 
                默认每小题 <input name="TxtScore" type="text" value="1" id="TxtScore" class="textbox nopadtext" style="width:50px;text-align:center" /> 分&nbsp; 
                  
                    <span id="ydt" style="display:none;">
                     默认小题内容：<input type="text" class="textbox" value="" name="defaultTm" id="defaultTm" style="width:200px;" />
                     默认小题题型：<select name="xttype" onchange="chanageoption(this.value)" id="xttype"><option value="2"  selected="selected">单选题</option><option value="3">多选题</option><option value="4">对错题</option><option value="5">填空题</option><option value="1">主观题</option></select>
                    <span id="showoptionnum">默认选项<select name="defaultoptionnum" id="defaultoptionnum">
                        <option value="2">2个</option>
                        <option value="3">3个</option>
                        <option value="4" selected="selected">4个</option>
                        <option value="5">5个</option>
                        <option value="6">6个</option>
                        <option value="7">7个</option>
                        <option value="8">8个</option>
                        <option value="9">9个</option>
                        </select></span>
                     <input type="button" class="button" value="添加小题"  onclick="addxt()"/>
                    </span>
    
                    <span id="kjflt" style="display:none">
                     <input type="button" class="button" value="添加分录答案"  onclick="addflt()"/>
                     <input type="button" class="button" value="添加计算题"  onclick="addJst()"/>
                    </span>
    
                    <span class="tips" style="display:none">
                     <input id="CkbAddRnd" type="checkbox" name="CkbAddRnd" />
                     <label for="CkbAddRnd">此大题下的小题允许加入随机题库</label></span>
                  </td>
            </tr>
    
            <%if (KSCMS.S("Isrndsj") == "1")
              { %>
            <tr style="display:none" id="showth">
            <%}
              else
              { %>
                  <tr  id="Tr2" style="display:none" id="Tr3">
             
           <%} %>
                <td align="right" class="lefttd" height="30" >小题开始题号：</td>
              <td class="tag_left"><span id="LabXiHao" class="biaoti">
            <%if (hasXihao == 0)
        {
            KSCMS.W("<input class=\"textbox\" style=\"text-align:center\" name=\"xihao\" type=\"text\" id=\"xihao\" value=\"1\" size=\"6\"> ");
        }
        else
        {
            KSCMS.W(string.Format(@" <input name=""xihao"" id=""xihao"" type=""radio"" value=""1""> 1 开始 <input checked type=""radio"" value=""{0}"" name=""xihao"" id=""xihao""> {0} 开始 ", hasXihao + 1));
        } 
        %>
                  <span class="tips">建议按默认方式添加。</span>
                    </td>
    
            </tr>
            <tr>
                <td align="right" class="lefttd" height="30">序号：</td>
                <td class="tag_left">
                <input name="TxtOrderID" type="text" value="<%=TxtOrderID %>" id="TxtOrderID" class="textbox nopadtext" style="width:50px;text-align:center" />
                 <span class="tips">数据越小排在越前面</span></td>
            </tr>
            <tbody id="ydlj"></tbody>
            <tbody id="kjfl"></tbody>
    
    
            <tr style="display:none" id="showdajs">
                <td align="right" class="lefttd" height="30">
                    <strong>答案解释：</strong></td>
                <td class="righttd" valign="top">
                <textarea name="TxtDAJS" rows="2" cols="40" id="TxtDAJS" style="width:800px;height:120px"></textarea>
                       <%Kesion.APPCode.EditorAPI.EchoHead(); %>
                       <% Kesion.APPCode.EditorAPI.EchoEditor("editor", "TxtDAJS", "Basic");%>             
                </td>
            </tr>
        </table>
        <input name="TxtClassID" type="text" value="<%=TxtClassID %>" id="TxtClassID" style="display:none" />
    
        <div class="clear blank10"></div>
        <div class="cz_btn nofloat" style="padding-left:142px;">
            <span><input type="submit" name="Button2" value="下一步(O)" onclick="return(CheckForm());" id="Button2" class="button" /></span>
            <span><input type="button" class="button" onclick="window.history.go(-1);"value=" 返 回 "></span>
        </div>	   
        <div class="clear blank20"></div>
      </div>
    </form>

<%} %>