* Adjust task operate menus init.

This commit is contained in:
caoyanyi
2023-06-02 13:41:07 +08:00
parent e5083047e2
commit a1b5ce9e7f
4 changed files with 158 additions and 54 deletions
+52 -1
View File
@@ -8,6 +8,45 @@ detailHeader
to::title(entityLabel(set(array('entityID' => $task->id, 'level' => 1, 'text' => $task->name)))),
to::suffix(btn(set::icon('plus'), set::url(''), set::type('primary'), $lang->task->create))
);
/* Build replace url param, replace {id} to $task->id. */
$urlReplaceName = array();
$urlReplaceValue = array();
foreach($task as $key => $value)
{
$urlReplaceName[] = "{{$key}}";
$urlReplaceValue[] = $value;
}
/* Construct suitable actions for the current task. */
$operateMenus = array();
foreach($config->task->view->operateList['main'] as $operate)
{
if(!common::hasPriv('task', $operate)) continue;
if(!$this->task->isClickable($task, $operate)) continue;
if($operate == 'batchCreate' && (!empty($task->team) || !empty($task->children))) continue;
$settings = $config->task->actionList[$operate];
$settings['url'] = str_replace($urlReplaceName, $urlReplaceValue, $settings['url']);
$operateMenus[] = $settings;
}
/* Construct common actions for task. */
$commonActions = array();
foreach($config->task->view->operateList['common'] as $operate)
{
if(!common::hasPriv('task', $operate)) continue;
if($operate == 'view' && $task->parent <= 0) continue;
$settings = $config->task->actionList[$operate];
$settings['url'] = str_replace($urlReplaceName, $urlReplaceValue, $settings['url']);
$settings['text'] = '';
$commonActions[] = $settings;
}
detailBody
(
sectionList
@@ -33,7 +72,19 @@ detailBody
set::text($task->storyTitle),
))
),
history(set(array('actions' => $actions, 'users' => $users, 'methodName' => $methodName)))
history(),
center
(
floatToolbar
(
set::prefix
(
array(array('icon' => 'back', 'text' => $lang->goback))
),
set::main($operateMenus),
set::suffix($commonActions)
)
)
),
detailSide
(