create.html.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <?php
  2. /**
  3. * The create file of block 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 liuruogu<liuruogu@easycorp.ltd>
  8. * @package block
  9. * @link https://www.zentao.net
  10. */
  11. namespace zin;
  12. include 'common.ui.php';
  13. set::title($title);
  14. jsVar('dashboard', $dashboard);
  15. jsVar('blockTitle', $lang->block->blockTitle);
  16. $showModules = ($dashboard == 'my' && $modules);
  17. $showCodes = (($showModules && $module && $codes) || $dashboard != 'my');
  18. $code = $showCodes ? $code : $module;
  19. $blockSize = !empty($config->block->size[$module][$code]) ? $config->block->size[$module][$code] : $config->block->defaultSize; // 获取当前区块的可选尺寸。
  20. /* 根据区块的可选尺寸生成区块的可选宽度列表。 */
  21. $widthOptions = array();
  22. foreach(array_keys($blockSize) as $width) $widthOptions[$width] = zget($this->lang->block->widthOptions, $width);
  23. $defaultWidth = reset($widthOptions);
  24. $moduleWidth = $app->getClientLang() == 'en' ? '160' : '128';
  25. row
  26. (
  27. setID('blockCreateForm'),
  28. $showModules ? cell
  29. (
  30. set::width($moduleWidth),
  31. setClass('flex-none bg-surface rounded rounded-r-none rounded-tl-none overflow-y-auto'),
  32. buildBlockModuleNav()
  33. ) : null,
  34. cell
  35. (
  36. setClass('flex-auto pt-2 pr-6 pb-4'),
  37. form
  38. (
  39. on::change('[name="code"]', 'getForm'),
  40. on::change('[name="params\[type\]"]', 'changeType'),
  41. formRow
  42. (
  43. setClass('hidden'),
  44. formGroup
  45. (
  46. set::name('module'),
  47. set::value($app->tab == 'my' ? $module : $dashboard)
  48. )
  49. ),
  50. formRow
  51. (
  52. setID('codesRow'),
  53. setClass($showCodes ? '' : 'hidden'),
  54. formGroup
  55. (
  56. set::label($lang->block->lblBlock),
  57. $showCodes ? picker(set::name('code'), set::value($code), set::items($codes), set::required(true)) : input(set::name('code'), set::value($code))
  58. )
  59. ),
  60. div
  61. (
  62. setID('paramsRow'),
  63. setClass('space-y-4'),
  64. buildParamsRows(),
  65. formRow
  66. (
  67. setClass(empty($code) ? 'hidden' : ''),
  68. formGroup
  69. (
  70. set::label($lang->block->width),
  71. picker
  72. (
  73. set::name('width'),
  74. set::items($widthOptions),
  75. set::value($defaultWidth),
  76. set::required(true)
  77. )
  78. )
  79. ),
  80. formRow
  81. (
  82. set::className($module == 'html' ? '' : 'hidden'),
  83. formGroup
  84. (
  85. set::label($lang->block->lblHtml),
  86. editor(set::name('html'))
  87. )
  88. )
  89. )
  90. )
  91. )
  92. );
  93. if(isInModal())
  94. {
  95. set::condensed(true);
  96. set::bodyClass('border-t');
  97. set::bodyProps(array('style' => array('padding' => 0)));
  98. }
  99. render();