* fix a bug for file link.

This commit is contained in:
wangyidong
2012-08-31 08:32:16 +00:00
parent 7788f10987
commit f3caba603e
3 changed files with 14 additions and 12 deletions
+3 -2
View File
@@ -393,9 +393,10 @@ class common extends control
*/
public function getSysURL()
{
$httpType = isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on' ? 'https' : 'http';
$httpType = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') ? 'https' : 'http';
$httpPort = $_SERVER['SERVER_PORT'] == 80 ? '' : $_SERVER['SERVER_PORT'];
$httpHost = $_SERVER['HTTP_HOST'];
return "$httpType://$httpHost";
return "$httpType://$httpHost:$httpPort";
}
/**
+8 -6
View File
@@ -156,32 +156,34 @@ class file extends control
*/
public function export2HTML()
{
$this->view->fields = $this->post->fields;
$this->view->rows = $this->post->rows;
$this->view->fields = $this->post->fields;
$this->view->rows = $this->post->rows;
$this->host = common::getSysURL();
switch($this->post->kind)
{
case 'task':
foreach($this->view->rows as $row)
{
$row->name = html::a('http://' . $_SERVER['HTTP_HOST'] . $this->createLink('task', 'view', "taskID=$row->id"), $row->name);
$row->name = html::a($this->host . $this->createLink('task', 'view', "taskID=$row->id"), $row->name);
}
break;
case 'story':
foreach($this->view->rows as $row)
{
$row->title= html::a('http://' . $_SERVER['HTTP_HOST'] . $this->createLink('story', 'view', "storyID=$row->id"), $row->title);
$row->title= html::a($this->host . $this->createLink('story', 'view', "storyID=$row->id"), $row->title);
}
break;
case 'bug':
foreach($this->view->rows as $row)
{
$row->title= html::a('http://' . $_SERVER['HTTP_HOST'] . $this->createLink('bug', 'view', "bugID=$row->id"), $row->title);
$row->title= html::a($this->host . $this->createLink('bug', 'view', "bugID=$row->id"), $row->title);
}
break;
case 'testcase':
foreach($this->view->rows as $row)
{
$row->title= html::a('http://' . $_SERVER['HTTP_HOST'] . $this->createLink('testcase', 'view', "caseID=$row->id"), $row->title);
$row->title= html::a($this->host . $this->createLink('testcase', 'view', "caseID=$row->id"), $row->title);
}
break;
}
+3 -4
View File
@@ -546,17 +546,16 @@ class testcase extends control
foreach($relatedSteps[$case->id] as $step)
{
if($step->version != $case->version) continue;
$case->stepDesc .= $i . "." . $step->desc . "\n";
$case->stepExpect .= $i . "." . $step->expect . "\n";
$sign = (in_array($this->post->fileType, array('html', 'xml'))) ? '<br />' : "\n";
$case->stepDesc .= $i . ". " . $step->desc . $sign;
$case->stepExpect .= $i . ". " . $step->expect . $sign;
$i ++;
}
}
if($this->post->fileType == 'csv')
{
$case->stepDesc = str_replace('<br />', "\n", $case->stepDesc);
$case->stepDesc = str_replace('"', '""', $case->stepDesc);
$case->stepExpect = str_replace('<br />', "\n", $case->stepExpect);
$case->stepExpect = str_replace('"', '""', $case->stepExpect);
}