noticeimport.html.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. /**
  3. * The notice view file of common module of ZenTaoPMS.
  4. * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
  5. * @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  6. * @author Tingting Dai <daitingting@easycorp.ltd>
  7. * @package common
  8. * @link https://www.zentao.net
  9. */
  10. namespace zin;
  11. modalTrigger
  12. (
  13. modal
  14. (
  15. on::click('.cover', "submitForm('cover')"),
  16. on::click('.insert', "submitForm('insert')"),
  17. on::click('.close', "enableSubmitButton()"),
  18. setID('importNoticeModal'),
  19. set::title($lang->importConfirm),
  20. set::footerClass('justify-center'),
  21. to::footer
  22. (
  23. btn
  24. (
  25. setClass('danger wide cover'),
  26. zui::width('86px'),
  27. $lang->importAndCover
  28. ),
  29. btn
  30. (
  31. setClass('primary wide insert'),
  32. $lang->importAndInsert
  33. )
  34. ),
  35. div
  36. (
  37. setClass('alert'),
  38. icon('exclamation-sign'),
  39. $lang->noticeImport
  40. )
  41. )
  42. );
  43. $footerActions = array(
  44. array('class' => 'danger cover', 'text' => $lang->importAndCover),
  45. array('class' => 'primary insert', 'text' => $lang->importAndInsert)
  46. );
  47. h::js
  48. (
  49. <<<JAVASCRIPT
  50. window.submitForm = function(type)
  51. {
  52. $('#insert').val(type == 'insert' ? 1 : 0);
  53. $('#importNoticeModal .modal-footer .btn').addClass('disabled');
  54. const formUrl = $("button[data-target='#importNoticeModal']").closest('form').attr('action');
  55. const formData = new FormData($("button[data-target='#importNoticeModal']").closest('form')[0]);
  56. $.ajaxSubmit({url: formUrl, data: formData, onFail: function(error)
  57. {
  58. $('#importNoticeModal .modal-footer button').removeClass('disabled');
  59. $('#importNoticeModal').zui('modal').hide();
  60. if(error?.message) showValidateMessage(error.message);
  61. }});
  62. }
  63. window.enableSubmitButton = function()
  64. {
  65. $('#importNoticeModal .modal-footer .btn').removeClass('disabled');
  66. }
  67. JAVASCRIPT
  68. );