78 lines
3.1 KiB
PHP
78 lines
3.1 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
/**
|
|
* The UI view file of story module of ZenTaoPMS.
|
|
* @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
|
|
* @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
|
|
* @author Wang Yidong <yidong@easycorp.ltd>
|
|
* @package story
|
|
* @link https://www.zentao.net
|
|
*/
|
|
namespace zin;
|
|
|
|
jsVar('branchTagOption', $branchTagOption);
|
|
jsVar('moduleList', $moduleList);
|
|
jsVar('planGroups', $plans);
|
|
jsVar('meeting', isset($meetings) ? $meetings : array());
|
|
jsVar('researchReports', isset($researchReports) ? $researchReports : array());
|
|
jsVar('productStoryList', $productStoryList);
|
|
|
|
if(!empty($twinsTip)) js("zui.Modal.alert({message: '{$twinsTip}', icon: 'icon-exclamation-sign', iconClass: 'warning-pale rounded-full icon-2x'});\n");
|
|
|
|
$fields = $config->story->form->batchEdit;
|
|
|
|
$items = array();
|
|
$items['storyIdList'] = array('name' => 'storyIdList', 'label' => '', 'control' => 'hidden', 'hidden' => true);
|
|
$items['id'] = array('name' => 'id', 'label' => $lang->idAB, 'control' => 'index', 'width' => '60px');
|
|
foreach($fields as $fieldName => $field)
|
|
{
|
|
if(isset($field['options']) && $field['options'] == 'users') $field['options'] = $users;
|
|
$items[$fieldName] = array('name' => $fieldName, 'label' => zget($lang->story, $fieldName), 'control' => $field['control'], 'width' => $field['width'], 'required' => $field['required'], 'items' => zget($field, 'options', array()));
|
|
}
|
|
$items['assignedTo']['ditto'] = true;
|
|
$items['source']['ditto'] = true;
|
|
$items['stage']['ditto'] = true;
|
|
$items['assignedTo']['defaultDitto'] = 'off';
|
|
$items['source']['defaultDitto'] = 'off';
|
|
$items['stage']['defaultDitto'] = 'off';
|
|
|
|
if(!$branchProduct) unset($items['branch'], $customFields['branch']);
|
|
|
|
/* Build form field value for batch edit. */
|
|
$fieldNameList = array_keys($items);
|
|
$data = array();
|
|
foreach($stories as $storyID => $story)
|
|
{
|
|
$data[$storyID] = $story;
|
|
foreach($fieldNameList as $fieldName)
|
|
{
|
|
if($fieldName == 'storyIdList')$data[$storyID]->storyIdList = $story->id;
|
|
if($fieldName == 'status')
|
|
{
|
|
$data[$storyID]->rawStatus = $story->status;
|
|
$data[$storyID]->$fieldName = $this->processStatus('story', $story);
|
|
}
|
|
}
|
|
}
|
|
|
|
$fnGenerateCustomizedFields = function() use ($showFields, $customFields)
|
|
{
|
|
$showFields = ",{$showFields},";
|
|
$fields = array();
|
|
$defaultFields = explode(',', 'branch,module,plan,estimate,pri,source,stage,closedBy,closedReason');
|
|
foreach($customFields as $name => $text) $fields[] = array('name' => $name, 'text' => $text, 'show' => str_contains($showFields, ",$name,"), 'default' => in_array($name, $defaultFields));
|
|
return $fields;
|
|
};
|
|
|
|
formBatchPanel
|
|
(
|
|
set::title($lang->story->batchEdit),
|
|
set::mode('edit'),
|
|
set::items($items),
|
|
set::data(array_values($data)),
|
|
set::customFields(array('items' => $fnGenerateCustomizedFields(), 'urlParams' => 'module=story§ion=custom&key=batchEditFields')),
|
|
set::onRenderRow(jsRaw('renderRowData')),
|
|
);
|
|
|
|
render();
|