* finish task#633.

This commit is contained in:
chencongzhi520@gmail.com
2012-06-12 07:11:47 +00:00
parent a5bf8ba911
commit 0b74074b2c
10 changed files with 94 additions and 2 deletions

View File

@@ -347,6 +347,11 @@ class bug extends control
/* Get product info. */
$productID = $bug->product;
$productName = $this->products[$productID];
/* Get the previous and next bug. */
$tmpBugIDs = $this->dao->select('id')->from(TABLE_BUG)->where($this->session->storyReport)->fetchPairs('id');
$bugIDs = ',' . implode(',', $tmpBugIDs) . ',';
$this->view->preAndNext = $this->loadModel('common')->getPreAndNextObject('bug', $bugIDs, $bugID);
/* Header and positon. */
$this->view->header->title = $this->products[$productID] . $this->lang->colon . $this->lang->bug->view;

View File

@@ -41,6 +41,14 @@
common::printLink('bug', 'delete', $params, $lang->delete, 'hiddenwin');
}
echo html::a($browseLink, $lang->goback);
if($preAndNext->pre)
{
echo "<abbr title='{$preAndNext->pre->id}{$lang->colon}{$preAndNext->pre->title}'>" . html::a($this->inLink('view', "storyID={$preAndNext->pre->id}"), '<') . "</abbr>&nbsp;&nbsp;";
}
if($preAndNext->next)
{
echo "<abbr title={$preAndNext->next->id}{$lang->colon}{$preAndNext->pre->title}>" . html::a($this->inLink('view', "storyID={$preAndNext->next->id}"), '>') . "</abbr>";
}
?>
</div>
</div>

View File

@@ -429,4 +429,44 @@ class commonModel extends model
return false;
}
/**
* Get the previous and next object.
*
* @param string $type story|task|bug|case
* @param string $objectIDs
* @param string $objectID
* @access public
* @return void
*/
public function getPreAndNextObject($type, $objectIDs, $objectID)
{
$table = '';
switch($type)
{
case 'story' : $table = TABLE_STORY; break;
case 'task' : $table = TABLE_TASK; break;
case 'bug' : $table = TABLE_BUG; break;
case 'case' : $table = TABLE_CASE; break;
default:break;
}
$currentStart = strpos($objectIDs, ',' . $objectID . ',') + 1;
$currentEnd = $currentStart + strlen($objectID) - 1;
/* Get the previous object. */
$tmp = substr($objectIDs, 0, $currentStart - 1);
$preStart = strrpos($tmp, ',', 0) + 1;
$preEnd = $currentStart - 2;
$preID = substr($objectIDs, $preStart, $preEnd - $preStart + 1);
$preAndNextObject->pre = $this->dao->select('*')->from($table)->where('id')->eq($preID)->fetch();
/* Get the next object. */
$nextStart = $currentEnd + 2;
$nextEnd = strpos($objectIDs, ',', $nextStart) - 1;
$nextID = substr($objectIDs, $nextStart, $nextEnd - $nextStart + 1);
$preAndNextObject->next = $this->dao->select('*')->from($table)->where('id')->eq($nextID)->fetch();
return $preAndNextObject;
}
}

View File

@@ -367,6 +367,11 @@ class story extends control
/* Set the menu. */
$this->product->setMenu($this->product->getPairs(), $product->id);
/* Get the previous and next story. */
$tmpStoryIDs = $this->dao->select('id')->from(TABLE_STORY)->where($this->session->storyReport)->fetchPairs('id');
$storyIDs = ',' . implode(',', $tmpStoryIDs) . ',';
$this->view->preAndNext = $this->loadModel('common')->getPreAndNextObject('story', $storyIDs, $storyID);
$header['title'] = $product->name . $this->lang->colon . $this->lang->story->view . $this->lang->colon . $story->title;
$position[] = html::a($this->createLink('product', 'browse', "product=$product->id"), $product->name);
$position[] = $this->lang->story->view;

View File

@@ -29,6 +29,14 @@
common::printLink('story', 'delete', "storyID=$story->id", $lang->delete, 'hiddenwin');
}
echo html::a($browseLink, $lang->goback);
if($preAndNext->pre)
{
echo "<abbr title='{$preAndNext->pre->id}{$lang->colon}{$preAndNext->pre->title}'>" . html::a($this->inLink('view', "storyID={$preAndNext->pre->id}&version={$preAndNext->pre->version}"), '<') . "</abbr>&nbsp;&nbsp;";
}
if($preAndNext->next)
{
echo "<abbr title={$preAndNext->next->id}{$lang->colon}{$preAndNext->pre->title}>" . html::a($this->inLink('view', "storyID={$preAndNext->next->id}&version={$preAndNext->next->version}"), '>') . "</abbr>";
}
?>
</div>
</div>

