市长热线演示版

questionmanage.aspx 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="questionmanage.aspx.cs"
  2. Inherits="HySoft.BaseCallCenter.Web.askmanage.questionmanage" %>
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <html xmlns="http://www.w3.org/1999/xhtml">
  5. <head id="Head1" runat="server">
  6. <title>试题管理</title>
  7. <link href="../scripts/ui/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
  8. <script src="../scripts/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
  9. <script src="../scripts/jquery/jquery-1.8.3.min.js" type="text/javascript"></script>
  10. <script src="../scripts/ui/js/core/base.js" type="text/javascript"></script>
  11. <script src="../scripts/ui/js/ligerui.min.js" type="text/javascript"></script>
  12. <link href="../scripts/ui/skins/Tab/css/tab.css" rel="stylesheet" type="text/css" />
  13. <link href="../scripts/ui/skins/Tab/css/grid.css" rel="stylesheet" type="text/css" />
  14. <script src="../scripts/ui/js/plugins/ligerGrid.js" type="text/javascript"></script>
  15. <script src="../scripts/ui/js/plugins/ligerLayout.js" type="text/javascript"></script>
  16. <script src="../scripts/ui/js/plugins/ligerTree.js" type="text/javascript"></script>
  17. <script src="../scripts/ui/js/plugins/ligerMenu.js" type="text/javascript"></script>
  18. <script src="../scripts/CustomersData.js" type="text/javascript"></script>
  19. <link href="../scripts/ui/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
  20. <script src="../scripts/My97DatePicker/lang/zh-cn.js" type="text/javascript"></script>
  21. <link href="../images/style.css" rel="stylesheet" type="text/css" />
  22. <script type="text/javascript">
  23. var selectcategoryid = "";
  24. var categorylist;
  25. var questionlist;
  26. function LoadCategoryList() {
  27. categorylist=$("#divCategoryList").ligerGrid({
  28. height: '97%',
  29. width: 230,
  30. columns: [
  31. { display: '试题分类', width: '86%', name: '_f_categoryname' }
  32. ],
  33. toolbar: {
  34. items: [
  35. { text: '增加', click: itemclick1, icon: 'add' },
  36. { line: true },
  37. { text: '修改', click: itemclick1, icon: 'modify' },
  38. { line: true },
  39. { text: '删除', click: itemclick1, icon: 'delete' }
  40. ]
  41. },
  42. url: 'ajax/questioncategory.ashx?action=getlist', pageSize: 50, pageSizeOptions: [10, 20, 50], rownumbers: true,
  43. onSelectRow: function (data, rowindex, rowobj) {
  44. selectcategoryid = data._f_categoryid;
  45. LoadQuestionList();
  46. },
  47. onDblClickRow: function (data, rowindex, rowobj) {
  48. var id = "";
  49. try {
  50. id = data._f_categoryid;
  51. }
  52. catch (e) {
  53. }
  54. if (id != "") {
  55. $.ligerDialog.open({ url: 'questioncategoryedit.aspx?otype=modify&id=' + id, title: '修改分类', height: 200, width: 380, isResize: true
  56. });
  57. }
  58. else {
  59. $.ligerDialog.error('没有选择要修改的分类,请选择');
  60. }
  61. }
  62. });
  63. $("#pageloading").hide();
  64. }
  65. function LoadQuestionList() {
  66. var selecttype = document.getElementById("dropQuestionType").value;
  67. var key=escape(document.getElementById("txtKeywords").value);
  68. questionlist=$("#divQuestionList").ligerGrid({
  69. height: '97%',
  70. columns: [
  71. { display: '试题分类', width: '120', name: '_f_categoryname' },
  72. { display: '试题类型', width: '80', name: '_f_type', render: function (rowdata, rowindex, value) {
  73. if (value == "1")
  74. return "<img src='../images/help_question_mark_24.png' style='width:18px' />&nbsp;&nbsp;<font color='red'>问答题</font>";
  75. else if(value == "2")
  76. return "<img src='../images/radio_button_off_16.png' style='width:16px' />&nbsp;&nbsp;<font color='green'>单选题</font>";
  77. else if (value == "3")
  78. return "<img src='../images/check_box_24.png' style='width:18px' />&nbsp;&nbsp;<font color='blue'>多选题</font>";
  79. else
  80. return "";
  81. }
  82. },
  83. { display: '试题标题', align: 'left', width: '350', name: '_f_title' },
  84. { display: '试题内容', align:'left', width: '550', name: '_f_content' }
  85. ],
  86. toolbar: {
  87. items: [
  88. { text: '增加', click: itemclick2, icon: 'add' },
  89. { line: true },
  90. { text: '修改', click: itemclick2, icon: 'modify' },
  91. { line: true },
  92. { text: '删除', click: itemclick2, icon: 'delete' },
  93. { line: true },
  94. { text: '所有试题', click: itemclick2, icon: 'attibutes' }
  95. ]
  96. },
  97. url: 'ajax/question.ashx?action=getlist&categoryid=' + selectcategoryid + '&selecttype=' + selecttype+'&key='+key, pageSize: 50, pageSizeOptions: [10, 20, 50], rownumbers: true,
  98. onSelectRow: function (data, rowindex, rowobj) {
  99. },
  100. onDblClickRow: function (data, rowindex, rowobj) {
  101. var vheight = $("#form1").height() - 30;
  102. var vwidth = $("#form1").width() * 0.9;
  103. if (vwidth > 700) {
  104. vwidth = 700;
  105. }
  106. var id = "";
  107. var vtitle = "修改试题";
  108. try {
  109. id = data._f_questionid;
  110. vtitle = "【<font color='red'>" + data._f_title + "</font>】修改试题";
  111. }
  112. catch (e) {
  113. }
  114. if (id != "") {
  115. var selecttype = document.getElementById("dropQuestionType").value;
  116. $.ligerDialog.open({ url: 'questionedit.aspx?otype=modify&id=' + id, title: vtitle, height: vheight, width: vwidth, isResize: true
  117. });
  118. }
  119. else {
  120. $.ligerDialog.error('没有选择要修改的试题,请选择');
  121. }
  122. }
  123. });
  124. $("#pageloading").hide();
  125. }
  126. function itemclick1(item) {
  127. switch (item.icon) {
  128. case "add":
  129. $.ligerDialog.open({ url: 'questioncategoryedit.aspx?otype=new', title: '添加分类', height: 200, width: 380, isResize: true
  130. });
  131. break;
  132. case "modify":
  133. var id = "";
  134. try {
  135. var rowobj = categorylist.getSelectedRow();
  136. id = rowobj._f_categoryid;
  137. }
  138. catch (e) {
  139. }
  140. if (id != "") {
  141. $.ligerDialog.open({ url: 'questioncategoryedit.aspx?otype=modify&id=' + id, title: '修改分类', height: 200, width: 380, isResize: true
  142. });
  143. }
  144. else {
  145. $.ligerDialog.error('没有选择要修改的分类,请选择');
  146. }
  147. break;
  148. case "delete":
  149. var id = "";
  150. var rowobj;
  151. try {
  152. rowobj = categorylist.getSelectedRow();
  153. id = rowobj._f_categoryid;
  154. }
  155. catch (e) {
  156. }
  157. if (id != "") {
  158. $.ligerDialog.confirm('确定要删除【<font color="red">' + rowobj._f_categoryname + '</font>】吗?', function (yes) {
  159. if (yes) {
  160. $.post("ajax/questioncategory.ashx?action=delete&id=" + id, function (data) {
  161. if (data == "success") {
  162. $.ligerDialog.success('删除成功');
  163. LoadCategoryList();
  164. }
  165. else if (data == "error") {
  166. $.ligerDialog.error('删除失败');
  167. }
  168. else {
  169. $.ligerDialog.error('删除失败,此分类下有【<font color="red">' + data + '</font>】个关联试题,无法删除');
  170. }
  171. });
  172. }
  173. });
  174. }
  175. else {
  176. $.ligerDialog.error('没有选择要删除的分类,请选择');
  177. }
  178. break;
  179. }
  180. }
  181. function itemclick2(item) {
  182. switch (item.icon) {
  183. case "add":
  184. var vheight = $("#form1").height() - 30;
  185. var vwidth = $("#form1").width() * 0.9;
  186. if (vwidth > 700) {
  187. vwidth = 700;
  188. }
  189. var id = "";
  190. var vtitle = "添加试题";
  191. var rowobj;
  192. try {
  193. rowobj = categorylist.getSelectedRow();
  194. id = rowobj._f_categoryid;
  195. vtitle = "【<font color='red'>" + rowobj._f_categoryname + "</font>】分类下添加试题";
  196. }
  197. catch (e) {
  198. }
  199. var selecttype = document.getElementById("dropQuestionType").value;
  200. $.ligerDialog.open({ url: 'questionedit.aspx?otype=new&categoryid=' + id + '&selecttype=' + selecttype, title: vtitle, height: vheight, width: vwidth, isResize: true
  201. });
  202. break;
  203. case "modify":
  204. var vheight = $("#form1").height() - 30;
  205. var vwidth = $("#form1").width() * 0.9;
  206. if (vwidth > 700) {
  207. vwidth = 700;
  208. }
  209. var id = "";
  210. var vtitle = "修改试题";
  211. var rowobj;
  212. try {
  213. rowobj = questionlist.getSelectedRow();
  214. id = rowobj._f_questionid;
  215. vtitle = "【<font color='red'>" + rowobj._f_title + "</font>】修改试题";
  216. }
  217. catch (e) {
  218. }
  219. if (id != "") {
  220. var selecttype = document.getElementById("dropQuestionType").value;
  221. $.ligerDialog.open({ url: 'questionedit.aspx?otype=modify&id=' + id, title: vtitle, height: vheight, width: vwidth, isResize: true
  222. });
  223. }
  224. else {
  225. $.ligerDialog.error('没有选择要修改的试题,请选择');
  226. }
  227. break;
  228. case "delete":
  229. var id = "";
  230. var rowobj;
  231. try {
  232. rowobj = questionlist.getSelectedRow();
  233. id = rowobj._f_questionid;
  234. }
  235. catch (e) {
  236. }
  237. if (id != "") {
  238. $.ligerDialog.confirm('确定要删除【<font color="red">' + rowobj._f_title + '</font>】试题吗?', function (yes) {
  239. if (yes) {
  240. $.post("ajax/question.ashx?action=delete&id=" + id, function (data) {
  241. if (data == "success") {
  242. $.ligerDialog.success('删除成功');
  243. LoadQuestionList();
  244. }
  245. else{
  246. $.ligerDialog.error('删除失败');
  247. }
  248. });
  249. }
  250. });
  251. }
  252. else {
  253. $.ligerDialog.error('没有选择要删除的试题,请选择');
  254. }
  255. break;
  256. case "attibutes":
  257. selectcategoryid = "";
  258. LoadQuestionList();
  259. break;
  260. }
  261. }
  262. $(function () {
  263. //var vheight = $("#form1").height();
  264. //document.getElementById("tableMessage").style.height = vheight - 80;
  265. LoadCategoryList();
  266. LoadQuestionList();
  267. });
  268. document.onkeydown = function (event) {
  269. var e = event || window.event || arguments.callee.caller.arguments[0];
  270. if (e && e.keyCode == 13) {
  271. LoadQuestionList();
  272. }
  273. };
  274. </script>
  275. </head>
  276. <body>
  277. <form id="form1" runat="server">
  278. <div class="tools_box">
  279. <asp:HiddenField ID="hdF_FunctionId" runat="server" />
  280. <asp:HiddenField ID="hdF_ModuleId" runat="server" />
  281. <div class="tools_bar">
  282. <div class="search_box">
  283. 题型:<asp:DropDownList ID="dropQuestionType" runat="server" onchange="LoadQuestionList();" CssClass="selectBox" Width="120px">
  284. <asp:ListItem Value="" Text="所有题型"></asp:ListItem>
  285. <asp:ListItem Value="1" Text="问答题"></asp:ListItem>
  286. <asp:ListItem Value="2" Text="单选题"></asp:ListItem>
  287. <asp:ListItem Value="3" Text="多选题"></asp:ListItem>
  288. </asp:DropDownList>
  289. &nbsp;&nbsp;关键字:<asp:TextBox ID="txtKeywords" runat="server" CssClass="txtInput"></asp:TextBox>&nbsp;&nbsp;
  290. <input id="btnSearch" type="button" value="搜 索" class="btnSearch" onclick="LoadQuestionList();" />
  291. </div>
  292. </div>
  293. </div>
  294. <table id="tableMessage" cellpadding="3" cellspacing="3" border="0" style="width: 100%;">
  295. <tr>
  296. <td valign="top" style="width: 230px; padding: 0px 2px 5px 2px;">
  297. <div class="tools_box" style="height: 30px;">
  298. <div class="tools_bar">
  299. <div style="float: left; padding-top: 6px; padding-left: 1px; font-weight: bold;
  300. color: red;">
  301. <img src="../images/icon_site.gif" />&nbsp;试题分类</div>
  302. </div>
  303. </div>
  304. <div id="divCategoryList">
  305. </div>
  306. </td>
  307. <td valign="top" style="padding: 0px 2px 5px 2px;">
  308. <div class="tools_box" style="height: 30px;">
  309. <div class="tools_bar">
  310. <div style="float: left; padding-top: 6px; padding-left: 1px; font-weight: bold;
  311. color: red;">
  312. <img src="../images/icon_attach.png" />&nbsp;试题列表</div>
  313. </div>
  314. </div>
  315. <div id="divQuestionList">
  316. </div>
  317. </td>
  318. </tr>
  319. </table>
  320. </form>
  321. </body>
  322. </html>