<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true" Inherits="Kesion.NET.WebSite.Course.Admin.Course.KS_CosFaceExamlist" CodeBehind="KS.CosFaceExamlist.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.CosFaceList.aspx';" class="button">返回课程列表</a>
                <asp:LinkButton ID="addclassbutton" runat="server" OnClick="addclassbutton_Click" CssClass="button">添加</asp:LinkButton>
            </ul>
        </div>

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

        <div class="content-area">
            <div class="myTitle">
                <div class="tabButton">
                    <a href="KS.FaceSignUp.aspx?CosType=2&CourseId=<%=courseid %>&teacherid=<%=teacherid%>&type=1">已报名</a>
                    <a class="on" href="KS.CosFaceExamlist.aspx?courseid=<%=courseid %>&teacherid=<%=teacherid%>&CosType=2&type=1">试卷</a>
                    <a href="KS.CsTeacher.aspx?CourseId=<%=courseid %>&teacherid=<%=teacherid%>&CosType=2&type=1">教师</a>
                    <a href="KS.CsZLInfo.aspx?type=1&CourseId=<%=courseid %>&teacherid=<%=teacherid%>&CosType=2">资料</a>
                    <a href="KS.CosPJ.aspx?courseid=<%=courseid %>&teacherid=<%=teacherid%>&CosType=2&type=1">评价</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").ToString()))   %>" 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>
       
    </asp:Panel>
 </div>
    </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&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 showwatermarkarea() {
                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" />
        <input type="hidden" value="<%=KSCMS.S("costype") %>" name="costype" />
        <div class="content-area">
            <table border="0" width="100%">
                <tr>
                    <td align="right" class="lefttd" height="30" style="width: 102px">
                        <strong>是否有模拟试卷：</strong></td>
                    <td class="righttd">
                        <asp:RadioButtonList ID="RadioButtonList1" onclick="showwatermarkarea()" runat="server"
                            RepeatDirection="Horizontal" Height="24px">
                            <asp:ListItem Value="0" Selected="True">无</asp:ListItem>
                            <asp:ListItem Value="1">指定试卷栏目</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 style="display: none">
                        <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>

