[Fusionforge-commits] r12911 - trunk/src/plugins/oslc/include

Sabri LABBENE labbenes at fusionforge.org
Fri Mar 25 14:56:22 CET 2011


Author: labbenes
Date: 2011-03-25 14:56:22 +0100 (Fri, 25 Mar 2011)
New Revision: 12911

Modified:
   trunk/src/plugins/oslc/include/CompactRessource.class.php
   trunk/src/plugins/oslc/include/oslcPlugin.class.php
Log:
Add hooks that responds to content negociation from users script to display user tooltips.

Modified: trunk/src/plugins/oslc/include/CompactRessource.class.php
===================================================================
--- trunk/src/plugins/oslc/include/CompactRessource.class.php	2011-03-25 13:07:14 UTC (rev 12910)
+++ trunk/src/plugins/oslc/include/CompactRessource.class.php	2011-03-25 13:56:22 UTC (rev 12911)
@@ -32,7 +32,7 @@
 	public function compactUserLink($username, $user_id) {
 		$ressource_uri = util_make_url('/plugins/oslc/compact/user/'.$username);
 		$url = '<a href="'. util_make_url_u ($username, $user_id) . '"' .
-		' onmouseover="hover(\''. $ressource_uri . '\', \'compact_user_' . $username . '\');" onmouseout="closeHover();">' . 
+		' onmouseover="hover(\''. util_make_url_u ($username, $user_id) . '\', \'compact_user_' . $username . '\');" onmouseout="closeHover();">' . 
 		$username . '</a>';
 		// Add div that will contain the popup
 		$url .= '<div id="compact_user_'.$username.'"></div>';

Modified: trunk/src/plugins/oslc/include/oslcPlugin.class.php
===================================================================
--- trunk/src/plugins/oslc/include/oslcPlugin.class.php	2011-03-25 13:07:14 UTC (rev 12910)
+++ trunk/src/plugins/oslc/include/oslcPlugin.class.php	2011-03-25 13:56:22 UTC (rev 12911)
@@ -36,6 +36,8 @@
 		$this->_addHook("project_admin_plugins"); // to show up in the admin page fro group
 		$this->_addHook("user_link_with_tooltip"); 
 		$this->_addHook("javascript_file"); // Add js files for oslc plugin
+		$this->_addHook("script_accepted_types");
+		$this->_addHook("content_negociated_user_home");		
 	}
 
 	function CallHook ($hookname, &$params) {
@@ -158,8 +160,21 @@
 			$params['user_link'] = $CR->compactUserLink($params['username'], $params['user_id']);
 		}
 		elseif ($hookname == "javascript_file") {
-			echo '<script type="text/javascript" src="/plugins/oslc/scripts/pluginOSLCHoverScripts.js"></script>'."\n";
+			use_javascript('/plugins/oslc/scripts/pluginOSLCHoverScripts.js');
 		}
+		elseif($hookname == "script_accepted_types"){
+			$script = $params['script']; 
+			if ($script == 'user_home') { 
+				$params['accepted_types'][] = 'application/x-oslc-compact+xml'; 
+			} 
+		}
+		elseif($hookname == "content_negociated_user_home") {
+			$username = $params['username']; 
+			$accept = $params['accept']; 
+			if($accept == 'application/x-oslc-compact+xml') {
+				$params['return'] = '/plugins/oslc/compact/user/'.$username;
+			}
+		}
 		elseif ($hookname == "blahblahblah") {
 			// ...
 		} 




More information about the Fusionforge-commits mailing list