Преглед изворни кода

Notifications template may specify this->hyperlink(portal) (and fixed issues in sample data)

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@805 a333f486-631f-4898-b8df-5754b55c2be0
romainq пре 14 година
родитељ
комит
1dd3bad9a8

+ 13 - 0
application/utils.inc.php

@@ -189,6 +189,7 @@ class utils
     /**
     /**
      * Returns an absolute URL to the current page
      * Returns an absolute URL to the current page
      * @param $bQueryString bool True to also get the query string, false otherwise
      * @param $bQueryString bool True to also get the query string, false otherwise
+     * @param $bForceHTTPS bool True to force HTTPS, false otherwise
      * @return string The absolute URL to the current page
      * @return string The absolute URL to the current page
      */                   
      */                   
 	static public function GetAbsoluteUrl($bQueryString = true, $bForceHTTPS = false)
 	static public function GetAbsoluteUrl($bQueryString = true, $bForceHTTPS = false)
@@ -248,6 +249,18 @@ class utils
 		return $sUrl;
 		return $sUrl;
 	}
 	}
 	
 	
+    /**
+     * Returns the absolute URL PATH of the current page
+     * @param $bForceHTTPS bool True to force HTTPS, false otherwise
+     * @return string The absolute URL to the current page
+     */                   
+	static public function GetAbsoluteUrlPath($bForceHTTPS = false)
+	{
+		$sAbsoluteUrl = self::GetAbsoluteUrl(false, $bForceHTTPS); // 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 /
+		return $sAbsoluteUrl;
+	}
+
 	/**
 	/**
 	 * Tells whether or not log off operation is supported.
 	 * Tells whether or not log off operation is supported.
 	 * Actually in only one case:
 	 * Actually in only one case:

+ 3 - 2
core/dbobject.class.php

@@ -1130,8 +1130,9 @@ abstract class DBObject
 			$aScalarArgs[$sArgName.'->id'] = $this->GetKey();
 			$aScalarArgs[$sArgName.'->id'] = $this->GetKey();
 			$aScalarArgs[$sArgName.'->object()'] = $this;
 			$aScalarArgs[$sArgName.'->object()'] = $this;
 			$aScalarArgs[$sArgName.'->hyperlink()'] = $this->GetHyperlink();
 			$aScalarArgs[$sArgName.'->hyperlink()'] = $this->GetHyperlink();
-			// #@# Prototype for a user portal - to be dehardcoded later 
-			$aScalarArgs[$sArgName.'->hyperlink(portal)'] = '../portal/index.php?operation=details&id='.$this->GetKey();
+			// #@# Prototype for a user portal - to be dehardcoded later
+			$sToPortal = utils::GetAbsoluteUrlPath().'portal/index.php?operation=details&id='.$this->GetKey();
+			$aScalarArgs[$sArgName.'->hyperlink(portal)'] = '<a href="'.$sToPortal.'">'.$this->GetName().'</a>';
 			$aScalarArgs[$sArgName.'->name()'] = $this->GetName();
 			$aScalarArgs[$sArgName.'->name()'] = $this->GetName();
 		
 		
 			$sClass = get_class($this);
 			$sClass = get_class($this);

+ 3 - 4
modules/itop-tickets-1.0.0/data.struct.ta-actions.xml

@@ -54,14 +54,13 @@
 <to>SELECT Person WHERE id=:this-&gt;caller_id</to>
 <to>SELECT Person WHERE id=:this-&gt;caller_id</to>
 <cc></cc>
 <cc></cc>
 <bcc></bcc>
 <bcc></bcc>
-<subject>Ticket $this-&gt;name()$, priority $this-&gt;label(priority)$ - $this-&gt;ticket_status$</subject>
+<subject>Ticket $this-&gt;name()$, priority $this-&gt;label(priority)$ - $this-&gt;status$</subject>
 <body>&lt;html&gt;
 <body>&lt;html&gt;
 &lt;body&gt;
 &lt;body&gt;
-&lt;p&gt;The incident ticket $this-&gt;name()$ has changed to status $this-&gt;ticket_status$&lt;/p&gt;
-&lt;p&gt;Current situation: $this-&gt;current_situation$&lt;/p&gt;
+&lt;p&gt;The incident ticket $this-&gt;name()$ has changed to status $this-&gt;status$&lt;/p&gt;
 &lt;p&gt;Last update: $this-&gt;last_update$&lt;/p&gt;
 &lt;p&gt;Last update: $this-&gt;last_update$&lt;/p&gt;
 &lt;hr/&gt;
 &lt;hr/&gt;
-&lt;p&gt;for more information on this ticket, click here: $this-&gt;hyperlink()$&lt;/p&gt;
+&lt;p&gt;for more information on this ticket, click here: $this-&gt;hyperlink(portal)$&lt;/p&gt;
 &lt;/body&gt;
 &lt;/body&gt;
 &lt;/html&gt;</body>
 &lt;/html&gt;</body>
 <importance>normal</importance>
 <importance>normal</importance>