[Fusionforge-commits] r12474 - in trunk: . src/plugins src/plugins/projectimport src/plugins/projectimport/common src/plugins/projectimport/etc src/plugins/projectimport/etc/plugins src/plugins/projectimport/etc/plugins/projectimport src/plugins/projectimport/www

Olivier Berger olberger at fusionforge.org
Tue Mar 1 21:53:14 CET 2011


Author: olberger
Date: 2011-03-01 21:53:14 +0100 (Tue, 01 Mar 2011)
New Revision: 12474

Added:
   trunk/src/plugins/projectimport/
   trunk/src/plugins/projectimport/INSTALL
   trunk/src/plugins/projectimport/README
   trunk/src/plugins/projectimport/bin/
   trunk/src/plugins/projectimport/common/
   trunk/src/plugins/projectimport/common/ProjectImportPlugin.class.php
   trunk/src/plugins/projectimport/common/ProjectImporter.class.php
   trunk/src/plugins/projectimport/common/languages/
   trunk/src/plugins/projectimport/common/projectimport-init.php
   trunk/src/plugins/projectimport/etc/
   trunk/src/plugins/projectimport/etc/plugins/
   trunk/src/plugins/projectimport/etc/plugins/projectimport/
   trunk/src/plugins/projectimport/etc/plugins/projectimport/config.php
   trunk/src/plugins/projectimport/www/
   trunk/src/plugins/projectimport/www/index.php
Modified:
   trunk/
Log:
Adding projectimport plugin


Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk:8721-8727
/branches/Branch_5_0:8892,8895,8897-8898,8900,8903-8904,8906-8907,8910,8915,8922,8924,8926,8929,8931-8933,8941,8946,8951,8955,8972-8977,8981,8997,8999,9002,9031-9032,9050,9080-9081,9084-9086,9093-9095,9102-9104,9108,9113-9115,9117-9118,9123,9125,9127-9131,9135-9136,9139,9146,9148-9150,9179-9191,9193-9195,9198,9200,9202,9204,9207,9209,9211,9213,9215,9220-9222,9231,9234-9235,9243,9251,9254,9259,9287,9315,9318,9347-9349,9358,9396,9427,9429,9431-9433,9441-9442,9444-9445,9462,9464,9468,9522-9523,9549,9551-9552,9576-9577,9579,9615,9633-9634,9672-9673,9675-9676,9684,9686-9687,9689,9699,9727,9729,9731,9930-9932,9935,9956,9980,10005-10006,10021,10024,10027,10064,10081-10082,10273,10285,10820-10824,10868,10872,10876-10878,10880,10918,11015,11017,11058-11060,11085-11086,11160-11165,11252-11253,11287,11294,11581,11619-11620,11679,11722-11723,11907,11974
/branches/Branch_4_8:7334-7335,7344-7345,7382,7387,7389-7390,7396,7398,7401-7402,7428-7429,7437,7440,7443,7449-7455,7459,7462,7466,7469-7470,7476-7478,7480,7485,7490-7492,7505,7540,7556-7560,7568,7570-7571,7573,7576,7580,7609-7611,7613,7615,7618,7621-7622,7625-7627,7639,7658,7661,7663-7664,7666-7667,7673,7675,7678,7680,7685,7688-7689,7693,7700,7706-7708,7713,7725,7728-7742,7760,7763-7764,7767,7769-7770,7773,7776,7784-7785,7791,7797,7799,7802-7808,7810-7811,7816,7818,7825-7828,7839,7846-7847,7850,7894,7902,7920-7922,7927-7928,7932,7936-7937,7939,7942,7944-7945,7947,7951,7956,7958,7960,8064,8079-8080,8108,8113,8119,8121,8127-8128,8145,8197,8201-8202,8216,8224,8226,8228,8247-8250,8252,8271-8272,8310-8311,8328,8337,8339-8357,8361,8371,8373-8375,8378-8379,8383-8396,8415,8427-8431,8438-8441,8449,8452-8453,8458,8461,8477-8478,8480,8482,8492,8514,8530,8604-8605,8608,8637,8662,8674,8751,8754,8756,8760-8761,8812,8850,8945,8995,8998,9004-9006,9124,9137,9141,9317,9443,9469,9670,9701,9726,9934,10013
/branches/Branch_5_1:11607-11609,11621,11625,11627,11631,11638,11644,11647-11651,11677,11680-11681,11683-11684,11719-11720,11724,11754,11780,11783,11792,11794,11802,11808-11816,11818,11822-11824,11827-11829,11834-11835,11847,11849,11851-11852,11855,11858,11862,11867,11869-11872,11876,11880,11893,11902-11905,11915,11923-11927,11929-11930,11932,11934-11941,11943,11948-11949,11952-11954,11956-11960,11962,11965-11966,11972,11975,11980,11983-11984,11986-11987,11990,11992-11997,12003-12004,12010-12013,12015,12018-12023,12024,12043-12044,12046-12050,12051-12061,12063,12065,12070,12073-12074,12075-12076,12081-12083,12093-12094,12102,12105,12118,12124,12127-12128,12139,12141,12143,12148-12149,12153,12157-12159,12168-12169,12175-12180,12190,12194-12198,12203,12208-12213,12217-12258,12262,12264-12266
/branches/Branch_4_7:6879,6881,6884,6897,6899,6902,6904,6906,6909,6911,6922,6932,6936,6939,6942,6944,6946-6948,6954,6956,6959,7000-7001,7012,7111,7130-7131,7133-7134,7138,7140-7142,7147-7148,7159-7160,7163,7168,7177,7179,7203,7205,7207,7210,7212,7251-7253,7255,7284,7287,7291,7293,7295-7296,7300,7355,7365-7366,7375-7376,7378,7395,7423-7426,7435,7458,7504,7567,7577,7623-7624,7638,7659-7660,7662,7665,7668,7674,7699,7746-7748,7771,7774,7786,7838

   + /trunk:8721-8727
