PageRenderTime 48ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/application/views/admin/reports/reports_js.php

https://github.com/Magaz/Ushahidi_Web
PHP | 58 lines | 30 code | 8 blank | 20 comment | 7 complexity | 781b9dcec130b217e076b0d893092c8f MD5 | raw file
Possible License(s): AGPL-1.0, LGPL-3.0, BSD-3-Clause, GPL-2.0, LGPL-2.1
  1. /**
  2. * Main reports js file.
  3. *
  4. * Handles javascript stuff related to reports function.
  5. *
  6. * PHP version 5
  7. * LICENSE: This source file is subject to LGPL license
  8. * that is available through the world-wide-web at the following URI:
  9. * http://www.gnu.org/copyleft/lesser.html
  10. * @author Ushahidi Team <team@ushahidi.com>
  11. * @package Ushahidi - http://source.ushahididev.com
  12. * @module API Controller
  13. * @copyright Ushahidi - http://www.ushahidi.com
  14. * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License (LGPL)
  15. */
  16. <?php require SYSPATH.'../application/views/admin/utils_js.php' ?>
  17. // Ajax Submission
  18. function reportAction ( action, confirmAction, incident_id )
  19. {
  20. var statusMessage;
  21. if( !isChecked( "incident" ) && incident_id=='' )
  22. {
  23. alert('Please select at least one report.');
  24. } else {
  25. var answer = confirm('<?php echo Kohana::lang('ui_admin.are_you_sure_you_want_to'); ?> ' + confirmAction + '?')
  26. if (answer){
  27. // Set Submit Type
  28. $("#action").attr("value", action);
  29. if (incident_id != '')
  30. {
  31. // Submit Form For Single Item
  32. $("#incident_single").attr("value", incident_id);
  33. $("#reportMain").submit();
  34. }
  35. else
  36. {
  37. // Set Hidden form item to 000 so that it doesn't return server side error for blank value
  38. $("#incident_single").attr("value", "000");
  39. // Submit Form For Multiple Items
  40. $("#reportMain").submit();
  41. }
  42. } else {
  43. return false;
  44. }
  45. }
  46. }
  47. function showLog(id)
  48. {
  49. $('#' + id).toggle(400);
  50. }