mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
Fixed the HTML display in the export webservice page. (Trac #58)
SVN:trunk[199]
This commit is contained in:
@@ -214,6 +214,7 @@ EOF
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<title>{$this->s_title}</title>\n";
|
||||
echo $this->get_base_tag();
|
||||
// Stylesheets MUST be loaded before any scripts otherwise
|
||||
// jQuery scripts may face some spurious problems (like failing on a 'reload')
|
||||
foreach($this->a_linked_stylesheets as $a_stylesheet)
|
||||
|
||||
@@ -19,6 +19,7 @@ class web_page
|
||||
protected $a_include_scripts;
|
||||
protected $a_include_stylesheets;
|
||||
protected $a_headers;
|
||||
protected $a_base;
|
||||
|
||||
public function __construct($s_title)
|
||||
{
|
||||
@@ -29,6 +30,7 @@ class web_page
|
||||
$this->a_linked_scripts = array();
|
||||
$this->a_linked_stylesheets = array();
|
||||
$this->a_headers = array();
|
||||
$this->a_base = array( 'href' => '', 'target' => '');
|
||||
ob_start(); // Start capturing the output
|
||||
}
|
||||
|
||||
@@ -40,6 +42,15 @@ class web_page
|
||||
$this->s_title = $s_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify a default URL and a default target for all links on a page
|
||||
*/
|
||||
public function set_base($s_href = '', $s_target = '')
|
||||
{
|
||||
$this->a_base['href'] = $s_href;
|
||||
$this->a_base['target'] = $s_target;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add any text or HTML fragment to the body of the page
|
||||
*/
|
||||
@@ -227,6 +238,7 @@ class web_page
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<title>{$this->s_title}</title>\n";
|
||||
echo $this->get_base_tag();
|
||||
foreach($this->a_linked_scripts as $s_script)
|
||||
{
|
||||
echo "<script type=\"text/javascript\" src=\"$s_script\"></script>\n";
|
||||
@@ -285,5 +297,24 @@ class web_page
|
||||
$this->add("<input type=\"hidden\" name=\"".$sLabel."[$sKey]\" value=\"$sValue\">");
|
||||
}
|
||||
}
|
||||
|
||||
protected function get_base_tag()
|
||||
{
|
||||
$sTag = '';
|
||||
if (($this->a_base['href'] != '') || ($this->a_base['target'] != ''))
|
||||
{
|
||||
$sTag = '<base ';
|
||||
if (($this->a_base['href'] != ''))
|
||||
{
|
||||
$sTag .= "href =\"{$this->a_base['href']}\" ";
|
||||
}
|
||||
if (($this->a_base['target'] != ''))
|
||||
{
|
||||
$sTag .= "target =\"{$this->a_base['target']}\" ";
|
||||
}
|
||||
$sTag .= " />\n";
|
||||
}
|
||||
return $sTag;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -32,6 +32,21 @@ if (!empty($sExpression))
|
||||
{
|
||||
case 'html':
|
||||
$oP = new nice_web_page("iTop - Export");
|
||||
// The HTML output is made for pages located in the /pages/ folder
|
||||
// since this page is in a different folder, let's adjust the HTML 'base' attribute
|
||||
// to make the relative hyperlinks in the page work
|
||||
$sServerName = $_SERVER['SERVER_NAME'];
|
||||
$sProtocol = isset($_SERVER['HTTPS']) ? 'https' : 'http';
|
||||
if ($sProtocol == 'http')
|
||||
{
|
||||
$sPort = ($_SERVER['SERVER_PORT'] == 80) ? '' : ':'.$_SERVER['SERVER_PORT'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$sPort = ($_SERVER['SERVER_PORT'] == 443) ? '' : ':'.$_SERVER['SERVER_PORT'];
|
||||
}
|
||||
$sUrl = "$sProtocol://{$sServerName}{$sPort}/pages/";
|
||||
$oP->set_base($sUrl);
|
||||
cmdbAbstractObject::DisplaySet($oP, $oSet, array('menu' => false));
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user