/branches/Branch_4_7:6879,6881,6884,6897,6899,6902,6904,6906,6909,6911,6922,6932,6936,6939,6942,6944,6946-6948,6954,6956,6959,7000-7001,7012,7111,7130-7131,7133-7134,7138,7140-7142,7147-7148,7159-7160,7163,7168,7177,7179,7203,7205,7207,7210,7212,7251-7253,7255,7284,7287,7291,7293,7295-7296,7300,7355,7365-7366,7375-7376,7378,7395,7423-7426,7435,7458,7504,7567,7577,7623-7624,7638,7659-7660,7662,7665,7668,7674,7699,7746-7748,7771,7774,7786,7838
/branches/Branch_5_1:11607-11609,11621,11625,11627,11631,11638,11644,11647-11651,11677,11680-11681,11683-11684,11719-11720,11724,11754,11780,11783,11792,11794,11802,11808-11816,11818,11822-11824,11827-11829,11834-11835,11847,11849,11851-11852,11855,11858,11862,11867,11869-11872,11876,11880,11893,11902-11905,11915,11923-11927,11929-11930,11932,11934-11941,11943,11948-11949,11952-11954,11956-11960,11962,11965-11966,11972,11975,11980,11983-11984,11986-11987,11990,11992-11997,12003-12004,12010-12013,12015,12018-12023,12024,12043-12044,12046-12050,12051-12061,12063,12065,12070,12073-12074,12075-12076,12081-12083,12093-12094,12102,12105,12118,12124,12127-12128,12139,12141,12143,12148-12149,12153,12157-12159,12168-12169,12175-12180,12190,12194-12198,12203,12208-12213,12217-12258,12262,12264-12266
/branches/Branch_4_8:7334-7335,7344-7345,7382,7387,7389-7390,7396,7398,7401-7402,7428-7429,7437,7440,7443,7449-7455,7459,7462,7466,7469-7470,7476-7478,7480,7485,7490-7492,7505,7540,7556-7560,7568,7570-7571,7573,7576,7580,7609-7611,7613,7615,7618,7621-7622,7625-7627,7639,7658,7661,7663-7664,7666-7667,7673,7675,7678,7680,7685,7688-7689,7693,7700,7706-7708,7713,7725,7728-7742,7760,7763-7764,7767,7769-7770,7773,7776,7784-7785,7791,7797,7799,7802-7808,7810-7811,7816,7818,7825-7828,7839,7846-7847,7850,7894,7902,7920-7922,7927-7928,7932,7936-7937,7939,7942,7944-7945,7947,7951,7956,7958,7960,8064,8079-8080,8108,8113,8119,8121,8127-8128,8145,8197,8201-8202,8216,8224,8226,8228,8247-8250,8252,8271-8272,8310-8311,8328,8337,8339-8357,8361,8371,8373-8375,8378-8379,8383-8396,8415,8427-8431,8438-8441,8449,8452-8453,8458,8461,8477-8478,8480,8482,8492,8514,8530,8604-8605,8608,8637,8662,8674,8751,8754,8756,8760-8761,8812,8850,8945,8995,8998,9004-9006,9124,9137,9141,9317,9443,9469,9670,9701,9726,9934,10013
/branches/Branch_5_0:8892,8895,8897-8898,8900,8903-8904,8906-8907,8910,8915,8922,8924,8926,8929,8931-8933,8941,8946,8951,8955,8972-8977,8981,8997,8999,9002,9031-9032,9050,9080-9081,9084-9086,9093-9095,9102-9104,9108,9113-9115,9117-9118,9123,9125,9127-9131,9135-9136,9139,9146,9148-9150,9179-9191,9193-9195,9198,9200,9202,9204,9207,9209,9211,9213,9215,9220-9222,9231,9234-9235,9243,9251,9254,9259,9287,9315,9318,9347-9349,9358,9396,9427,9429,9431-9433,9441-9442,9444-9445,9462,9464,9468,9522-9523,9549,9551-9552,9576-9577,9579,9615,9633-9634,9672-9673,9675-9676,9684,9686-9687,9689,9699,9727,9729,9731,9930-9932,9935,9956,9980,10005-10006,10021,10024,10027,10064,10081-10082,10273,10285,10820-10824,10868,10872,10876-10878,10880,10918,11015,11017,11058-11060,11085-11086,11160-11165,11252-11253,11287,11294,11581,11619-11620,11679,11722-11723,11907,11974


Added: trunk/src/plugins/projectimport/INSTALL
===================================================================
--- trunk/src/plugins/projectimport/INSTALL	                        (rev 0)
+++ trunk/src/plugins/projectimport/INSTALL	2011-03-01 20:53:14 UTC (rev 12474)
@@ -0,0 +1,21 @@
+0. INSTALLATION of Helloworld Plugin
+
+Let's say that you have installed FusionForge in $GFORGEDIR (for instance /srv/www/gforge/)
+
+The plugins should be installed in the directory $GFORGEDIR/plugins/
+($GFORGEPLUGINSDIR below).  So you should end up with the plugin
+installed in /srv/www/gforge/plugins/projectimport/ and all the files in
+there.
+
+1. CONFIGURATION
+
+A) Make the symbolic links for each section
+
+(this is just an example, you should change the variables for what you have on your installation)
+
+/$GFORGEDIR/www/plugins/projectimport -> /$GFORGEPLUGINSDIR/projectimport/www
+/$ETC/gforge/plugins/projectimport ->  /$GFORGEPLUGINSDIR/projectimport/etc/plugins/projectimport
+
+B) Run the db/projectimport-init.sql file
+
+psql -U gforge gforge < $GFORGEPLUGINSDIR/db/projectimport-init.sql

