Oppaitime's version of Gazelle
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

reports.js 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. function toggleNotes(id) {
  2. var style = $('#notes_div_' + id).raw().style.display;
  3. if (style == "none") {
  4. $('#notes_div_' + id).raw().style.display = "block";
  5. }
  6. else {
  7. $('#notes_div_' + id).raw().style.display = "none";
  8. }
  9. }
  10. function saveNotes(id) {
  11. var notes = $('#notes_' + id).raw().value;
  12. var post = new Array();
  13. post['id'] = id;
  14. post['notes'] = notes;
  15. ajax.post('reports.php?action=add_notes', post, function (response) {
  16. if (JSON.parse(response)['status'] != 'success') {
  17. alert("Error, could not save notes");
  18. }
  19. });
  20. }
  21. function claim(id) {
  22. var post = new Array();
  23. post['id'] = id;
  24. ajax.post('reports.php?action=claim', post, function (response) {
  25. var json = JSON.parse(response);
  26. if (json['status'] == 'failure') {
  27. alert("Error, could not claim.");
  28. }
  29. if (json['status'] == 'dupe') {
  30. alert("Oops, this report has already been claimed.");
  31. }
  32. if (json['status'] == 'success') {
  33. var username = json['username'];
  34. $('#claim_' + id).raw().innerHTML = '<a href="#" onclick="return false;">Claimed by ' + username + '</a>';
  35. }
  36. });
  37. }
  38. function unClaim(id) {
  39. var post = new Array();
  40. post['id'] = id;
  41. post['remove'] = '1';
  42. ajax.post('reports.php?action=unclaim', post, function (response) {
  43. var json = JSON.parse(response);
  44. if (json['status'] == 'success') {
  45. $('#claimed_' + id).raw().innerHTML = '<a href="#" id="claim_' + id + '" onclick="claim(' + id + '); return false;" class="brackets">Claim</a>';
  46. }
  47. });
  48. }
  49. function resolve(id, claimer) {
  50. var answer = true;
  51. if (!claimer) {
  52. if ($('#claimed_' + id).raw()) {
  53. var answer = confirm("This is a claimed report. Are you sure you want to resolve it?");
  54. if (answer)
  55. answer = true;
  56. else
  57. answer = false;
  58. }
  59. }
  60. if (answer) {
  61. ajax.post('reports.php?action=resolve', 'report_form_' + id, function (response) {
  62. var json = JSON.parse(response);
  63. if (json['status'] == 'success') {
  64. $('#report_' + id).remove();
  65. } else {
  66. alert(json['status']);
  67. }
  68. }
  69. );
  70. }
  71. return false;
  72. }