* Finish task#8865.

This commit is contained in:
leiyong
2021-01-01 11:34:11 +08:00
parent de2769bc5f
commit 0c4afee4ee
9 changed files with 103 additions and 15 deletions
+21
View File
@@ -455,6 +455,27 @@ class issue extends control
}
}
/**
* AJAX: return issues of a user in html select.
*
* @param int $userID
* @param string $id
* @param string $status
* @access public
* @return void
*/
public function ajaxGetUserIssues($userID = '', $id = '', $status = 'all')
{
if($userID == '') $userID = $this->app->user->id;
$user = $this->loadModel('user')->getById($userID, 'id');
$account = $user->account;
$issues = $this->issue->getUserIssuePairs($account, 0, $status);
if($id) die(html::select("issues[$id]", $issues, '', 'class="form-control"'));
die(html::select('issue', $issues, '', 'class=form-control'));
}
/**
* View an issue.
*
+3 -1
View File
@@ -186,10 +186,11 @@ class issueModel extends model
* @param string $account
* @param int $limit
* @param string $status all|unconfirmed|active|suspended|resolved|closed|canceled
* @param array $skipProjectIDList
* @access public
* @return array
*/
public function getUserIssuePairs($account, $limit = 0, $status = 'all')
public function getUserIssuePairs($account, $limit = 0, $status = 'all', $skipProjectIDList = array())
{
$stmt = $this->dao->select('t1.id, t1.title, t2.name as project')
->from(TABLE_ISSUE)->alias('t1')
@@ -197,6 +198,7 @@ class issueModel extends model
->where('t1.assignedTo')->eq($account)
->andWhere('t1.deleted')->eq(0)
->beginIF($status != 'all')->andWhere('t1.status')->in($status)->fi()
->beginIF(!empty($skipProjectIDList))->andWhere('t1.PRJ')->notin($skipProjectIDList)->fi()
->beginIF($limit)->limit($limit)->fi()
->query();
+23 -1
View File
@@ -389,7 +389,7 @@ class risk extends control
$actionID = $this->loadModel('action')->create('risk', $riskID, 'Activated', $this->post->comment);
$this->action->logHistory($actionID, $changes);
}
if(isonlybody()) die(js::closeModal('parent.parent', 'this'));
die(js::locate($this->createLink('risk', 'browse'), 'parent'));
}
@@ -401,4 +401,26 @@ class risk extends control
$this->view->risk = $this->risk->getById($riskID);
$this->display();
}
/**
* AJAX: return risks of a user in html select.
*
* @param int $userID
* @param string $id
* @param string $status
* @access public
* @return void
*/
public function ajaxGetUserRisks($userID = '', $id = '', $status = 'all')
{
if($userID == '') $userID = $this->app->user->id;
$user = $this->loadModel('user')->getById($userID, 'id');
$account = $user->account;
$risks = $this->risk->getUserRiskPairs($account, 0, $status);
if($id) die(html::select("risks[$id]", $risks, '', 'class="form-control"'));
die(html::select('risk', $risks, '', 'class=form-control'));
}
}
+3 -1
View File
@@ -260,10 +260,11 @@ class riskModel extends model
* @param string $account
* @param int $limit
* @param string $status all|active|closed|hangup|canceled
* @param array $skipProjectIDList
* @access public
* @return array
*/
public function getUserRiskPairs($account, $limit = 0, $status = 'all')
public function getUserRiskPairs($account, $limit = 0, $status = 'all', $skipProjectIDList = array())
{
$stmt = $this->dao->select('t1.id, t1.name, t2.name as project')
->from(TABLE_RISK)->alias('t1')
@@ -271,6 +272,7 @@ class riskModel extends model
->where('t1.assignedTo')->eq($account)
->andWhere('t1.deleted')->eq(0)
->beginIF($status != 'all')->andWhere('t1.status')->in($status)->fi()
->beginIF(!empty($skipProjectIDList))->andWhere('t1.PRJ')->notin($skipProjectIDList)->fi()
->beginIF($limit)->limit($limit)->fi()
->query();
+21
View File
@@ -1175,4 +1175,25 @@ class testtask extends control
$this->view->productID = $productID;
$this->display();
}
/**
* AJAX: return test tasks of a user in html select.
*
* @param int $userID
* @param string $id
* @param string $status
* @access public
* @return void
*/
public function ajaxGetUserTestTasks($userID = '', $id = '', $status = 'all')
{
if($userID == '') $userID = $this->app->user->id;
$user = $this->loadModel('user')->getById($userID, 'id');
$account = $user->account;
$testTasks = $this->testtask->getUserTestTaskPairs($account, 0, $status);
if($id) die(html::select("testTasks[$id]", $testTasks, '', 'class="form-control"'));
die(html::select('testTask', $testTasks, '', 'class=form-control'));
}
}
+5 -3
View File
@@ -1085,11 +1085,12 @@ class testtaskModel extends model
* @param string $account
* @param int $limit
* @param string $status all|wait|doing|done|blocked
* @param string $skipProjectIDList
* @param array $skipProductIDList
* @param array $skipProjectIDList
* @access public
* @return array
*/
public function getUserTesttaskPairs($account, $limit = 0, $status = 'all', $skipProjectIDList = '')
public function getUserTestTaskPairs($account, $limit = 0, $status = 'all', $skipProductIDList = array(), $skipProjectIDList = array())
{
$stmt = $this->dao->select('t1.id, t1.name, t2.name as project')
->from(TABLE_TESTTASK)->alias('t1')
@@ -1097,7 +1098,8 @@ class testtaskModel extends model
->where('t1.owner')->eq($account)
->andWhere('t1.deleted')->eq(0)
->beginIF($status != 'all')->andWhere('t1.status')->in($status)->fi()
->beginIF(!empty($skipProjectIDList))->andWhere('t1.project')->notin($skipProjectIDList)->fi()
->beginIF(!empty($skipProductIDList))->andWhere('t1.product')->notin($skipProductIDList)->fi()
->beginIF(!empty($skipProjectIDList))->andWhere('t1.PRJ')->notin($skipProjectIDList)->fi()
->beginIF($limit)->limit($limit)->fi()
->query();
+2
View File
@@ -5,3 +5,5 @@
.cycleConfig .tab-pane{padding:8px 0px;}
.cycleConfig .tab-pane .input-group{width:380px}
#name{height: 34px}
.nameBox{display: grid;}
.chosen-container-single .chosen-single{height: 34px;}
+17 -1
View File
@@ -37,8 +37,24 @@ function loadList(type, id)
{
link = createLink('story', 'ajaxGetUserStories', param);
}
else if(type == 'issue')
{
link = createLink('issue', 'ajaxGetUserIssues', param);
}
else if(type == 'risk')
{
link = createLink('risk', 'ajaxGetUserRisks', param);
}
else if(type == 'testtask')
{
link = createLink('testtask', 'ajaxGetUserTestTasks', param);
}
else if(type == 'review')
{
link = createLink('review', 'ajaxGetUserReviews', param);
}
if(type == 'bug' || type == 'task' || type == 'story')
if(type == 'bug' || type == 'task' || type == 'story' || type == 'issue' || type == 'risk' || type == 'testtask' || type == 'review' )
{
$.get(link, function(data, status)
{
+8 -8
View File
@@ -103,7 +103,7 @@
<?php printf($lang->todo->beforeDays, html::input('config[beforeDays]', 0, "class='form-control'"));?>
</div>
</td>
</tr>
</tr>
<tr class='cycleConfig hidden'>
<th><?php echo $lang->todo->deadline;?></th>
<td><?php echo html::input("config[end]", '', "class='form-control form-date'");?></td>
@@ -111,7 +111,7 @@
<tr>
<th><?php echo $lang->todo->type;?></th>
<td><?php echo html::select('type', $lang->todo->typeList, '', 'onchange="loadList(this.value);" class="form-control"');?></td>
</tr>
</tr>
<tr>
<th><?php echo $lang->todo->name;?></th>
<td colspan='2'>
@@ -119,7 +119,7 @@
<div class='input-group title-group required'>
<div class='nameBox'><?php echo html::input('name', isset($name) ? $name : '', "class='form-control'");?></div>
<span class="input-group-addon fix-border br-0" style="border-radius: 0px;"><?php echo $lang->todo->pri;?></span>
<div class="input-group-btn pri-selector" data-type="pri">
<div class="input-group-btn pri-selector" data-type="pri">
<button type="button" class="btn dropdown-toggle br-0" data-toggle="dropdown">
<span class="pri-text"><span class="label-pri label-pri-3">3</span></span> &nbsp;<span class="caret"></span>
</button>
@@ -129,15 +129,15 @@
</div>
</div>
</td>
</tr>
</tr>
<tr>
<th><?php echo $lang->todo->desc;?></th>
<td colspan='2'><?php echo html::textarea('desc', isset($desc) ? $desc : '', "rows='8' class='form-control'");?></td>
</tr>
</tr>
<tr>
<th><?php echo $lang->todo->status;?></th>
<td><?php echo html::select('status', $lang->todo->statusList, '', "class='form-control chosen'");?></td>
</tr>
</tr>
<tr>
<th><?php echo $lang->todo->beginAndEnd;?></th>
<td>
@@ -151,7 +151,7 @@
<label for='switchTime'><?php echo $lang->todo->lblDisableDate;?></label>
</div>
</td>
</tr>
</tr>
<tr>
<th><?php echo $lang->todo->private;?></th>
<td>
@@ -160,7 +160,7 @@
<label for='private'></label>
</div>
</td>
</tr>
</tr>
<tr>
<td colspan='3' class='text-center form-actions'>
<?php echo html::submitButton() . html::backButton();?>