<%@ Page Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true" Inherits="Kesion.NET.WebSite.Admin_ZGPGScore" Title="批改试卷" Codebehind="KS.ZGPGScore.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%">
        <div id="manage_top" class="menu_top_fixed">
            <ul class="titleTab">
                <li><a href="KS.SJScore.aspx">模拟试卷管理</a></li>
                <li><a href="KS.ZGPGScore.aspx">正规试卷管理</a></li>
                <li><a href="KS.SJTrainingRecord.aspx">会员练习管理</a></li>
            </ul>
        </div>
        <div class="menu_top_fixed_height"></div>
        <script>
            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() {
                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>');
                    }
                });
        
            });
        </script>
        <style>
            .anstable{border:#E5E5E5 1px solid;padding:1px;width:80%;}
            .anstable split. td{background:#FAFAFA;font-size:12px;padding-left:12px;}
            .anstable .t{background:#DBE9F6;height:28px;line-height:28px;}
            .anstable .t td{font-size:12px;padding-left:12px;padding-right:12px;}
        </style>
        <div class="content-area">  
            <div class="myTitle">
            	<%if(KSCMS.S("member").Equals("tc")){ %>
                <input type="button" class="fr button mr20" value="返回" onclick="location.href='../course/KS.CosClassHWSJ.Aspx?sjid=<%=sjId %>&roomid=<%=roomid%>	';" />
                <%}else{ %>
                <input type="button" class="fr button mr20" value="返回" onclick="location.href='<%= KSCMS.GetInstallDir() + MyCache.GetCacheConfig(4) %>	/Exam/KS.ZGSJPGItem.Aspx?sjid=<%=sjId %>	';" />
                <%} %>
                批阅试卷
            </div>
            <div class="info grayFont" style="margin-bottom:20px;">
                <span class="mr15">批改试卷[<span style="color:Red"><%=dr!=null?dr["title"].ToString():String.Empty %></span>]</span> 
                <span class="mr15">试卷总分：<%=dr != null ? dr["score"].ToString() : string.Empty%>分</span>
                <span class="mr15">限制时间：<%=dr!=null?dr["kssj"].ToString():string.Empty %>分钟</span>
                <span class="mr15">考生：<%=drr!=null?drr["username"].ToString():string.Empty %></span>
                <span class="mr15">姓名：<%=drr!=null?drr["realname"].ToString():string.Empty %></span>
            </div> 
            <asp:Repeater ID="Repeater1" runat="server"  onitemdatabound="Repeater1_ItemDataBound" >
                <HeaderTemplate>
                <table width="98%" align="center" border="0" cellpadding="0" cellspacing="0" class="CTable">
                </HeaderTemplate>
                <ItemTemplate>
                    <tr class="CTitle sort topbar">
                        <td align="center" nowrap><span style='cursor:pointer' id='t<%# Eval("typeid") %>' class="toggleArea" onclick="showToggle(<%# Eval("typeid") %>);"></span></td>
                        <td colspan="5" style="text-align:left;padding-top:2px;padding-bottom:2px;padding-left:10px;">
                        <strong>
                        第<%# UtilsAutoID.CapitalFigures(Utils.StrToInt(Convert.ToString(Eval("orderid")), 1)-1)%>大题&nbsp;
                        <%#Eval("typename")%>
                        <div style="display:none">
                        <%#Eval("intro")%>
                        </div>
                        </strong>
                        </td>
                        <td style="text-align:center"></td>
                    </tr>
                    <tbody id='xt<%# Eval("typeid") %>' class="showArea">
                        <tr class="bar" align="center">
                        <td>题号</td>
                        <td>分数</td>
                        <td style="width:500px;">题目内容</td>
                        <td>考生答案</td>
                        <td>正确答案</td>
                        <td>是否正确</td>
                        <td>得分</td>
                        </tr>
                        <asp:Repeater ID="Repeater2" runat="server">
                        <ItemTemplate>
                        <tr class="tdbg"> 
                          <td style="text-align:center" width="48"> <strong><%# DataBinder.Eval(Container.DataItem,"OrderID") %></strong></td>
                          <td align="center" style="font-weight:bold" nowrap><%# DataBinder.Eval(Container.DataItem,"TMFS") %>分</td>
                          <td><%# DataBinder.Eval(Container.DataItem,"title") %><%# DataBinder.Eval(Container.DataItem,"TMnr") %></td>
                          <%#GetUserAnswerList(Convert.ToInt32(Eval("TmType")),Convert.ToInt32(Eval("tmid")),Convert.ToString(Eval("answer")),Convert.ToString(Eval("tmfs")))      %>
                        </tr>
                        </ItemTemplate>
                        </asp:Repeater>
                    </tbody>  
                </ItemTemplate>
                <FooterTemplate>
                    <tr class="tdbg" style="display:<%# bool.Parse((Repeater1.Items.Count==0).ToString())?"":"none"%>">
                        <td class="Ctd" style="text-align:center" colspan="4"></td>
                    </tr> 
                </table>
                </FooterTemplate>
            </asp:Repeater>
            <table width="99%" align="center" border="0" cellpadding="0" cellspacing="0" class="CTable no-borderTable"> 
                <tr>
                    <td class="lefttd" height="30" align="right" style="width: 108px"><b>批卷教师：</b></td>
                    <td class="righttd">
                    &nbsp;<asp:TextBox CssClass="textbox" ID="TxtPJTeacher" runat="server" Width="203px"></asp:TextBox>
                    </td>
                </tr>
                
                <tr>
                    <td align="right" class="lefttd" height="30" style="width: 108px">
                    <strong>总&nbsp;得&nbsp;分：</strong></td>
                    <td class="righttd" style="font-size:20px;font-weight:bold;"> &nbsp;<span id="totalscore" style="color:Red">0</span>分
                    
                    <script>
                    
                    jQuery(document).ready(function() {
                    getScore();
                    jQuery("input[name=score]").keyup(function() {
                    getScore();
                     
                    });
                    });
                    function getScore() {
                    var score = 0;
                    jQuery("input[name=score]").each(function() {
                    
                    score += parseFloat(jQuery(this).val());
                    });
                    jQuery("#totalscore").html(score);
                    jQuery("#TotalScore").val(score);
                    }
                    //估分时，检查总分
                    function checkgfnum(obj, t) {
                    if (isNaN(obj.value)) {
                    obj.value = '0';
                    obj.focus();
                    window.KesionJS.Alert("分数必须输入数字! ");
                    return false;
                    }
                    if (obj.value > t) {
                    obj.value = t;
                    obj.focus();
                    window.KesionJS.Alert("此题总分 " + t + " 分，评分不能超过 " + t + " 分! ");
                    return false;
                    }
                    }
                    function check() {
                    var str = '';
                    jQuery("input[name=score]").each(function() {
                    if (jQuery(this).attr("tmid") != undefined) {
                        if (str=='')
                            str = jQuery(this).attr("tmid") + "|" + jQuery(this).val();
                        else
                            str +='$'+ jQuery(this).attr("tmid") + "|" + jQuery(this).val();
                    }
                    });
                    jQuery("#ZGTDFQK").val(str);
                    return true;
                    }
                    </script>
                    
                    </td>
                </tr>
                <tr>
                    <td class="lefttd" height="30" align="right" style="width: 108px"><b>教师评语：</b></td>
                    <td class="righttd"><asp:TextBox ID="TxtPY" TextMode="MultiLine" 
                    runat="server" Width="70%" Height="160px"></asp:TextBox>
                    <% Kesion.APPCode.EditorAPI.EchoEditor("editor", this.TxtPY.ClientID, "Basic", 0, false, true, false, false, true);%>
                    </td>
                </tr>            
                
                <tr>
                    <td class="lefttd" height="30" align="right" style="width: 108px"><b>批卷时间：</b></td>
                    <td class="righttd">
                    &nbsp;<asp:TextBox CssClass="textbox" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'});"  ID="TxtPJSJ" runat="server" Width="203px"></asp:TextBox>
                    </td>
                </tr>
            </table>
            <div class="main-button">
                <input type="hidden" name="ZGTDFQK" id="ZGTDFQK" />
                <input type="hidden" name="TotalScore" id="TotalScore" />
                <input type="hidden" name="member" id="<%=KSCMS.S("member") %>" />
                <input type="hidden" name="roomid" id="<%=roomid %>" />
                <asp:Button ID="BtnSubmit" Text="完成批改" OnClientClick="return(check())" 
                runat="server" CssClass="button" onclick="BtnSubmit_Click" />
                <asp:Button ID="BtnExportExcel" Text="导出Excel" runat="server" CssClass="button" onclick="BtnExportExcel_Click" />  
            </div>
            <asp:Panel ID="Panel1" runat="server" Height="30px" Width="100%">
                <script type="text/javascript">
                    showtips('<span class="state"><strong>操作说明：</strong><br /></span>客观题系统会自动批改给出分数，出现<img src="../../sysimg/default/unknow.gif">表示系统无法自动批改，请批卷教师给分。');
                </script>
            </asp:Panel>
        </div>
    </asp:Panel>
</asp:Content>
