diff --git a/application/cmdbabstract.class.inc.php b/application/cmdbabstract.class.inc.php
index dbe5665c2..83e54a317 100644
--- a/application/cmdbabstract.class.inc.php
+++ b/application/cmdbabstract.class.inc.php
@@ -14,7 +14,7 @@ abstract class cmdbAbstractObject extends CMDBObject
public static function GetUIPage()
{
- return './UI.php';
+ return '../pages/UI.php';
}
public static function ComputeUIPage($sClass)
@@ -40,6 +40,9 @@ abstract class cmdbAbstractObject extends CMDBObject
$oAppContext = new ApplicationContext();
$sExtClassNameAtt = MetaModel::GetNameAttributeCode($sObjClass);
$sPage = self::ComputeUIPage($sObjClass);
+ $sAbsoluteUrl = utils::GetAbsoluteUrl(false); // False => Don't get the query string
+ $sAbsoluteUrl = substr($sAbsoluteUrl, 0, 1+strrpos($sAbsoluteUrl, '/')); // remove the current page, keep just the path, up to the last /
+
// Use the "name" of the target class as the label of the hyperlink
// unless it's not available in the external attributes...
if (isset($aAvailableFields[$sExtClassNameAtt]))
@@ -71,7 +74,7 @@ abstract class cmdbAbstractObject extends CMDBObject
$sLabel = MetaModel::GetName($sObjClass)." #$sObjKey";
}
$sHint = MetaModel::GetName($sObjClass)."::$sObjKey";
- return "GetForLink()."\" title=\"$sHint\">$sLabel";
+ return "GetForLink()."\" title=\"$sHint\">$sLabel";
}
public function GetDisplayValue($sAttCode)
diff --git a/application/displayblock.class.inc.php b/application/displayblock.class.inc.php
index 10438b921..74d9f9e23 100644
--- a/application/displayblock.class.inc.php
+++ b/application/displayblock.class.inc.php
@@ -330,7 +330,7 @@ class DisplayBlock
{
$sHtml .= $oPage->GetP("No object to display.");
$sClass = $this->m_oFilter->GetClass();
- $bDisplayMenu = isset($this->m_aParams['menu']) ? $this->m_aParams['menu'] == true : true;
+ $bDisplayMenu = isset($aExtraParams['menu']) ? $aExtraParams['menu'] == true : true;
if ($bDisplayMenu)
{
if (UserRights::IsActionAllowed($sClass, UR_ACTION_MODIFY) == UR_ALLOWED_YES)
@@ -779,7 +779,7 @@ class MenuBlock extends DisplayBlock
}
else
{
- $sUrl = self::GetAbsoluteUrl();
+ $sUrl = utils::GetAbsoluteUrl();
$aActions[] = array ('label' => 'eMail', 'url' => "mailto:?subject=".$oSet->GetFilter()->__DescribeHTML()."&body=".urlencode("$sUrl?operation=search&filter=$sFilter&$sContext"));
$aActions[] = array ('label' => 'CSV Export', 'url' => "../pages/$sUIPage?operation=search&filter=$sFilter&format=csv&$sContext");
//$aActions[] = array ('label' => 'Bookmark...', 'url' => "../pages/ajax.render.php?operation=create&class=$sClass&filter=$sFilter", 'class' => 'jqmTrigger');
@@ -831,7 +831,7 @@ class MenuBlock extends DisplayBlock
else
{
// many objects in the set, possible actions are: new / modify all / delete all
- $sUrl = self::GetAbsoluteUrl();
+ $sUrl = utils::GetAbsoluteUrl();
$aActions[] = array ('label' => 'eMail', 'url' => "mailto:?subject=".$oSet->GetFilter()->__DescribeHTML()."&body=".urlencode("$sUrl?operation=search&filter=$sFilter&$sContext"));
$aActions[] = array ('label' => 'CSV Export', 'url' => "../pages/$sUIPage?operation=search&filter=$sFilter&format=csv&$sContext");
//$aActions[] = array ('label' => 'Bookmark...', 'url' => "../pages/ajax.render.php?operation=create&class=$sClass&filter=$sFilter", 'class' => 'jqmTrigger');
@@ -850,39 +850,5 @@ class MenuBlock extends DisplayBlock
$oPage->add_ready_script("$(\"ul.jd_menu\").jdMenu();\n");
return $sHtml;
}
-
- static public function GetAbsoluteUrl()
- {
- // Build an absolute URL to this page on this server/port
- $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'];
- }
- // $_SERVER['REQUEST_URI'] is empty when running on IIS
- // Let's use Ivan Tcholakov's fix (found on www.dokeos.com)
- if (!empty($_SERVER['REQUEST_URI']))
- {
- $sPath = $_SERVER['REQUEST_URI'];
- }
- else
- {
- $sPath = $_SERVER['SCRIPT_NAME'];
- if (!empty($_SERVER['QUERY_STRING']))
- {
- $sPath .= '?'.$_SERVER['QUERY_STRING'];
- }
- $_SERVER['REQUEST_URI'] = $sPath;
- }
- $sPath = $_SERVER['REQUEST_URI'];
- $sUrl = "$sProtocol://{$sServerName}{$sPort}{$sPath}";
-
- return $sUrl;
- }
}
?>
diff --git a/application/utils.inc.php b/application/utils.inc.php
index 3330714fb..6eb172280 100644
--- a/application/utils.inc.php
+++ b/application/utils.inc.php
@@ -147,5 +147,53 @@ class utils
}
return $iReturn;
}
+
+ /**
+ * Returns an absolute URL to the current page
+ * @param $bQueryString bool True to also get the query string, false otherwise
+ * @return string The absolute URL to the current page
+ */
+ static public function GetAbsoluteUrl($bQueryString = true)
+ {
+ // Build an absolute URL to this page on this server/port
+ $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'];
+ }
+ // $_SERVER['REQUEST_URI'] is empty when running on IIS
+ // Let's use Ivan Tcholakov's fix (found on www.dokeos.com)
+ if (!empty($_SERVER['REQUEST_URI']))
+ {
+ $sPath = $_SERVER['REQUEST_URI'];
+ }
+ else
+ {
+ $sPath = $_SERVER['SCRIPT_NAME'];
+ if (!empty($_SERVER['QUERY_STRING']))
+ {
+ $sPath .= '?'.$_SERVER['QUERY_STRING'];
+ }
+ $_SERVER['REQUEST_URI'] = $sPath;
+ }
+ $sPath = $_SERVER['REQUEST_URI'];
+ if (!$bQueryString)
+ {
+ // remove all the parameters from the query string
+ $iQuestionMarkPos = strpos($sPath, '?');
+ if ($iQuestionMarkPos !== false)
+ {
+ $sPath = substr($sPath, 0, $iQuestionMarkPos);
+ }
+ }
+ $sUrl = "$sProtocol://{$sServerName}{$sPort}{$sPath}";
+
+ return $sUrl;
+ }
}
?>
diff --git a/business/ServiceDesk.business.php b/business/ServiceDesk.business.php
index bdcd80347..ddb7244b6 100644
--- a/business/ServiceDesk.business.php
+++ b/business/ServiceDesk.business.php
@@ -139,11 +139,6 @@ class bizServiceCall extends cmdbAbstractObject
$this->Set('end_date', $oGenerator->GenerateString("2007-|number(07-12)|-|number(01-30)| |number(07-12)|:|number(00-59)|:|number(00-59)"));
}
- public static function GetUIPage()
- {
- return './UI.php';
- }
-
// State machine actions
diff --git a/business/incidentMgmt.business.php b/business/incidentMgmt.business.php
index 2a44a4672..b4b8c6d0a 100644
--- a/business/incidentMgmt.business.php
+++ b/business/incidentMgmt.business.php
@@ -134,11 +134,6 @@ class bizIncidentTicket extends cmdbAbstractObject
$this->Set('end_date', $oGenerator->GenerateString("2007-|number(07-12)|-|number(01-30)| |number(07-12)|:|number(00-59)|:|number(00-59)"));
}
- public static function GetUIPage()
- {
- return './UI.php';
- }
-
// State machine actions
public function IncrementAssignmentCount($sStimulusCode)
{