<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true" Inherits="Kesion.NET.WebSite.Course.Admin.Course.KS_CosExamlist" Codebehind="KS.CosExamlist.aspx.cs" %>
<%@ Import Namespace="Kesion.Publics" %>
<%@ Import Namespace="Kesion.Cache" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="Kesion.Course" %>
<%@ Import Namespace="Kesion.BLL" %>
<asp:Content ID="Content1" ContentPlaceHolderID="KSContent" Runat="Server">
    <script>

        function addSt() {

            parent.openWin("添加指定试卷ID", "Course/KS.CsAddExam.aspx?CourseId=" +<%=courseid %> +"&teacherid=" +<%=teacherid%> +"", true, 700, 400);
    }


</script>
    <asp:Panel ID="ListPanel" runat="server" Width="100%">
 <%if(istop==0){ %>
     <div class="listedit">
        <ul>
            <a href="javascript:;" onclick="location.href='KS.CosList.aspx?costype=<%=KSCMS.S("costype") %>';" class="button">返回课程列表</a>
            <asp:LinkButton ID="addclassbutton" runat="server" OnClick="addclassbutton_Click" CssClass="button button_on">添加</asp:LinkButton>
        </ul>
    </div>

         <!--当前课程信息-->
        <asp:PlaceHolder ID="PlaceHolder1"  runat="server"></asp:PlaceHolder>

	<div class="content-area">
        <div class="myTitle">
            <div class="tabButton">
                <%if(Course.GetIsPeriod(courseid)==1){ %>
                <a class="noLeftBorder" href="KS.CosPeriod.Aspx?CourseId=<%=courseid %>&teacherid=<%=teacherid%>">课时</a>
                <%} %>
                <a  href="KS.CsTeacher.aspx?CosType=1&teacherid=<%=teacherid%>&CourseId=<%=courseid%>">教师</a>
                <a href="KS.CsZLInfo.aspx?type=0&CourseId=<%=courseid %>&teacherid=<%=teacherid%>">资料</a>
                <a class="on" href="KS.CosExamlist.aspx?CourseId=<%=courseid %>&teacherid=<%=teacherid%>">试卷</a>
				 <a href="KS.CosLearnRecord.aspx?CosType=1&courseid=<%=courseid %>&teacherid=<%=teacherid%>">学员</a>
				 <a href="KS.CosPJ.aspx?CosType=1&courseid=<%=courseid %>&teacherid=<%=teacherid%>">评价</a>
			
        	</div>
         
           试卷管理
        </div>

   <%} %>

        <asp:Repeater ID="Repeater1" runat="server"   >
          <HeaderTemplate>
          <table width="99%" border="0" cellpadding="1" cellspacing="0" class="CTable BTable">
              <tr class="CTitle">
                  <th scope="col" width="30">序号</th>
                  <th>试卷名称</th>
                  <%if(istop==0&&IsExam==2){ %>
                <th scope="col"  width="30">删除</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;">
			      <a href="<%# Kesion.HtmlTags.BasicField.GetRewriteUrl("examview",Utils.StrToInt(Eval("id"))) %>"target="_blank" > <%# Eval("Title")%></a>
				</td>
                 <%if (istop == 0 && IsExam ==2)
                   { %>
				<td class="Ctd" style="text-align:center" width="170">
                    
				   <a href="?action=dels&CourseId=<%#courseid %>&sjid=<%# Eval("id") %>&teacherid=<%#teacherid %>" onClick="return confirm('您确定要删除【<%# Eval("Title")%>】试卷吗？')" class="delete">删除</a> 
                </td>
                 <%} %>
			</TR>
         </ItemTemplate>
          <FooterTemplate>
            <tr class="tdbg" style="display:<%# bool.Parse((Repeater1.Items.Count==0).ToString())?"":"none"%>">
                <td class="Ctd" colspan="4" style="border:0px;">
                  <div class="empty">还没有添加任何试题</div>
                </td>
               </tr> 
           </table>
          </FooterTemplate>
        </asp:Repeater>

       <KS:Page ID="Page1" runat="server" />
        
       <asp:Panel ID="Panel2" runat="server" Height="30px" Width="100%">
        <script type="text/javascript">
            showtips('<span class="state"><strong>操作说明：</strong><br /></span>如果您的课程绑定是考试分类是不让删除的。');
		</script>

	</div>
       </asp:Panel>
    
</asp:Panel>

<asp:Panel ID="AddPanel" runat="server" Width="100%"> 
<script>
    function searchSJ() {
        var key = jQuery("#<%=this.TxtSJKey.ClientID %>").val();
        if (key == '') {
            KesionJS.Alert("请输入试卷关键字！", "jQuery('#<%=this.TxtSJKey.ClientID %>').focus()");
            return false;
        } else {
            jQuery.ajax({
                url: "KS.CosList.aspx?action=GetSJ&CourseId=<%=courseid%>&teacherid=<%=teacherid%>&Key=" + escape(key), success: function (d) {

                    jQuery("#<%=this.LstB2.ClientID %>").empty().append(d);
            }
            });
            }
        }
        function addUser() {
            var src = document.getElementById('<%=this.LstB2.ClientID %>');
        var dest = document.getElementById('<%=this.LstB1.ClientID %>');

        for (var i = 0; i < src.options.length; i++) {
            if (src.options[i].selected) {
                var exist = false;
                for (var j = 0; j < dest.options.length; j++) {
                    if (dest.options[j].value == src.options[i].value) {
                        exist = true;
                        break;
                    }
                }
                if (!exist) {
                    var opt = document.createElement('OPTION');
                    opt.value = src.options[i].value;
                    opt.text = src.options[i].text;
                    dest.options.add(opt);
                }
            }
        }
    }

    function delUser() {
        var dest = document.getElementById('<%=this.LstB1.ClientID %>');

        for (var i = dest.options.length - 1; i >= 0; i--) {
            if (dest.options[i].selected) {
                dest.options[i] = null;
            }
        }
    }
            </script>
 <script>

     function CheckForm() {       
             if (jQuery('#<%=this.LstB2.ClientID %>').val() == '') {
          KesionJS.Alert('查无试卷!', "jQuery('#<%=this.LstB2.ClientID %>').focus()");
                 return false;
             }
     	if (jQuery('#<%=this.RadioButtonList1.ClientID %> :radio[checked]').val() == '2') {
     		if (jQuery('#<%=this.LstB1.ClientID %>').val() == '') {
     			KesionJS.Alert('请加入试卷!', "jQuery('#<%=this.LstB1.ClientID %>').focus()");
     			return false;
     		}
     		var idArr = new Array();
     		var dest = document.getElementById('<%=this.LstB1.ClientID %>');
     		for (var i = 0; i < dest.options.length; i++) {
     			dest.options[i].selected = "true";
     			idArr.push(dest.options[i].value);
     		}
     		if (idArr.length <= 0) {
     			alert("请加入试卷!");
     			return false;

     		}
     	}
     
     		return true;
     	
     }
    

     function showwatermarkarea2() {
       
         var checkrad = jQuery("#<%=this.RadioButtonList1.ClientID %> :radio[checked]").val();
        
	     	if (checkrad == "2") {
	     		jQuery("#<%=this.watermark0.ClientID %>").css("display", "none");
            	jQuery("#<%=this.watermark2.ClientID %>").css("display", "");
            } else if (checkrad == "1") {
            	jQuery("#<%=this.watermark0.ClientID %>").css("display", "");
            	jQuery("#<%=this.watermark2.ClientID %>").css("display", "none");
            }
            else {
            	jQuery("#<%=this.watermark0.ClientID %>").css("display", "none");
            	jQuery("#<%=this.watermark2.ClientID %>").css("display", "none");

            }
	}
   </script>

  <KS:TopNav ID="TopNav1" runat="server" /> 
	<div class="content-area">
	<input type="hidden" value="<%=KSCMS.S("costype") %>" name="costype" />
 	  <table border=0 width="100%">
           <tr>
                        <td align="right" class="lefttd" height="30" style="width: 180px;">
                            <strong>是否有模拟试卷：</strong></td>
                        <td class="righttd">
                            <asp:RadioButtonList ID="RadioButtonList1" onclick="showwatermarkarea2()" runat="server" RepeatDirection="Horizontal" Height="24px">
                                <asp:ListItem Value="0" >无</asp:ListItem>
                                <asp:ListItem Value="1" Selected="True">指定试卷栏目</asp:ListItem>
                                <asp:ListItem Value="2">指定试卷ID</asp:ListItem>
                            </asp:RadioButtonList>
                        </td>
                    </tr>
                    <tbody id="watermark0" runat="server" style="display: none">
                        <tr>
                            <td align="right" class="lefttd">
                                <strong>试卷栏目：</strong></td>
                            <td class="righttd">
                                <asp:ListBox ID="ListSjClass" runat="server" Width="200px" SelectionMode="Multiple" Height="300px"></asp:ListBox>
                                <a class="textarea_min" href="javascript:zoomtextarea(-5,'<%=this.ListSjClass.ClientID %>');"></a>
                                <a class="textarea_max" href="javascript:zoomtextarea(5,'<%=this.ListSjClass.ClientID %>');"></a>
                            </td>
                        </tr>
                    </tbody>
                    <tbody id="watermark2" style="display: none" runat="server">
                        <tr>
                            <td align="right" class="lefttd" height="30">
                                <strong>试卷ID：</strong></td>
                            <td class="righttd" valign="top">&nbsp;
         
            <table border="0" width='100%'>
                <tr>
                    <td style="width: 200px">搜索试卷：<asp:TextBox ID="TxtSJKey" runat="server" Width="140px" CssClass="textbox" />
                        <input type="button" value="搜索" class="button" onclick="searchSJ();" cssclass="button" />
                        <br />

                        <asp:ListBox ID="LstB2" runat="server" Width="300px" Height="200px" SelectionMode="Multiple"></asp:ListBox>
                    </td>
                    <td>
                        <p>
                            <input type="button" value=" > " onclick="addUser()" class="button" />
                        </p>
                        <br />
                        <p>
                            <input type="button" value=" < " onclick="delUser()" class="button" />
                        </p>
                    </td>
                    <td>指定试卷如下：
                 <br />
                        <asp:ListBox ID="LstB1" runat="server" Width="300px" Height="200px" SelectionMode="Multiple"></asp:ListBox>
                    </td>

                </tr>
            </table>
                            </td>
                        </tr>
                        <tr>
                            <td align="right" class="lefttd" height="30"><strong>考试状态规定：</strong></td>
                            <td class="righttd">
                                <asp:TextBox ID="regulations" CssClass="textbox"  runat="server" Width="40px" Height="23px"></asp:TextBox>%
               <font color="red">学习达到总课时的多少比例时才能考试，留空或0为不限制</font>
                            </td>
                        </tr>

                    </tbody>
      </table>
      
  	<KS:Foot ID="Foot1" runat="server" OnSubmit="Foot1_Submit" />

 </div>

</asp:Panel>


</asp:Content>

