+ finish the task #650.

This commit is contained in:
shiyangyangwork@yahoo.cn
2011-12-21 01:46:00 +00:00
parent 842c41442d
commit 5c52685cab
13 changed files with 104 additions and 17 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ class actionModel extends model
/* Get product and project for this object. */
$productAndProject = $this->getProductAndProject($objectType, $objectID);
$action->product = $productAndProject['product'];
$action->project = $productAndProject['project'];
if($objectType != 'case')$action->project = $productAndProject['project'];
$this->dao->insert(TABLE_ACTION)->data($action)->autoCheck()->exec();
return $this->dbh->lastInsertID();
+9 -4
View File
@@ -454,13 +454,18 @@ class bug extends control
* @access public
* @return void
*/
public function edit($bugID)
public function edit($bugID, $comment = false)
{
if(!empty($_POST))
{
$changes = $this->bug->update($bugID);
if(dao::isError()) die(js::error(dao::getError()));
$files = $this->loadModel('file')->saveUpload('bug', $bugID);
$changes = array();
$files = array();
if($comment == false)
{
$changes = $this->bug->update($bugID);
if(dao::isError()) die(js::error(dao::getError()));
$files = $this->loadModel('file')->saveUpload('bug', $bugID);
}
if($this->post->comment != '' or !empty($changes) or !empty($files))
{
$action = !empty($changes) ? 'Edited' : 'Commented';
+4
View File
@@ -0,0 +1,4 @@
function setComment()
{
$('#comment').show();
}
+13
View File
@@ -22,6 +22,7 @@
if(!$bug->deleted)
{
if(!($bug->status == 'active' and $bug->confirmed == 0 and common::printLink('bug', 'confirmBug', $params, $lang->bug->buttonConfirm))) echo $lang->bug->buttonConfirm . ' ';
echo html::a('#', $lang->comment, '', 'onclick=setComment()'). ' ';
common::printLink('bug', 'edit', $params, $lang->bug->buttonEdit);
if(!($bug->status == 'active' and common::printLink('bug', 'resolve', $params, $lang->bug->buttonResolve))) echo $lang->bug->buttonResolve . ' ';
if(!($bug->status == 'resolved' and common::printLink('bug', 'close', $params, $lang->bug->buttonClose))) echo $lang->bug->buttonClose . ' ';
@@ -57,6 +58,7 @@
if(!$bug->deleted)
{
if(!($bug->status == 'active' and $bug->confirmed == 0 and common::printLink('bug', 'confirmBug', $params, $lang->bug->buttonConfirm))) echo $lang->bug->buttonConfirm . ' ';
if(common::hasPriv('bug', 'edit')) echo html::a('#', $lang->comment, '', 'onclick=setComment()'). ' ';
common::printLink('bug', 'edit', $params, $lang->bug->buttonEdit);
if(!($bug->status == 'active' and common::printLink('bug', 'resolve', $params, $lang->bug->buttonResolve))) echo $lang->bug->buttonResolve . ' ';
if(!($bug->status == 'resolved' and common::printLink('bug', 'close', $params, $lang->bug->buttonClose))) echo $lang->bug->buttonClose . ' ';
@@ -76,6 +78,17 @@
echo html::a($browseLink, $lang->goback);
?>
</div>
<div id='comment' class='hidden'>
<fieldset>
<legend><?php echo $lang->comment;?></legend>
<form method='post' enctype='multipart/form-data' action='<?php echo inlink('edit', "bugID=$bug->id&comment=true")?>'>
<table align='center'>
<tr><?php echo html::textarea('comment', '',"rows='5' class='w-p100'");?></tr>
<tr><td><?php echo html::submitButton() . html::resetButton();?></td></tr>
</table>
</form>
</fieldset>
</div>
</td>
<td class='divider'></td>
<td class='side'>
+7 -3
View File
@@ -236,13 +236,17 @@ class story extends control
* @access public
* @return void
*/
public function edit($storyID)
public function edit($storyID, $comment = false)
{
$this->loadModel('action');
if(!empty($_POST))
{
$changes = $this->story->update($storyID);
if(dao::isError()) die(js::error(dao::getError()));
$changes = array();
if($comment == false)
{
$changes = $this->story->update($storyID);
if(dao::isError()) die(js::error(dao::getError()));
}
if($this->post->comment != '' or !empty($changes))
{
$action = !empty($changes) ? 'Edited' : 'Commented';
+4
View File
@@ -0,0 +1,4 @@
function setComment()
{
$('#comment').show();
}
+13
View File
@@ -20,6 +20,7 @@
{
if(!($story->status != 'closed' and common::printLink('story', 'change', "storyID=$story->id", $lang->story->change))) echo $lang->story->change . ' ';
if(!(($story->status == 'draft' or $story->status == 'changed') and common::printLink('story', 'review', "storyID=$story->id", $lang->story->review))) echo $lang->story->review . ' ';
if(common::hasPriv('story', 'edit')) echo html::a('#', $lang->comment, '', 'onclick=setComment()'). ' ';
if(!($story->status != 'closed' and common::printLink('story', 'close', "storyID=$story->id", $lang->story->close))) echo $lang->story->close . ' ';
if(!($story->status == 'closed' and $story->closedReason == 'postponed' and common::printLink('story', 'activate', "storyID=$story->id", $lang->story->activate))) echo $lang->story->activate . ' ';
if(!common::printLink('story', 'edit', "storyID=$story->id", $lang->edit)) echo $lang->edit . ' ';
@@ -51,6 +52,7 @@
{
if(!($story->status != 'closed' and common::printLink('story', 'change', "storyID=$story->id", $lang->story->change))) echo $lang->story->change . ' ';
if(!(($story->status == 'draft' or $story->status == 'changed') and common::printLink('story', 'review', "storyID=$story->id", $lang->story->review))) echo $lang->story->review . ' ';
if(common::hasPriv('story', 'edit')) echo html::a('#', $lang->comment, '', 'onclick=setComment()'). ' ';
if(!($story->status != 'closed' and common::printLink('story', 'close', "storyID=$story->id", $lang->story->close))) echo $lang->story->close . ' ';
if(!($story->status == 'closed' and $story->closedReason == 'postponed' and common::printLink('story', 'activate', "storyID=$story->id", $lang->story->activate))) echo $lang->story->activate . ' ';
if(!common::printLink('testcase', 'create', "productID=$story->product&moduleID=0&from=&param=0&storyID=$story->id", $lang->story->createCase)) echo $lang->story->createCase . ' ';
@@ -60,6 +62,17 @@
echo html::a($browseLink, $lang->goback);
?>
</div>
<div id='comment' class='hidden'>
<fieldset>
<legend><?php echo $lang->comment;?></legend>
<form method='post' enctype='multipart/form-data' action='<?php echo inlink('edit', "storyID=$story->id&comment=true")?>'>
<table align='center'>
<tr><?php echo html::textarea('comment', '',"rows='5' class='w-p100'");?></tr>
<tr><td><?php echo html::submitButton() . html::resetButton();?></td></tr>
</table>
</form>
</fieldset>
</div>
</td>
<td class='divider'></div>
<td class='side'>
+9 -4
View File
@@ -162,16 +162,21 @@ class task extends control
* @access public
* @return void
*/
public function edit($taskID)
public function edit($taskID, $comment = false)
{
$this->commonAction($taskID);
if(!empty($_POST))
{
$this->loadModel('action');
$changes = $this->task->update($taskID);
if(dao::isError()) die(js::error(dao::getError()));
$files = $this->loadModel('file')->saveUpload('task', $taskID);
$changes = array();
$files = array();
if($comment == false)
{
$changes = $this->task->update($taskID);
if(dao::isError()) die(js::error(dao::getError()));
$files = $this->loadModel('file')->saveUpload('task', $taskID);
}
$task = $this->task->getById($taskID);
if($this->post->comment != '' or !empty($changes) or !empty($files))
+5 -1
View File
@@ -1,6 +1,10 @@
function assign(taskID, assignedTo)
function assign(taskID, assignedTo)
{
$('.assign').width(150);
$('.assign').height(40);
$('.assign').load(createLink('user', 'ajaxGetUser', 'taskID=' + taskID + '&assignedTo=' + assignedTo));
}
function setComment()
{
$('#comment').show();
}
+13
View File
@@ -24,6 +24,7 @@
{
//if(!($task->status != 'closed' and $task->status != 'cancel' and common::printLink('task', 'logEfforts', "taskID=$task->id", $lang->task->buttonLogEfforts))) echo $lang->task->buttonLogEfforts . ' ';
if(!(($task->status == 'wait') and common::printLink('task', 'start', "taskID=$task->id", $lang->task->buttonStart))) echo $lang->task->buttonStart . ' ';
if(common::hasPriv('task', 'edit')) echo html::a('#', $lang->comment, '', 'onclick=setComment()'). ' ';
if(!(($task->status == 'wait' or $task->status == 'doing') and common::printLink('task', 'finish', "taskID=$task->id", $lang->task->buttonDone))) echo $lang->task->buttonDone . ' ';
if(!(($task->status == 'done' or $task->status == 'cancel') and common::printLink('task', 'close', "taskID=$task->id", $lang->task->buttonClose))) echo $lang->task->buttonClose . ' ';
if(!(($task->status == 'wait' or $task->status == 'doing') and common::printLink('task', 'cancel', "taskID=$task->id", $lang->task->buttonCancel))) echo $lang->task->buttonCancel . ' ';
@@ -51,6 +52,7 @@
if(!$task->deleted)
{
if(!(($task->status == 'wait') and common::printLink('task', 'start', "taskID=$task->id", $lang->task->buttonStart))) echo $lang->task->buttonStart . ' ';
if(common::hasPriv('task', 'edit')) echo html::a('#', $lang->comment, '', 'onclick=setComment()'). ' ';
if(!(($task->status == 'wait' or $task->status == 'doing') and common::printLink('task', 'finish', "taskID=$task->id", $lang->task->buttonDone))) echo $lang->task->buttonDone . ' ';
if(!(($task->status == 'done' or $task->status == 'cancel') and common::printLink('task', 'close', "taskID=$task->id", $lang->task->buttonClose))) echo $lang->task->buttonClose . ' ';
if(!(($task->status == 'wait' or $task->status == 'doing') and common::printLink('task', 'cancel', "taskID=$task->id", $lang->task->buttonCancel))) echo $lang->task->buttonCancel . ' ';
@@ -62,6 +64,17 @@
echo html::a($browseLink, $lang->goback);
?>
</div>
<div id='comment' class='hidden'>
<fieldset>
<legend><?php echo $lang->comment;?></legend>
<form method='post' enctype='multipart/form-data' action='<?php echo inlink('edit', "taskID=$task->id&comment=true")?>'>
<table align='center'>
<tr><?php echo html::textarea('comment', '',"rows='5' class='w-p100'");?></tr>
<tr><td><?php echo html::submitButton() . html::resetButton();?></td></tr>
</table>
</form>
</fieldset>
</div>
</td>
<td class='divider'></td>
<td class='side'>
+9 -4
View File
@@ -340,15 +340,20 @@ class testcase extends control
* @access public
* @return void
*/
public function edit($caseID)
public function edit($caseID, $comment = false)
{
$this->loadModel('story');
if(!empty($_POST))
{
$changes = $this->testcase->update($caseID);
if(dao::isError()) die(js::error(dao::getError()));
$files = $this->loadModel('file')->saveUpload('testcase', $caseID);
$changes = array();
$files = array();
if($comment == false)
{
$changes = $this->testcase->update($caseID);
if(dao::isError()) die(js::error(dao::getError()));
$files = $this->loadModel('file')->saveUpload('testcase', $caseID);
}
if($this->post->comment != '' or !empty($changes) or !empty($files))
{
$this->loadModel('action');
+4
View File
@@ -3,3 +3,7 @@ $(document).ready(function()
$(".runcase").colorbox({width:900, height:600, iframe:true, transition:'none'});
$(".results").colorbox({width:900, height:600, iframe:true, transition:'none'});
})
function setComment()
{
$('#comment').show();
}
+13
View File
@@ -22,6 +22,7 @@
common::printLink('testtask', 'runCase', "runID=0&caseID=$case->id&version=$case->currentVersion", $this->app->loadLang('testtask')->testtask->runCase, '', 'class="runcase"');
common::printLink('testtask', 'results', "runID=0&caseID=$case->id&version=$case->version", $lang->testtask->results, '', 'class="results"');
if($case->lastRunResult == 'fail') common::printLink('bug', 'create', "product=$case->product&extra=caseID=$case->id,version=$case->version,runID=", $lang->testtask->createBug);
if(common::hasPriv('testcase', 'edit')) echo html::a('#', $lang->comment, '', 'onclick=setComment()'). ' ';
common::printLink('testcase', 'edit', "caseID=$case->id", $lang->testcase->buttonEdit);
common::printLink('testcase', 'create', "productID=$case->product&moduleID=$case->module&from=testcase&param=$case->id", $lang->copy);
common::printLink('testcase', 'delete', "caseID=$case->id", $lang->delete, 'hiddenwin');
@@ -61,12 +62,24 @@
<?php
if(!$case->deleted)
{
if(common::hasPriv('testcase', 'edit')) echo html::a('#', $lang->comment, '', 'onclick=setComment()'). ' ';
common::printLink('testcase', 'edit', "caseID=$case->id", $lang->testcase->buttonEdit);
common::printLink('testcase', 'delete', "caseID=$case->id", $lang->delete, 'hiddenwin');
}
echo html::a($browseLink, $lang->goback);
?>
</div>
<div id='comment' class='hidden'>
<fieldset>
<legend><?php echo $lang->comment;?></legend>
<form method='post' enctype='multipart/form-data' action='<?php echo inlink('edit', "caseID=$case->id&comment=true")?>'>
<table align='center'>
<tr><?php echo html::textarea('comment', '',"rows='5' class='w-p100'");?></tr>
<tr><td><?php echo html::submitButton() . html::resetButton();?></td></tr>
</table>
</form>
</fieldset>
</div>
</td>
<td class='divider'></td>
<td class='side'>