View File

@@ -343,6 +343,11 @@ class task extends control
$project = $this->project->getById($task->project);
$this->project->setMenu($this->project->getPairs(), $project->id);
/* Get the previous and next task. */
$tmpTaskIDs = $this->dao->select('id')->from(TABLE_TASK)->alias('t1')->where($this->session->taskReportCondition)->fetchPairs('id');
$taskIDs = ',' . implode(',', $tmpTaskIDs) . ',';
$this->view->preAndNext = $this->loadModel('common')->getPreAndNextObject('task', $taskIDs, $taskID);
$header['title'] = $project->name . $this->lang->colon . $this->lang->task->view;
$position[] = html::a($this->createLink('project', 'browse', "projectID=$task->project"), $project->name);
$position[] = $this->lang->task->view;

View File

@@ -34,6 +34,14 @@
if(!common::printLink('task', 'delete',"projectID=$task->project&taskID=$task->id", $lang->task->buttonDelete, 'hiddenwin')) echo $lang->task->buttonDelete . ' ';
}
echo html::a($browseLink, $lang->goback);
if($preAndNext->pre)
{
echo "<abbr title='{$preAndNext->pre->id}{$lang->colon}{$preAndNext->pre->name}'>" . html::a($this->inLink('view', "taskID={$preAndNext->pre->id}"), '<') . "</abbr>&nbsp;&nbsp;";
}
if($preAndNext->next)
{
echo "<abbr title={$preAndNext->next->id}{$lang->colon}{$preAndNext->pre->name}>" . html::a($this->inLink('view', "taskID={$preAndNext->next->id}"), '>') . "</abbr>";
}
?>
</div>
</div>

View File

@@ -320,6 +320,11 @@ class testcase extends control
$productID = $case->product;
$this->testcase->setMenu($this->products, $productID);
/* Get the previous and next testcase. */
$tmpCaseIDs = $this->dao->select('id')->from(TABLE_CASE)->where($this->session->testcaseReport)->fetchPairs('id');
$caseIDs = ',' . implode(',', $tmpCaseIDs) . ',';
$this->view->preAndNext = $this->loadModel('common')->getPreAndNextObject('case', $caseIDs, $caseID);
$this->view->header['title'] = $this->products[$productID] . $this->lang->colon . $this->lang->testcase->view;
$this->view->position[] = html::a($this->createLink('testcase', 'browse', "productID=$productID"), $this->products[$productID]);
$this->view->position[] = $this->lang->testcase->view;

View File

@@ -28,6 +28,14 @@
common::printLink('testcase', 'delete', "caseID=$case->id", $lang->delete, 'hiddenwin');
}
echo html::a($browseLink, $lang->goback);
if($preAndNext->pre)
{
echo "<abbr title='{$preAndNext->pre->id}{$lang->colon}{$preAndNext->pre->title}'>" . html::a($this->inLink('view', "storyID={$preAndNext->pre->id}&version={$preAndNext->pre->version}"), '<') . "</abbr>&nbsp;&nbsp;";
}
if($preAndNext->next)
{
echo "<abbr title={$preAndNext->next->id}{$lang->colon}{$preAndNext->pre->title}>" . html::a($this->inLink('view', "storyID={$preAndNext->next->id}&version={$preAndNext->next->version}"), '>') . "</abbr>";
}
?>
</div>
</div>

View File

@@ -321,8 +321,8 @@ table.tablesorter thead tr .headerSortDown {background-image: url(./images/table
/* Title bar. */
#titlebar {font-size:14px; font-weight:bold; background-color:#efefef; padding:0px 5px; margin:10px 0; height:30px; line-height:30px;}
#titlebar #main {float:left; width:70%; clear:none; text-align:left}
#titlebar div {float:right; width:30%; clear:none; text-align:right}
#titlebar #main {float:left; width:65%; clear:none; text-align:left}
#titlebar div {float:right; width:35%; clear:none; text-align:right}
#titlebar #main input {font-size:14px; margin-top:5px}
#titlebar .text-1 {width:80%}