* Adjust code,

This commit is contained in:
leiyong
2021-01-08 14:07:16 +08:00
parent d5164338e6
commit 65870829ed
6 changed files with 87 additions and 52 deletions
+1 -1
View File
@@ -26,7 +26,7 @@
<?php if($bug->deleted):?>
<span class='label label-danger'><?php echo $lang->bug->deleted;?></span>
<?php endif; ?>
</div>
</div>
</div>
<?php if(!isonlybody()):?>
<div class="btn-toolbar pull-right">
+2 -2
View File
@@ -229,8 +229,8 @@ class risk extends control
$this->action->logHistory($actionID, $changes);
}
$response['locate'] = inlink('browse');
$this->send($response);
if(isonlybody()) die(js::closeModal('parent.parent', 'this'));
$this->send(array('locate' => inlink('browse')));
}
$this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->track;
+26 -24
View File
@@ -13,29 +13,31 @@
<?php include "../../common/view/header.html.php";?>
<?php include '../../common/view/kindeditor.html.php';?>
<div id='mainContent' class='main-content'>
<div class='main-header'>
<h2>
<span class='prefix label-id'><strong><?php echo $risk->id;?></strong></span>
<?php echo "<span title='$risk->name'>" . $risk->name . '</span>';?>
</h2>
</div>
<form class='load-indicator main-form' method='post' target='hiddenwin'>
<table class='table table-form'>
<tbody>
<tr>
<th class='w-100px'><?php echo $lang->risk->assignedTo;?></th>
<td><?php echo html::select('assignedTo', $users, $risk->assignedTo, "class='form-control chosen'");?></td>
<td></td>
</tr>
<tr>
<th><?php echo $lang->comment;?></th>
<td colspan='2'><?php echo html::textarea('comment', '', "rows='6' class='form-control kindeditor' hidefocus='true'");?></td>
</tr>
<tr>
<td class='text-center form-actions' colspan='3'><?php echo html::submitButton(); ?></td> </tr>
</tbody>
</table>
</form>
<div class="center-block">
<div class='main-header'>
<h2>
<span class='prefix label-id'><strong><?php echo $risk->id;?></strong></span>
<?php echo "<span title='$risk->name'>" . $risk->name . '</span>';?>
</h2>
</div>
<form method='post' enctype='multipart/form-data' target='hiddenwin'>
<table class='table table-form'>
<tbody>
<tr>
<th class='w-100px'><?php echo $lang->risk->assignedTo;?></th>
<td><?php echo html::select('assignedTo', $users, $risk->assignedTo, "class='form-control chosen'");?></td>
<td></td>
</tr>
<tr>
<th><?php echo $lang->comment;?></th>
<td colspan='2'><?php echo html::textarea('comment', '', "rows='6' class='form-control kindeditor' hidefocus='true'");?></td>
</tr>
<tr>
<td class='text-center form-actions' colspan='3'><?php echo html::submitButton(); ?></td>
</tr>
</tbody>
</table>
</form>
</div>
</div>
<?php include "../../common/view/footer.html.php";?>
+1 -1
View File
@@ -6,7 +6,7 @@
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Yuchun Li <liyuchun@cnezsoft.com>
* @package view
* @version $Id: track.html.php 4903 2020-09-04 09:32:59Z lyc $
* @version $Id
* @link http://www.zentao.net
*/
?>
+2 -2
View File
@@ -1193,7 +1193,7 @@ class testtask extends control
$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'));
if($id) die(html::select("testtasks[$id]", $testTasks, '', 'class="form-control"'));
die(html::select('testtask', $testTasks, '', 'class=form-control'));
}
}
+55 -22
View File
@@ -9,8 +9,6 @@
* @version $Id: model.php 5035 2013-07-06 05:21:58Z wyd621@gmail.com $
* @link http://www.zentao.net
*/
?>
<?php
class todoModel extends model
{
/**
@@ -19,24 +17,23 @@ class todoModel extends model
* @param date $date
* @param string $account
* @access public
* @return void
* @return bool|int
*/
public function create($date, $account)
{
$objectType = $this->post->type;
$hasObject = in_array($objectType, array('bug', 'task', 'story', 'issue', 'risk', 'review', 'testtask', 'feedback'));
$todo = fixer::input('post')
->add('account', $this->app->user->account)
->setDefault('idvalue', 0)
->cleanInt('pri, begin, end, private')
->setIF($this->post->type == 'bug' and $this->post->bug, 'idvalue', $this->post->bug)
->setIF($this->post->type == 'task' and $this->post->task, 'idvalue', $this->post->task)
->setIF($this->post->type == 'story' and $this->post->story, 'idvalue', $this->post->story)
->setIF($this->post->type == 'issue' and $this->post->issue, 'idvalue', $this->post->issue)
->setIF($this->post->type == 'feedback' and $this->post->feedback, 'idvalue', $this->post->feedback)
->setIF($hasObject && $objectType, 'idvalue', $this->post->$objectType)
->setIF($this->post->date == false, 'date', '2030-01-01')
->setIF($this->post->begin == false, 'begin', '2400')
->setIF($this->post->begin == false or $this->post->end == false, 'end', '2400')
->stripTags($this->config->todo->editor->create['id'], $this->config->allowedTags)
->remove('bug, task, story, issue, uid, feedback')
->remove('bug, task, story, issue, risk, review, testtask, uid, feedback')
->get();
if($todo->end < $todo->begin)
@@ -76,12 +73,8 @@ class todoModel extends model
$todo = $this->loadModel('file')->processImgURL($todo, $this->config->todo->editor->create['id'], $this->post->uid);
$this->dao->insert(TABLE_TODO)->data($todo)
->autoCheck()
->checkIF(!in_array($todo->type, array('bug', 'task', 'story')), $this->config->todo->create->requiredFields, 'notempty')
->checkIF($todo->type == 'bug' and $todo->idvalue == 0, 'idvalue', 'notempty')
->checkIF($todo->type == 'task' and $todo->idvalue == 0, 'idvalue', 'notempty')
->checkIF($todo->type == 'story' and $todo->idvalue == 0, 'idvalue', 'notempty')
->checkIF($todo->type == 'issue' and $todo->idvalue == 0, 'idvalue', 'notempty')
->checkIF($todo->type == 'feedback' and $todo->idvalue == 0, 'idvalue', 'notempty')
->checkIF(!$hasObject, $this->config->todo->create->requiredFields, 'notempty')
->checkIF($hasObject && $todo->idvalue == 0, 'idvalue', 'notempty')
->exec();
if(!dao::isError())
@@ -107,7 +100,7 @@ class todoModel extends model
$validTodos = array();
for($i = 0; $i < $this->config->todo->batchCreate; $i++)
{
if($todos->names[$i] != '' || isset($todos->bugs[$i + 1]) || isset($todos->tasks[$i + 1]) || isset($todos->stories[$i + 1]))
if($todos->names[$i] != '' || isset($todos->bugs[$i + 1]) || isset($todos->tasks[$i + 1]) || isset($todos->stories[$i + 1]) || isset($todos->issues[$i + 1]) || isset($todos->risks[$i + 1]) || isset($todos->reviews[$i + 1]) || isset($todos->testtask[$i + 1]))
{
$todo = new stdclass();
$todo->account = $this->app->user->account;
@@ -119,6 +112,7 @@ class todoModel extends model
{
$todo->date = $this->post->date;
}
$todo->type = $todos->types[$i];
$todo->pri = $todos->pris[$i];
$todo->name = isset($todos->names[$i]) ? $todos->names[$i] : '';
@@ -128,9 +122,14 @@ class todoModel extends model
$todo->status = "wait";
$todo->private = 0;
$todo->idvalue = 0;
if($todo->type == 'bug') $todo->idvalue = isset($todos->bugs[$i + 1]) ? $todos->bugs[$i + 1] : 0;
if($todo->type == 'task') $todo->idvalue = isset($todos->tasks[$i + 1]) ? $todos->tasks[$i + 1] : 0;
if($todo->type == 'story') $todo->idvalue = isset($todos->stories[$i + 1]) ? $todos->stories[$i + 1] : 0;
if($todo->type == 'bug') $todo->idvalue = isset($todos->bugs[$i + 1]) ? $todos->bugs[$i + 1] : 0;
if($todo->type == 'task') $todo->idvalue = isset($todos->tasks[$i + 1]) ? $todos->tasks[$i + 1] : 0;
if($todo->type == 'story') $todo->idvalue = isset($todos->stories[$i + 1]) ? $todos->stories[$i + 1] : 0;
if($todo->type == 'issue') $todo->idvalue = isset($todos->issues[$i + 1]) ? $todos->issues[$i + 1] : 0;
if($todo->type == 'risk') $todo->idvalue = isset($todos->risks[$i + 1]) ? $todos->risks[$i + 1] : 0;
if($todo->type == 'review') $todo->idvalue = isset($todos->reviews[$i + 1]) ? $todos->reviews[$i + 1] : 0;
if($todo->type == 'testtask') $todo->idvalue = isset($todos->testtasks[$i + 1]) ? $todos->testtasks[$i + 1] : 0;
if($todo->end < $todo->begin) die(js::alert(sprintf($this->lang->error->gt, $this->lang->todo->end, $this->lang->todo->begin)));
@@ -458,6 +457,7 @@ class todoModel extends model
->beginIF($limit > 0)->limit($limit)->fi()
->page($pager)
->query();
/* Set session. */
$sql = explode('WHERE', $this->dao->get());
$sql = explode('ORDER', $sql[1]);
@@ -465,9 +465,13 @@ class todoModel extends model
while($todo = $stmt->fetch())
{
if($todo->type == 'story') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_STORY)->fetch('title');
if($todo->type == 'task') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_TASK)->fetch('name');
if($todo->type == 'bug') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_BUG)->fetch('title');
if($todo->type == 'story') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_STORY)->fetch('title');
if($todo->type == 'task') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_TASK)->fetch('name');
if($todo->type == 'bug') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_BUG)->fetch('title');
if($todo->type == 'issue') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_ISSUE)->fetch('title');
if($todo->type == 'risk') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_RISK)->fetch('name');
if($todo->type == 'review') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_REVIEW)->fetch('title');
if($todo->type == 'testtask') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_TESTTASK)->fetch('name');
$todo->begin = date::formatTime($todo->begin);
$todo->end = date::formatTime($todo->end);
@@ -725,4 +729,33 @@ class todoModel extends model
->markRight(1)
->fetch('count');
}
/**
* Gets the project ID of the to-do object.
*
* @param array $todoList
* @access public
* @return array
*/
public function getTodoProjects($todoList = array())
{
$projectIdList = array();
foreach($todoList as $type => $todos)
{
$todoIdList = array_keys($todos);
if(empty($todoIdList))
{
$projectIdList[$type] = array();
continue;
}
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');
}
return $projectIdList;
}
}