市长热线演示版

questionedit.aspx 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  1. <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="questionedit.aspx.cs" Inherits="HySoft.BaseCallCenter.Web.askmanage.questionedit" %>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head id="Head1" runat="server">
  5. <title>编辑试题</title>
  6. <link href="/scripts/ui/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
  7. <script src="/scripts/jquery/jquery-1.8.3.min.js" type="text/javascript"></script>
  8. <script src="/scripts/ui/json2.js" type="text/javascript"></script>
  9. <script src="/scripts/ui/js/core/base.js" type="text/javascript"></script>
  10. <script src="/scripts/ui/js/ligerui.min.js" type="text/javascript"></script>
  11. <script src="/scripts/ui/js/plugins/ligerTextBox.js" type="text/javascript"></script>
  12. <script src="/scripts/ui/js/plugins/ligerSpinner.js" type="text/javascript"></script>
  13. <script src="/scripts/function.js" type="text/javascript"></script>
  14. <script src="/scripts/utils.js" type="text/javascript"></script>
  15. <script src="/scripts/ui/js/plugins/ligerDateEditor.js" type="text/javascript"></script>
  16. <link href="/scripts/ui/skins/Tab/css/grid.css" rel="stylesheet" type="text/css" />
  17. <link href="/images/style.css" rel="stylesheet" type="text/css" />
  18. <link href="/scripts/ui/skins/Tab/css/grid.css" rel="stylesheet" type="text/css" />
  19. <link href="/scripts/ui/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
  20. <style type="text/css">
  21. .l-toolbar
  22. {
  23. background: none;
  24. height: 23px;
  25. border: 0px solid #9CBAE7;
  26. border-top: 0px solid #EFF7F7;
  27. }
  28. .tools_box
  29. {
  30. border: 1px solid #D6D6D6;
  31. border-bottom: 0px;
  32. }
  33. </style>
  34. <script type="text/javascript">
  35. var g;
  36. var arr1=new Array("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20");
  37. var arr2 = new Array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T");
  38. var sort = 0;
  39. var questionlist;
  40. function CloseThis() {
  41. var dialog = frameElement.dialog;
  42. parent.LoadQuestionList();
  43. dialog.close();
  44. }
  45. $(function () {
  46. var a = $("#navtab1").ligerTab({
  47. showSwitch: false,
  48. contextmenu: false,
  49. onAfterSelectTabItem: function (targettabid) {
  50. }
  51. });
  52. $("#toptoolbar1").ligerToolBar({ items: [
  53. { text: '添加选项', click: itemclick, icon: 'add' }
  54. ]
  55. });
  56. var id = document.getElementById("txtId").value;
  57. if (id != "") {
  58. action = "getlist";
  59. }
  60. var type = document.getElementById("dropQuestionType").value;
  61. if (type != "1") {
  62. selecttype();
  63. }
  64. $("#pageloading_bg,#pageloading").hide();
  65. });
  66. var itemcount = 0;
  67. var action = "gettemplist";
  68. function LoadItem() {
  69. itemcount = 0;
  70. var selecttype = document.getElementById("dropQuestionType").value;
  71. var userid = document.getElementById("txtUserId").value;
  72. var sorttype = document.getElementById("dropSortModel").value;
  73. var questionid = document.getElementById("txtId").value;
  74. questionlist = $("#divItemList").ligerGrid({
  75. height: 190,
  76. enabledEdit: true,
  77. onBeforeEdit: f_onBeforeEdit,
  78. onAfterEdit: f_onAfterEdit,
  79. columns: [
  80. { display: '序号', width: '50', name: '_f_itemid', render: function (rowdata, rowindex, value) {
  81. var strres = "";
  82. try {
  83. if (sorttype == "1") {
  84. strres = arr2[rowindex];
  85. }
  86. else {
  87. strres = arr1[rowindex];
  88. }
  89. }
  90. catch (e)
  91. { }
  92. return strres;
  93. }
  94. },
  95. { display: '选项', align: 'left', name: '_f_itemname', editor: { type: 'text' }, render: function (rowdata, rowindex, value) {
  96. if (selecttype == "1")
  97. return "&nbsp;&nbsp;<img src='../images/help_question_mark_24.png' style='width:18px' />&nbsp;&nbsp;<font color='red'>" + value + "</font>";
  98. else if (selecttype == "2")
  99. return "&nbsp;&nbsp;<img src='../images/radio_button_off_16.png' style='width:16px' />&nbsp;&nbsp;<font color='green'>" + value + "</font>";
  100. else if (selecttype == "3")
  101. return "&nbsp;&nbsp;<img src='../images/check_box_24.png' style='width:18px' />&nbsp;&nbsp;<font color='blue'>" + value + "</font>";
  102. else
  103. return "";
  104. }
  105. },
  106. // { display: '是否答案', width: '80', name: '_f_questionid', render: function (rowdata, rowindex, value) {
  107. // if (value == "1")
  108. // return "<img src='../images/ico-2.png' style='width:16px' />";
  109. // else
  110. // return "";
  111. // }
  112. // },
  113. {display: '排序', width: '50', align: 'left', name: '_f_sort', render: function (rowdata, rowindex, value) {
  114. if (value > sort) {
  115. sort = value;
  116. }
  117. if (rowindex == 0)
  118. return "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img id='xy_" + rowindex + "' onclick='MoveItem(\"" + rowdata._f_itemid + "\",\"" + value + "\",\"1\");' src='../images/icon_desc.gif' title='下移' style='width:12px; cursor:hand;' />";
  119. else
  120. return "&nbsp;<img id='sy_" + rowindex + "' onclick='MoveItem(\"" + rowdata._f_itemid + "\",\"" + value + "\",\"-1\");' src='../images/icon_asc.gif' title='上移' style='width:12px; cursor:hand;' />&nbsp;&nbsp;<img id='xy_" + rowindex + "' onclick='MoveItem(\"" + rowdata._f_itemid + "\",\"" + value + "\",\"1\");' src='../images/icon_desc.gif' title='下移' style='width:12px; cursor:hand;' />";
  121. }
  122. },
  123. { display: '操作', width: '60', name: '_f_itemid', render: function (rowdata, rowindex, value) {
  124. return "<div style='padding-top:5px;'><img src='../images/icon_del.gif' onclick='DeleteItem(\"" + value + "\")' title='删除' style='width:12px; cursor:hand;' /></div>";
  125. }
  126. }
  127. ],
  128. url: 'ajax/questionitems.ashx?action=' + action + '&type=&questionid=' + questionid + '&userid=' + userid, pageSize: 50, pageSizeOptions: [10, 20, 50], rownumbers: false,
  129. onAfterShowData: function (data) {
  130. itemcount = data.Total;
  131. var imgindex = itemcount - 1;
  132. try {
  133. var imgid = "xy_" + imgindex;
  134. document.getElementById("xy_" + imgindex).style.display = "none";
  135. }
  136. catch (e) {
  137. }
  138. }
  139. });
  140. $("#pageloading").hide();
  141. }
  142. //编辑后事件
  143. function f_onAfterEdit(e) {
  144. var imgindex = itemcount - 1;
  145. try {
  146. var imgid = "xy_" + imgindex;
  147. document.getElementById("xy_" + imgindex).style.display = "none";
  148. }
  149. catch (ex) {
  150. }
  151. //更新数据
  152. var id = document.getElementById("txtId").value;
  153. var userid = document.getElementById("txtUserId").value;
  154. var sorttype = document.getElementById("dropSortModel").value;
  155. var timeno = new Date().getTime();
  156. var dataObj = questionlist.getRow(e.rowindex);
  157. if (dataObj) {
  158. var itemid = dataObj._f_itemid;
  159. var itemvalue = escape(dataObj._f_itemname);
  160. var optaction = "modifytemp";
  161. if (id != "") {
  162. optaction = "modify";
  163. }
  164. try {
  165. $.ajax({
  166. type: "get",
  167. url: "ajax/questionitems.ashx?action=" + optaction + "&questionid=" + id + "&userid=" + userid + "&itemid=" + itemid + "&itemvalue=" + itemvalue + "&timeno=" + timeno,
  168. dataType: "html",
  169. success: function (res) {
  170. if (res == "success") {
  171. //selecttype();
  172. } else {
  173. $.ligerDialog.error("修改选项失败");
  174. }
  175. }
  176. });
  177. }
  178. catch (e) {
  179. }
  180. }
  181. else {
  182. $.ligerDialog.error("没有选择要修改的项");
  183. }
  184. }
  185. //编辑前事件
  186. function f_onBeforeEdit(e) {
  187. return true;
  188. }
  189. function itemclick(item) {
  190. switch (item.icon) {
  191. case "add":
  192. if (itemcount < 20) {
  193. AddItem();
  194. }
  195. else {
  196. $.ligerDialog.error('选项不能超过20项');
  197. }
  198. break;
  199. }
  200. }
  201. function AddItem() {
  202. var id = document.getElementById("txtId").value;
  203. var userid = document.getElementById("txtUserId").value;
  204. var sorttype = document.getElementById("dropSortModel").value;
  205. var timeno = new Date().getTime();
  206. var optaction = "addtemp";
  207. if (id != "") {
  208. optaction = "add";
  209. }
  210. try {
  211. $.ajax({
  212. type: "get",
  213. url: "ajax/questionitems.ashx?action=" + optaction + "&questionid=" + id + "&userid=" + userid + "&sorttype=" + sorttype + "&sort=" + sort + "&timeno=" + timeno,
  214. dataType: "html",
  215. success: function (res) {
  216. if (res == "success") {
  217. selecttype();
  218. } else {
  219. $.ligerDialog.error("添加选项失败");
  220. }
  221. }
  222. });
  223. }
  224. catch (e) {
  225. }
  226. }
  227. function DeleteItem(itemid) {
  228. var id = document.getElementById("txtId").value;
  229. var timeno = new Date().getTime();
  230. var optaction = "deletetemp";
  231. if (id != "") {
  232. optaction = "delete";
  233. }
  234. try {
  235. $.ajax({
  236. type: "get",
  237. url: "ajax/questionitems.ashx?action=" + optaction + "&questionid=" + id + "&itemid=" + itemid + "&timeno=" + timeno,
  238. dataType: "html",
  239. success: function (res) {
  240. if (res == "success") {
  241. selecttype();
  242. } else {
  243. $.ligerDialog.error("删除选项失败");
  244. }
  245. }
  246. });
  247. }
  248. catch (e) {
  249. }
  250. }
  251. function MoveItem(itemid, sort,type) {
  252. var id = document.getElementById("txtId").value;
  253. var timeno = new Date().getTime();
  254. var optaction = "movetemp";
  255. if (id != "") {
  256. optaction = "move";
  257. }
  258. try {
  259. $.ajax({
  260. type: "get",
  261. url: "ajax/questionitems.ashx?action=" + optaction + "&questionid=" + id + "&itemid=" + itemid + "&sort=" + sort + "&movetype=" + type + "&timeno=" + timeno,
  262. dataType: "html",
  263. success: function (res) {
  264. if (res == "success") {
  265. selecttype();
  266. } else {
  267. $.ligerDialog.error("移动选项失败");
  268. }
  269. }
  270. });
  271. }
  272. catch (e) {
  273. }
  274. }
  275. function selecttype() {
  276. var selectid = document.getElementById("dropQuestionType").value;
  277. if (selectid == "1") {
  278. document.getElementById("trSelect").style.display = "none";
  279. }
  280. else {
  281. document.getElementById("trSelect").style.display = "block";
  282. LoadItem();
  283. }
  284. }
  285. function validate() {
  286. var i = 0;
  287. if (!validate1()) {
  288. i++;
  289. }
  290. if (!validate2()) {
  291. i++;
  292. }
  293. if (!validate3()) {
  294. i++;
  295. }
  296. if (i > 0) {
  297. return false;
  298. }
  299. return true;
  300. }
  301. function validate1() {
  302. if ($("#dropQuestionCategory").val() == "" || $("#dropQuestionCategory").val() == undefined) {
  303. document.getElementById("lbQuestionCategory").innerHTML = "* 未选择分类!";
  304. document.getElementById("lbQuestionCategory").style.color = "red";
  305. return false;
  306. }
  307. else {
  308. document.getElementById("lbQuestionCategory").innerHTML = "*";
  309. document.getElementById("lbQuestionCategory").style.color = "#414141";
  310. return true;
  311. }
  312. }
  313. function validate2() {
  314. if ($("#txtF_Title").val() == "" || $("#txtF_Title").val() == undefined) {
  315. document.getElementById("lbF_Title").innerHTML = "* 标题不能为空!";
  316. document.getElementById("lbF_Title").style.color = "red";
  317. return false;
  318. }
  319. else {
  320. document.getElementById("lbF_Title").innerHTML = "*";
  321. document.getElementById("lbF_Title").style.color = "#414141";
  322. return true;
  323. }
  324. }
  325. function validate3() {
  326. if (document.getElementById("dropQuestionType").value != "1") {
  327. if (itemcount<1) {
  328. document.getElementById("lbQuestionType").innerHTML = "* 此题型下未选项!";
  329. document.getElementById("lbQuestionType").style.color = "red";
  330. return false;
  331. }
  332. else {
  333. document.getElementById("lbQuestionType").innerHTML = "*";
  334. document.getElementById("lbQuestionType").style.color = "#414141";
  335. return true;
  336. }
  337. }
  338. else {
  339. document.getElementById("lbQuestionType").innerHTML = "*";
  340. document.getElementById("lbQuestionType").style.color = "#414141";
  341. return true;
  342. }
  343. }
  344. </script>
  345. </head>
  346. <body>
  347. <form id="form1" runat="server">
  348. <asp:HiddenField ID="hidF_CategoryId" runat="server" Value="" />
  349. <asp:HiddenField ID="txtUserId" runat="server" Value="0" />
  350. <asp:HiddenField ID="txtId" runat="server" Value="" />
  351. <div id="pageloading">
  352. 数据加载中,请稍等...
  353. </div>
  354. <table class="form_table" style="width: 100%; height: 100%;">
  355. <colgroup>
  356. <col width="100" />
  357. <col />
  358. <col width="100" />
  359. <col />
  360. </colgroup>
  361. <tr style="height: 25px;">
  362. <th style="height: 25px; padding: 0px 8px 0px 0px;">
  363. 试题分类:
  364. </th>
  365. <td style="height: 25px; padding: 2px 0px 0px 8px;">
  366. <asp:DropDownList ID="dropQuestionCategory" runat="server" CssClass="selectBox" Width="120px">
  367. </asp:DropDownList><label
  368. id="lbQuestionCategory" for="dropQuestionCategory"></label>
  369. </td>
  370. <th style="height: 25px; padding: 0px 8px 0px 0px;">
  371. 试题题型:
  372. </th>
  373. <td style="height: 25px; padding: 2px 0px 0px 8px;">
  374. <asp:DropDownList ID="dropQuestionType" runat="server" onchange="selecttype();" CssClass="selectBox"
  375. Width="120px">
  376. <asp:ListItem Value="1" Text="问答题" Selected></asp:ListItem>
  377. <asp:ListItem Value="2" Text="单选题"></asp:ListItem>
  378. <asp:ListItem Value="3" Text="多选题"></asp:ListItem>
  379. </asp:DropDownList><label
  380. id="lbQuestionType" for="dropQuestionType"></label>
  381. </td>
  382. </tr>
  383. <tr style="height: 25px;">
  384. <th style="height: 25px; padding: 0px 8px 0px 0px;">
  385. 试题标题:
  386. </th>
  387. <td colspan="3" style="height: 25px; padding: 5px 0px 5px 8px;">
  388. <textarea id="txtF_Title" cols="20" rows="4" runat="server" class="txtInput normal"
  389. style="width: 455px; height: 60px;"></textarea><label
  390. id="lbF_Title" for="txtF_Title"></label>
  391. </td>
  392. </tr>
  393. </table>
  394. <div id="trSelect" style="width: 99%; display: none; text-align: center;">
  395. <div id="navtab1" style="width: 100%; height: 250px; border: 1px solid #D3D3d3;">
  396. <div title="试题选项" tabid="tab1">
  397. <div class="tools_box" style="height: 30px;">
  398. <div class="tools_bar">
  399. <div style="float: left; padding-top: 3px; padding-left: 1px; font-weight: bold;
  400. color: red;">
  401. <img src="../images/check_list_16.png" />&nbsp;选项序列模式&nbsp;&nbsp;
  402. <asp:DropDownList ID="dropSortModel" runat="server" onchange="selecttype();" CssClass="selectBox"
  403. Width="120px">
  404. <asp:ListItem Value="1" Text="A、B、C..." Selected></asp:ListItem>
  405. <asp:ListItem Value="2" Text="1、2、3..."></asp:ListItem>
  406. </asp:DropDownList>
  407. </div>
  408. <div id="toptoolbar1" style="float: right;">
  409. </div>
  410. </div>
  411. </div>
  412. <div id="divItemList">
  413. </div>
  414. </div>
  415. </div>
  416. </div>
  417. <br />
  418. <div style="width: 100%; text-align: center;">
  419. <asp:Button ID="btnSubmit" runat="server" Text="保&nbsp;&nbsp;存" CssClass="btnSubmit"
  420. OnClientClick="return validate();" OnClick="btnSubmit_Click" /></div><br />
  421. </form>
  422. </body>
  423. </html>