forum_moderate.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /*
  2. [Discuz!] (C)2001-2099 Comsenz Inc.
  3. This is NOT a freeware, use is subject to license terms
  4. $Id: forum_moderate.js 26484 2011-12-14 02:08:03Z svn_project_zhangjie $
  5. */
  6. function modaction(action, pid, extra, mod) {
  7. if(!action) {
  8. return;
  9. }
  10. var mod = mod ? mod : 'forum.php?mod=topicadmin';
  11. var extra = !extra ? '' : '&' + extra;
  12. if(!pid && in_array(action, ['delpost', 'banpost'])) {
  13. var checked = 0;
  14. var pid = '';
  15. for(var i = 0; i < $('modactions').elements.length; i++) {
  16. if($('modactions').elements[i].name.match('topiclist')) {
  17. checked = 1;
  18. break;
  19. }
  20. }
  21. } else {
  22. var checked = 1;
  23. }
  24. if(!checked) {
  25. alert('请选择需要操作的帖子');
  26. } else {
  27. $('modactions').action = mod + '&action='+ action +'&fid=' + fid + '&tid=' + tid + '&handlekey=mods&infloat=yes&nopost=yes' + (!pid ? '' : '&topiclist[]=' + pid) + extra + '&r' + Math.random();
  28. showWindow('mods', 'modactions', 'post');
  29. if(BROWSER.ie) {
  30. doane(event);
  31. }
  32. hideMenu();
  33. }
  34. }
  35. function modthreads(optgroup, operation) {
  36. var operation = !operation ? '' : operation;
  37. $('modactions').action = 'forum.php?mod=topicadmin&action=moderate&fid=' + fid + '&moderate[]=' + tid + '&handlekey=mods&infloat=yes&nopost=yes' + (optgroup != 3 && optgroup != 2 ? '&from=' + tid : '');
  38. $('modactions').optgroup.value = optgroup;
  39. $('modactions').operation.value = operation;
  40. hideWindow('mods');
  41. showWindow('mods', 'modactions', 'post', 0);
  42. if(BROWSER.ie) {
  43. doane(event);
  44. }
  45. }
  46. function pidchecked(obj) {
  47. if(obj.checked) {
  48. try {
  49. var inp = document.createElement('<input name="topiclist[]" />');
  50. } catch(e) {
  51. try {
  52. var inp = document.createElement('input');
  53. inp.name = 'topiclist[]';
  54. } catch(e) {
  55. return;
  56. }
  57. }
  58. inp.id = 'topiclist_' + obj.value;
  59. inp.value = obj.value;
  60. inp.type = 'hidden';
  61. $('modactions').appendChild(inp);
  62. } else {
  63. $('modactions').removeChild($('topiclist_' + obj.value));
  64. }
  65. }
  66. var modclickcount = 0;
  67. function modclick(obj, pid) {
  68. if(obj.checked) {
  69. modclickcount++;
  70. } else {
  71. modclickcount--;
  72. }
  73. $('mdct').innerHTML = modclickcount;
  74. if(modclickcount > 0) {
  75. var offset = fetchOffset(obj);
  76. $('mdly').style.top = offset['top'] - 65 + 'px';
  77. $('mdly').style.left = offset['left'] - 215 + 'px';
  78. $('mdly').style.display = '';
  79. } else {
  80. $('mdly').style.display = 'none';
  81. }
  82. }
  83. function resetmodcount() {
  84. modclickcount = 0;
  85. $('mdly').style.display = 'none';
  86. }
  87. function tmodclick(obj) {
  88. if(obj.checked) {
  89. modclickcount++;
  90. } else {
  91. modclickcount--;
  92. }
  93. $('mdct').innerHTML = modclickcount;
  94. if(modclickcount > 0) {
  95. var top_offset = obj.offsetTop;
  96. while((obj = obj.offsetParent).id != 'threadlist') {
  97. top_offset += obj.offsetTop;
  98. }
  99. $('mdly').style.top = top_offset - 7 + 'px';
  100. $('mdly').style.display = '';
  101. } else {
  102. $('mdly').style.display = 'none';
  103. }
  104. }
  105. function tmodthreads(optgroup, operation) {
  106. var checked = 0;
  107. var operation = !operation ? '' : operation;
  108. for(var i = 0; i < $('moderate').elements.length; i++) {
  109. if($('moderate').elements[i].name.match('moderate') && $('moderate').elements[i].checked) {
  110. checked = 1;
  111. break;
  112. }
  113. }
  114. if(!checked) {
  115. alert('请选择需要操作的帖子');
  116. } else {
  117. $('moderate').optgroup.value = optgroup;
  118. $('moderate').operation.value = operation;
  119. hideWindow('mods');
  120. showWindow('mods', 'moderate', 'post', 0);
  121. }
  122. }
  123. function getthreadclass() {
  124. var fid = $('fid');
  125. if(fid) {
  126. ajaxget('forum.php?mod=ajax&action=getthreadclass&fid=' + fid.value, 'threadclass', null, null, null, showthreadclass);
  127. }
  128. }
  129. function showthreadclass() {
  130. try{
  131. $('append_parent').removeChild($('typeid_ctrl_menu'));
  132. }catch(e) {}
  133. simulateSelect('typeid');
  134. }
  135. loadcss('forum_moderator');