[Fusionforge-commits] FusionForge branch 5.2-admssw updated. eec35089e9ef79a992e1a90e093e150c124e8a4f

Olivier Berger olberger at fusionforge.org
Thu Feb 21 11:09:57 CET 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, 5.2-admssw has been updated
       via  eec35089e9ef79a992e1a90e093e150c124e8a4f (commit)
       via  f7ed8fdbc0028c98c384bfa84419b5fe980b7811 (commit)
       via  cc50ff050e3b642a15e90bbda3d03c3095922d7d (commit)
       via  6c6914b756bc68a25aa6a66661aae71bc80dee59 (commit)
       via  778e62852f526afa91f03161303e4b41285f7c19 (commit)
       via  a5b182ba4a7326fd14977be00ebe21c9ea498901 (commit)
      from  60c1937d0a73db1c71154b75da5eacce6c662288 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit eec35089e9ef79a992e1a90e093e150c124e8a4f
Author: Olivier Berger <olivier.berger at telecom-sudparis.eu>
Date:   Thu Feb 21 11:08:25 2013 +0100

    Make sure RDF description of a single project is extensive, while still rather minimal in default project list

diff --git a/src/docs/README.Plugins b/src/docs/README.Plugins
index ab491f2..613f65d 100644
--- a/src/docs/README.Plugins
+++ b/src/docs/README.Plugins
@@ -506,6 +506,7 @@ TODO : document Auth plugins :
   Parameters : $params['prefixes'] : already used RDF prefixes in the form URL => shortname, 
                $hook_params['group'] : group_id of the project,
 			   $hook_params['in_Resource'] : (read-only) ARC2 resource already available,
+			   $hook_params['details'] : 'full' or 'minimal' whether requesting a detailed or minimal description
 			   $hook_params['out_Resources'] : (write) to be returned the new ARC2 resource 
   Description: returns in $params['prefixes'] and $params['out_Resources'] added prefixes and ARC2 RDF resource to be included in the project's DOAP description 
 
