uploadimages.html.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * The uploadimages file of file module of ZenTaoPMS.
  4. *
  5. * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
  6. * @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  7. * @author Yuting Wang <wangyuting@easycorp.ltd>
  8. * @package file
  9. * @link https://www.zentao.net
  10. */
  11. namespace zin;
  12. $selectorID = uniqid('uploader');
  13. $uploadOptions = array();
  14. $uploadOptions['uploadUrl'] = createLink('file', 'uploadImages', "module=$module&params=$params&uid=$uid");
  15. $uploadOptions['locateUrl'] = createLink('file', 'uploadImages', "module=$module&params=$params&uid=$uid&locate=true");
  16. $uploadOptions['errorUploadEmpty'] = $lang->file->errorUploadEmpty;
  17. $uploadOptions['uploadingImages'] = $lang->file->uploadingImages;
  18. $uploadOptions['chunkSize'] = 1024 * 1024;
  19. set::title($lang->uploadImages);
  20. set::titleClass('flex-none');
  21. to::header(span(setClass('text-gray text-sm font-normal'), $lang->uploadImagesTip));
  22. imageSelector(set::_id($selectorID), set::className('surface'), set::name('uploader'), set::tip(false), set::onChange(jsCallback('event')->do('$(event.target).closest(".modal-dialog").find(".btn-upload").toggleClass("disabled", !event.target.files.length)')));
  23. toolbar
  24. (
  25. btn
  26. (
  27. setClass('primary btn-upload'),
  28. set::disabled(true),
  29. on::click()->call('uploadImages', "#$selectorID", $uploadOptions, jsRaw('$this')),
  30. $lang->file->beginUpload,
  31. span(setClass('as-progress'))
  32. )
  33. );