diff --git a/tags/0.7.2/application/displayblock.class.inc.php b/tags/0.7.2/application/displayblock.class.inc.php index 418d58647..f41ab6a28 100644 --- a/tags/0.7.2/application/displayblock.class.inc.php +++ b/tags/0.7.2/application/displayblock.class.inc.php @@ -612,20 +612,7 @@ class MenuBlock extends DisplayBlock } else { - // 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']; - } - $sPath = $_SERVER['REQUEST_URI']; - - $sUrl = "$sProtocol://{$sServerName}{$sPort}{$sPath}"; + $sUrl = self::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'); @@ -673,7 +660,8 @@ class MenuBlock extends DisplayBlock else { // many objects in the set, possible actions are: new / modify all / delete all - $aActions[] = array ('label' => 'eMail', 'url' => "mailto:?subject=".$oSet->GetFilter()->__DescribeHTML()."&body=".urlencode("http://localhost:81/pages/UI.php?operation=search&filter=$sFilter&$sContext")); + $sUrl = self::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'); if ($bIsModifyAllowed) { $aActions[] = array ('label' => 'New...', 'url' => "../pages/$sUIPage?operation=new&class=$sClass&$sContext"); } @@ -690,7 +678,25 @@ class MenuBlock extends DisplayBlock $sHtml .= "\n\n\n"; $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']; + } + $sPath = $_SERVER['REQUEST_URI']; + $sUrl = "$sProtocol://{$sServerName}{$sPort}{$sPath}"; + + return $sUrl; + } } ?>