* Replace with common::buildOperateMenu to get the productplan actions.
This commit is contained in:
@@ -91,3 +91,7 @@ $config->productplan->actionList['unlinkBug']['url'] = 'javascript:unlinkObject
|
||||
$config->productplan->actionList['unlinkStory']['icon'] = 'unlink';
|
||||
$config->productplan->actionList['unlinkStory']['hint'] = $lang->productplan->unlinkStory;
|
||||
$config->productplan->actionList['unlinkStory']['url'] = 'javascript:unlinkObject("story", "{id}")';
|
||||
|
||||
$config->productplan->actions = new stdclass();
|
||||
$config->productplan->actions->view = array();
|
||||
$config->productplan->actions->view['mainActions'] = array('start', 'finish', 'close', 'activate', 'create', 'edit', 'delete');
|
||||
|
||||
@@ -387,7 +387,6 @@ class productplan extends control
|
||||
$this->view->planStories = $planStories;
|
||||
$this->view->planBugs = $this->loadModel('bug')->getPlanBugs($planID, 'all', $type == 'bug' ? $sort : 'id_desc', $bugPager);
|
||||
$this->view->summary = $this->product->summary($planStories);
|
||||
$this->view->actionMenus = $this->productplanZen->buildViewActions($plan);
|
||||
$this->view->type = $type;
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->link = $link;
|
||||
|
||||
@@ -159,6 +159,12 @@ $fnGetChildrenPlans = function($childrenPlans)
|
||||
return $childrenPlanItems;
|
||||
};
|
||||
|
||||
$actions = $this->loadModel('common')->buildOperateMenu($plan);
|
||||
foreach($actions['mainActions'] as $key => $action)
|
||||
{
|
||||
$actions['mainActions'][$key]['className'] = isset($action['className']) ? $action['className'] . ' ghost' : 'ghost';
|
||||
$actions['mainActions'][$key]['iconClass'] = isset($action['iconClass']) ? $action['iconClass'] . ' text-primary' : 'text-primary';
|
||||
}
|
||||
detailHeader
|
||||
(
|
||||
to::prefix
|
||||
@@ -169,7 +175,7 @@ detailHeader
|
||||
span(setClass('label circle primary'), ($plan->begin == FUTURE_TIME || $plan->end == FUTURE_TIME) ? $lang->productplan->future : $plan->begin . '~' . $plan->end),
|
||||
$plan->deleted ? span(setClass('label danger'), $lang->product->deleted) : null
|
||||
),
|
||||
(!$plan->deleted && $actionMenus) ? to::suffix(btnGroup(set::items($actionMenus))) : null
|
||||
(!$plan->deleted && $actions) ? to::suffix(btnGroup(set::items($actions['mainActions']))) : null
|
||||
);
|
||||
|
||||
detailBody
|
||||
|
||||
@@ -331,36 +331,4 @@ class productplanZen extends productplan
|
||||
}
|
||||
$this->loadModel('search')->setSearchParams($this->config->bug->search);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造计划详情页面的操作菜单。
|
||||
* Build operate menu for plan detail page.
|
||||
*
|
||||
* @param object $plan
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function buildViewActions(object $plan): array
|
||||
{
|
||||
$params = "planID=$plan->id";
|
||||
|
||||
$canEdit = common::hasPriv('productplan', 'edit');
|
||||
$canStart = common::hasPriv('productplan', 'start') && $this->productplan->isClickable($plan, 'start');
|
||||
$canFinish = common::hasPriv('productplan', 'finish') && $this->productplan->isClickable($plan, 'finish');
|
||||
$canClose = common::hasPriv('productplan', 'close') && $this->productplan->isClickable($plan, 'close');
|
||||
$canActivate = common::hasPriv('productplan', 'activate') && $this->productplan->isClickable($plan, 'activate');
|
||||
$canCreateChild = common::hasPriv('productplan', 'create') && $this->productplan->isClickable($plan, 'create');
|
||||
$canDelete = common::hasPriv('productplan', 'delete') && $this->productplan->isClickable($plan, 'delete');
|
||||
|
||||
$menu = array();
|
||||
if($canStart) $menu[] = array('icon' => 'play text-primary', 'class' => 'ghost', 'text' => $this->lang->productplan->startAB, 'data-url' => helper::createLink('productplan', 'start', $params), 'data-action' => 'start', 'onclick' => 'ajaxConfirmLoad(this)');
|
||||
if($canFinish) $menu[] = array('icon' => 'checked text-primary', 'class' => 'ghost', 'text' => $this->lang->productplan->finishAB, 'data-url' => helper::createLink('productplan', 'finish', $params), 'data-action' => 'finish', 'onclick' => 'ajaxConfirmLoad(this)');
|
||||
if($canClose) $menu[] = array('icon' => 'off text-primary', 'class' => 'ghost', 'text' => $this->lang->productplan->closeAB, 'url' => helper::createLink('productplan', 'close', $params, '', true), 'data-toggle' => 'modal');
|
||||
if($canActivate) $menu[] = array('icon' => 'magic text-primary', 'class' => 'ghost', 'text' => $this->lang->productplan->activateAB, 'data-url' => helper::createLink('productplan', 'activate', $params), 'data-action' => 'activate', 'onclick' => 'ajaxConfirmLoad(this)');
|
||||
if($canCreateChild) $menu[] = array('icon' => 'split text-primary', 'class' => 'ghost', 'text' => $this->lang->productplan->children, 'url' => helper::createLink('productplan', 'create', "product={$plan->product}&branch={$plan->branch}&parent={$plan->id}"));
|
||||
if($canEdit) $menu[] = array('icon' => 'edit text-primary', 'class' => 'ghost', 'text' => $this->lang->edit, 'url' => helper::createLink('productplan', 'edit', $params));
|
||||
if($canDelete) $menu[] = array('icon' => 'trash text-primary', 'class' => 'ghost', 'text' => $this->lang->delete, 'data-url' => helper::createLink('productplan', 'delete', $params), 'data-action' => 'delete', 'onclick' => 'ajaxConfirmLoad(this)');
|
||||
|
||||
return $menu;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user