* adjust code for todo module.

This commit is contained in:
wangyidong
2021-03-05 09:25:26 +08:00
parent 993d852d2e
commit 361af39093
4 changed files with 18 additions and 18 deletions
+7 -7
View File
@@ -399,8 +399,8 @@ class todo extends control
$this->lang->set('menugroup.todo', $from);
}
$projects = $this->loadModel('program')->getPRJPairs();
if(!isset($this->session->PRJ)) $this->session->set('PRJ', key($projects));
$projects = $this->loadModel('project')->getPairs();
if(!isset($this->session->project)) $this->session->set('project', key($projects));
$this->view->title = $this->app->user->account == $todo->account ? "{$this->lang->todo->common} #$todo->id $todo->name" : $this->lang->todo->common ;
$this->view->position[] = $this->lang->todo->view;
@@ -411,9 +411,9 @@ class todo extends control
$this->view->actions = $this->loadModel('action')->getList('todo', $todoID);
$this->view->from = $from;
$this->view->projects = $projects;
$this->view->executions = $this->loadModel('project')->getExecutionPairs($this->session->PRJ);
$this->view->executions = $this->loadModel('execution')->getPairs($this->session->project);
$this->view->products = $this->loadModel('product')->getPairs();
$this->view->projectProducts = $this->loadModel('product')->getProductPairsByProject($this->session->PRJ);
$this->view->projectProducts = $this->loadModel('product')->getProductPairsByProject($this->session->project);
$this->display();
}
@@ -661,9 +661,9 @@ class todo extends control
*/
public function ajaxGetExecutionPairs($projectID)
{
$this->session->set('PRJ', $projectID);
$this->session->set('project', $projectID);
$executions = $this->loadModel('project')->getExecutionsByProject($projectID, 'undone');
$executions = $this->loadModel('execution')->getByProject($projectID, 'undone');
foreach($executions as $id => $execution) $executions[$id] = $execution->name;
die(html::select('execution', $executions, '', "class='form-control chosen'"));
@@ -678,7 +678,7 @@ class todo extends control
*/
public function ajaxGetProductPairs($projectID)
{
$this->session->set('PRJ', $projectID);
$this->session->set('project', $projectID);
$products = $this->loadModel('product')->getProductPairsByProject($projectID);
die(html::select('product', $products, '', "class='form-control chosen'"));
+1 -1
View File
@@ -22,7 +22,7 @@ $(function()
}
var onlybody = config.onlybody;
var projectID = $('#project').val();
var link = createLink('task', 'create', 'projectID=' + executionID + '&storyID=0&moduleID=0&taskID=0&todoID=' + todoID, config.defaultView, 'no', projectID);
var link = createLink('task', 'create', 'executionID=' + executionID + '&storyID=0&moduleID=0&taskID=0&todoID=' + todoID, config.defaultView, 'no', projectID);
location.href = link;
})
+6 -6
View File
@@ -758,12 +758,12 @@ class todoModel extends model
}
$todoIdList = array_unique($todoIdList);
if($type == 'task') $projectIdList[$type] = $this->dao->select('id,PRJ')->from(TABLE_TASK)->where('id')->in($todoIdList)->fetchPairs('id', 'PRJ');
if($type == 'bug') $projectIdList[$type] = $this->dao->select('id,PRJ')->from(TABLE_BUG)->where('id')->in($todoIdList)->fetchPairs('id', 'PRJ');
if($type == 'issue') $projectIdList[$type] = $this->dao->select('id,PRJ')->from(TABLE_ISSUE)->where('id')->in($todoIdList)->fetchPairs('id', 'PRJ');
if($type == 'risk') $projectIdList[$type] = $this->dao->select('id,PRJ')->from(TABLE_RISK)->where('id')->in($todoIdList)->fetchPairs('id', 'PRJ');
if($type == 'review') $projectIdList[$type] = $this->dao->select('id,PRJ')->from(TABLE_REVIEW)->where('id')->in($todoIdList)->fetchPairs('id', 'PRJ');
if($type == 'testtask') $projectIdList[$type] = $this->dao->select('id,PRJ')->from(TABLE_TESTTASK)->where('id')->in($todoIdList)->fetchPairs('id', 'PRJ');
if($type == 'task') $projectIdList[$type] = $this->dao->select('id,project')->from(TABLE_TASK)->where('id')->in($todoIdList)->fetchPairs('id', 'project');
if($type == 'bug') $projectIdList[$type] = $this->dao->select('id,project')->from(TABLE_BUG)->where('id')->in($todoIdList)->fetchPairs('id', 'project');
if($type == 'issue') $projectIdList[$type] = $this->dao->select('id,project')->from(TABLE_ISSUE)->where('id')->in($todoIdList)->fetchPairs('id', 'project');
if($type == 'risk') $projectIdList[$type] = $this->dao->select('id,project')->from(TABLE_RISK)->where('id')->in($todoIdList)->fetchPairs('id', 'project');
if($type == 'review') $projectIdList[$type] = $this->dao->select('id,project')->from(TABLE_REVIEW)->where('id')->in($todoIdList)->fetchPairs('id', 'project');
if($type == 'testtask') $projectIdList[$type] = $this->dao->select('id,project')->from(TABLE_TESTTASK)->where('id')->in($todoIdList)->fetchPairs('id', 'project');
}
return $projectIdList;
+4 -4
View File
@@ -78,7 +78,7 @@
echo "<button type='button' class='btn btn-success dropdown-toggle' data-toggle='dropdown'>{$this->lang->more}<span class='caret'></span></button>";
echo "<ul class='dropdown-menu pull-right' role='menu'>";
if($createStoryPriv) echo '<li>' . html::a('###', $lang->todo->reasonList['story'], '', "data-toggle='modal' data-target='#productModal' data-backdrop='false' data-moveable='true' data-position='center' id='toStoryLink'") . '</li>';
if($createTaskPriv) echo '<li>' . html::a('###', $lang->todo->reasonList['task'], '', "data-toggle='modal' data-target='#projectModal' data-backdrop='false' data-moveable='true' data-position='center' id='toTaskLink'") . '</li>';
if($createTaskPriv) echo '<li>' . html::a('###', $lang->todo->reasonList['task'], '', "data-toggle='modal' data-target='#executionModal' data-backdrop='false' data-moveable='true' data-position='center' id='toTaskLink'") . '</li>';
if($createBugPriv) echo '<li>' . html::a('###', $lang->todo->reasonList['bug'], '', "data-toggle='modal' data-target='#projectProductModal' data-backdrop='false' data-moveable='true' data-position='center' id='toBugLink'") . '</li>';
echo "</ul>";
if($isonlybody) $_GET['onlybody'] = 'yes';
@@ -187,12 +187,12 @@
<div id="mainActions" class='main-actions'>
<div class="container"></div>
</div>
<div class="modal fade" id="projectModal">
<div class="modal fade" id="executionModal">
<div class="modal-dialog mw-500px">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="icon icon-close"></i></button>
<h4 class="modal-title"><?php echo $lang->project->selectExecution;?></h4>
<h4 class="modal-title"><?php echo $lang->execution->selectExecution;?></h4>
</div>
<div class="modal-body">
<?php if(empty($projects)):?>
@@ -282,7 +282,7 @@
</div>
</div>
<?php js::set('todoID', $todo->id);?>
<?php js::set('selectExecution', $lang->project->selectExecution);?>
<?php js::set('selectExecution', $lang->execution->selectExecution);?>
<?php else:?>
<?php echo $lang->todo->thisIsPrivate;?>
<?php endif;?>