<%@ Page Language="C#" Debug="true" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="True" Inherits="Kesion.NET.WebSite.Course.Admin_Course_KS_CsExamlist" Codebehind="KS.CsExamlist.aspx.cs" %>
<%@ Import Namespace="Kesion.Publics" %>
<%@ Import Namespace="Kesion.Cache" %>
<asp:Content ID="Content1" ContentPlaceHolderID="KSContent" Runat="Server">
    <asp:Panel ID="ListPanel" runat="server" Width="100%">
  
<script>
    function editSt(id) {
        parent.openWin('修改试题', 'exam/KS.EditSt.Aspx?tmid=' + id, true,900,520);
    }
    function addSt(id) {
        parent.openWin('添加指定试卷ID', 'Course/KS.CsAddExam.aspx?id='+id, true,700,400);
    }
  
    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('<span class="tree_Open"/>关闭</span>')
        } else {
            jQuery('#xt' + id).slideUp('fast');
            jQuery("#t" + id).html('<span class="tree_Close"/>打开</span>')
        }
    }
    jQuery(document).ready(function() {
             <%if (KSCMS.S("action") == "modifyth") {%>
        jQuery(".toggleArea").html('<span class="tree_Open"/>关闭</span>');
                 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('<span class="tree_Close"/>打开</span>');
                 jQuery(".showArea").attr("style","display:none");
                 <%} %>
             });
    var currStatue=1;
    function openAll(){
        if (currStatue==1){ //展开
            currStatue=0
            jQuery(".toggleArea").html('<span class="tree_Open"/>关闭</span>');
            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('<span class="tree_Close"/>打开</span>');
            jQuery(".showArea").attr("style","display:none");
            jQuery("#allstate").html('全部展开');
        }
    }
</script>
      <div class="message">
         <span style="float:right;padding-right:10px">
         <strong>搜索课程：</strong>
            <asp:TextBox ID="TextBox1" CssClass="textbox" runat="server"></asp:TextBox>           
            <asp:Button ID="Button2" runat="server" Text=" 搜索 " CssClass="button" onclick="Button2_Click" />
        </span>
        
        当前位置：课程试卷
        </div>
     
  
        <asp:Repeater ID="Repeater1" runat="server"  onitemdatabound="Repeater1_ItemDataBound" >
          <HeaderTemplate>
          <table width="99%" border="0" cellpadding="1" cellspacing="0" class="CTable BTable">
              <tr class="CTitle">
                  <th scope="col" width="30">序号</th>
                  <th>课程名称(<a href="javascript:;" onclick="openAll()" id="allstate">全部展开</a>)</th>
             
            
                <th scope="col">管理操作</th>
              </tr>
          </HeaderTemplate>
         <ItemTemplate>
             <TR >
              <td class="Ctd" align="center" nowrap>
               <strong><%# Container.ItemIndex + 1%></strong>
                 </td>
				 <td class="Ctd" style="padding-top:2px;padding-bottom:2px;padding-left:10px;">
                 <span style='cursor:pointer' id='t<%# Eval("CourseID") %>' class="toggleArea" onclick="showToggle(<%# Eval("CourseID") %>);">
                 </span>
				 <strong>
				 <a href="../../course/view.aspx?id=<%# Eval("courseid") %>" title="前台页" target="_blank"> <%# Eval("name") %></a>
				</strong>
				</td>
				<td class="Ctd" style="text-align:center" width="170">
				 <input type='button' value='添加' onclick='addSt(<%#Eval("CourseID") %>)' class='button'  />
				  <input type="button" value="删除" class="button" onClick="if (confirm('删除课程，此课程下的试卷将被清空，且此操作不可逆，确定执行删除操作吗？')){location.href='?action=deldt&id=<%# Eval("CourseID") %>        ';}"/>
                </td>
			</TR>
			<tbody id='xt<%# Eval("CourseID") %>' class="showArea">
             <asp:Repeater ID="Repeater2" runat="server">
               <ItemTemplate>
               
               <tr > 
                  <td  class="Ctd" style="text-align:center" width="48"> 
		            <font color=red>
		            <strong><%# Container.ItemIndex + 1%>.</strong>
		            </font>		           
		          </td>
		          <td class="Ctd" style="padding:10px">
                     <a href="../../<%=MyCache.GetSJCacheConfig(1) %>/view.aspx?id=<%# Eval("id") %>" target="_blank"></a>
			      <a href="../../<%=MyCache.GetSJCacheConfig(1) %>/view.aspx?id=<%# Eval("id") %>" target="_blank" > <%# Eval("Title")%></a>
			       </td>
                  <td class="Ctd" style="text-align:center" width="170">
                    <a href="?action=dels&cid=<%#Eval("CourseID") %>&sjid=<%# Eval("id") %>" onClick="return confirm('您确定要删除【<%# Eval("Title")%>】试卷吗？')">删除</a> 
                    </td>
                </tr>
               
               </ItemTemplate>
             </asp:Repeater>
           </tbody>  
         </ItemTemplate>
          <FooterTemplate>
            <tr class="tdbg" style="display:<%# bool.Parse((Repeater1.Items.Count==0).ToString())?"":"none"%>">
                <td class="Ctd" style="height:40px;line-height:40px;text-align:center" colspan="4">
                  还没有添加任何试题!
                  
                </td>
               </tr> 
           </table>
          </FooterTemplate>
        </asp:Repeater>

       <KS:Page ID="Page1" runat="server" />
        
       <asp:Panel ID="Panel2" runat="server" Height="30px" Width="100%">
         <br />
        <script type="text/javascript">
            showtips('<span class="state"><strong>操作说明：</strong><br /></span>在此页面您可以给试卷增加或是删除试卷。');
		</script>

       </asp:Panel>
    
</asp:Panel>
</asp:Content>