Added: trunk/src/plugins/projectimport/README
===================================================================
--- trunk/src/plugins/projectimport/README	                        (rev 0)
+++ trunk/src/plugins/projectimport/README	2011-03-01 20:53:14 UTC (rev 12474)
@@ -0,0 +1,14 @@
+Project importer plugin for FusionForge 5.0.x
+
+Developped as part of the COCLICO project.
+
+This plugin allows you to import projects exported to a format compatible with ForgePlucker's one.
+
+See : https://fusionforge.org/tracker/index.php?func=detail&aid=227&group_id=6&atid=114 
+for reference on the corresponding feature request.
+
+
+Dependencies :
+ - ARC2 for PHP library (cf. http://arc.semsol.org/ or https://github.com/semsol/arc2)
+ - OSLC Core compatible RDF JSON parser plugin for ARC2 :
+   svn co https://oslc-tools.svn.sourceforge.net/svnroot/oslc-tools/language-libs/php/arc2-plugin/
\ No newline at end of file

Added: trunk/src/plugins/projectimport/common/ProjectImportPlugin.class.php
===================================================================
--- trunk/src/plugins/projectimport/common/ProjectImportPlugin.class.php	                        (rev 0)
+++ trunk/src/plugins/projectimport/common/ProjectImportPlugin.class.php	2011-03-01 20:53:14 UTC (rev 12474)
@@ -0,0 +1,162 @@
+<?php
+
+/**
+ * ProjectImportPlugin Class
+ *
+ *
+ * This file is part of GForge.
+ *
+ * GForge is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * GForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GForge; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ */
+
+class ProjectImportPlugin extends Plugin {
+	function ProjectImportPlugin () {
+		$this->Plugin() ;
+		$this->name = "projectimport" ;
+		$this->text = "Project import" ; // To show in the tabs, use...
+		$this->hooks[] = "user_personal_links";//to make a link to the user's personal part of the plugin
+		$this->hooks[] = "usermenu" ;
+		$this->hooks[] = "groupmenu" ;	// To put into the project tabs
+		$this->hooks[] = "groupisactivecheckbox" ; // The "use ..." checkbox in editgroupinfo
+		$this->hooks[] = "groupisactivecheckboxpost" ; //
+		$this->hooks[] = "userisactivecheckbox" ; // The "use ..." checkbox in user account
+		$this->hooks[] = "userisactivecheckboxpost" ; //
+		$this->hooks[] = "project_admin_plugins"; // to show up in the admin page fro group
+	}
+
+	function CallHook ($hookname, $params) {
+		global $use_projectimportplugin,$G_SESSION,$HTML;
+		if ($hookname == "usermenu") {
+			$text = $this->text; // this is what shows in the tab
+			if ($G_SESSION->usesPlugin("projectimport")) {
+				$param = '?type=user&id=' . $G_SESSION->getId() . "&pluginname=" . $this->name; // we indicate the part we're calling is the user one
+				echo ' | ' . $HTML->PrintSubMenu (array ($text),
+						  array ('/plugins/projectimport/index.php' . $param ));				
+			}
+		} elseif ($hookname == "groupmenu") {
+			$group_id=$params['group'];
+			$project = &group_get_object($group_id);
+			if (!$project || !is_object($project)) {
+				return;
+			}
+			if ($project->isError()) {
+				return;
+			}
+			if (!$project->isProject()) {
+				return;
+			}
+			if ( $project->usesPlugin ( $this->name ) ) {
+				$params['TITLES'][]=$this->text;
+				$params['DIRS'][]=util_make_url ('/plugins/projectimport/index.php?type=group&group_id=' . $group_id . "&pluginname=" . $this->name) ; // we indicate the part we're calling is the project one
+			} else {
+				$params['TITLES'][]=$this->text." is [Off]";
+				$params['DIRS'][]='';
+			}	
+			(($params['toptab'] == $this->name) ? $params['selected']=(count($params['TITLES'])-1) : '' );
+		} elseif ($hookname == "groupisactivecheckbox") {
+			//Check if the group is active
+			// this code creates the checkbox in the project edit public info page to activate/deactivate the plugin
+			$group_id=$params['group'];
+			$group = &group_get_object($group_id);
+			echo "<tr>";
+			echo "<td>";
+			echo ' <input type="checkbox" name="use_projectimportplugin" value="1" ';
+			// checked or unchecked?
+			if ( $group->usesPlugin ( $this->name ) ) {
+				echo "checked";
+			}
+			echo " /><br/>";
+			echo "</td>";
+			echo "<td>";
+			echo "<strong>Use ".$this->text." Plugin</strong>";
+			echo "</td>";
+			echo "</tr>";
+		} elseif ($hookname == "groupisactivecheckboxpost") {
+			// this code actually activates/deactivates the plugin after the form was submitted in the project edit public info page
+			$group_id=$params['group'];
+			$group = &group_get_object($group_id);
+			$use_projectimportplugin = getStringFromRequest('use_projectimportplugin');
+			if ( $use_projectimportplugin == 1 ) {
+				$group->setPluginUse ( $this->name );
+			} else {
+				$group->setPluginUse ( $this->name, false );
+			}
+		} elseif ($hookname == "userisactivecheckbox") {
+			//check if user is active
+			// this code creates the checkbox in the user account manteinance page to activate/deactivate the plugin
+			$user = $params['user'];
+			echo "<tr>";
+			echo "<td>";
+			echo ' <input type="checkbox" name="use_projectimportplugin" value="1" ';
+			// checked or unchecked?
+			if ( $user->usesPlugin ( $this->name ) ) {
+				echo "checked";
+ 			}
+			echo " />    Use ".$this->text." Plugin";
+			echo "</td>";
+			echo "</tr>";
+		} elseif ($hookname == "userisactivecheckboxpost") {
+			// this code actually activates/deactivates the plugin after the form was submitted in the user account manteinance page
+			$user = $params['user'];
+			$use_projectimportplugin = getStringFromRequest('use_projectimportplugin');
+			if ( $use_projectimportplugin == 1 ) {
+				$user->setPluginUse ( $this->name );
+			} else {
+				$user->setPluginUse ( $this->name, false );
+			}
+			echo "<tr>";
+			echo "<td>";
+			echo ' <input type="checkbox" name="use_projectimportplugin" value="1" ';
+			// checked or unchecked?
+			if ( $user->usesPlugin ( $this->name ) ) {
+				echo "checked";
+			}
+			echo " />    Use ".$this->text." Plugin";
+			echo "</td>";
+			echo "</tr>";
+		} elseif ($hookname == "user_personal_links") {
+			// this displays the link in the user's profile page to it's personal ProjectImport (if you want other sto access it, youll have to change the permissions in the index.php
+			$userid = $params['user_id'];
+			$user = user_get_object($userid);
+			$text = $params['text'];
+			//check if the user has the plugin activated
+			if ($user->usesPlugin($this->name)) {
+				echo '	<p>' ;
+				echo util_make_link ("/plugins/projectimport/index.php?id=$userid&type=user&pluginname=".$this->name,
+						     _('View Personal ProjectImport')
+					);
+				echo '</p>';
+			}
+		} elseif ($hookname == "project_admin_plugins") {
+			// this displays the link in the project admin options page to it's  ProjectImport administration
+			$group_id = $params['group_id'];
+			$group = &group_get_object($group_id);
+			if ( $group->usesPlugin ( $this->name ) ) {
+				echo util_make_link ("/plugins/projectimport/index.php?id=".$group->getID().'&type=admin&pluginname='.$this->name,
+						     _('View the ProjectImport Administration')).'<br />';
+			}
+		}												    
+		elseif ($hookname == "blahblahblah") {
+			// ...
+		} 
+	}
+}
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
+?>

Added: trunk/src/plugins/projectimport/common/ProjectImporter.class.php
===================================================================
--- trunk/src/plugins/projectimport/common/ProjectImporter.class.php	                        (rev 0)
+++ trunk/src/plugins/projectimport/common/ProjectImporter.class.php	2011-03-01 20:53:14 UTC (rev 12474)
@@ -0,0 +1,452 @@
+<?php
+
+/**
+ * ProjectImporter Class
+ *
+ *
+ * This file is part of FusionForge.
+ *
+ * FusionForge is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GForge; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ */
+
+// Include standard ARC library
+include_once("arc/ARC2.php");
+// Include the JSON RDF parser ala OSLC developped in COCLICO
+include_once('ARC2_OSLCCoreRDFJSONParserPlugin.php');
+
+#require_once $gfcommon.'import/import_users.php';
+
+define('FORGEPLUCKER_NS', 'http://planetforge.org/ns/forgeplucker_dump/');
+
+/**
+ * TODO Enter description here ...
+ * @author Olivier Berger
+ *
+ */
+class ProjectImporter {
+	
+	/**
+	 * Index of all triples imported
+	 * @var ARC2 triples
+	 */
+	protected $index;
+	
+	protected $project_dump_res;
+	
+	/**
+	 * Users descriptions found in the dump
+	 * @var array of ARC2 resources (keys are URIs)
+	 */
+	protected $users;
+	
+	/**
+	 * User names for the users found in the dump
+	 * @var array of strings (keys are URIs)
+	 */
+	protected $user_names;
+	
+	/**
+	 * Enter description here ...
+	 * @var unknown_type
+	 */
+	protected $providers;
+	
+	/**
+	 * Enter description here ...
+	 * @var unknown_type
+	 */
+	static $allowedprovidertypes = array('planetforge:TrackersTool',
+					      'planetforge:ForumsTool', 
+					      'planetforge:DocumentsTool', 
+					      'planetforge:MailingListTool',  
+					      'planetforge:TaskTool',
+					      'planetforge:ScmTool',
+					      'planetforge:NewsTool',
+					      'planetforge:FilesReleasesTool',
+						  'planetforge:SvnScmTool');
+		
+	/**
+	 * Enter description here ...
+	 * @var unknown_type
+	 */
+	static $ns = array(
+			    'rdf'	=> 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
+				'foaf' => 'http://xmlns.com/foaf/0.1/',
+				'dcterms' => 'http://purl.org/dc/terms/',
+				'oslc' => 'http://open-services.net/ns/core#',
+				'oslc_cm' => 'http://open-services.net/ns/cm#',
+				'forgeplucker' => FORGEPLUCKER_NS,
+				'doap' => 'http://usefulinc.com/ns/doap#',
+				'sioc' => 'http://rdfs.org/sioc/ns#',
+				'planetforge' => 'http://coclico-project.org/ontology/planetforge#'
+				);
+	/**
+	 * TODO Enter description here ...
+	 * @param unknown_type $group_id
+	 */
+	function ProjectImporter($group_id) {
+	  $this->group_id = $group_id;
+	  $this->index = False;
+	  
+	  
+	  $this->trackers = array();
+	  $this->users = False;
+	  $this->project_dump_res = False;
+	  $this->user_names = array();
+	  
+	}
+
+	/**
+	 * Converts the JSON RDF ala OSLC to ARC2 triples
+	 * @param string $json
+	 * @return triples
+	 */
+	function parse_OSLCCoreRDFJSON($json)
+	{
+	  $conf = array('ns' => ProjectImporter::$ns);
+
+	  // "load" the ARC2 plugin to parse RDF ala OSLC in JSON 
+	  $parser = ARC2::getComponent("OSLCCoreRDFJSONParserPlugin", $conf);
+
+/*
+			$arr = json_decode($json, true);
+			if ($arr) {
+//				$feedback = "JSON decoded to :";
+//				$message .= '<pre>'. nl2br(print_r($arr, true)) . '</pre>';
+				$prefixes=false;
+				$result=false;
+				foreach($arr as $type => $tabType){
+//					$message .= 'type: '.$type.'<br />';
+//					$message .= '<pre>'. nl2br(print_r($tabType, true)) . '</pre>';
+
+					if ($type=="users"){
+						$users = $tabType;	
+					}
+					elseif($type=="roles"){
+						$roles = $tabType;
+					}
+					elseif($type=="trackers"){
+						$trackers = $tabType;
+					}
+					elseif($type=="docman"){
+						$docman = $tabType;
+					}
+					elseif($type=="frs"){
+						$frs = $tabType;
+					}
+					elseif($type=='forums'){
+						$forums = $tabType;
+					}
+					elseif($type=='forgeplucker:trackers') {
+						foreach($tabType as $bar)
+						{
+							$result = json_encode($bar);
+						}
+						break;
+					}
+					elseif($type=='prefixes') {
+						$prefixes = $tabType;
+					}
+				}
+				$result['prefixes']=$prefixes;
+				$message .= '<pre>'. nl2br(print_r($arr, true)) . '</pre>';
+				$arr = $parser->parseData($result);
+*/
+	  $parser->parseData($json);
+	  $triples = $parser->getTriples();
+//			echo 'triples :';
+//			print_r($triples);
+	  $this->index = ARC2::getSimpleIndex($triples, false);
+	  return $triples;
+	}
+
+	/**
+	 * Creates an ARC2 resource
+	 * @param ARC2 triples index $index
+	 * @param string $uri
+	 * @return ARC2 resource
+	 */
+	static function make_resource($index, $uri) {
+	  $conf = array('ns' => ProjectImporter::$ns);
+	  $res = ARC2::getResource($conf);
+	  $res->setIndex($index);
+	  $res->setUri($uri);
+	  return $res;
+	}
+
+	/**
+	 * Returns a Dump object for the index, whose rdf:type is http://planetforge.org/ns/forgeplucker_dump/project_dump#
+	 * @return ARC2 resource
+	 */
+	protected function project_dump() {
+		if (! is_array($this->project_dump_res)) {
+			$dumpres = array();
+
+			$dumpresuri = False;
+			foreach ($this->index as $uri => $resource) {
+				$res = $this->make_resource($this->index, $uri);
+				if ($res->hasPropValue('rdf:type', 'http://planetforge.org/ns/forgeplucker_dump/project_dump#')) {
+					//	    if ($this->is_project_dump($resource)) {
+					$dumpresuri = $uri;
+					break;
+				}
+			}
+			// found a dump resource
+			if ($dumpresuri) {
+				//	    $dumpres = $this->index[$dumpresuri];Enter description here ...
+				$dumpres = $this->make_resource($this->index, $dumpresuri);
+			}
+			$this->project_dump_res = $dumpres;
+		}
+		return $this->project_dump_res;
+	}
+	
+	function has_project_dump() {
+		$result = False;
+		$dumpres = $this->project_dump();
+		if ($dumpres && count($dumpres)) {
+			$result = True; 
+		}
+		return $result;
+	}
+
+	function get_user_name($user) {
+		return $this->user_names[$user];
+	}
+	/**
+	 * Return a user's email
+	 * @param URI $user
+	 */
+	function get_user_email($user) {
+		$res = $this->users[$user];
+		return $res->getPropValue('sioc:email');
+	}
+
+	/**
+	 * Extract users / persons from the dump
+	 * @param unknown_type $dumpres
+ 	 * @return array of ARC2 resource
+	 */
+	function get_users() {
+		if (! $this->users) {
+			$dumpres = $this->project_dump();
+			$this->users = array();
+			// USERS
+			$users = $dumpres->getPropValues('forgeplucker:users');
+			foreach ($users as $user) {
+				//	      print_r($this->index[$user]);
+				$res = $this->make_resource($this->index, $user);
+				$accountName = $res->getPropValue('foaf:accountName');
+				$this->user_names[$user] = $accountName;
+				$this->users[$user] = $res;
+				//			print 'Found user : '. $accountName . "\n";
+			}
+			$persons = $dumpres->getPropValues('forgeplucker:persons');
+			foreach ($persons as $person) {
+				$res = $this->make_resource($this->index, $person);
+				 
+				//			print 'Found person : '. $res->getPropValue('foaf:name') . "\n";
+				//	      print_r($this->index[$person]);
+				//print_r($res->getProps());
+				$accounts = $res->getPropValues('foaf:holdsAccount');
+				foreach($accounts as $account) {
+					//				print 'account : '.$account;
+					$user = $this->users[$account];
+					if (! $user->getPropValue('sioc:account_of')) {
+						$user->setProp('sioc:account_of', $person);
+					}
+				}
+			}
+			/*		foreach ($this->users as $user) {
+			 print 'this->user : ';
+			 print_r($user->getProps());
+			 }
+			 */
+		}
+		return $this->users;
+	}
+
+	/**
+	 * Returns a project's name
+	 * @param ARC2 resource $projectres
+	 */
+	function get_project_name($projectres) {
+		return $projectres->getPropValue('doap:name');
+	}
+
+	/**
+	 * Return a project's description
+	 * @param ARC2 resource $projectres
+	 */
+	function get_project_description($projectres) {
+		return $projectres->getPropValue('dcterms:description');
+	}
+
+	/**
+	 * Analyze the tools description found in the dump
+	 */
+	function get_tools() {
+		global $feedback;
+
+		$dumpres = $this->project_dump();
+		
+		// TOOLS
+		
+		$tools = $dumpres->getPropValues('forgeplucker:tools');
+		//	    print_r($tools);
+		$providers = array();
+		foreach ($tools as $tool) {
+			$toolres = $this->make_resource($this->index, $tool);
+			//	      print_r($toolres->getProps()); echo "\n";
+			$provider = $toolres->getPropValue('planetforge:provided_by');
+			if ($provider) {
+				$providerres = $this->make_resource($this->index, $provider);
+				$types = $providerres->getPropValues('rdf:type');
+				foreach ($types as $type) {
+					if (!in_array($type, ProjectImporter::$allowedprovidertypes)) {
+						$feedback .= 'Need provider type : '. $type . "\n";
+					}
+					else {
+						if (!in_array($provider, $providers)) {
+							$providers[] = $provider;
+						}
+					}
+				}
+			}
+		}
+		//	    echo 'PROVIDERS';
+		//	    print_r($providers); echo "\n";
+		$this->providers = $providers;
+	}
+
+	/**
+	 * Enter description here ...
+	 * @param unknown_type $dumpres
+	 * @return Ambigous <multitype:, ARC2>
+	 */
+	function get_projects() {
+		global $feedback;
+
+		$dumpres = $this->project_dump();
+		
+		$results = array();
+
+	    
+		$this->get_users($dumpres);
+
+		// PROJECT
+		//	    $projects = $this->dump_project_uris($dumpres);
+		$projects = $dumpres->getPropValues('forgeplucker:project');
+
+		foreach ($projects as $project) {
+			//	      print 'Found project : '. $project . "\n";
+			//	      print_r($this->index[$project]);
+			$res = $this->make_resource($this->index, $project);
+	      
+			//	      print_r($res->getProps());
+			$name = $res->getPropValue('doap:name');
+			$description = $res->getPropValue('dcterms:description');
+			$homepage = $res->getPropValue('doap:homepage');
+			$hosted_by = $res->getPropValue('planetforge:hosted_by');
+			//	      print 'Project: '. $name . ' - '. $description . ' ('. $homepage . ') hosted on: '. $hosted_by;
+//			$results[] = array($name, $description, $homepage, $hosted_by);
+			$results[] = $res;
+			// handle project's roles
+			$users_roles=array();
+			$roles = $res->getPropValues('sioc:scope_of');
+			foreach($roles as $role) {
+				$roleres = $this->make_resource($this->index, $role);
+				$name = $roleres->getPropValue('sioc:name');
+				$users = $roleres->getPropValues('sioc:function_of');
+				//		print_r($name);
+				//print_r($users);
+				foreach($users as $user) {
+					$users_roles[$this->user_names[$user]] = array('role' => $name);
+				}
+			}
+			//	      print_r($users_roles);
+//			echo "creating roles of existing users in the project\n";
+//			echo "calling user_fill(".'$users'.", $this->group_id)\nwhere ".'$users'." is";
+			// check user_fill : True == check mode
+//			user_fill($users_roles, $this->group_id, True);
+//			print_r($users_roles);
+//			echo "\n";
+
+		}
+
+		return $results;
+	}
+
+	// handle project's spaces
+
+	function decode_space($space, $spaceres) {
+		$types = $spaceres->getPropValues('rdf:type');
+		$supported_type = False;
+		foreach($types as $type) {
+
+			// Case of the trackers
+			if ($type == 'http://coclico-project.org/ontology/planetforge#Tracker') {
+				$supported_type = True;
+				//		      print 'Found tracker :'. $space . "\n";
+				$tracker = array('uri' => $space);
+				// Decode TRACKER
+				$artifacts = $spaceres->getPropValues('oslc:results');
+				$tracker['artifacts'] = array();
+				foreach ($artifacts as $artifact) {
+					// Decode ARTIFACTS
+					//			print 'Found tracker artifact :'. $artifact . "\n";
+					$cmres = $this->make_resource($this->index, $artifact);
+					$tracker['artifacts'][] = array('uri' => $artifact,
+									'details' => $cmres->getProps());
+				}
+//				$this->trackers[] = $tracker;
+				echo '<pre>'. htmlspecialchars(print_r($tracker, True)) . '</pre>';
+				break;
+			}
+			// other cases 
+			//  ...
+		}
+	}
+
+	/**
+	 * Return the spaces used by a project
+	 * @param ARC2 resource $projectres
+	 * @return array of ARC2 resources
+	 */
+	function project_get_spaces($projectres) {
+		global $feedback;
+
+		$results = array();
+
+		$spaces = $projectres->getPropValues('sioc:has_space');
+		foreach ($spaces as $space) {
+			$spaceres = $this->make_resource($this->index, $space);
+			$provider = $spaceres->getPropValue('planetforge:provided_by');
+			if (!in_array($provider, $this->providers)) {
+				$feedback .= 'error : no supported provider for '. $space .': '. $provider."!\n";
+			}
+			else {
+				$results[$space] = $spaceres;
+			}
+		}
+		return $results;
+	}
+
+}
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+

Added: trunk/src/plugins/projectimport/common/projectimport-init.php
===================================================================
--- trunk/src/plugins/projectimport/common/projectimport-init.php	                        (rev 0)
+++ trunk/src/plugins/projectimport/common/projectimport-init.php	2011-03-01 20:53:14 UTC (rev 12474)
@@ -0,0 +1,34 @@
+<?php
+
+/**
+ *
+ * This file is part of GForge.
+ *
+ * GForge is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * GForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GForge; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ */
+
+global $gfplugins;
+require_once $gfplugins.'projectimport/common/ProjectImportPlugin.class.php' ;
+
+$ProjectImportPluginObject = new ProjectImportPlugin ;
+
+register_plugin ($ProjectImportPluginObject) ;
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:
+
+?>

Added: trunk/src/plugins/projectimport/etc/plugins/projectimport/config.php
===================================================================
--- trunk/src/plugins/projectimport/etc/plugins/projectimport/config.php	                        (rev 0)
+++ trunk/src/plugins/projectimport/etc/plugins/projectimport/config.php	2011-03-01 20:53:14 UTC (rev 12474)
@@ -0,0 +1,7 @@
+<?php 
+
+// here you can put all your configuration variables
+
+$world = 'Earth';
+
+?>

Added: trunk/src/plugins/projectimport/www/index.php
===================================================================
--- trunk/src/plugins/projectimport/www/index.php	                        (rev 0)
+++ trunk/src/plugins/projectimport/www/index.php	2011-03-01 20:53:14 UTC (rev 12474)
@@ -0,0 +1,429 @@
+<?php
+
+/**
+ * ProjectImport plugin for FusionForge 5.0.x
+ *
+ *
+ * This is the beginning of a project import pugin
+ * 
+ * Author : Olivier Berger <olivier.berger at it-sudparis.eu>
+ * 
+ * Copyright (c) Olivier Berger & Institut Télécom
+ * 
+ * Released under the GNU GPL v2 or later
+ * 
+ */
+
+require_once('../../../www/env.inc.php');
+require_once $gfwww.'include/pre.php';
+
+// don't include this in ProjectImporter, for unit test purposes, so do it here, in caller
+require_once $gfcommon.'import/import_users.php';
+//print_r($gfplugins.'projectimport/common/ProjectImporter.class.php');
+
+require_once $gfplugins.'projectimport/common/ProjectImporter.class.php';
+
+// Dependency on php-arc
+include_once('arc/ARC2.php');
+
+/**
+ * Manages the display of the page : HTML + forms
+ * @author Olivier Berger
+ *
+ */
+class ProjectImportPage {
+
+	protected $message;
+	
+	protected $importer;
+
+	// will contain the list of spaces to be imported
+	protected $posted_spaces_imported;
+
+	// will contain mapping of imported users to forge users
+	protected $posted_user_mapping;
+
+	protected $form_header_already_displayed;
+	
+	protected $html_generator;
+	
+	function ProjectImportPage($HTML) {
+		$this->html_generator = $HTML;
+		$this->message = '';
+		$this->form_header_already_displayed = false;
+		$this->importer = False;
+		$this->posted_user_mapping = array();
+		$this->posted_spaces_imported = array();
+	}
+
+	/**
+	 * Initializes data structurs from POSTed data coming from the form input
+	 */
+	function initialize_from_submitted_data() {
+		global $group_id, $feedback;
+
+		$group_id = getIntFromRequest('group_id');
+		$json = getUploadedFile('json');
+		$imported_file = $json['tmp_name'];
+		$json = fread(fopen($imported_file, 'r'), $json['size']);
+		if(! $json) {
+			$feedback = "Error : missing data";
+		}
+		else {
+
+			//			print_r($imported_file);
+			$this->importer = new ProjectImporter($group_id);
+			$this->importer->parse_OSLCCoreRDFJSON($json);
+
+			/*
+			 $triples = $importer->parse_OSLCCoreRDFJSON($json);
+			 $ser = ARC2::getTurtleSerializer();
+
+			 if(count($triples)) {
+				$message .= '<pre>'. nl2br(htmlspecialchars($ser->toTurtle($triples))) . '</pre>';
+				}
+				*/
+
+			// Get the user mappings posted (if any)
+			if (getStringFromPost('submit_mappings')) {
+				foreach (array_keys($_POST) as $key) {
+					//					print_r('key : '. $key);
+					if(!strncmp($key, 'map_', 4)) {
+						$imported_user = substr($key, 4);
+						$mapped_user = getStringFromPost($key);
+						//						print_r('Mapped : '. $imported_user . ' to ' . $mapped_user);
+						//						echo '<br />';
+						if($mapped_user) {
+							$this->posted_user_mapping[$imported_user] = $mapped_user;
+						}
+					}
+				}
+			}
+			// Get the spaces checked as to be imported (if any)
+			if (getStringFromPost('submit_spaces')) {
+				foreach (array_keys($_POST) as $key) {
+					if(!strncmp($key, 'import_', 7)) {
+						$spacesha1 = substr($key, 7);
+						//						print_r('Selected for import : '. $spacesha1);
+						//						echo '<br />';
+						$this->posted_spaces_imported[] = $spacesha1;
+					}
+				}
+			}
+			//	echo '$posted_spaces_imported : ';
+			//	print_r($posted_spaces_imported);
+			//	echo '<br />';
+			
+		}
+	}
+	
+	/**
+	 * Display initial contents of the page
+	 * @param string $message
+	 */
+	function display_headers($message) {
+		global $group_id, $feedback;
+		
+		$params= array();
+		$params['title']=_('Project importer');
+		$params['toptab']='projectimport';
+		$params['group']=$group_id;
+
+		site_project_header($params);
+		
+		$this->message .= $message;
+	}
+	
+	/**
+	 * Tries to match imported users to forge users, and display mapping form bits if needed
+	 * @param array of ARC2 resources $imported_users
+	 * @return html string
+	 */
+	function match_users($imported_users)
+	{
+		global $group_id, $feedback;
+		
+		$html = '';
+		
+		$res_memb = db_query_params('SELECT users.realname,users.user_id,
+			users.user_name,user_group.admin_flags,user_group.role_id
+			FROM users,user_group 
+			WHERE users.user_id=user_group.user_id 
+			AND user_group.group_id=$1 ORDER BY users.realname',
+		array($group_id));
+
+		$existing_users = array();
+		while ($row_memb=db_fetch_array($res_memb)) {
+			$existing_users[] = $row_memb['user_name'];
+		}
+			
+		$matching_users_header_displayed = False;
+			
+		//$missing_users = array();
+		foreach($imported_users as $user => $userres) {
+			$imported_username = $this->importer->get_user_name($user);
+			$email = $this->importer->get_user_email($user);
+			if (array_key_exists($imported_username, $this->posted_user_mapping)) {
+				$username = $this->posted_user_mapping[$imported_username];
+			}
+			else {
+				$username = $imported_username;
+			}
+			//			print_r('check for '.$username);
+			$user_object = &user_get_object_by_name($username);
+			if (!$user_object) {
+				//		$missing_users[] = $username;
+				if ($feedback) $feedback .= '<br />';
+				$feedback .= sprintf(_('Failed to find existing user matching imported user "%s"'), $username);
+
+				if (! $matching_users_header_displayed) {
+					$matching_users_header_displayed = True;
+
+					$html .= $this->html_generator->boxTop(_("Matching imported users"));
+
+					$html .= '<p>'._('Failed to find existing users matching the following imported users.').'<br />'.
+					_('If you wish to map their data to existing users, choose them in the form bellow, and re-submit it:'). '</p>';
+
+					$html .= '<table width="100%"><thead><tr>';
+					$html .= '<th>'._('User logname').'</th>';
+					$html .= '<th>'._('email').'</th>';
+					$html .= '<th>'._('map to').'</th>';
+					$html .= '</tr></thead><tbody>';
+					$html .= '<input type="hidden" name="submit_mappings" value="y" />';
+				}
+
+				$html .= '<tr>';
+				$html .= '<td style="white-space: nowrap;">'. $username .'</td>';
+				$html .= '<td style="white-space: nowrap;">'. $email .'</td>';
+				$html .= '<td><select name="map_'.$username.'">';
+
+				$html .= '<option value="0" selected="selected">'._('Select existing user').'</option>';
+				foreach($existing_users as $existing_user) {
+					$html .= '<option value="'. $existing_user .'">'. $existing_user .'</option>';
+				}
+				$html .= '</select></td>';
+				$html .= '</tr>';
+
+			} else {
+				if ($this->message) {
+					$this->message .= '<br />';
+				}
+				$this->message .= sprintf(_('Found matching user for imported user "%s" : "%s"'), $imported_username, $username);
+			}
+		} // foreach
+			
+		if ($matching_users_header_displayed) {
+			//			$html .= '</form>';
+			$html .= '</tbody></table>';
+			$html .= $this->html_generator->boxBottom();
+
+		}
+		return $html;
+
+	}
+	
+	/**
+	 * Does the main work
+	 * @return html string
+	 */
+	function do_work() {
+		global $group_id, $feedback;
+		
+		$html = '';
+		
+		// If the posted JSON file indeed contains a project dump, an importer was created, and if it has data we can work
+		if($this->importer) {
+			// If it indeed has valid data
+			if ($this->importer->has_project_dump()) {
+				$this->message .= "Here are the results from your upload :";
+
+				$imported_users = $this->importer->get_users();
+
+				$this->importer->get_tools();
+
+				$projects = $this->importer->get_projects();
+
+				// always display the form : to be improved TODO
+				if (! $this->form_header_already_displayed) {
+					$this->form_header_already_displayed = true;
+					$html .= '<form enctype="multipart/form-data" action="'.getStringFromServer('PHP_SELF').'" method="post">';
+				}
+				
+				// Handle missing users, taking into account the user mapping form elements that may have been provided
+				$html .= $this->match_users($imported_users);
+				
+				// Then handle project(s)
+
+				if(count($projects)) {
+
+					//			$output = '<b>Project parsed:</b><br />';
+					//			$output .= '<pre>'. nl2br(htmlspecialchars(print_r($projects,True))) . '</pre>';
+					/*			$output .= '<b>Trackers parsed:</b><br />';
+					foreach ($this->importer->trackers as $tracker) {
+					$output .= '<pre>'. nl2br(htmlspecialchars(print_r($tracker, True))) . '</pre>';
+					}
+					*/
+					//			$html .= $output;
+
+					// Display project attributes
+					foreach($projects as $project) {
+						$html .= '<table id="project-summary-and-devs" class="my-layout-table" summary="">
+	                             <tr>
+		                     <td>
+			             <h2>'._('Details of imported project : ').'<pre>'.$this->importer->get_project_name($project).'</pre></h2>
+			             <h3>'._('Project summary').'</h3>';
+						$html .= '<p><pre>'.$this->importer->get_project_description($project).'</pre></p>';
+
+						$spaces = $this->importer->project_get_spaces($project);
+
+						// if no spaces posted to be imported, display checkboxes to prompt user for spaces to be imported for next POST 
+						if(!count($this->posted_spaces_imported)) {
+
+							if(count($spaces)) {
+								$html .= $this->html_generator->boxTop(_("Project's spaces found"));
+								if (! $this->form_header_already_displayed) {
+									$html .= '<form enctype="multipart/form-data" action="'.getStringFromServer('PHP_SELF').'" method="post">';
+									$this->form_header_already_displayed = true;
+								}
+								$html .= '<table width="100%"><thead><tr>';
+								$html .= '<th>'._('uri').'</th>';
+								$html .= '<th>'._('type').'</th>';
+								$html .= '<th>'._('Import space ?').'</th>';
+								$html .= '</tr></thead><tbody>';
+							}
+							foreach($spaces as $space => $spaceres) {
+								$uri = $space;
+								$sha_uri = sha1($uri);
+								$type = $spaceres->getPropValue('rdf:type');
+
+								$html .= '<tr>';
+								$html .= '<td style="white-space: nowrap;">'. $uri .'</td>';
+								$html .= '<td style="white-space: nowrap;">'. $type .'</td>';
+								if(array_key_exists($sha_uri, $this->posted_spaces_imported)) {
+									$html .= '<td><input type="checkbox" name="import_'.$sha_uri.'" value="'.$sha_uri.'" selected="selected" /></td>';
+								}
+								else {
+									$html .= '<td><input type="checkbox" name="import_'.$sha_uri.'" value="'.$sha_uri.'" /></td>';
+								}
+								$html .= '</tr>';
+							}
+							if(count($spaces)) {
+								$html .= '<input type="hidden" name="submit_spaces" value="y" />';
+								$html .= '</tbody></table>';
+								$html .= $this->html_generator->boxBottom();
+							}
+						}
+						// else, user tells us we have to import the spaces
+						else {
+							//					$html .= 'to be imported:';
+							//					print_r($this->posted_spaces_imported);
+							//					$html .= '<br />';
+							foreach($spaces as $space => $spaceres) {
+								$uri = $space;
+								$sha_uri = sha1($uri);
+								//						$html .= 'sha1 :'.$sha_uri.'<br />';
+								if (in_array($sha_uri, $this->posted_spaces_imported)) {
+									$html .= 'Importing :'.$uri.'<br />';
+									$this->importer->decode_space($space, $spaceres);
+								}
+							}
+						}
+					}
+				}
+			}
+			else {
+				$feedback .= 'parsing problem <br />';
+			}
+		}
+		return $html;
+	}
+	
+	/**
+	 * Display the page
+	 */
+	function display_main() {
+		global $feedback, $group_id;
+		
+		$html = $this->do_work();
+		
+		if($this->message) {
+			echo $this->message . '<br />';
+		}
+		html_feedback_top($feedback);
+		
+		echo $html;
+		
+		// If invoked initially (not on callback) or if more details needed
+		
+		// display the last part of the form for JSON file upload
+		if (! $this->form_header_already_displayed) {
+			echo '<form enctype="multipart/form-data" action="'.getStringFromServer('PHP_SELF').'" method="post">';
+			$this->form_header_already_displayed = True;
+		}
+
+		
+		if(count($this->posted_user_mapping)) {
+			foreach ($this->posted_user_mapping as $imported_user => $mapped_user) {
+				echo '<input type="hidden" name="map_'. $imported_user .'" value="'. $mapped_user .'" />';
+			}
+			echo '<input type="hidden" name="submit_mappings" value="y" />';
+		}
+
+		echo '<input type="hidden" name="group_id" value="' . $group_id . '" />
+                    <fieldset><legend>Please upload a file :</legend>
+		       <p><center>
+                          <input type="file" id="json" name="json" tabindex="2" size="30" />
+                       </center></p>
+                    </fieldset>
+                    <div style="text-align:center;">
+                      <input type="submit" name="submit" value="Submit" />
+                    </div>
+              </form>';
+
+
+		site_project_footer(array());
+		
+	}
+}
+
+// OK, we need a session
+if (session_loggedin()) {
+
+	// The user should be project admin
+	if (!user_ismember($group_id,'A')) {
+		exit_permission_denied(_('You cannot import project unless you are an admin on that project'));
+	}
+
+	global $group_id, $feedback;
+
+	$this_page = new ProjectImportPage($HTML);
+
+	//	print_r($_POST);
+	
+	$message = '';
+	
+	// when called back by post form we can initialize some elements provided by the user
+	if (getStringFromRequest('submit')) {
+		
+		$this_page->initialize_from_submitted_data();
+			
+	}
+	else {
+		$message .= "You can import a project from a JSON RDF document compatible with ForgePlucker's dump format.<br />";
+	}
+
+	$this_page->display_headers($message);
+	
+	$this_page->display_main();
+	
+} else {
+
+	exit_not_logged_in();
+
+}
+
+
+// Local Variables:
+// mode: php
+// c-file-style: "bsd"
+// End:




More information about the Fusionforge-commits mailing list