PageRenderTime 50ms CodeModel.GetById 29ms RepoModel.GetById 1ms app.codeStats 0ms

/application/views/admin/reports_js.php

https://github.com/sclode/Ushahidi_Web
PHP | 57 lines | 31 code | 6 blank | 20 comment | 7 complexity | 609f7d6afa83f597ccd4ad02814a0f52 MD5 | raw file
  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/form_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('Are You Sure You Want To ' + confirmAction + ' items?')
  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. $("input[name='incident_id[]'][checked]").each(
  41. function()
  42. {
  43. $("#reportMain").submit();
  44. }
  45. );
  46. }
  47. } else {
  48. return false;
  49. }
  50. }
  51. }