/Quản lý website trường trung học phổ thông PHP/lc1/modules/download/js/admin.dev.js

https://gitlab.com/phamngsinh/baitaplon_sinhvien · JavaScript · 419 lines · 317 code · 66 blank · 36 comment · 42 complexity · 9b6a91e416e9376ddb09dd57b8413701 MD5 · raw file

  1. /* *
  2. * @Project NUKEVIET 3.0
  3. * @Author VINADES., JSC ( contact@vinades.vn )
  4. * @Copyright ( C ) 2010 VINADES., JSC. All rights reserved
  5. * @Createdate 1 - 31 - 2010 5 : 12
  6. */
  7. function nv_chang_weight( catid )
  8. {
  9. var nv_timer = nv_settimeout_disable( 'weight' + catid, 5000 );
  10. var newpos = document.getElementById( 'weight' + catid ).options[document.getElementById( 'weight' + catid ).selectedIndex].value;
  11. nv_ajax( "post", script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=cat&changeweight=1&catid=' + catid + '&new=' + newpos + '&num=' + nv_randomPassword( 8 ), '', 'nv_chang_weight_result' );
  12. return;
  13. }
  14. // ---------------------------------------
  15. function nv_chang_weight_result( res )
  16. {
  17. if ( res != 'OK' )
  18. {
  19. alert( nv_is_change_act_confirm[2] );
  20. }
  21. clearTimeout( nv_timer );
  22. window.location.href = window.location.href;
  23. return;
  24. }
  25. // ---------------------------------------
  26. function nv_chang_status( catid )
  27. {
  28. var nv_timer = nv_settimeout_disable( 'change_status' + catid, 5000 );
  29. nv_ajax( "post", script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=cat&changestatus=1&catid=' + catid + '&num=' + nv_randomPassword( 8 ), '', 'nv_chang_status_res' );
  30. return;
  31. }
  32. // ---------------------------------------
  33. function nv_chang_status_res( res )
  34. {
  35. if( res != 'OK' )
  36. {
  37. alert( nv_is_change_act_confirm[2] );
  38. window.location.href = window.location.href;
  39. }
  40. return;
  41. }
  42. // ---------------------------------------
  43. function nv_row_del( catid )
  44. {
  45. if ( confirm( nv_is_del_confirm[0] ) )
  46. {
  47. nv_ajax( 'post', script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=cat&del=1&catid=' + catid, '', 'nv_row_del_result' );
  48. }
  49. return false;
  50. }
  51. // ---------------------------------------
  52. function nv_row_del_result( res )
  53. {
  54. if( res == 'OK' )
  55. {
  56. window.location.href = window.location.href;
  57. }
  58. else
  59. {
  60. alert( nv_is_del_confirm[2] );
  61. }
  62. return false;
  63. }
  64. // ---------------------------------------
  65. function nv_file_del( fid )
  66. {
  67. if ( confirm( nv_is_del_confirm[0] ) )
  68. {
  69. nv_ajax( 'post', script_name, nv_name_variable + '=' + nv_module_name + '&del=1&id=' + fid, '', 'nv_file_del_result' );
  70. }
  71. return false;
  72. }
  73. // ---------------------------------------
  74. function nv_file_del_result( res )
  75. {
  76. if( res == 'OK' )
  77. {
  78. window.location.href = window.location.href;
  79. }
  80. else
  81. {
  82. alert( nv_is_del_confirm[2] );
  83. }
  84. return false;
  85. }
  86. // ---------------------------------------
  87. function nv_chang_file_status( fid )
  88. {
  89. var nv_timer = nv_settimeout_disable( 'change_status' + fid, 5000 );
  90. nv_ajax( "post", script_name, nv_name_variable + '=' + nv_module_name + '&changestatus=1&id=' + fid + '&num=' + nv_randomPassword( 8 ), '', 'nv_chang_file_status_res' );
  91. return;
  92. }
  93. // ---------------------------------------
  94. function nv_chang_file_status_res( res )
  95. {
  96. if( res != 'OK' )
  97. {
  98. alert( nv_is_change_act_confirm[2] );
  99. window.location.href = window.location.href;
  100. }
  101. return;
  102. }
  103. // ---------------------------------------
  104. function nv_filequeue_del( fid )
  105. {
  106. if ( confirm( nv_is_del_confirm[0] ) )
  107. {
  108. nv_ajax( 'post', script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=filequeue&del=1&id=' + fid, '', 'nv_filequeue_del_result' );
  109. }
  110. return false;
  111. }
  112. // ---------------------------------------
  113. function nv_filequeue_del_result( res )
  114. {
  115. if( res == 'OK' )
  116. {
  117. window.location.href = window.location.href;
  118. }
  119. else
  120. {
  121. alert( nv_is_del_confirm[2] );
  122. }
  123. return false;
  124. }
  125. // ---------------------------------------
  126. function nv_filequeue_alldel()
  127. {
  128. if ( confirm( nv_is_del_confirm[0] ) )
  129. {
  130. nv_ajax( 'post', script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=filequeue&alldel=1', '', 'nv_filequeue_alldel_result' );
  131. }
  132. return false;
  133. }
  134. // ---------------------------------------
  135. function nv_filequeue_alldel_result( res )
  136. {
  137. if( res == 'OK' )
  138. {
  139. window.location.href = window.location.href;
  140. }
  141. else
  142. {
  143. alert( nv_is_del_confirm[2] );
  144. }
  145. return false;
  146. }
  147. // ---------------------------------------
  148. function nv_checkfile( mylink, is_myUrl, butt )
  149. {
  150. var nv_timer = nv_settimeout_disable( butt, 5000 );
  151. var link = document.getElementById( mylink ).value;
  152. if( trim( link ) == '' )
  153. {
  154. document.getElementById( mylink ).value = '';
  155. return false;
  156. }
  157. link = rawurlencode( link );
  158. nv_ajax( 'post', script_name, nv_name_variable + '=' + nv_module_name + '&check=1&url=' + link + '&is_myurl=' + is_myUrl + '&num=' + nv_randomPassword( 8 ), '', 'nv_checkfile_result' );
  159. return false;
  160. }
  161. // ---------------------------------------
  162. function nv_gourl( mylink, is_myUrl, butt )
  163. {
  164. var nv_timer = nv_settimeout_disable( butt, 5000 );
  165. var link = document.getElementById( mylink ).value;
  166. if( trim( link ) == '' )
  167. {
  168. document.getElementById( mylink ).value = '';
  169. return false;
  170. }
  171. if( is_myUrl )
  172. {
  173. link = rawurlencode( link );
  174. link = script_name + '?' + nv_name_variable + '=' + nv_module_name + '&fdownload=' + link;
  175. window.location.href = link;
  176. }
  177. else
  178. {
  179. if( ! link.match( /^(http|ftp)\:\/\/\w+([\.\-]\w+)*\.\w{2,4}(\:\d+)*([\/\.\-\?\&\%\#]\w+)*\/?$/i ) )
  180. {
  181. alert( nv_url );
  182. document.getElementById( mylink ).focus();
  183. }
  184. else
  185. {
  186. var w = window.open( link );
  187. w.focus();
  188. }
  189. }
  190. return false;
  191. }
  192. // ---------------------------------------
  193. function nv_checkfile_result( res )
  194. {
  195. alert( res );
  196. return false;
  197. }
  198. // ---------------------------------------
  199. function nv_report_del( rid )
  200. {
  201. if ( confirm( nv_is_del_confirm[0] ) )
  202. {
  203. nv_ajax( 'post', script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=report&del=1&id=' + rid, '', 'nv_report_del_result' );
  204. }
  205. return false;
  206. }
  207. // ---------------------------------------
  208. function nv_report_del_result( res )
  209. {
  210. if( res == 'OK' )
  211. {
  212. window.location.href = window.location.href;
  213. }
  214. else
  215. {
  216. alert( nv_is_del_confirm[2] );
  217. }
  218. return false;
  219. }
  220. // ---------------------------------------
  221. function nv_report_check( fid )
  222. {
  223. nv_ajax( 'post', script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=report&linkcheck=1&id=' + fid + '&num=' + nv_randomPassword( 8 ), '', 'nv_report_check_result' );
  224. return false;
  225. }
  226. // ---------------------------------------
  227. function nv_report_check_result( res )
  228. {
  229. var r_split = res.split( "_" );
  230. if( r_split[0] == "OK" )
  231. {
  232. var report_check_ok = document.getElementById( 'report_check_ok' ).value;
  233. if ( confirm( report_check_ok ) )
  234. {
  235. nv_ajax( 'post', script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=report&del=1&id=' + r_split[1], '', 'nv_report_del_result' );
  236. }
  237. }
  238. else
  239. {
  240. if( r_split[0] == "NO" )
  241. {
  242. var report_check_error = document.getElementById( 'report_check_error' ).value;
  243. if ( confirm( report_check_error ) )
  244. {
  245. nv_report_edit( r_split[1] );
  246. }
  247. }
  248. else
  249. {
  250. var report_check_error2 = document.getElementById( 'report_check_error2' ).value;
  251. if ( confirm( report_check_error2 ) )
  252. {
  253. nv_ajax( 'post', script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=report&del=1&id=' + r_split[1], '', 'nv_report_del_result' );
  254. }
  255. }
  256. }
  257. return false;
  258. }
  259. // ---------------------------------------
  260. function nv_report_edit( fid )
  261. {
  262. window.location.href = script_name + '?' + nv_name_variable + '=' + nv_module_name + '&edit=1&id=' + fid + '&report=1';
  263. return false;
  264. }
  265. // ---------------------------------------
  266. function nv_report_alldel()
  267. {
  268. if ( confirm( nv_is_del_confirm[0] ) )
  269. {
  270. nv_ajax( 'post', script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=report&alldel=1', '', 'nv_report_alldel_result' );
  271. }
  272. return false;
  273. }
  274. // ---------------------------------------
  275. function nv_report_alldel_result( res )
  276. {
  277. if( res == 'OK' )
  278. {
  279. window.location.href = window.location.href;
  280. }
  281. else
  282. {
  283. alert( nv_is_del_confirm[2] );
  284. }
  285. return false;
  286. }
  287. // ---------------------------------------
  288. function nv_chang_comment_status ( cid )
  289. {
  290. var nv_timer = nv_settimeout_disable( 'status' + cid, 5000 );
  291. nv_ajax( "post", script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=comment&changestatus=1&id=' + cid + '&num=' + nv_randomPassword( 8 ), '', 'nv_chang_comment_status_res' );
  292. return;
  293. }
  294. // ---------------------------------------
  295. function nv_chang_comment_status_res( res )
  296. {
  297. if( res != 'OK' )
  298. {
  299. alert( nv_is_change_act_confirm[2] );
  300. }
  301. window.location.href = window.location.href;
  302. return;
  303. }
  304. // ---------------------------------------
  305. function nv_comment_del( cid )
  306. {
  307. if ( confirm( nv_is_del_confirm[0] ) )
  308. {
  309. nv_ajax( 'post', script_name, nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=comment&del=1&id=' + cid, '', 'nv_comment_del_result' );
  310. }
  311. return false;
  312. }
  313. // ---------------------------------------
  314. function nv_comment_del_result( res )
  315. {
  316. if( res == 'OK' )
  317. {
  318. window.location.href = window.location.href;
  319. }
  320. else
  321. {
  322. alert( nv_is_del_confirm[2] );
  323. }
  324. return false;
  325. }
  326. // ---------------------------------------
  327. function nv_file_additem()
  328. {
  329. file_items ++ ;
  330. var newitem = "<input readonly=\"readonly\" class=\"txt\" value=\"\" name=\"fileupload[]\" id=\"fileupload" + file_items + "\" style=\"width : 300px\" maxlength=\"255\" />";
  331. newitem += "&nbsp;<input type=\"button\" value=\"" + file_selectfile + "\" name=\"selectfile\" onclick=\"nv_open_browse_file( '" + nv_base_adminurl + "index.php?" + nv_name_variable + "=upload&popup=1&area=fileupload" + file_items + "&path=" + file_dir + "&type=file', 'NVImg', 850, 500, 'resizable=no,scrollbars=no,toolbar=no,location=no,status=no' ); return false; \" />";
  332. newitem += "&nbsp;<input type=\"button\" value=\"" + file_checkUrl + "\" id= \"check_fileupload" + file_items + "\" onclick=\"nv_checkfile( 'fileupload" + file_items + "', 1, 'check_fileupload" + file_items + "' ); \" />";
  333. newitem += "&nbsp;<input type=\"button\" value=\"" + file_gourl + "\" id= \"go_fileupload" + file_items + "\" onclick=\"nv_gourl( 'fileupload" + file_items + "', 1, 'go_fileupload" + file_items + "' ); \" /><br />";
  334. $( "#fileupload_items" ).append( newitem );
  335. }
  336. // ---------------------------------------
  337. function nv_file_additem2()
  338. {
  339. var newitem = "<input readonly=\"readonly\" class=\"txt\" value=\"\" name=\"fileupload2[]\" id=\"fileupload2_" + file_items + "\" style=\"width : 300px\" maxlength=\"255\" />";
  340. newitem += "&nbsp;<input type=\"button\" value=\"" + file_selectfile + "\" name=\"selectfile\" onclick=\"nv_open_browse_file( '" + nv_base_adminurl + "index.php?" + nv_name_variable + "=upload&popup=1&area=fileupload2_" + file_items + "&path=" + file_dir + "&type=file', 'NVImg', 850, 500, 'resizable=no,scrollbars=no,toolbar=no,location=no,status=no' ); return false; \" />";
  341. newitem += "&nbsp;<input type=\"button\" value=\"" + file_checkUrl + "\" id= \"check_fileupload2_" + file_items + "\" onclick=\"nv_checkfile( 'fileupload2_" + file_items + "', 1, 'check_fileupload2_" + file_items + "' ); \" />";
  342. newitem += "&nbsp;<input type=\"button\" value=\"" + file_gourl + "\" id= \"go_fileupload2_" + file_items + "\" onclick=\"nv_gourl( 'fileupload2_" + file_items + "', 1, 'go_fileupload2_" + file_items + "' ); \" /><br />";
  343. $( "#fileupload2_items" ).append( newitem );
  344. file_items ++ ;
  345. }
  346. // ---------------------------------------
  347. function nv_linkdirect_additem()
  348. {
  349. var newitem = "<textarea name=\"linkdirect[]\" id=\"linkdirect" + linkdirect_items + "\" style=\"width : 300px; height : 150px\"></textarea>";
  350. newitem += "&nbsp;<input type=\"button\" value=\"" + file_checkUrl + "\" id=\"check_linkdirect" + linkdirect_items + "\" onclick=\"nv_checkfile( 'linkdirect" + linkdirect_items + "', 0, 'check_linkdirect" + linkdirect_items + "' ); \" /><br />";
  351. $( "#linkdirect_items" ).append( newitem );
  352. linkdirect_items ++ ;
  353. }