exportweeklyreport.html.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php js::set('errNoData', $lang->error->noData);?>
  2. <form method='post' onsubmit='setDownloading()' action='<?php echo $this->createLink('weekly', 'exportweeklyreport', "module=$module&projectID=$projectID&productID=$productID");?>' target='hiddenwin' id='exportForm'>
  3. <table class="w-p100 table-form">
  4. <tr>
  5. <th class="w-110px"><?php echo $lang->setFileName;?></th>
  6. <td class="w-150px"><?php echo html::input('fileName', '', 'class="form-control"');?></td>
  7. <td><?php echo html::submitButton($lang->save, '', 'btn btn-primary upload-btn') . html::hidden('selectedWeekBegin');?></td>
  8. </tr>
  9. </table>
  10. </form>
  11. <script>
  12. $(function()
  13. {
  14. $('#exportForm #submit').click(function()
  15. {
  16. if(selectedWeekBegin === undefined || selectedWeekBegin === '')
  17. {
  18. alert(errNoData);
  19. return false;
  20. }
  21. $('#exportForm #selectedWeekBegin').val(selectedWeekBegin);
  22. return true;
  23. });
  24. })
  25. function setDownloading()
  26. {
  27. /* Opera don't support, omit it. */
  28. if(navigator.userAgent.toLowerCase().indexOf("opera") > -1) return true;
  29. $.cookie('downloading', 0);
  30. $('.upload-btn').attr('disabled', 'disabled').addClass('disabled loading');
  31. time = setInterval("closeWindow()", 300);
  32. return true;
  33. }
  34. function closeWindow()
  35. {
  36. if($.cookie('downloading') == 1)
  37. {
  38. $.cookie('downloading', null);
  39. clearInterval(time);
  40. location.reload('parent.parent');
  41. }
  42. }
  43. </script>