* [task#152648] Set the button of create when story are baselined.
This commit is contained in:
@@ -198,8 +198,8 @@ $batchItems = array();
|
||||
if($canOpreate['batchCreate']) $batchItems[] = array('text' => $lang->SRCommon, 'url' => $batchCreateLink);
|
||||
if(in_array($execution->attribute, array('mix', 'request', 'design')) || !$execution->multiple)
|
||||
{
|
||||
if($canOpreate['createRequirement']) $createItems[] = array('text' => $lang->requirement->create, 'url' => $createRequirementLink);
|
||||
if($canOpreate['createEpic']) $createItems[] = array('text' => $lang->epic->create, 'url' => $createEpicLink);
|
||||
if($canOpreate['createRequirement']) $createItems[] = array('text' => $lang->requirement->create, 'url' => $createRequirementLink, 'hint' => $frozenStories ? sprintf($lang->story->frozenTip, $lang->requirement->create) : '');
|
||||
if($canOpreate['createEpic']) $createItems[] = array('text' => $lang->epic->create, 'url' => $createEpicLink, 'hint' => $frozenStories ? sprintf($lang->story->frozenTip, $lang->epic->create) : '');
|
||||
if($canOpreate['batchCreateRequirement']) $batchItems[] = array('text' => $lang->URCommon, 'url' => $batchCreateRequirementLink);
|
||||
if($canOpreate['batchCreateEpic']) $batchItems[] = array('text' => $lang->ERCommon, 'url' => $batchCreateEpicLink);
|
||||
}
|
||||
@@ -208,7 +208,7 @@ if(!empty($product->id))
|
||||
{
|
||||
if(count($batchItems) > 1)
|
||||
{
|
||||
$createItems[] = array('text' => $lang->story->batchCreate, 'items' => $batchItems);
|
||||
$createItems[] = array('text' => $lang->story->batchCreate, 'items' => $batchItems, 'hint' => $frozenStories ? sprintf($lang->story->frozenTip, $lang->story->batchCreate) : '');
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -228,11 +228,11 @@ if(commonModel::isTutorialMode())
|
||||
$canlinkPlanStory = false;
|
||||
}
|
||||
|
||||
$linkItem = array('text' => $lang->story->linkStory, 'url' => $linkStoryUrl, 'data-app' => $app->tab);
|
||||
$linkPlanItem = array('text' => $lang->execution->linkStoryByPlan, 'url' => '#linkStoryByPlan', 'data-toggle' => 'modal', 'data-size' => 'sm');
|
||||
$linkItem = array('text' => $lang->story->linkStory, 'url' => $linkStoryUrl, 'data-app' => $app->tab, 'hint' => $frozenStories ? sprintf($lang->story->frozenTip, $lang->story->linkStory) : '');
|
||||
$linkPlanItem = array('text' => $lang->execution->linkStoryByPlan, 'url' => '#linkStoryByPlan', 'data-toggle' => 'modal', 'data-size' => 'sm', 'hint' => $frozenStories ? sprintf($lang->story->frozenTip, $lang->execution->linkStoryByPlan) : '');
|
||||
|
||||
$createBtnGroup = null;
|
||||
if(!$isFromDoc && empty($frozenStories))
|
||||
if(!$isFromDoc)
|
||||
{
|
||||
if($canOpreate['create'])
|
||||
{
|
||||
@@ -243,9 +243,11 @@ if(!$isFromDoc && empty($frozenStories))
|
||||
setClass('btn secondary'),
|
||||
set::icon('plus'),
|
||||
set::url($createLink),
|
||||
set::disabled(!empty($frozenStories)),
|
||||
$frozenStories ? set::hint(sprintf($lang->story->frozenTip, $lang->story->create)) : null,
|
||||
$lang->story->create
|
||||
),
|
||||
empty($createItems) ? null : dropdown
|
||||
empty($createItems) || $frozenStories ? null : dropdown
|
||||
(
|
||||
btn(setClass('btn secondary dropdown-toggle'),
|
||||
setStyle(array('padding' => '6px', 'border-radius' => '0 2px 2px 0'))),
|
||||
@@ -256,7 +258,7 @@ if(!$isFromDoc && empty($frozenStories))
|
||||
}
|
||||
elseif(count($createItems) == 1)
|
||||
{
|
||||
$createBtnGroup = item(set($createItems[0] + array('class' => 'btn secondary', 'icon' => 'plus')));
|
||||
$createBtnGroup = item(set($createItems[0] + array('class' => 'btn secondary' . ($frozenStories ? ' disabled' : ''), 'icon' => 'plus')));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,16 +301,18 @@ if($product && !$isFromDoc) toolbar
|
||||
|
||||
$createBtnGroup,
|
||||
|
||||
$canLinkStory && $canlinkPlanStory && empty($frozenStories) ? btngroup
|
||||
$canLinkStory && $canlinkPlanStory ? btngroup
|
||||
(
|
||||
btn(
|
||||
setClass('btn primary'),
|
||||
set::icon('link'),
|
||||
set::url($linkStoryUrl),
|
||||
set::disabled(!empty($frozenStories)),
|
||||
$frozenStories ? set::hint(sprintf($lang->story->frozenTip, $lang->story->linkStory)) : null,
|
||||
setData('app', $app->tab),
|
||||
$lang->story->linkStory
|
||||
),
|
||||
dropdown
|
||||
$frozenStories ? null : dropdown
|
||||
(
|
||||
btn(setClass('btn primary dropdown-toggle'),
|
||||
setStyle(array('padding' => '6px', 'border-radius' => '0 2px 2px 0'))),
|
||||
@@ -316,8 +320,8 @@ if($product && !$isFromDoc) toolbar
|
||||
set::placement('bottom-end')
|
||||
)
|
||||
) : null,
|
||||
$canLinkStory && !$canlinkPlanStory && empty($frozenStories) ? item(set($linkItem + array('class' => 'btn primary link-story-btn', 'icon' => 'link'))) : null,
|
||||
$canlinkPlanStory && !$canLinkStory && empty($frozenStories) ? item(set($linkPlanItem + array('class' => 'btn primary', 'icon' => 'link'))) : null
|
||||
$canLinkStory && !$canlinkPlanStory ? item(set($linkItem + array('class' => 'btn primary link-story-btn' . ($frozenStories ? ' disabled' : ''), 'icon' => 'link'))) : null,
|
||||
$canlinkPlanStory && !$canLinkStory ? item(set($linkPlanItem + array('class' => 'btn primary' . ($frozenStories ? ' disabled' : ''), 'icon' => 'link'))) : null
|
||||
);
|
||||
|
||||
$isFromDoc ? null : sidebar
|
||||
|
||||
@@ -34,6 +34,11 @@ $storyBrowseType = $this->session->storyBrowseType;
|
||||
$storyProductIds = array();
|
||||
$frozenStories = 0;
|
||||
|
||||
foreach($stories as $story)
|
||||
{
|
||||
if($isProjectStory && !empty($story->frozen)) $frozenStories ++;
|
||||
}
|
||||
|
||||
$isFromDoc = $from === 'doc';
|
||||
|
||||
$hideGrade = (($app->tab == 'product' || $from == 'doc') && $storyType == 'story' && count($gradeGroup['story']) <= 2) || $config->vision != 'rnd';
|
||||
@@ -68,7 +73,7 @@ $fnGenerateSideBar = function() use ($moduleTree, $moduleID, $productID, $branch
|
||||
};
|
||||
|
||||
/* Build create story button. */
|
||||
$fnBuildCreateStoryButton = function() use ($lang, $product, $isProjectStory, $storyType, $productID, $branch, $moduleID, $projectID, $project, $projectProducts)
|
||||
$fnBuildCreateStoryButton = function() use ($lang, $product, $isProjectStory, $storyType, $productID, $branch, $moduleID, $projectID, $project, $projectProducts, $frozenStories)
|
||||
{
|
||||
if(!common::canModify('product', $product)) return null;
|
||||
if(!empty($project) && !common::canModify('project', $project)) return null;
|
||||
@@ -140,11 +145,13 @@ $fnBuildCreateStoryButton = function() use ($lang, $product, $isProjectStory, $s
|
||||
btn
|
||||
(
|
||||
setClass(($app->tab != 'product' ? 'secondary' : 'primary') . ' create-story-btn'),
|
||||
$isProjectStory && $frozenStories ? setClass('disabled') : null,
|
||||
$isProjectStory && $frozenStories ? set::hint(sprintf($lang->story->frozenTip, $createBtnTitle)) : null,
|
||||
set::icon('plus'),
|
||||
set::text($createBtnTitle),
|
||||
set::url($createBtnLink)
|
||||
),
|
||||
empty($items) ? null : dropdown
|
||||
empty($items) || ($isProjectStory && $frozenStories) ? null : dropdown
|
||||
(
|
||||
btn(setClass('dropdown-toggle'), setClass($app->tab != 'product' ? 'secondary' : 'primary'), setStyle(array('padding' => '6px', 'border-radius' => '0 2px 2px 0'))),
|
||||
set::placement('bottom-end'),
|
||||
@@ -163,7 +170,7 @@ $fnBuildCreateStoryButton = function() use ($lang, $product, $isProjectStory, $s
|
||||
};
|
||||
|
||||
/* Build link story button. */
|
||||
$fnBuildLinkStoryButton = function() use($lang, $app, $product, $projectHasProduct, $project, $storyType)
|
||||
$fnBuildLinkStoryButton = function() use($lang, $app, $product, $projectHasProduct, $project, $storyType, $isProjectStory, $frozenStories)
|
||||
{
|
||||
if(!common::canModify('product', $product)) return null;
|
||||
if(!empty($project) && !common::canModify('project', $project)) return null;
|
||||
@@ -185,20 +192,22 @@ $fnBuildLinkStoryButton = function() use($lang, $app, $product, $projectHasProdu
|
||||
$canLinkStory = common::hasPriv('projectstory', 'linkStory');
|
||||
$canlinkPlanStory = !empty($product) && common::hasPriv('projectstory', 'importPlanStories') && $storyType == 'story' && !$project->charter;
|
||||
$linkStoryUrl = $this->createLink('projectstory', 'linkStory', "project=$project->id&browseType=¶m=0&orderBy=id_desc&recPerPage=50&pageID=1&extra=&storyType=$storyType");
|
||||
$linkItem = array('text' => $lang->execution->linkStory, 'url' => $linkStoryUrl);
|
||||
$linkPlanItem = array('text' => $lang->execution->linkStoryByPlan, 'url' => '#linkStoryByPlan', 'data-toggle' => 'modal', 'data-size' => 'sm');
|
||||
$linkItem = array('text' => $lang->execution->linkStory, 'url' => $linkStoryUrl, 'hint' => $isProjectStory && $frozenStories ? sprintf($lang->story->frozenTip, $lang->execution->linkStory) : '');
|
||||
$linkPlanItem = array('text' => $lang->execution->linkStoryByPlan, 'url' => '#linkStoryByPlan', 'data-toggle' => 'modal', 'data-size' => 'sm', 'hint' => $isProjectStory && $frozenStories ? sprintf($lang->story->frozenTip, $lang->execution->linkStoryByPlan) : '');
|
||||
if($canLinkStory && $canlinkPlanStory)
|
||||
{
|
||||
return btngroup
|
||||
(
|
||||
btn(
|
||||
setClass('btn primary'),
|
||||
$isProjectStory && $frozenStories ? setClass('disabled') : null,
|
||||
$isProjectStory && $frozenStories ? set::hint(sprintf($lang->story->frozenTip, $lang->execution->linkStory)) : null,
|
||||
set::icon('link'),
|
||||
set::url($linkStoryUrl),
|
||||
setData('app', $app->tab),
|
||||
$lang->execution->linkStory
|
||||
),
|
||||
dropdown
|
||||
$isProjectStory && $frozenStories ? null : dropdown
|
||||
(
|
||||
btn(setClass('btn primary dropdown-toggle'),
|
||||
setStyle(array('padding' => '6px', 'border-radius' => '0 2px 2px 0'))),
|
||||
@@ -208,8 +217,8 @@ $fnBuildLinkStoryButton = function() use($lang, $app, $product, $projectHasProdu
|
||||
);
|
||||
|
||||
}
|
||||
if($canLinkStory && !$canlinkPlanStory) return item(set($linkItem + array('class' => 'btn primary link-story-btn', 'icon' => 'link')));
|
||||
if($canlinkPlanStory && !$canLinkStory) return item(set($linkPlanItem + array('class' => 'btn primary', 'icon' => 'link')));
|
||||
if($canLinkStory && !$canlinkPlanStory) return item(set($linkItem + array('class' => 'btn primary link-story-btn' . ($isProjectStory && $frozenStories ? ' disabled' : ''), 'icon' => 'link')));
|
||||
if($canlinkPlanStory && !$canLinkStory) return item(set($linkPlanItem + array('class' => 'btn primary' . ($isProjectStory && $frozenStories ? ' disabled' : ''), 'icon' => 'link')));
|
||||
};
|
||||
|
||||
/* DataTable columns. */
|
||||
@@ -248,7 +257,6 @@ foreach($stories as $story)
|
||||
$story->from = $app->tab;
|
||||
$options['branches'] = zget($branchOptions, $story->product, array());
|
||||
$data[] = $this->story->formatStoryForList($story, $options, $storyType, $maxGradeGroup);
|
||||
if($isProjectStory && !empty($story->frozen)) $frozenStories ++;
|
||||
}
|
||||
|
||||
/* Generate toolbar of DataTable footer. */
|
||||
@@ -517,8 +525,8 @@ toolbar
|
||||
))),
|
||||
(!$canReport || !$productID) ? null : item(set(array('id' => 'reportBtn', 'icon' => 'bar-chart', 'class' => 'ghost', 'url' => $reportUrl))),
|
||||
item(set(array('id' => 'exportBtn', 'icon' => 'export', 'class' => 'ghost' . ($canExport ? '' : ' hidden'), 'url' => $exportUrl, 'data-toggle' => 'modal'))),
|
||||
empty($frozenStories) ? $fnBuildCreateStoryButton() : null,
|
||||
empty($frozenStories) ? $fnBuildLinkStoryButton() : null
|
||||
$fnBuildCreateStoryButton(),
|
||||
$fnBuildLinkStoryButton()
|
||||
);
|
||||
|
||||
if(!$isFromDoc) $fnGenerateSideBar();
|
||||
|
||||
Reference in New Issue
Block a user