gyhlw_dotnet/网站项目/VRS/Management/VSAT/ExamTheory.aspx

439 lines
24 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ExamTheory.aspx.cs" Inherits="VRS.Management.VSAT.ExamTheory" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>试卷题目管理</title>
<link href="/Assets/Layui/css/bootstrap.min.css" rel="stylesheet" />
<link href="/Assets/Layui/css/materialdesignicons.min.css" rel="stylesheet" />
<link href="/Assets/Layui/css/style.min.css" rel="stylesheet" />
<link href="/Css/BaseStyle.css" type="text/css" rel="Stylesheet" />
<style type="text/css">
.wrap-text {
white-space: pre-wrap; /* 保留换行符 */
width: 400px; /* 设置宽度以触发换行 */
}
</style>
</head>
<script type="text/javascript">
function OpenWindowAdd() {
var Id = $("#hid_examid").val();
var oWnd = radopen("ExamTheory_BatchAdd.aspx?Id=" + Id, "RadWindowManager1");
oWnd.setSize(1124, 658);
oWnd.center();
}
function OpenWindowScore() {
var Id = $("#hid_examid").val();
var oWnd = radopen("ExamTheory_BatchScore.aspx?Id=" + Id, "RadWindowManager1");
oWnd.setSize(1024, 608);
oWnd.center();
}
function OpenWindowRandom() {
var Id = $("#hid_examid").val();
var oWnd = radopen("ExamTheory_RandomAdd.aspx?Id=" + Id, "RadWindowManager1");
oWnd.setSize(824, 608);
oWnd.center();
}
function OpenWindowDetail(Id) {
var oWnd = radopen("Examination_Edit.aspx?Id=" + Id, "RadWindowManager1");
oWnd.setSize(980, 430);
oWnd.center();
}
function OnDataDelete(Id) {
if (confirm("确定删除数据吗?")) {
$("#IdInput").val(Id);
$("#btnDelete").click();
}
}
function OpenWindowDetailFaultExam(Id) {
var oWnd = radopen("FaultExamPaperMark.aspx?result_id=" + Id, "RadWindowManager1");
oWnd.setSize(780, 580);
oWnd.center();
}
function confirmCallBackFn(arg) {
radalert("<strong>radconfirm</strong> returned the following result: <h3 style='color: #ff0000;'>" + arg + "</h3>", 420, 220, "结果");
}
function promptCallBackFn(arg) {
radalert("After 7.5 million years, <strong>Deep Thought</strong> answers:<h3 style='color: #ff0000;'>" + arg + "</h3>", 360, 250, "结果");
}
//radconfirm('<h3 style=\'color: #333399;\'>Are you sure?</h3>', confirmCallBackFn, 330, 200, null, '确认'); //$$$$
//radprompt('<span style=\'color: #333399;\'>What is the answer of Life, Universe and Everything?</span>', promptCallBackFn, 330, 230, null, '问题', '42'); //$$$$
//return false;
function OpenWindowDetailSub(Id) {
var oWnd = window.radopen("SubjectVideo.aspx?Id=" + Id, null);
oWnd.setSize(850, 490);
oWnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Close);
oWnd.center();
return false;
}
function OpenWindowDetailSub_old(Id) {
var oWnd = window.radopen("SubjectVideo.aspx?Id=" + Id, null);
oWnd.setSize(850, 490);
oWnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Close);
oWnd.center();
return false;
/*
var oWnd = radopen("SubjectVideo.aspx?Id=" + Id, "RadWindowManager1");
oWnd.setSize(850, 690);
oWnd.center();
*/
}
function OnImport() {
var oWnd = radopen("../Util/Import.aspx?cmd=ImportUsers", "RadWindowManager1");
oWnd.setSize(480, 280);
oWnd.center();
}
function refreshGrid(args, msg) {
if (!args) {
$("#btnSelect").click();
}
}
function allowOnlyNumbers(sender, eventArgs) {
var keyCode = eventArgs.get_keyCode(); // 获取按键代码
//console.log(keyCode);
// 允许数字0-9 (48-57) 以及退格键(8) 、46小数点
if ((keyCode < 48 || keyCode > 57) && keyCode != 8 && keyCode != 46) {
eventArgs.set_cancel(true); // 取消非数字按键输入
}
}
function calculateSum() {
var listBox = $find("RadListBoxDestination"); // 获取RadListBox客户端对象
if (!listBox) {
console.error("RadListBox not found.");
return;
}
var items = listBox.get_items(); // 获取所有项
var total = 0;
var count = 0;
for (var i = 0; i < items.get_count(); i++) {
var item = items.getItem(i);
// 在项中查找RadTextBox控件
var textBox = item.findControl("option_name"); // 传入服务器端设置的ID
if (textBox) {
var value = textBox.get_value(); // 获取RadTextBox的值
// 如果get_value()不适用可以尝试get_text()具体取决于RadTextBox的设置
// var value = textBox.get_text();
var num = parseFloat(value);
if (!isNaN(num)) {
total += num;
}
count++;
}
}
document.getElementById("span_name").innerHTML = "总题目:" + count + " 总分值:" + total;
}
</script>
<script type="text/javascript">
function triggerServerSidePostback(sender, args) {
// 假设你通过某种方式获取到了那个用于回发的隐藏按钮的客户端ID
console.log(sender);
var btn = document.getElementById('<%= btnCheck.ClientID %>');
if (btn) {
btn.click();
}
}
</script>
<body>
<form id="form1" runat="server">
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
<Scripts>
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js"></asp:ScriptReference>
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js"></asp:ScriptReference>
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js"></asp:ScriptReference>
</Scripts>
</telerik:RadScriptManager>
<div class="hidden">
<asp:HiddenField ID="IdInput" runat="server" />
<asp:HiddenField ID="hid_examid" runat="server" />
<asp:Button ID="btnDelete" runat="server" Text="" OnClick="btnDelete_Click" />
<asp:Button ID="btnSelect" runat="server" Text="查询" CssClass="btn btn-primary " OnClick="btnSelect_Click" />
<asp:Button ID="btnCheck" runat="server" Text="" OnClick="btnCheck_Click" />
</div>
<div>
<table class="table-form">
<tr>
<td class="table-td-name">试卷名称:
</td>
<td class="table-td-content">
<telerik:RadTextBox ID="txt_exam_name" runat="server" Skin="Bootstrap" Width="200px" Visible="false">
</telerik:RadTextBox>
<span runat="server" id="span_exam_name"></span>
</td>
<td class="table-td-name">试卷状态:
</td>
<td class="table-td-content">
<%--状态1未发布2已发布3删除--%>
<telerik:RadDropDownList ID="dp_exam_status" runat="server" Skin="Bootstrap" Width="90px" Enabled="false">
<Items>
<telerik:DropDownListItem Value="" Text="" />
<telerik:DropDownListItem Value="1" Text="未发布" />
<telerik:DropDownListItem Value="2" Text="已发布" />
<telerik:DropDownListItem Value="3" Text="删除" />
</Items>
</telerik:RadDropDownList>
&nbsp; &nbsp; 试卷分值:<span runat="server" id="span_total_score"></span>
</td>
<td class="table-td-content ">
<input type="button" value="新增题目" class="btn btn-success" onclick="OpenWindowAdd()" />
<input type="button" value="随机添加题目" class="btn btn-primary" onclick="OpenWindowRandom()"/>
<input type="button" value="批量设置分数" class="btn btn-brown" onclick="OpenWindowScore()" />
</td>
</tr>
<tr class="hidden">
<td class="table-td-name">开始时间:
</td>
<td class="table-td-content">
<telerik:RadDatePicker ID="start" runat="server" Skin="Bootstrap" DateInput-DisplayDateFormat="yyyy-MM-dd" Width="200px"></telerik:RadDatePicker>
<span runat="server" id="span_exam_code"></span>
</td>
<td class="table-td-name">结束时间:
</td>
<td class="table-td-content">
<telerik:RadDatePicker ID="end" runat="server" Skin="Bootstrap" DateInput-DisplayDateFormat="yyyy-MM-dd" Width="200px"></telerik:RadDatePicker>
</td>
<td>
</td>
</tr>
<tr>
<th class="caption" colspan="5">题目列表:<span id="span_name" style="color: red" runat="server"></span></th>
</tr>
<tr class="hidden">
<td colspan="5">
<telerik:RadGrid ID="dataList" runat="server" Visible="true" AllowPaging="True" AutoGenerateColumns="False" BorderWidth="0" BorderColor="Transparent"
CellSpacing="0" Culture="zh-CN" GridLines="None" Skin="Bootstrap" AllowMultiRowSelection="true" MasterTableView-NoMasterRecordsText="记录不存在"
AllowSorting="True" OnPageSizeChanged="GridList_PageSizeChanged"
OnSortCommand="GridList_SortCommand"
OnDeleteCommand="GrdList_DeleteCommand"
PagerStyle-AlwaysVisible="false" PageSize="20" PagerStyle-PageSizes="20,50,100,200"
OnPageIndexChanged="GridList_PageIndexChanged">
<ClientSettings EnableRowHoverStyle="True" >
<Selecting AllowRowSelect="true" />
<Resizing AllowColumnResize="true" />
<Scrolling AllowScroll="true" UseStaticHeaders="true"></Scrolling>
</ClientSettings>
<MasterTableView DataKeyNames="id" ClientDataKeyNames="id">
<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
<RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
<ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn DataField="id" HeaderStyle-Height="32" ItemStyle-Height="32" HeaderText="id" Visible="false">
</telerik:GridBoundColumn>
<telerik:GridClientSelectColumn UniqueName="ClientSelectColumn" HeaderText="选中" HeaderStyle-Width="50px"> </telerik:GridClientSelectColumn>
<telerik:GridBoundColumn DataField="kind" HeaderText="题目类型"> </telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="question" HeaderText="题干"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="answer" HeaderText="答案"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="per_score" HeaderText="每题分数"></telerik:GridBoundColumn>
<telerik:GridTemplateColumn HeaderText="操作">
<ItemTemplate>
<a onclick="OnDataDelete('<%#Eval("id") %>')" class="btn btn-danger btn-xs"><span class="mdi mdi-close"></span></a>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column">
</EditColumn>
</EditFormSettings>
</MasterTableView>
<GroupingSettings CollapseTooltip="收起分组" ExpandTooltip="打开分组" GroupContinuedFormatString="... 上一页延续的分组数据。 "
GroupContinuesFormatString="分组数据会在下一页继续显示。" GroupSplitDisplayFormat="显示了 {1} 条记录中的 {0} 条。"
UnGroupButtonTooltip="点击此处以去除分组" UnGroupTooltip="拖离以去除分组" />
<SortingSettings SortedAscToolTip="升序排序" SortedDescToolTip="降序排序" SortToolTip="请点击此处进行排序" />
<GroupPanel Text="分组区(请将列名拖到此区域以实现根据列名分组)"></GroupPanel>
<PagerStyle FirstPageToolTip="首页" LastPageToolTip="尾页" NextPageToolTip="下一页" PagerTextFormat="更改页:{4} &amp;nbsp;第&lt;strong&gt;{0}&lt;/strong&gt;页,共&lt;strong&gt;{1}&lt;/strong&gt;页,记录数 第&lt;strong&gt;{2}&lt;/strong&gt; 条到第 &lt;strong&gt;{3}&lt;/strong&gt;条 ,一共 &lt;strong&gt;{5}&lt;/strong&gt; 条记录"
PageSizeLabelText="每页数据记录数:" PrevPageToolTip="上一页" />
<FilterMenu EnableImageSprites="False">
</FilterMenu>
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Metro">
</HeaderContextMenu>
</telerik:RadGrid>
</td>
</tr>
<tr class="">
<td colspan="5">
<%--<table style="width: 100%">
<tr>
<td style="width: 150px;" class="table-td-name"></td>
<td>
</td>
<td style="width: 150px;">
&nbsp;&nbsp;&nbsp;&nbsp;<input class="btn btn-default" type="button" value="修改分值" />
&nbsp;&nbsp;
</td>
</tr>
</table>--%>
</td>
</tr>
<tr class="">
<td colspan="5">
<telerik:RadListBox ID="RadListBoxDestination" RenderMode="Lightweight" AllowReorder="false" runat="server" Width="1200px" Skin="Bootstrap"
ButtonSettings-AreaWidth="35px" AutoPostBackOnReorder="true" OnReordered="RadListBoxDestination_Reordered" Font-Size="Smaller"
SelectionMode="Multiple" EnableDragAndDrop="true" AllowDelete="false" OnDeleted="RadListBoxDestination_Deleted"
OnItemDataBound="RadListBoxDestination_ItemDataBound"
AutoPostBackOnDelete="true" ButtonSettings-VerticalAlign="Top" ButtonSettings-HorizontalAlign="Center">
<HeaderTemplate>
<%-- <input class="btn btn-default btn btn-xs" type="button" value="批量删除" />--%>
&nbsp; &nbsp; &nbsp; &nbsp;
<table style="width: 100%; user-select: none;" class="table-form">
<tr>
<td style="width: 565px;">
<telerik:RadButton ID="btnBatchSelect" OnClick="btnBatchSelectAll_Click" Visible="true" runat="server" CssClass="btn btn-success" Skin="Bootstrap" Width="80px" Text="全选" ></telerik:RadButton>
&nbsp; &nbsp;<telerik:RadButton ID="btnBatchDeleteItem" OnClick="btnBatchDeleteItem_Click" runat="server" CssClass="btn btn-success" Skin="Bootstrap" Width="80px" Text="批量移除" ></telerik:RadButton>
&nbsp; &nbsp;<asp:Label runat="server" id="lb_score_header" Visible="false"></asp:Label>
</td>
<td class="">
<telerik:RadButton ID="btnBatchComputeItem" Visible="false" OnClick="btnBatchComputeItem_Click" runat="server" CssClass="btn btn-success" Skin="Bootstrap" Width="80px" Text="计算分数" BackColor="DodgerBlue" ForeColor="White" ></telerik:RadButton>
&nbsp;&nbsp;
<telerik:RadButton ID="btnBatchSaveItem" OnClick="btnBatchSaveItem_Click" runat="server" CssClass="btn btn-success" Skin="Bootstrap" Width="80px" Text="保存所有" BackColor="DodgerBlue" ForeColor="White" ></telerik:RadButton>
</td>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<table style="width: 100%; user-select: none;" class="table-form" >
<tr>
<td style="width: 50px;">
<asp:CheckBox runat="server" ID="chk_item" />
</td>
<td style="width: 50px;">
<asp:Label runat="server" Text='<%# int.Parse(DataBinder.Eval(Container, "Index").ToString())+1%>' Width="50"></asp:Label>
</td>
<td style="width: 100px;">
<asp:Label runat="server" Width="80" ID="lb_question_kind"></asp:Label>
<asp:HiddenField runat="server" ID="hid_content" />
</td>
<td style="width: 630px;" class="">
<asp:Label runat="server" Text='<%# DataBinder.Eval(Container, "ToolTip") %>' CssClass="wrap-text"></asp:Label>
</td>
<td>
<span style="font-size: small">
<telerik:RadTextBox runat="server" ID="option_name" Skin="Bootstrap" DisabledStyle-BackColor="LightGray"
AutoPostBack="false" Width="60" Text='<%# DataBinder.Eval(Container, "Text")%>' OnTextChanged="option_name_TextChanged" AutoCompleteType="Disabled">
<ClientEvents OnKeyPress="allowOnlyNumbers" />
<ClientEvents OnValueChanged="calculateSum" />
</telerik:RadTextBox>
</span>&nbsp;分
<asp:RequiredFieldValidator ID="RequiredFieldValidator_option_name" runat="server" Display="Dynamic" SkinID="Bootstrap" CssClass="text-danger" ForeColor="Red" ControlToValidate="option_name" ErrorMessage="不能为空!"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegexValidator_option_name" runat="server" ControlToValidate="option_name" ValidationExpression="^(0|[1-9]\d*)(\.\d{1,3})?$" ErrorMessage="请输入最多3位小数!" Display="Dynamic" SkinID="Bootstrap" CssClass="text-danger" ForeColor="Red"></asp:RegularExpressionValidator>
</td>
<td style="width: 60px;">
<telerik:RadButton ID="btnDeleteOne" OnClick="btnDeleteOne_Click" runat="server" CssClass="btn btn-success" Skin="Bootstrap" Width="80px" Text="移除" ></telerik:RadButton>
</td>
</tr>
</table>
</ItemTemplate>
<FooterTemplate>
</FooterTemplate>
</telerik:RadListBox>
</td>
</tr>
</table>
</div>
<telerik:RadWindowManager ID="RadWindowManager1" runat="server" Behaviors="Close,Move" VisibleStatusbar="False"
Modal="false" Skin="Bootstrap">
<Localization Close="关闭" OK="确定" Cancel="取消" Yes="确定" No="取消" />
</telerik:RadWindowManager>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" UpdatePanelsRenderMode="Inline"
OnAjaxRequest="AjaxManager_AjaxRequest">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="btnSelect">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="dataList" />
<telerik:AjaxUpdatedControl ControlID="RadListBoxDestination" />
<telerik:AjaxUpdatedControl ControlID="span_name" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="dataList">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="dataList" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="RadListBoxDestination">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadListBoxDestination" />
<telerik:AjaxUpdatedControl ControlID="span_name" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="option_name">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadListBoxDestination" />
<telerik:AjaxUpdatedControl ControlID="lb_score_header" />
<telerik:AjaxUpdatedControl ControlID="span_name" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="btnDeleteOne">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadListBoxDestination" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="btnCheck">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadListBoxDestination" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
</form>
</body>
</html>