<%@ Page Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true" Inherits="Kesion.NET.WebSite.Admin.Exam.Admin_SJTK" Title="试题库" CodeBehind="KS.SJTK.aspx.cs" %>
<%@ Import Namespace="Kesion.Publics" %>
<%@ Import Namespace="Kesion.Cache" %>
<%@ Import Namespace="Kesion.BLL" %>

<asp:Content ID="Content1" ContentPlaceHolderID="KSContent" Runat="Server">
<asp:Panel ID="ListPanel" runat="server" Width="100%">
	<script src="../../<%=MyCache.GetSJCacheConfig(1) %>/exam.js"></script>
    <script src="http://cdn.mathjax.org/mathjax/2.2-latest/MathJax.js?config=TeX-AMS_HTML"></script> <!--数学公式-->
    <%if (Kesion.APPCode.EditorAPI.EditorTag()=="UM"){ %>
    <link rel="stylesheet" href="../../UMEditor/third-party/mathquill/mathquill.css"/>
    <script src="../../UMEditor/third-party/mathquill/mathquill.min.js"></script>
    <%} %>
	<script>
        function editSt(id) {
            parent.openWin('修改试题', 'exam/KS.EditSt.Aspx?tmid=' + id,false,  1300,760);
        }
        function addSt() {
            parent.openWin('添加试题', 'exam/KS.EditSt.Aspx?from=tk&classid=<%=classId %>', true, 1300, 760);
    
        }
        function GetMyIds() {
			var sid = null;
			for (var i = 0; i < document.getElementsByName("ids").length; i++) {
				var KS = document.getElementsByName("ids")[i];
				if (KS.checked == true) {
					if (sid == null)
						sid = KS.value;
					else
						sid += "," + KS.value;
				}
			}
			return sid;
		} 
        function ContentSetAttribute(){
			var sid = GetMyIds();
			if (sid!=null)  parent.openWin("批量设置题库属性","<%=KSCMS.GetInstallDir()+MyCache.GetCacheConfig(4)%>/exam/KS.TkBatch.aspx?ContentID="+sid+"",true);
		}
		function showAnswer(obj){
			$(obj).siblings('.Answertips').toggle();
        }
        function OnChange(id, key) {
            var sjtypeclassId = document.getElementById('ctl00_KSContent_drpSJtypeClass').value;
             var classId=document.getElementById('ctl00_KSContent_DrpClassID').value;
            if (id == 1) {//分类
                location.href = "?classid=" + key+"&sjtypeclassId="+sjtypeclassId;
            } else {
                location.href = "?sjtypeclassid=" + key + "&classid=" + classId;
            }
        }
    </script>
       
    <div class="listedit">
        
        <ul>
 <div class="floatLeft allCheck">
                <label><input type="checkbox" name="chkall" id="chkall" onclick="CheckAll(this.form);"/>全选</label>
            </div>
            <asp:LinkButton ID="delclassbutton" runat="server" onclick="delclassbutton_Click" CssClass="button">删除试题</asp:LinkButton>
            <asp:LinkButton ID="batchset" runat="server" CssClass="button">批量设置</asp:LinkButton>
        </ul>

    </div> 
	<style>
        .categorynav{line-height:25px;width:97%;margin:0 auto;margin-bottom:10px;border:1px solid #DEEFFA;background-color:#F7FBFE;padding:5px 0px 5px 10px; height:100%; overflow:hidden;}
        ul,li{padding:0px;margin:0px}
        .categorynav li{width:160px;float:left;}
    </style>
    <div class="content-area mt20">
          <div class="myTitle clearfix">
            <div class="fr headOperation">
                <ul>
                  
                    <li id='p4' class="fl"><a href="KS.SJTK.aspx?action=importword" class="button">从Word导入题库</a></li>
                    <li id='p4' class="fl"><a href="KS.SJTK.aspx?action=importexcel" class="button">从Excel导入题库</a></li>
                    <li id='p4' class="fl"><a href="KS.SJCorrection.aspx" class="button">试题纠错管理</a></li>

                </ul>
            </div>
            <span style="float:right;padding-right:20px; font-size:12px;">题库中共有 <span style='color:green'><%=DataFactory.GetOnlyValue("select count(1) From KS_SJTK") %></span> 道题  涉及知识点 <span style='color:green'><%=DataFactory.GetDataTable("select distinct(KnowledgeId) from ks_sjtk where KnowledgeId<>0").Rows.Count%></span> 个 涉及分类 <span style='color:green'><%=DataFactory.GetDataTable("select distinct(classId) from ks_sjtk where classId<>0").Rows.Count%></span> 个</span>
            试卷题库管理
            <!--当前位置：<asp:Label ID="LabNav" runat="server"> </asp:Label>-->
          </div>
          <div class="quickSearch clearfix"> 
             <div class="quickSelect">
                <asp:DropDownList ID="DrpClassID" runat="server" onchange="OnChange(1,this.value);" Width="130">
                 <asp:ListItem Value="0">--按分类查看--</asp:ListItem>
                 </asp:DropDownList>
             </div>
             <div class="SearchBox fl">
                 <asp:DropDownList ID="drpSJtypeClass" runat="server" onchange="OnChange(2,this.value);" Style="margin-right:8px;">
                    <asp:ListItem Value="0">-选择章节属性-</asp:ListItem>
                 </asp:DropDownList>
                 <asp:DropDownList ID="DrpTJ" runat="server" Style="margin-right:8px;">
                     <asp:ListItem Value="3">题目ID</asp:ListItem>
                     <asp:ListItem Value="1">试题标题</asp:ListItem>
                     <asp:ListItem Value="2">试题内容</asp:ListItem>
                 </asp:DropDownList>
                 <asp:TextBox ID="TxtKeyWord" runat="server" CssClass="textbox" />
                 <asp:Button ID="BtnSearch" runat="server" CssClass="button" Text="开始搜索" onclick="BtnSearch_Click" />
             </div>
             <div class="property">
                    <div class="name button ml15">筛选</div>
                    <div class="propertyBox">
                        <ul class="tabs clearfix">
                            <span class="screen fl">题目类型：</span>
                            <li<%=KSCMS.S("showType")==""?" class='active'":string.Empty %> class="fl">
                                <a href="KS.SJTK.Aspx?<%=UtilsQueryParam.Get("showtype") %>"><span>所有试题</span></a></li>
                            <li<%=KSCMS.S("showType")=="1"?" class='active'":string.Empty %> class="fl">
                                <a href="KS.SJTK.Aspx?showType=1&<%=UtilsQueryParam.Get("showtype") %>">
                                <span>主观题</span></a></li>
                            <li<%=KSCMS.S("showType")=="2"?" class='active'":string.Empty %> class="fl">
                                <a href="KS.SJTK.Aspx?showType=2&<%=UtilsQueryParam.Get("showtype")%>">
                                <span>单选题</span></a></li>
                            <li<%=KSCMS.S("showType")=="3"?" class='active'":string.Empty %> class="fl">
                                <a href="KS.SJTK.Aspx?showType=3&<%=UtilsQueryParam.Get("showtype")%>">
                                <span>多选题</span></a></li>
                            <li<%=KSCMS.S("showType")=="4"?" class='active'":string.Empty %> class="fl">
                                <a href="KS.SJTK.Aspx?showType=4&<%=UtilsQueryParam.Get("showtype")%>">
                                <span>判断题</span></a></li>
                            <li<%=KSCMS.S("showType")=="5"?" class='active'":string.Empty %> class="fl">
                                <a href="KS.SJTK.Aspx?showType=5&<%=UtilsQueryParam.Get("showtype")%>">
                                <span>填空题</span></a></li>
                            <li<%=KSCMS.S("showType")=="6"?" class='active'":string.Empty %> class="fl">
                                <a href="KS.SJTK.Aspx?showType=6&<%=UtilsQueryParam.Get("showtype")%>">
                                <span>阅读分析</span></a></li>
                            <li<%=KSCMS.S("showType")=="7"?" class='active'":string.Empty %> class="fl">
                                <a href="KS.SJTK.Aspx?showType=7&<%=UtilsQueryParam.Get("showtype")%>">
                                <span>会计分录题</span></a></li>
                        </ul>
                    </div>
              </div>
              <a href="javascript:addSt();" class="fr button button_on">添加试题</a>
          </div>
          <table width="100%" border="0" cellpadding="0" cellspacing="0" class="CTable mytable">
                <tr class="CTitle topbar">
                    <td height="25" width="48" align="center"><b>选择</b></td>
                    <td width="60" align="center"><b>题目ID</b></td>
                    <td width="849" style="text-align:left"><b>题目内容</b></td>
                    <td ><b>分值</b></td>
                    <td width="100" align="center"><b>操作</b></td>
                </tr>
                <asp:Repeater ID="Repeater1" runat="server"  >
                    <HeaderTemplate>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <tr class="CtrMouseOut" onmouseover="this.className='CtrMouseOver'" onmouseout="this.className='CtrMouseOut'" > 
                            <td class="Ctd" nowrap="nowrap" align="center" onclick="chk(this)" style="background:none !important;">
                                <input type="checkbox"  name="ids" id="ids" value='<%# Eval("tmid") %>' />
                            </td>
                            <td  class="splittd Ctd" align="center">
                                 <%# Eval("tmid") %>
                            </td>
                            <td class="Ctd anstextBox">
                                <strong style="display:none;"><%# ReplaceTMNR(Convert.ToString(DataBinder.Eval(Container.DataItem, "Title")), Convert.ToInt32(Eval("tmid")))%></strong>
                                <%# ReplaceTMNR(Convert.ToString(DataBinder.Eval(Container.DataItem, "TMNR")),Convert.ToInt32(Eval("tmid")))%>
                                <span class="greenFont ml20" onclick="showAnswer(this)" style="cursor:pointer;">展开答案及解析</span>
                                <div class="Answertips">
                                    <%# (Convert.ToString(Eval("tmtype"))!="6" && Convert.ToString(Eval("tmtype"))!="7")?"<div>参考答案："+Kesion.Exam.Function.GetCKDA(Utils.StrToInt(Eval("tmtype")),Convert.ToString(Eval("answer")))+"</div>":"" %> 
                                    <%# string.IsNullOrEmpty(Convert.ToString(Eval("dajs")))?"":"答案解释："+Utils.replaceBR(Convert.ToString(DataBinder.Eval(Container.DataItem, "dajs"))) %>
                                </div>
                                
                            </td>
                            <td  class="splittd Ctd" align="center" width="50">
                                <span><%# Eval("tmfs") %>分</span>
                            </td>
                            <td  class="splittd Ctd" align="center" width="150">
                                <a class="greenFont" title="修改" href="javascript:;" onClick="editSt(<%# Eval("tmid") %>);">修改</a>&nbsp;&nbsp;&nbsp;
                                <a class="greenFont" title="删除" onClick="return(confirm('确定删除该试题吗?'))" href="?action=delst&ids=<%# Eval("tmid") %>">删除</a>
                            </td>
                        </tr>  
                    </ItemTemplate>
                    <FooterTemplate>
                      <asp:Label ID="lblEmptyZP" Text="<tr class='tdbg'><td height='50' style='text-align:center' colspan=4>没有试题！！！</td></tr>" CssClass="text_hei_12" runat="server" Visible='<%#bool.Parse((Repeater1.Items.Count==0).ToString())%>'>
                    </asp:Label>
                    </FooterTemplate>
                </asp:Repeater>
          </table>
          <KS:Page ID="Page1" runat="server" />
          <asp:Panel ID="Panel1" runat="server" Height="30px" Width="100%">
            <script type="text/javascript">
                showtips('<span class="state"><strong>操作说明：</strong><br /></span>在此页面您可以给增加，修改或是删除试题。');
            </script>
          </asp:Panel>
    </div>
</asp:Panel>


</asp:Content>