diff --git a/src/plugins/admssw/include/admsswPlugin.class.php b/src/plugins/admssw/include/admsswPlugin.class.php
index 591f7b0..bd4bdf7 100644
--- a/src/plugins/admssw/include/admsswPlugin.class.php
+++ b/src/plugins/admssw/include/admsswPlugin.class.php
@@ -187,14 +187,14 @@ class admsswPlugin extends Plugin {
 	 */
 	public function htmlPreviewProjectAsTurtle($group_id) {
 	
-		$resourceindex = $this->getProjectResourceIndex($group_id);
-
+		$detailed = true;
+		
 		$graph = new Graphite();
 	
 		$this->graphSetAdmsswNameSpaces($graph);
-		
-		$count = $graph->addTriples( ARC2::getTriplesFromIndex($resourceindex) );
-	
+
+		$resourceindex = $this->addProjectResourceToGraph($graph, $group_id, $detailed);
+			
 		return $graph->dump();
 	}
 	
@@ -203,14 +203,14 @@ class admsswPlugin extends Plugin {
 	 * 
 	 * @param int $group_id
 	 */
-	private function getProjectResourceIndex($group_id) {
+	private function addProjectResourceToGraph(&$graph, $group_id, $detailed = false) {
 
 		// part of the work is done by the doaprdf plugin, which will in turn call us back (see project_rdf_metadata)	
 		$doaprdfplugin = plugin_get_object ("doaprdf");
 		
 		$ns = $this->admsswNameSpaces();
 		
-		$resourceindex = $doaprdfplugin->getProjectResourceIndex($group_id, $ns);
+		$resourceindex = $doaprdfplugin->getProjectResourceIndex($group_id, $ns, $detailed);
 		
 		// update the namespaces if they happen to get updated in between
 		foreach($ns as $s => $u)
@@ -220,7 +220,9 @@ class admsswPlugin extends Plugin {
 			}
 		}
 		
-		return $resourceindex;
+		$count = $graph->addTriples( ARC2::getTriplesFromIndex($resourceindex) );
+		
+		return $graph;
 	}
 	
 	/**
@@ -244,6 +246,11 @@ class admsswPlugin extends Plugin {
 			}
 		}
 		
+		$detailed = false;
+		if ($params['details'] == 'full') {
+			$detailed = true;
+		}
+		
 		// The ARC2 RDF_Resource already initialized by doaprdf plugin
 		$res = $params['in_Resource'];
 	
@@ -386,6 +393,27 @@ class admsswPlugin extends Plugin {
 		rdfutils_setPropToUri($res, 'rdfs:seeAlso', util_make_url ('/frs/?group_id='.$group_id));
 		
 		$params['out_Resources'][] = $res;
+		
+		if ($detailed) {
+			$graph = new Graphite();
+			$this->graphSetAdmsswNameSpaces($graph);
+			
+			$this->addProjectFrsResourcesToGraph($graph, $group_id);
+			
+			$subjects = $graph->allSubjects();
+			foreach ($subjects as $subject) {
+				$resource = $graph->resource( $subject );
+				$triples = $resource->toArcTriples();
+				
+				$index = ARC2::getSimpleIndex($triples, false);
+				
+				$res = ARC2::getResource();
+				$res->setIndex($index);
+				
+				$params['out_Resources'][] = $res;				
+			}
+		}
+		
 
 	}
 	
@@ -440,16 +468,10 @@ class admsswPlugin extends Plugin {
 		$count = $graph->addTriples( ARC2::getTriplesFromIndex($res->index) );
 
 		// if needed, provide also full details about the projects
-		if($detailed) {
-			foreach ($projects as $row_grp) {
+		foreach ($projects as $row_grp) {
 				$group_id = $row_grp['group_id'];
 				//$proj_uri = util_make_url_g(strtolower($row_grp['unix_group_name']),$row_grp['group_id']);
-				$resindex = $this->getProjectResourceIndex($row_grp['group_id']);
-				$count = $graph->addTriples( ARC2::getTriplesFromIndex($resindex) );
-				
-				$this->addProjectFrsResourcesToGraph($graph, $group_id);
-				
-			}
+				$count = $this->addProjectResourceToGraph($graph, $row_grp['group_id'], $detailed);				
 		}
 		
 		$this->graphSetAdmsswNameSpaces($graph);
diff --git a/src/plugins/doaprdf/include/doaprdfPlugin.class.php b/src/plugins/doaprdf/include/doaprdfPlugin.class.php
index b49d1b7..1e567de 100644
--- a/src/plugins/doaprdf/include/doaprdfPlugin.class.php
+++ b/src/plugins/doaprdf/include/doaprdfPlugin.class.php
@@ -63,7 +63,7 @@ class doaprdfPlugin extends Plugin {
 		return $ns;
 	}
 	
-	function getProjectResourceIndex($group_id, &$ns) {
+	function getProjectResourceIndex($group_id, &$ns, $detailed = false) {
 
 		// connect to FusionForge internals
 		$pm = ProjectManager::instance();
@@ -115,6 +115,12 @@ class doaprdfPlugin extends Plugin {
 		// pass the resource in case it could be useful (read-only in principle)
 		$hook_params['in_Resource'] = $res;
 		$hook_params['out_Resources'] = array();
+		if ($detailed) {
+			$hook_params['details'] = 'full';
+		} 
+		else {
+			$hook_params['details'] = 'minimal';
+		}
 		plugin_hook_by_reference('project_rdf_metadata', $hook_params);
 		
 		// add new prefixes to the list
@@ -150,7 +156,7 @@ class doaprdfPlugin extends Plugin {
 
 			$ns = $this->doapNameSpaces();
 			
-			$merged_index = $this->getProjectResourceIndex($group_id, $ns);
+			$merged_index = $this->getProjectResourceIndex($group_id, $ns, $detailed = true);
 				
 			$conf = array(
 					'ns' => $ns,

commit f7ed8fdbc0028c98c384bfa84419b5fe980b7811
Author: Olivier Berger <olivier.berger at telecom-sudparis.eu>
Date:   Wed Feb 20 22:38:21 2013 +0100

    Fix alternate representation URLs

diff --git a/src/plugins/admssw/include/admsswPlugin.class.php b/src/plugins/admssw/include/admsswPlugin.class.php
index dc755c2..591f7b0 100644
--- a/src/plugins/admssw/include/admsswPlugin.class.php
+++ b/src/plugins/admssw/include/admsswPlugin.class.php
@@ -76,7 +76,7 @@ class admsswPlugin extends Plugin {
 		}
 
 		$this->_addHook("project_rdf_metadata"); // will provide some RDF metadata for the project's DOAP profile to 'doaprdf' plugin		
-		$this->_addHook("alt_representations"); // supports conneg (content-negociation) for alternate representations of some scripts
+		$this->_addHook("alt_representations"); // declares a link to itself in the link+meta HTML headers of /projects and /softwaremap
 		$this->_addHook("script_accepted_types"); // supported alternate content-types (Accept HTTP header values)
 		$this->_addHook("content_negociated_projects_list"); // registers to be able to return content-negociated content for /projects/...
 		$this->_addHook("softwaremap_links"); // display additional submenu in the softwaremap tool
@@ -111,11 +111,18 @@ class admsswPlugin extends Plugin {
 	public function alt_representations (&$params) {
 		$script_name = $params['script_name'];
 		$php_self = $params['php_self'];
-		$php_self = substr($php_self,0,strpos($php_self,'/',1));
-		if ($php_self == '/projects' || $php_self == '/softwaremap') {
-			$params['return'][] = '<link rel="meta" type="application/rdf+xml" title="ADMS.SW RDF Data" href="'. util_make_url ("/projects") .'"/>';
-			$params['return'][] = '<link rel="meta" type="text/turtle" title="ADMS.SW RDF Data" href="'. util_make_url ("/projects") .'"/>';
+		if ($php_self == '/softwaremap/trove_list.php') {
+			$params['return'][] = '<link rel="alternate" type="application/rdf+xml" title="ADMS.SW RDF Data" href="'. util_make_url ("/plugins/admssw/trove.php") .'"/>';
+			$params['return'][] = '<link rel="alternate" type="text/turtle" title="ADMS.SW RDF Data" href="'. util_make_url ("/plugins/admssw/trove.php") .'"/>';
 		}
+		elseif ($script_name == '/softwaremap') {
+			$params['return'][] = '<link rel="alternate" type="application/rdf+xml" title="ADMS.SW RDF Data" href="'. util_make_url ("/projects") .'"/>';
+			$params['return'][] = '<link rel="alternate" type="text/turtle" title="ADMS.SW RDF Data" href="'. util_make_url ("/projects") .'"/>';
+		}
+		else if($script_name == '/projects') {
+			$params['return'][] = '<link rel="alternate" type="application/rdf+xml" title="ADMS.SW RDF Data" href="'. util_make_url ($php_self) .'"/>';
+			$params['return'][] = '<link rel="alternate" type="text/turtle" title="ADMS.SW RDF Data" href="'. util_make_url ($php_self) .'"/>';
+		} 
 	}
 	
 	/**
@@ -137,7 +144,7 @@ class admsswPlugin extends Plugin {
 	 */
 	public function project_after_description (&$params) {
 		$group_id = $params['group_id'];
-		print '<br />'. sprintf( _('View <a href="%1$s">ADMS.SW meta-data</a> about the project'), util_make_url ('/plugins/'. $this->name .'/projectturtle.php?group_id='.$group_id));
+		print '<br />'. sprintf( _('Preview <a href="%1$s">ADMS.SW meta-data</a> about the project'), util_make_url ('/plugins/'. $this->name .'/projectturtle.php?group_id='.$group_id));
 	}
 	
 	

commit cc50ff050e3b642a15e90bbda3d03c3095922d7d
Author: Olivier Berger <olivier.berger at telecom-sudparis.eu>
Date:   Wed Feb 20 22:36:12 2013 +0100

    Add navigation menus

diff --git a/src/plugins/admssw/www/full.php b/src/plugins/admssw/www/full.php
index 23f8d00..1a4b47a 100644
--- a/src/plugins/admssw/www/full.php
+++ b/src/plugins/admssw/www/full.php
@@ -55,7 +55,8 @@ if($content_type != $default_content_type) {
 		exit(0);
 	}
 } else {
-	$HTML->header(array('title'=>'Full ADMS.SW export','pagename'=>'admssw_full'));
+	$HTML->header(array('title'=>_('Full ADMS.SW export'),'pagename'=>'admssw_full'));
+	$HTML->printSoftwareMapLinks();
 	
 	echo '<p>'. _('This script is meant to produce machine-readable RDF meta-data, in Turtle or RDF/XML formats, which can be obtained with, for instance:').'<br />';
 	
diff --git a/src/plugins/admssw/www/index.php b/src/plugins/admssw/www/index.php
index 852a084..5cdb7ae 100644
--- a/src/plugins/admssw/www/index.php
+++ b/src/plugins/admssw/www/index.php
@@ -34,7 +34,8 @@ require_once $gfcommon.'include/pre.php';
 
 $pluginname = 'admssw';
 
-$HTML->header(array('title'=>'ADMS.SW','pagename'=>'admssw'));
+$HTML->header(array('title'=>_('ADMS.SW'),'pagename'=>'admssw'));
+$HTML->printSoftwareMapLinks();
 
 echo '<p>'._('Preview of RDF meta-data about the forge, conforming to the ADMS.SW specifications').'</p>';
 
diff --git a/src/plugins/admssw/www/projectsturtle.php b/src/plugins/admssw/www/projectsturtle.php
index 7760809..925131c 100644
--- a/src/plugins/admssw/www/projectsturtle.php
+++ b/src/plugins/admssw/www/projectsturtle.php
@@ -34,7 +34,8 @@ require_once $gfcommon.'include/pre.php';
 
 $pluginname = 'admssw';
 
-$HTML->header(array('title'=>'ADMS.SW','pagename'=>'admssw'));
+$HTML->header(array('title'=>_('ADMS.SW meta-data index of public projects'),'pagename'=>'admssw'));
+$HTML->printSoftwareMapLinks();
 
 $plugin = plugin_get_object ($pluginname);
 
diff --git a/src/plugins/admssw/www/projectturtle.php b/src/plugins/admssw/www/projectturtle.php
index dd69060..8d54e6d 100644
--- a/src/plugins/admssw/www/projectturtle.php
+++ b/src/plugins/admssw/www/projectturtle.php
@@ -41,7 +41,7 @@ session_require_perm ('project_read', $group_id) ;
 $group = &group_get_object($group_id);
 $projectname = $group->getUnixName();
 
-$HTML->header(array('title'=>'ADMS.SW project meta-data preview','pagename'=>'projectturtle'));
+site_project_header(array('title'=>_('ADMS.SW project meta-data preview'), 'h1' => '', 'group'=>$group_id, 'toptab' => 'home', 'pagename'=>'projectturtle'));
 
 $plugin = plugin_get_object($pluginname);
 
diff --git a/src/plugins/admssw/www/trove.php b/src/plugins/admssw/www/trove.php
index 0e2df47..b0db59d 100644
--- a/src/plugins/admssw/www/trove.php
+++ b/src/plugins/admssw/www/trove.php
@@ -34,7 +34,8 @@ require_once $gfcommon.'include/pre.php';
 
 $pluginname = 'admssw';
 
-$HTML->header(array('title'=>'ADMS.SW','pagename'=>'trove'));
+$HTML->header(array('title'=>_('SKOS meta-data for trove categories'),'pagename'=>'trove'));
+$HTML->printSoftwareMapLinks();
 
 $plugin = plugin_get_object ($pluginname);
 

commit 6c6914b756bc68a25aa6a66661aae71bc80dee59
Author: Olivier Berger <olivier.berger at telecom-sudparis.eu>
Date:   Wed Feb 20 22:31:33 2013 +0100

    Fix meta->alternate

diff --git a/src/plugins/doaprdf/include/doaprdfPlugin.class.php b/src/plugins/doaprdf/include/doaprdfPlugin.class.php
index a9e585e..b49d1b7 100644
--- a/src/plugins/doaprdf/include/doaprdfPlugin.class.php
+++ b/src/plugins/doaprdf/include/doaprdfPlugin.class.php
@@ -180,8 +180,8 @@ class doaprdfPlugin extends Plugin {
 		$php_self = $params['php_self'];
 		// really trigger only for real projects descriptions, not for the projects index
 		if ( ($script_name == '/projects') && (($php_self != '/projects') && ($php_self != '/projects/')) ) {
-			$params['return'][] = '<link rel="meta" type="application/rdf+xml" title="DOAP RDF Data" href=""/>';
-			$params['return'][] = '<link rel="meta" type="test/turtle" title="DOAP RDF Data" href=""/>';
+			$params['return'][] = '<link rel="alternate" type="application/rdf+xml" title="DOAP RDF Data" href=""/>';
+			$params['return'][] = '<link rel="alternate" type="test/turtle" title="DOAP RDF Data" href=""/>';
 		}
 	}
 	

commit 778e62852f526afa91f03161303e4b41285f7c19
Author: Olivier Berger <olivier.berger at telecom-sudparis.eu>
Date:   Wed Feb 20 22:31:12 2013 +0100

    Make sure alternate links are also displayed for /projects/PROJNAME

diff --git a/src/www/include/Layout.class.php b/src/www/include/Layout.class.php
index d2f959a..3dc4007 100644
--- a/src/www/include/Layout.class.php
+++ b/src/www/include/Layout.class.php
@@ -367,10 +367,15 @@ class Layout extends Error {
  	 * 		representations for Linked Data autodiscovery
  	 */
 	function headerLinkedDataAutodiscovery() {
-		// Only activated for /projects or /users for the moment
+
+		// retrieve the script's prefix
 		$script_name = getStringFromServer('SCRIPT_NAME');
-		$script_name = substr($script_name,0,strpos($script_name,'/',1));
+		$end = strpos($script_name,'/',1);
+		if($end) {
+			$script_name = substr($script_name,0,$end);
+		}
 		
+		// Only activated for /projects, /users or /softwaremap for the moment 
 		if ($script_name == '/projects' || $script_name == '/users' || $script_name == '/softwaremap') {
 
 			$php_self = getStringFromServer('PHP_SELF');

commit a5b182ba4a7326fd14977be00ebe21c9ea498901
Author: Olivier Berger <olivier.berger at telecom-sudparis.eu>
Date:   Wed Feb 20 22:30:16 2013 +0100

    Better comments

diff --git a/src/www/include/Layout.class.php b/src/www/include/Layout.class.php
index 477fe34..d2f959a 100644
--- a/src/www/include/Layout.class.php
+++ b/src/www/include/Layout.class.php
@@ -363,7 +363,7 @@ class Layout extends Error {
 	}
 
 	/**
- 	 * headerLinkedDataAutodiscovery() - creates the link+meta links to alternate
+ 	 * headerLinkedDataAutodiscovery() - creates the link+alternate links to alternate
  	 * 		representations for Linked Data autodiscovery
  	 */
 	function headerLinkedDataAutodiscovery() {
@@ -375,7 +375,8 @@ class Layout extends Error {
 
 			$php_self = getStringFromServer('PHP_SELF');
 			
-			// invoke the 'alt_representations' hook to add potential meta links (useful for Linked Data)
+			// invoke the 'alt_representations' hook to add potential 'alternate' links (useful for Linked Data)
+			// cf. http://www.w3.org/TR/cooluris/#linking
 			$params = array('script_name' => $script_name,
 							'php_self' => $php_self,
 							'return' => array());

-----------------------------------------------------------------------

Summary of changes:
 src/docs/README.Plugins                            |    1 +
 src/plugins/admssw/include/admsswPlugin.class.php  |   73 ++++++++++++++------
 src/plugins/admssw/www/full.php                    |    3 +-
 src/plugins/admssw/www/index.php                   |    3 +-
 src/plugins/admssw/www/projectsturtle.php          |    3 +-
 src/plugins/admssw/www/projectturtle.php           |    2 +-
 src/plugins/admssw/www/trove.php                   |    3 +-
 .../doaprdf/include/doaprdfPlugin.class.php        |   14 ++--
 src/www/include/Layout.class.php                   |   14 ++--
 9 files changed, 81 insertions(+), 35 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list