PageRenderTime 46ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/admin/js/comment.js

http://lazycms.googlecode.com/
JavaScript | 93 lines | 62 code | 0 blank | 31 comment | 3 complexity | 3f0ab1a2616a558aeac4ed1ee3ec777e MD5 | raw file
Possible License(s): LGPL-3.0, LGPL-2.1
  1. /**
  2. * +---------------------------------------------------------------------------+
  3. * | LL LLLL LL L LLLL LLLL |
  4. * | LL LL L LLL LL LL L LL LL |
  5. * | LL LLLL LLLLL LL LL LL LLLL LLL LL LL LL LL |
  6. * | LL LL LL LL LL LL L LLL LL LLLLL LL LL LL |
  7. * | LL LLLLL LL LLLL LL L L LL LLLLL LL LL LL |
  8. * | LL LL LL LL LLLL LL L LL LL LLLL LL |
  9. * | LL LL LL LL LL LL L L LL L LL LLLL LL |
  10. * | LLLLLL LLLLL LLLLL LL LLLL L LL LLLL LL LLLLLL |
  11. * | LL |
  12. * | LL |
  13. * +---------------------------------------------------------------------------+
  14. * | Copyright (C) 2007-2010 LazyCMS.com All rights reserved. |
  15. * +---------------------------------------------------------------------------+
  16. * | LazyCMS is free software. See LICENSE for copyright notices and details. |
  17. * +---------------------------------------------------------------------------+
  18. */
  19. function comment_list_init() {
  20. // ??????
  21. $('#comments').actions();
  22. }
  23. /**
  24. * ????
  25. *
  26. * @param cmtid
  27. */
  28. function comment_reply(cmtid) {
  29. var tr = $('#cmt-' + cmtid); LazyCMS.removeDialog('cmt_dialog');
  30. if ($('div.cmt_dialog', tr).is('div')===false) $('.row-actions', tr).after('<div class="cmt_dialog"></div>');
  31. $('.cmt_dialog', tr).dialog({
  32. name:'cmt_dialog', title:_('Reply comment'), masked: false, way:null, styles: {position:'absolute'},
  33. body:[
  34. '<div class="wrapper">',
  35. '<form action="' + LazyCMS.ADMIN + 'comment.php?method=reply" method="post" name="cmt_reply_frm" id="cmt_reply_frm">',
  36. '<textarea class="text" name="content" id="content" rows="8" cols="50"></textarea>',
  37. '<input type="hidden" name="parent" value="' + cmtid + '" />',
  38. '<div class="buttons">',
  39. '<button type="submit">' + _('Save') + '</button><button rel="close" type="button">' + _('Cancel') + '</button>',
  40. '</div>',
  41. '</form>',
  42. '</div>',
  43. ].join('')
  44. },function(r){
  45. $('form', this).ajaxSubmit(function(){
  46. LazyCMS.removeDialog('cmt_dialog');
  47. });
  48. });
  49. }
  50. /**
  51. * ????
  52. *
  53. * @param cmtid
  54. */
  55. function comment_edit(cmtid) {
  56. var tr = $('#cmt-' + cmtid); LazyCMS.removeDialog('cmt_dialog');
  57. if ($('div.cmt_dialog', tr).is('div')===false) $('.row-actions', tr).after('<div class="cmt_dialog"></div>');
  58. $.getJSON(LazyCMS.ADMIN + 'comment.php', {method: 'get', cmtid: cmtid} ,function(r){
  59. $('.cmt_dialog', tr).dialog({
  60. name:'cmt_dialog', title:_('Edit comment'), masked: false, way:null, styles: {position:'absolute'},
  61. body:[
  62. '<div class="wrapper">',
  63. '<form action="' + LazyCMS.ADMIN + 'comment.php?method=edit" method="post" name="cmt_edit_frm" id="cmt_edit_frm">',
  64. '<p><label>' + _('Author') + '</label><input class="text" type="text" size="20" name="author" value="' + r.author + '" /></p>',
  65. '<p><label>' + _('Email') + '</label><input class="text" type="text" size="30" name="mail" value="' + r.mail + '" /></p>',
  66. '<p><label>' + _('Url') + '</label><input class="text" type="text" size="40" name="url" value="' + r.url + '" /></p>',
  67. '<textarea class="text" name="content" id="content" rows="8" cols="50">' + r.content + '</textarea>',
  68. '<input type="hidden" name="cmtid" value="' + cmtid + '" />',
  69. '<div class="buttons">',
  70. '<button type="submit">' + _('Save') + '</button><button rel="close" type="button">' + _('Cancel') + '</button>',
  71. '</div>',
  72. '</form>',
  73. '</div>',
  74. ].join('')
  75. },function(r){
  76. $('form', this).ajaxSubmit(function(){
  77. LazyCMS.removeDialog('cmt_dialog');
  78. });
  79. });
  80. });
  81. }
  82. // ??????
  83. function comment_state(action,cmtid){
  84. return LazyCMS.postAction('comment.php', {method:'bulk', action:action}, cmtid);
  85. }
  86. // ????
  87. function comment_delete(cmtid){
  88. LazyCMS.confirm(_('Confirm Delete?'),function(r){
  89. if (r) {
  90. LazyCMS.postAction('comment.php', {method:'bulk', action:'delete'}, cmtid);
  91. }
  92. });
  93. }