* Code for task #7825.

This commit is contained in:
Yagami
2020-09-07 14:18:32 +08:00
parent d63e8916ea
commit 11bc9076ac
14 changed files with 136 additions and 51 deletions
+18 -22
View File
@@ -126,7 +126,7 @@ class router extends baseRouter
$commonSettings = array();
try
{
$commonSettings = $this->dbh->query('SELECT `key`, value FROM' . TABLE_CONFIG . "WHERE `owner`='system' AND `module`='custom' and `key` in ('productProject','URAndSR','URSRName','storyRequirement','hourPoint')")->fetchAll();
$commonSettings = $this->dbh->query('SELECT section, `key`, value FROM' . TABLE_CONFIG . "WHERE `owner`='system' AND `module`='custom' and `key` in ('productProject','URAndSR','URSRName','storyRequirement','hourPoint')")->fetchAll();
}
catch (PDOException $exception)
{
@@ -150,6 +150,16 @@ class router extends baseRouter
$productIndex = $storyIndex = $hourIndex = $planIndex = $URAndSR = 0;
$projectIndex = empty($this->config->isINT) ? 0 : 1;
if($this->session->program)
{
$template = $this->dbh->query('SELECT template FROM' . TABLE_PROJECT . "WHERE id = {$this->session->program}")->fetch();
if($template->template == 'waterfall')
{
$projectIndex = 2;
$planIndex = 1;
}
}
foreach($commonSettings as $setting)
{
if($setting->key == 'productProject') list($productIndex, $projectIndex) = explode('_', $setting->value);
@@ -159,19 +169,12 @@ class router extends baseRouter
if($setting->key == 'URSRName')
{
$URSRName = json_decode($setting->value, true);
if(isset($URSRName['urCommon'][$this->clientLang])) $lang->urCommon = $URSRName['urCommon'][$this->clientLang];
if(isset($URSRName['srCommon'][$this->clientLang])) $lang->srCommon = $URSRName['srCommon'][$this->clientLang];
}
}
if($this->session->program)
{
$template = $this->dbh->query('SELECT template FROM' . TABLE_PROJECT . "WHERE id = {$this->session->program}")->fetch();
if($template->template == 'waterfall')
{
$projectIndex = 2;
$planIndex = 1;
if(isset($template->template) && $setting->section == $template->template)
{
$URSRName = json_decode($setting->value, true);
if(isset($URSRName['URCommon'][$this->clientLang])) $lang->URCommon = $URSRName['URCommon'][$this->clientLang];
if(isset($URSRName['SRCommon'][$this->clientLang])) $lang->SRCommon = $URSRName['SRCommon'][$this->clientLang];
}
}
}
@@ -188,17 +191,10 @@ class router extends baseRouter
if($storyIndex == 0 and isset($URAndSR))
{
$config->URAndSR = $URAndSR;
if(!empty($URAndSR) and !empty($lang->srCommon)) $lang->storyCommon = $lang->srCommon;
if(!empty($URAndSR) and !empty($lang->SRCommon)) $lang->storyCommon = $lang->SRCommon;
}
}
/* When module is custom then reset storyCommon. */
if($moduleName == 'custom')
{
global $config;
$lang->storyCommon = isset($this->config->storyCommonList[$this->clientLang][(int)$config->storyCommon]) ? $this->config->storyCommonList[$this->clientLang][(int)$config->storyCommon] : $this->config->storyCommonList['en'][(int)$config->storyCommon];
}
parent::loadLang($moduleName, $appName);
/* Merge from the db lang. */
+17 -2
View File
@@ -398,14 +398,21 @@ class custom extends control
if($_POST)
{
$this->custom->setURAndSR();
$this->custom->setURAndSR('waterfall');
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('custom', 'configurewaterfall')));
}
$URSRName = $this->dao->select("`value`")->from(TABLE_CONFIG)
->where('module')->eq('custom')
->andWhere('section')->eq('waterfall')
->andWhere('`key`')->eq('URSRName')
->fetch('value');
$this->view->title = $this->lang->custom->common;
$this->view->position[] = $this->lang->custom->common;
$this->view->URSRName = json_decode($URSRName);
$this->display();
}
@@ -424,14 +431,22 @@ class custom extends control
if($_POST)
{
$this->custom->setConcept();
$this->custom->setURAndSR();
$this->custom->setURAndSR('scrum');
$locate = inlink('configureScrum');
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $locate));
}
$URSRName = $this->dao->select("`value`")->from(TABLE_CONFIG)
->where('module')->eq('custom')
->andWhere('section')->eq('scrum')
->andWhere('`key`')->eq('URSRName')
->fetch('value');
$this->view->title = $this->lang->custom->configureScrum;
$this->view->position[] = $this->lang->custom->configureScrum;
$this->view->URSRName = json_decode($URSRName);
$this->display();
}
+7 -1
View File
@@ -35,6 +35,8 @@ $lang->custom->isRange = '是否目标控制范围';
$lang->custom->configureScrum = '概念';
$lang->custom->URStory = "用户需求";
$lang->custom->SRStory = "软件需求";
$lang->custom->epic = "史诗";
$lang->custom->scrumStory = "故事";
$lang->custom->waterfallCommon = "瀑布";
$lang->custom->configureWaterfall = "瀑布自定义";
$lang->custom->configureScrum = "敏捷自定义";
@@ -203,9 +205,13 @@ $lang->custom->conceptOptions->hourPoint['2'] = '功能点';
$lang->custom->conceptOptions->hourPoint['3'] = '代码行';
$lang->custom->waterfall = new stdclass();
$lang->custom->waterfall->URAndSR = '是否启用用户需求和软件需求概念?';
$lang->custom->waterfall->URAndSR = '是否启用用户需求概念?';
$lang->custom->waterfall->URSRName = '用户需求和软件需求的概念定义?';
$lang->custom->scrum = new stdclass();
$lang->custom->scrum->URAndSR = '是否启用epic概念?';
$lang->custom->scrum->URSRName = '需求的概念定义?';
$lang->custom->waterfallOptions = new stdclass();
$lang->custom->waterfallOptions->URAndSR = array();
$lang->custom->waterfallOptions->URAndSR[0] = '否';
+6 -6
View File
@@ -579,23 +579,23 @@ class customModel extends model
}
/**
* Set ur and sr concept.
* Set ur and SR concept.
*
* @access public
* @return void
*/
public function setURAndSR()
public function setURAndSR($template = 'waterfall')
{
$data = fixer::input('post')->get();
$this->loadModel('setting')->setItem('system.custom.URAndSR', $data->URAndSR);
$this->loadModel('setting')->setItem("system.custom.URAndSR", $data->URAndSR);
if($data->URAndSR)
{
$clientLang = $this->app->getClientLang();
$URSRName = isset($this->config->custom->URSRName) ? json_decode($this->config->custom->URSRName, true) : array();
$URSRName['urCommon'][$clientLang] = $data->urCommon[$clientLang];
$URSRName['srCommon'][$clientLang] = $data->srCommon[$clientLang];
$this->setting->setItem('system.custom.URSRName', json_encode($URSRName));
$URSRName['URCommon'][$clientLang] = $data->URCommon[$clientLang];
$URSRName['SRCommon'][$clientLang] = $data->SRCommon[$clientLang];
$this->setting->setItem("system.custom.$template.URSRName", json_encode($URSRName));
}
}
+4 -5
View File
@@ -18,18 +18,17 @@
<div class="checkbox"> <?php echo html::radio('productProject', $lang->custom->productProject->relation, zget($this->config->custom, 'productProject', '0_0'))?> </div>
</div>
<div class='form-group'>
<label><?php echo '2. ' . $lang->custom->waterfall->URAndSR;?></label>
<label><?php echo '2. ' . $lang->custom->scrum->URAndSR;?></label>
<div class='checkbox'><?php echo html::radio('URAndSR', $lang->custom->waterfallOptions->URAndSR, zget($this->config->custom, 'URAndSR', '0'));?></div>
</div>
<?php $hidden = zget($this->config->custom, 'URAndSR', 0) == 0 ? 'hidden' : '';?>
<div class="form-group <?php echo $hidden;?>" id='URSRName'><label><?php echo '3. ' . $lang->custom->waterfall->URSRName;?></label>
<div class="form-group <?php echo $hidden;?>" id='URSRName'><label><?php echo '3. ' . $lang->custom->scrum->URSRName;?></label>
<div class='input-group'>
<?php
$URSRName = isset($this->config->custom->URSRName) ? json_decode($this->config->custom->URSRName, true) : array();
echo html::input("urCommon[{$clientLang}]", isset($URSRName['urCommon'][$clientLang]) ? $URSRName['urCommon'][$clientLang] : $lang->custom->URStory, "class='form-control'");
echo html::input("URCommon[{$clientLang}]", isset($URSRName->URCommon->$clientLang) ? $URSRName->URCommon->$clientLang : $lang->custom->URStory, "class='form-control'");
?>
<span class='input-group-addon'></span>
<?php echo html::input("srCommon[{$clientLang}]", isset($URSRName['srCommon'][$clientLang]) ? $URSRName['srCommon'][$clientLang] : $lang->custom->SRStory, "class='form-control'");?>
<?php echo html::input("SRCommon[{$clientLang}]", isset($URSRName->SRCommon->$clientLang) ? $URSRName->SRCommon->$clientLang : $lang->custom->SRStory, "class='form-control'");?>
</div>
</div>
<div class="form-group">
@@ -22,11 +22,10 @@
<div class="form-group <?php echo $hidden;?>" id='URSRName'><label><?php echo '2. ' . $lang->custom->waterfall->URSRName;?></label>
<div class='input-group'>
<?php
$URSRName = isset($this->config->custom->URSRName) ? json_decode($this->config->custom->URSRName, true) : array();
echo html::input("urCommon[{$clientLang}]", isset($URSRName['urCommon'][$clientLang]) ? $URSRName['urCommon'][$clientLang] : $lang->custom->URStory, "class='form-control'");
echo html::input("URCommon[{$clientLang}]", isset($URSRName->URCommon->$clientLang) ? $URSRName->URCommon->$clientLang : $lang->custom->URStory, "class='form-control'");
?>
<span class='input-group-addon'></span>
<?php echo html::input("srCommon[{$clientLang}]", isset($URSRName['srCommon'][$clientLang]) ? $URSRName['srCommon'][$clientLang] : $lang->custom->SRStory, "class='form-control'");?>
<?php echo html::input("SRCommon[{$clientLang}]", isset($URSRName->SRCommon->$clientLang) ? $URSRName->SRCommon->$clientLang : $lang->custom->SRStory, "class='form-control'");?>
</div>
</div>
<div class='form-group'>
+1 -1
View File
@@ -190,7 +190,7 @@ class product extends control
/* Change for requirement story title. */
if($storyType == 'requirement' and $this->config->URAndSR)
{
$this->lang->story->title = str_replace($this->lang->srCommon, $this->lang->urCommon, $this->lang->story->title);
$this->lang->story->title = str_replace($this->lang->SRCommon, $this->lang->URCommon, $this->lang->story->title);
$this->config->product->search['fields']['title'] = $this->lang->story->title;
}
+2 -2
View File
@@ -1049,8 +1049,8 @@ class productModel extends model
$storyCommon = $this->lang->storyCommon;
if($this->config->URAndSR)
{
if($storyType == 'requirement') $storyCommon = $this->lang->urCommon;
if($storyType == 'story') $storyCommon = $this->lang->srCommon;
if($storyType == 'requirement') $storyCommon = $this->lang->URCommon;
if($storyType == 'story') $storyCommon = $this->lang->SRCommon;
}
return sprintf($this->lang->product->storySummary, $allCount, $storyCommon, $totalEstimate, $rate * 100 . "%");
+1 -1
View File
@@ -242,7 +242,7 @@ $lang->story->create = $storyType == 'story' ? $lang->story->createStory : $lang
<div class='btn-group dropup'>
<?php
$disabled = $canBatchEdit ? '' : "disabled='disabled'";
$actionLink = $this->createLink('story', 'batchEdit', "productID=$productID&projectID=0&branch=$branch");
$actionLink = $this->createLink('story', 'batchEdit', "productID=$productID&projectID=0&branch=$branch&storyType=$storyType");
?>
<?php echo html::commonButton($lang->edit, "data-form-action='$actionLink' $disabled");?>
<button type='button' class='btn dropdown-toggle' data-toggle='dropdown'><span class='caret'></span></button>
+3 -2
View File
@@ -77,14 +77,15 @@ class programModel extends model
*/
public function getProgramOverview($queryType = 'byStatus', $param = 'all', $orderBy = 'id_desc', $limit = 15)
{
$queryType = strtolower($queryType);
$programs = $this->dao->select('*')->from(TABLE_PROJECT)
->where('iscat')->eq(0)
->andWhere('template')->ne('')
->andWhere('program')->eq(0)
->andWhere('deleted')->eq(0)
->beginIF(!$this->app->user->admin)->andWhere('id')->in($this->app->user->view->programs)->fi()
->beginIF($queryType == 'byStatus' and $param != 'all')->andWhere('status')->eq($param)->fi()
->beginIF($queryType == 'byId')->andWhere('id')->eq($param)->fi()
->beginIF($queryType == 'bystatus' and $param != 'all')->andWhere('status')->eq($param)->fi()
->beginIF($queryType == 'byid')->andWhere('id')->eq($param)->fi()
->orderBy($orderBy)
->limit($limit)
->fetchAll('id');
+70 -1
View File
@@ -45,6 +45,8 @@ class story extends control
*/
public function create($productID = 0, $branch = 0, $moduleID = 0, $storyID = 0, $projectID = 0, $bugID = 0, $planID = 0, $todoID = 0, $extra = '', $type = 'story')
{
$this->replaceURLang($type);
/* Whether there is a object to transfer story, for example feedback. */
$extra = str_replace(array(',', ' '), array('&', ''), $extra);
parse_str($extra, $output);
@@ -294,6 +296,8 @@ class story extends control
*/
public function batchCreate($productID = 0, $branch = 0, $moduleID = 0, $storyID = 0, $project = 0, $plan = 0, $type = 'story')
{
$this->replaceURLang($type);
/* Check can subdivide or not. */
if($storyID)
{
@@ -431,6 +435,8 @@ class story extends control
/* Set menu. */
$this->product->setMenu($products, $product->id, $story->branch);
$this->replaceURLang($story->type);
/* Assign. */
$this->view->position[] = html::a($this->createLink('product', 'browse', "product=$product->id&branch=$story->branch"), $product->name);
$this->view->position[] = $this->lang->story->common;
@@ -442,6 +448,58 @@ class story extends control
$this->view->actions = $this->action->getList('story', $storyID);
}
/**
* Replace requirement story lang.
*
* @param string $type
* @access public
* @return void
*/
public function replaceURLang($type)
{
if($type == 'requirement' and $this->config->URAndSR)
{
$storyLang = $this->lang->story;
$SRCommon = $this->lang->srCommon;
$URCommon = $this->lang->urCommon;
$storyLang->create = str_replace($SRCommon, $URCommon, $storyLang->create);
$storyLang->changeAction = str_replace($SRCommon, $URCommon, $storyLang->changeAction);
$storyLang->changed = str_replace($SRCommon, $URCommon, $storyLang->changed);
$storyLang->assignAction = str_replace($SRCommon, $URCommon, $storyLang->assignAction);
$storyLang->reviewAction = str_replace($SRCommon, $URCommon, $storyLang->reviewAction);
$storyLang->subdivideAction = str_replace($SRCommon, $URCommon, $storyLang->subdivideAction);
$storyLang->closeAction = str_replace($SRCommon, $URCommon, $storyLang->closeAction);
$storyLang->activateAction = str_replace($SRCommon, $URCommon, $storyLang->activateAction);
$storyLang->deleteAction = str_replace($SRCommon, $URCommon, $storyLang->deleteAction);
$storyLang->view = str_replace($SRCommon, $URCommon, $storyLang->view);
$storyLang->linkStory = str_replace($SRCommon, $URCommon, $storyLang->linkStory);
$storyLang->unlinkStory = str_replace($SRCommon, $URCommon, $storyLang->unlinkStory);
$storyLang->exportAction = str_replace($SRCommon, $URCommon, $storyLang->exportAction);
$storyLang->zeroCase = str_replace($SRCommon, $URCommon, $storyLang->zeroCase);
$storyLang->zeroTask = str_replace($SRCommon, $URCommon, $storyLang->zeroTask);
$storyLang->copyTitle = str_replace($SRCommon, $URCommon, $storyLang->copyTitle);
$storyLang->common = str_replace($SRCommon, $URCommon, $storyLang->common);
$storyLang->source = str_replace($SRCommon, $URCommon, $storyLang->source);
$storyLang->title = str_replace($SRCommon, $URCommon, $storyLang->title);
$storyLang->type = str_replace($SRCommon, $URCommon, $storyLang->type);
$storyLang->spec = str_replace($SRCommon, $URCommon, $storyLang->spec);
$storyLang->children = str_replace($SRCommon, $URCommon, $storyLang->children);
$storyLang->linkStories = str_replace($SRCommon, $URCommon, $storyLang->linkStories);
$storyLang->childStories = str_replace($SRCommon, $URCommon, $storyLang->childStories);
$storyLang->duplicateStory = str_replace($SRCommon, $URCommon, $storyLang->duplicateStory);
$storyLang->newStory = str_replace($SRCommon, $URCommon, $storyLang->newStory);
$storyLang->copy = str_replace($SRCommon, $URCommon, $storyLang->copy);
$storyLang->total = str_replace($SRCommon, $URCommon, $storyLang->total);
$storyLang->allStories = str_replace($SRCommon, $URCommon, $storyLang->allStories);
$storyLang->released = str_replace($SRCommon, $URCommon, $storyLang->released);
$storyLang->legendLifeTime = str_replace($SRCommon, $URCommon, $storyLang->legendLifeTime);
$storyLang->legendLinkStories = str_replace($SRCommon, $URCommon, $storyLang->legendLinkStories);
$storyLang->legendChildStories = str_replace($SRCommon, $URCommon, $storyLang->legendChildStories);
$storyLang->legendSpec = str_replace($SRCommon, $URCommon, $storyLang->legendSpec);
}
}
/**
* Edit a story.
*
@@ -482,6 +540,8 @@ class story extends control
$stories = $this->story->getParentStoryPairs($story->product, $story->parent);
if(isset($stories[$storyID])) unset($stories[$storyID]);
$this->replaceURLang($story->type);
$this->view->title = $this->lang->story->edit . "STORY" . $this->lang->colon . $this->view->story->title;
$this->view->position[] = $this->lang->story->edit;
$this->view->story = $story;
@@ -500,8 +560,10 @@ class story extends control
* @access public
* @return void
*/
public function batchEdit($productID = 0, $projectID = 0, $branch = 0)
public function batchEdit($productID = 0, $projectID = 0, $branch = 0, $storyType = 'story')
{
$this->replaceURLang($storyType);
/* Load model. */
$this->loadModel('productplan');
@@ -623,6 +685,7 @@ class story extends control
$this->view->branchProduct = $branchProduct;
$this->view->storyIdList = $storyIdList;
$this->view->branch = $branch;
$this->view->storyType = $storyType;
$this->view->stories = $stories;
$this->view->productName = isset($product) ? $product->name : '';
$this->display();
@@ -721,6 +784,8 @@ class story extends control
$story = $this->story->getById($storyID, $version, true);
if(!$story) die(js::error($this->lang->notFound) . js::locate('back'));
$this->replaceURLang($story->type);
$story->files = $this->loadModel('file')->getByObject('story', $storyID);
$product = $this->dao->findById($story->product)->from(TABLE_PRODUCT)->fields('name, id, type')->fetch();
$plan = $this->dao->findById($story->plan)->from(TABLE_PRODUCTPLAN)->fetch('title');
@@ -835,6 +900,8 @@ class story extends control
$story = $this->story->getById($storyID);
$product = $this->dao->findById($story->product)->from(TABLE_PRODUCT)->fields('name, id')->fetch();
$this->replaceURLang($story->type);
/* Set menu. */
$this->product->setMenu($this->product->getPairs('', $this->session->program), $product->id, $story->branch);
@@ -918,6 +985,8 @@ class story extends control
$story = $this->story->getById($storyID);
$product = $this->dao->findById($story->product)->from(TABLE_PRODUCT)->fields('name, id')->fetch();
$this->replaceURLang($story->type);
/* Set menu. */
$this->product->setMenu($this->product->getPairs('', $this->session->program), $product->id, $story->branch);
+2 -2
View File
@@ -16,8 +16,8 @@ $lang->story->createRequirement = 'Create Requirement';
if($config->URAndSR)
{
$lang->story->requirement = zget($lang, 'urCommon', "Requirement");
$lang->story->story = zget($lang, 'srCommon', "Story");
$lang->story->requirement = zget($lang, 'URCommon', "Requirement");
$lang->story->story = zget($lang, 'SRCommon', "Story");
$lang->story->createStory = 'Create ' . $lang->story->story;
$lang->story->createRequirement = 'Create ' . $lang->story->requirement;
$lang->story->affectedStories = "Affected {$lang->story->story}";
+2 -3
View File
@@ -16,12 +16,11 @@ $lang->story->createRequirement = "提{$lang->storyCommon}";
if($config->URAndSR)
{
$lang->story->requirement = zget($lang, 'urCommon', "用户需求");
$lang->story->story = zget($lang, 'srCommon', "软件需求");
$lang->story->requirement = zget($lang, 'SRCommon', "用户需求");
$lang->story->story = zget($lang, 'SRCommon', "软件需求");
$lang->story->createStory = '添加' . $lang->story->story;
$lang->story->createRequirement = '添加' . $lang->story->requirement;
$lang->story->affectedStories = "影响的{$lang->story->story}";
$lang->storyCommon = '需求';
}
$lang->story->batchCreate = "批量创建";
+1
View File
@@ -12,6 +12,7 @@
?>
<?php include '../../common/view/header.html.php';?>
<?php js::set('dittoNotice', $this->lang->story->dittoNotice);?>
<?php js::set('storyType', $storyType);?>
<div class='main-content' id='mainContent'>
<div class='main-header'>
<h2>