[Fusionforge-commits] FusionForge branch master updated. v6.0.5-1305-g99f3253

Franck Villaume nerville at libremir.placard.fr.eu.org
Wed Dec 28 18:35:36 CET 2016


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, master has been updated
       via  99f32538bd43f4a5befd440db78bb165ca9a61b6 (commit)
      from  811bda01ad7ce865e50addc0024532f4ac90f210 (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 -----------------------------------------------------------------
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=99f32538bd43f4a5befd440db78bb165ca9a61b6

commit 99f32538bd43f4a5befd440db78bb165ca9a61b6
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Wed Dec 28 18:35:03 2016 +0100

    plugin projects-hierarchy: massive clean-up & bugfix in display tree

diff --git a/src/plugins/projects-hierarchy/actions/projectsHierarchyDocman.php b/src/plugins/projects-hierarchy/actions/projectsHierarchyDocman.php
index 8483f16..a101fdc 100644
--- a/src/plugins/projects-hierarchy/actions/projectsHierarchyDocman.php
+++ b/src/plugins/projects-hierarchy/actions/projectsHierarchyDocman.php
@@ -1,6 +1,7 @@
 <?php
 /**
- * docman hierarchy view
+ * Projects Hierarchy Plugin
+ * action: set docman hierarchy
  *
  * Copyright 2011, Franck Villaume - Capgemini
  * http://fusionforge.org
diff --git a/src/plugins/projects-hierarchy/actions/updateGlobalConf.php b/src/plugins/projects-hierarchy/actions/updateGlobalConf.php
index 29c2444..80f6243 100644
--- a/src/plugins/projects-hierarchy/actions/updateGlobalConf.php
+++ b/src/plugins/projects-hierarchy/actions/updateGlobalConf.php
@@ -27,7 +27,6 @@ global $projectsHierarchy; // the projects-hierarchy plugin object
 $confArr = array();
 $confArr['tree'] = getIntFromRequest('tree');
 $confArr['docman'] = getIntFromRequest('docman');
-$confArr['delegate'] = 0;
 
 if (!$projectsHierarchy->updateGlobalConf($confArr)) {
 	$error_msg = _('Failed to update global configuration.');
diff --git a/src/plugins/projects-hierarchy/actions/updateProjectConf.php b/src/plugins/projects-hierarchy/actions/updateProjectConf.php
index 5ae5a36..7f8afd7 100644
--- a/src/plugins/projects-hierarchy/actions/updateProjectConf.php
+++ b/src/plugins/projects-hierarchy/actions/updateProjectConf.php
@@ -27,7 +27,6 @@ global $group_id;
 $confArr = array();
 $confArr['tree'] = getIntFromRequest('tree');
 $confArr['docman'] = getIntFromRequest('docman');
-$confArr['delegate'] = 0;
 $confArr['globalconf'] = getIntFromRequest('globalconf');
 
 if (!$projectsHierarchy->updateConf($group_id, $confArr)) {
diff --git a/src/plugins/projects-hierarchy/actions/validateRelationship.php b/src/plugins/projects-hierarchy/actions/validateRelationship.php
index 432112b..89fd043 100644
--- a/src/plugins/projects-hierarchy/actions/validateRelationship.php
+++ b/src/plugins/projects-hierarchy/actions/validateRelationship.php
@@ -1,6 +1,6 @@
 <?php
 /**
- * docman hierarchy view
+ * Projects Hierarchy Plugin
  *
  * Copyright 2011, Franck Villaume - Capgemini
  * http://fusionforge.org
diff --git a/src/plugins/projects-hierarchy/common/projects-hierarchy-init.php b/src/plugins/projects-hierarchy/common/projects-hierarchy-init.php
index 6bf540e..dab7149 100644
--- a/src/plugins/projects-hierarchy/common/projects-hierarchy-init.php
+++ b/src/plugins/projects-hierarchy/common/projects-hierarchy-init.php
@@ -1,5 +1,6 @@
 <?php
 /**
+ * Projects Hierarchy Plugin
  *
  * Copyright 2006 (c) Fabien Regnier - Sogeti
  * http://fusionforge.org
@@ -27,8 +28,3 @@ require_once $gfplugins.'projects-hierarchy/common/projects-hierarchyPlugin.clas
 $projects_hierarchyPluginObject = new projects_hierarchyPlugin;
 
 register_plugin($projects_hierarchyPluginObject);
-
-// Local Variables:
-// mode: php
-// c-file-style: "bsd"
-// End:
diff --git a/src/plugins/projects-hierarchy/common/projects-hierarchyPlugin.class.php b/src/plugins/projects-hierarchy/common/projects-hierarchyPlugin.class.php
index 202d71a..e11cc32 100644
--- a/src/plugins/projects-hierarchy/common/projects-hierarchyPlugin.class.php
+++ b/src/plugins/projects-hierarchy/common/projects-hierarchyPlugin.class.php
@@ -1,6 +1,6 @@
 <?php
 /**
- * projects_hierarchyPlugin Class
+ * Projects Hierarchy Plugin
  *
  * Copyright 2006 (c) Fabien Regnier - Sogeti
  * Copyright 2010-2011, Franck Villaume - Capgemini
@@ -30,7 +30,7 @@ class projects_hierarchyPlugin extends Plugin {
 		$this->name = 'projects-hierarchy';
 		$this->text = _('Project Hierarchy'); // To show in the tabs, use...
 		$this->pkg_desc =
-_('Organise projects hierarchically, relation type 1-n');
+_('Organise projects hierarchically, relation type 1-n.');
 		$this->_addHook('groupisactivecheckbox'); // The "use ..." checkbox in editgroupinfo
 		$this->_addHook('groupisactivecheckboxpost');
 		$this->_addHook('hierarchy_views'); // include specific views
@@ -90,7 +90,7 @@ _('Organise projects hierarchically, relation type 1-n');
 				$group_id = $params['group_id'];
 				$group = group_get_object($group_id);
 				if ($group->usesPlugin($this->name)) {
-					echo html_e('p', array(), util_make_link('/plugins/'.$this->name.'/?group_id='.$group_id.'&type=admin&pluginname='.$this->name, _('Hierarchy Admin'), array('title'=>_('Configure the projects-hierarchy plugin (docman, tree, delegate, globalconf features)'))));
+					echo html_e('p', array(), util_make_link('/plugins/'.$this->name.'/?group_id='.$group_id.'&type=admin&pluginname='.$this->name, _('Hierarchy Admin'), array('title'=>_('Configure the projects-hierarchy plugin (docman, tree, globalconf features)'))));
 				}
 				$returned = true;
 				break;
@@ -105,8 +105,9 @@ _('Organise projects hierarchically, relation type 1-n');
 						if (db_numrows($res1) > 0) {
 							$res2 = db_query_params('SELECT count(*) as used FROM plugin_projects_hierarchy_relationship where status = $1',
 										array('t'));
-							if ($res2)
+							if ($res2) {
 								$row = db_fetch_array($res2);
+							}
 							if ($row['used']) {
 								$hierarchy_used = true;
 							}
@@ -198,14 +199,15 @@ _('Organise projects hierarchically, relation type 1-n');
 		echo html_ao('ul', array('id' => 'tree'));
 		echo $this->getTree();
 		echo html_ac(html_ap() -1);
-		echo html_ao('script', array('type' => 'text/javascript')).'//<![CDATA['."\n";
-		echo 'jQuery(document).ready(function() {
-				if (typeof(jQuery(\'#tree\').simpleTreeMenu) != "undefined") {
-					jQuery(\'#tree\').simpleTreeMenu();
+		$javascript = <<<'EOS'
+			jQuery(document).ready(function() {
+				if (typeof(jQuery('#tree').simpleTreeMenu) != "undefined") {
+					jQuery('#tree').simpleTreeMenu();
 				}
 			})
-			//]]>'."\n";
-		echo html_ac(html_ap() - 2);
+EOS;
+		echo html_e('script', array( 'type'=>'text/javascript'), '//<![CDATA['."\n".'jQuery(function(){'.$javascript.'});'."\n".'//]]>');
+		echo html_ac(html_ap() - 1);
 	}
 
 	/**
@@ -223,7 +225,6 @@ _('Organise projects hierarchically, relation type 1-n');
 		switch ($status) {
 			case 'validated': {
 				$statusCondition = 't';
-
 				break;
 			}
 			case 'pending': {
@@ -237,27 +238,27 @@ _('Organise projects hierarchically, relation type 1-n');
 		}
 		switch ($order) {
 			case 'parent': {
-				$qpa = db_construct_qpa(false, 'SELECT project_id as id FROM plugin_projects_hierarchy_relationship
+				$qpa = db_construct_qpa(false, 'SELECT project_id AS id FROM plugin_projects_hierarchy_relationship
 							WHERE sub_project_id = $1', array($group_id));
-				if (isset($statusCondition))
+				if (isset($statusCondition)) {
 					$qpa = db_construct_qpa($qpa, ' AND status = $1', array($statusCondition));
-
+				}
 				$res = db_query_qpa($qpa);
 				break;
 			}
 			case 'child': {
-				$qpa = db_construct_qpa(false, 'SELECT sub_project_id as id FROM plugin_projects_hierarchy_relationship
+				$qpa = db_construct_qpa(false, 'SELECT sub_project_id AS id FROM plugin_projects_hierarchy_relationship
 							WHERE project_id = $1', array($group_id));
-				if (isset($statusCondition))
+				if (isset($statusCondition)) {
 					$qpa = db_construct_qpa($qpa, ' AND status = $1', array($statusCondition));
-
+				}
 				$res = db_query_qpa($qpa);
 				break;
 			}
 			case 'root': {
-				$qpa = db_construct_qpa(false, 'SELECT DISTINCT project_id as id FROM plugin_projects_hierarchy_relationship',
+				$res = db_query_params('SELECT project_id AS id FROM plugin_projects_hierarchy_relationship
+							WHERE project_id NOT IN (SELECT DISTINCT sub_project_id FROM plugin_projects_hierarchy_relationship)',
 							array());
-				$res = db_query_qpa($qpa);
 				break;
 			}
 			default: {
@@ -293,13 +294,13 @@ _('Organise projects hierarchically, relation type 1-n');
 	function getDocmanStatus($group_id) {
 		$res = db_query_params('SELECT docman FROM plugin_projects_hierarchy WHERE project_id = $1 limit 1',
 					array($group_id));
-		if (!$res)
+		if (!$res) {
 			return false;
-
+		}
 		$resArr = db_fetch_array($res);
-		if ($resArr['docman'] == 't')
+		if ($resArr['docman'] == 't') {
 			return true;
-
+		}
 		return false;
 	}
 
@@ -314,9 +315,9 @@ _('Organise projects hierarchically, relation type 1-n');
 		$res = db_query_params('UPDATE plugin_projects_hierarchy set docman = $1 WHERE project_id = $2',
 					array($status, $group_id));
 
-		if (!$res)
+		if (!$res) {
 			return false;
-
+		}
 		return true;
 	}
 
@@ -379,9 +380,10 @@ _('Organise projects hierarchically, relation type 1-n');
 	function add($group_id) {
 		if (!$this->exists($group_id)) {
 			$globalConf = $this->getGlobalconf();
-			$res = db_query_params('INSERT INTO plugin_projects_hierarchy (project_id, tree, docman, delegate) VALUES ($1, $2, $3, $4)', array($group_id, (int)$globalConf['tree'], (int)$globalConf['docman'], (int)$globalConf['delegate']));
-			if (!$res)
+			$res = db_query_params('INSERT INTO plugin_projects_hierarchy (project_id, tree, docman) VALUES ($1, $2, $3)', array($group_id, (int)$globalConf['tree'], (int)$globalConf['docman']));
+			if (!$res) {
 				return false;
+			}
 		}
 		return true;
 	}
@@ -426,9 +428,9 @@ _('Organise projects hierarchically, relation type 1-n');
 			if (!$this->hasRelation($project_id, $sub_project_id)) {
 				$res = db_query_params('INSERT INTO plugin_projects_hierarchy_relationship (project_id, sub_project_id)
 							VALUES ($1, $2)', array($project_id, $sub_project_id));
-				if (!$res)
+				if (!$res) {
 					return false;
-
+				}
 				return true;
 			}
 		}
@@ -449,9 +451,9 @@ _('Organise projects hierarchically, relation type 1-n');
 				$res = db_query_params('DELETE FROM plugin_projects_hierarchy_relationship
 							WHERE project_id = $1 AND sub_project_id = $2',
 							array($project_id, $sub_project_id));
-				if (!$res)
+				if (!$res) {
 					return false;
-
+				}
 				return true;
 			}
 		}
@@ -472,9 +474,9 @@ _('Organise projects hierarchically, relation type 1-n');
 				$res = db_query_params('DELETE FROM plugin_projects_hierarchy_relationship
 							WHERE project_id = $1 AND sub_project_id = $2',
 							array($sub_project_id, $project_id));
-				if (!$res)
+				if (!$res) {
 					return false;
-
+				}
 				return true;
 			}
 		}
@@ -495,8 +497,9 @@ _('Organise projects hierarchically, relation type 1-n');
 						WHERE ( project_id = $1 AND sub_project_id = $2 )
 						OR ( project_id = $2 AND sub_project_id = $1 )',
 						array($project_id, $sub_project_id));
-			if ($res && db_numrows($res) == 1 )
+			if ($res && db_numrows($res) == 1 ) {
 				return true;
+			}
 		}
 		return false;
 	}
@@ -529,11 +532,12 @@ _('Organise projects hierarchically, relation type 1-n');
 						}
 					}
 					$res = db_query_qpa($qpa);
-					if (!$res)
+					if (!$res) {
 						return false;
-
-					if (db_affected_rows($res))
+					}
+					if (db_affected_rows($res)) {
 						return true;
+					}
 				} else {
 					$qpa = db_construct_qpa(false, 'DELETE FROM plugin_projects_hierarchy_relationship');
 					switch ($relation) {
@@ -553,11 +557,12 @@ _('Organise projects hierarchically, relation type 1-n');
 						}
 					}
 					$res = db_query_qpa($qpa);
-					if (!$res)
+					if (!$res) {
 						return false;
-
-					if (db_affected_rows($res))
+					}
+					if (db_affected_rows($res)) {
 						return true;
+					}
 				}
 			}
 		}
@@ -573,12 +578,12 @@ _('Organise projects hierarchically, relation type 1-n');
 	 */
 	function exists($group_id) {
 		$res = db_query_params('SELECT project_id FROM plugin_projects_hierarchy WHERE project_id = $1', array($group_id));
-		if (!$res)
+		if (!$res) {
 			return false;
-
-		if (db_numrows($res))
+		}
+		if (db_numrows($res)) {
 			return true;
-
+		}
 		return false;
 	}
 
@@ -589,7 +594,7 @@ _('Organise projects hierarchically, relation type 1-n');
 	 * @access	public
 	 */
 	function getAdminOptionLink() {
-		return util_make_link('/plugins/'.$this->name.'/?type=globaladmin',_('Global Hierarchy admin'), array('title'=>_('Configure the projects-hierarchy plugin (docman, tree, delegate, globalconf features)')));
+		return util_make_link('/plugins/'.$this->name.'/?type=globaladmin',_('Global Hierarchy admin'), array('title'=>_('Configure the projects-hierarchy plugin (docman, tree, globalconf features)')));
 	}
 
 	/**
@@ -691,7 +696,6 @@ _('Organise projects hierarchically, relation type 1-n');
 				$returnArr[$column] = 0;
 			}
 		}
-
 		return $returnArr;
 	}
 
@@ -726,27 +730,26 @@ _('Organise projects hierarchically, relation type 1-n');
 	/**
 	 * updateGlobalConf - update the global configuration in database
 	 *
-	 * @param	array	$confArr configuration array (tree, docman, delegate)
+	 * @param	array	$confArr configuration array (tree, docman)
 	 * @return	bool	true on success
 	 */
 	function updateGlobalConf($confArr) {
-		if (!isset($confArr['tree']) || !isset($confArr['docman']) || !isset($confArr['delegate']))
+		if (!isset($confArr['tree']) || !isset($confArr['docman'])) {
 			return false;
-
+		}
 		$res = db_query_params('truncate plugin_projects_hierarchy_global',array());
-		if (!$res)
+		if (!$res) {
 			return false;
-
-		$res = db_query_params('insert into plugin_projects_hierarchy_global (tree, docman, delegate)
-					values ($1, $2, $3)',
+		}
+		$res = db_query_params('insert into plugin_projects_hierarchy_global (tree, docman)
+					values ($1, $2)',
 					array(
 						$confArr['tree'],
 						$confArr['docman'],
-						$confArr['delegate']
 					));
-		if (!$res)
+		if (!$res) {
 			return false;
-
+		}
 		return true;
 	}
 
@@ -754,26 +757,25 @@ _('Organise projects hierarchically, relation type 1-n');
 	 * updateConf - update the configuration in database for this project
 	 *
 	 * @param	integer	$project_id
-	 * @param	array	$confArr configuration array (tree, docman, delegate)
+	 * @param	array	$confArr configuration array (tree, docman)
 	 * @return	bool	true on success
 	 */
 	function updateConf($project_id, $confArr) {
-		if (!isset($confArr['tree']) || !isset($confArr['docman']) || !isset($confArr['delegate']) || !isset($confArr['globalconf']))
+		if (!isset($confArr['tree']) || !isset($confArr['docman']) || !isset($confArr['globalconf'])) {
 			return false;
-
+		}
 		$res = db_query_params('update plugin_projects_hierarchy
-					set (tree, docman, delegate, globalconf) = ($1, $2, $3, $4)
-					where project_id = $5',
+					set (tree, docman, globalconf) = ($1, $2, $3)
+					where project_id = $4',
 					array(
 						$confArr['tree'],
 						$confArr['docman'],
-						$confArr['delegate'],
 						$confArr['globalconf'],
 						$project_id
 					));
-		if (!$res)
+		if (!$res) {
 			return false;
-
+		}
 		return true;
 	}
 
@@ -858,13 +860,10 @@ _('Organise projects hierarchically, relation type 1-n');
 	 * @access	public
 	 */
 	function is_child($group_id) {
-		if (count($this->getFamily($group_id, 'parent', true, 'any'))>0)
+		if (count($this->getFamily($group_id, 'parent', true, 'any')) > 0) {
 			return true;
-		else
+		} else {
 			return false;
+		}
 	}
 }
-// Local Variables:
-// mode: php
-// c-file-style: "bsd"
-// End:
diff --git a/src/plugins/projects-hierarchy/db/20161228-plugin-hierarchy-nodelegate.sql b/src/plugins/projects-hierarchy/db/20161228-plugin-hierarchy-nodelegate.sql
new file mode 100644
index 0000000..89f3016
--- /dev/null
+++ b/src/plugins/projects-hierarchy/db/20161228-plugin-hierarchy-nodelegate.sql
@@ -0,0 +1,2 @@
+ALTER TABLE plugin_projects_hierarchy_global DROP COLUMN delegate;
+ALTER TABLE plugin_projects_hierarchy DROP COLUMN delegate;
diff --git a/src/plugins/projects-hierarchy/include/hierarchy_utils.php b/src/plugins/projects-hierarchy/include/hierarchy_utils.php
index 556ff86..b25e1ef 100644
--- a/src/plugins/projects-hierarchy/include/hierarchy_utils.php
+++ b/src/plugins/projects-hierarchy/include/hierarchy_utils.php
@@ -1,5 +1,7 @@
 <?php
-/*
+/**
+ * Projects Hierarchy Plugin
+ *
  * Copyright 2004 (c) GForge LLC
  * Copyright 2006 (c) Fabien Regnier - Sogeti
  * Copyright 2011, Franck Villaume - Capgemini
@@ -34,20 +36,6 @@ function link_box($group_id, $name, $selected = 'xzxzxz') {
 	return html_build_select_box($link, $name, $selected, false);
 }
 
-function type_son_box() {
-	return "<select name='link_type' onchange=\"javascript:
-if(this.value!= 0){
-document.formson.son.disabled=false
-}
-else {
-document.formson.son.disabled=true
-}\">
-\n<option value='0' selected=\"selected\" >"._('Link Type')."</option>\n
-<option value='shar'>"._('Share')."</option>\n
-<option value='navi' >"._('Navigation')."</option>\n
-</select>";
-}
-
 //search all the family,all ancestor
 function get_family($group_id, $family = '', $cpt = 0){
 	$res = db_query_params('SELECT project_id FROM plugin_projects_hierarchy WHERE sub_project_id = $1',
@@ -63,7 +51,3 @@ function get_family($group_id, $family = '', $cpt = 0){
 	}
 	return $family;
 }
-// Local Variables:
-// mode: php
-// c-file-style: "bsd"
-// End:
diff --git a/src/plugins/projects-hierarchy/view/admin/viewProjectConfiguration.php b/src/plugins/projects-hierarchy/view/admin/viewProjectConfiguration.php
index 2c8574a..c28b157 100644
--- a/src/plugins/projects-hierarchy/view/admin/viewProjectConfiguration.php
+++ b/src/plugins/projects-hierarchy/view/admin/viewProjectConfiguration.php
@@ -1,6 +1,6 @@
 <?php
 /**
- * Projects Hierarchy plugin
+ * Projects Hierarchy Plugin
  *
  * Copyright 2011, Franck Villaume - Capgemini
  * Copyright 2014, Franck Villaume - TrivialDev
@@ -50,17 +50,6 @@ if (!$projectsHierarchyProjectConf) {
 	$cells[][] = html_e('input', $inputAttrs);
 	echo $HTML->multiTableRow(array(), $cells);
 
-	/* Not Yet Implemented */
-	/*
-	$cells = array();
-	$cells[][] = html_e('label', array('id' => 'projectsHierarchy-delegate', 'title' => _('Enable full rights and configuration delegation to parent.')), _('Enable delegate'));
-	$inputAttrs = array('type' => 'checkbox', 'name' => 'delegate', 'value' => 1);
-	if ($projectsHierarchyProjectConf['delegate'])
-		$inputAttrs['checked'] = 'checked';
-	$cells[][] = html_e('input', $inputAttrs);
-	echo $HTML->multiTableRow(array(), $cells);
-	*/
-
 	$cells = array();
 	$cells[][] = html_e('label', array('id' => 'projectsHierarchy-globalconf', 'title' => _('Use forge global configuration. Superseed any configuration done at project level.')), _('Enable forge global configuration'));
 	$inputAttrs = array('type' => 'checkbox', 'name' => 'globalconf', 'value' => 1);
diff --git a/src/plugins/projects-hierarchy/view/admin_project_link.php b/src/plugins/projects-hierarchy/view/admin_project_link.php
index 9707153..2eaec39 100644
--- a/src/plugins/projects-hierarchy/view/admin_project_link.php
+++ b/src/plugins/projects-hierarchy/view/admin_project_link.php
@@ -1,5 +1,6 @@
 <?php
 /**
+ * Projects Hierarchy Plugin
  * admin hierarchy view
  *
  * Copyright 2006 (c) Fabien Regnier - Sogeti
@@ -78,5 +79,6 @@ if (sizeof($pendingParent)) {
 	echo $HTML->closeForm();
 }
 
-if (!sizeof($pendingParent))
+if (!sizeof($pendingParent)) {
 	echo $HTML->information(_('No pending requests'));
+}
diff --git a/src/plugins/projects-hierarchy/view/docman_project_link.php b/src/plugins/projects-hierarchy/view/docman_project_link.php
index e4eba31..0da1db3 100644
--- a/src/plugins/projects-hierarchy/view/docman_project_link.php
+++ b/src/plugins/projects-hierarchy/view/docman_project_link.php
@@ -1,5 +1,6 @@
 <?php
 /**
+ * Projects Hierarchy Plugin
  * docman hierarchy view
  *
  * Copyright 2011, Franck Villaume - Capgemini
diff --git a/src/plugins/projects-hierarchy/view/home_project_link.php b/src/plugins/projects-hierarchy/view/home_project_link.php
index 31e57a3..0d06f19 100644
--- a/src/plugins/projects-hierarchy/view/home_project_link.php
+++ b/src/plugins/projects-hierarchy/view/home_project_link.php
@@ -1,6 +1,6 @@
 <?php
 /**
- * projects_hierarchyPlugin Class
+ * Projects Hierarchy Plugin
  *
  * Copyright 2006 (c) Fabien Regnier - Sogeti
  * Copyright 2010-2011, Franck Villaume - Capgemini
@@ -55,9 +55,9 @@ if (sizeof($parent) || sizeof($childs)) {
 		echo html_ac(html_ap() -1);
 	}
 	if (sizeof($childs)) {
-		if (sizeof($parent))
+		if (sizeof($parent)) {
 			echo html_e('hr');
-
+		}
 		echo html_ao('ul');
 		foreach ($childs as $child) {
 			$childGroup = group_get_object($child);
diff --git a/src/plugins/projects-hierarchy/www/index.php b/src/plugins/projects-hierarchy/www/index.php
index 3668a5a..c885714 100644
--- a/src/plugins/projects-hierarchy/www/index.php
+++ b/src/plugins/projects-hierarchy/www/index.php
@@ -1,5 +1,7 @@
 <?php
 /**
+ * Projects Hierarchy Plugin
+ *
  * Copyright 2004 (c) GForge LLC
  * Copyright 2006 (c) Fabien Regnier - Sogeti
  * Copyright 2010-2011, Franck Villaume - Capgemini
@@ -24,10 +26,8 @@
 require_once '../../env.inc.php';
 require_once $gfcommon.'include/pre.php';
 
-$user = session_get_user(); // get the session user
-
-if (!$user || !is_object($user) || $user->isError() || !$user->isActive()) {
-	exit_error("Invalid User", "Cannot Process your request for this user.");
+if (!session_loggedin()) {
+	exit_not_logged_in();
 }
 
 $type = getStringFromRequest('type');
@@ -38,31 +38,27 @@ if (!$type) {
 }
 
 switch ($type) {
-	case "group": {
-		if (!session_loggedin()) {
-			exit_not_logged_in();
-		}
+	case 'group': {
 		$id = getStringFromRequest('id');
 		if (!$id) {
 			exit_error(_('Cannot Process your request')._(': ')._('No ID specified'), 'home');
 		}
 		$group = group_get_object($id);
 		if ( !$group) {
-			exit_error("Invalid Project", 'home');
+			exit_error(_('Invalid Project'), 'home');
 		}
+		session_require_perm('project_admin', $id);
 		if (!$group->usesPlugin($projectsHierarchy->name)) {//check if the group has the projects-hierarchy plugin active
 			exit_error(sprintf(_('First activate the %s plugin through the Project\'s Admin Interface'), $projectsHierarchy->name), 'home');
 		}
-		session_require_perm('project_admin', $id);
-
 		$action = getStringFromRequest('action');
 		global $gfplugins;
 		switch ($action) {
-			case "addChild":
-			case "projectsHierarchyDocman":
-			case "removeChild":
-			case "removeParent":
-			case "validateRelationship": {
+			case 'addChild':
+			case 'projectsHierarchyDocman':
+			case 'removeChild':
+			case 'removeParent':
+			case 'validateRelationship': {
 				include($gfplugins.$projectsHierarchy->name.'/actions/'.$action.'.php');
 				break;
 			}
@@ -73,10 +69,7 @@ switch ($type) {
 		}
 		break;
 	}
-	case "globaladmin": {
-		if (!session_loggedin()) {
-			exit_not_logged_in();
-		}
+	case 'globaladmin': {
 		session_require_global_perm('forge_admin');
 		$action = getStringFromRequest('action');
 		switch ($action) {
@@ -91,19 +84,16 @@ switch ($type) {
 		$projectsHierarchy->getFooter('globaladmin');
 		break;
 	}
-	case "admin": {
-		if (!session_loggedin()) {
-			exit_not_logged_in();
-		}
+	case 'admin': {
 		$id = getStringFromRequest('group_id');
-		session_require_perm('project_admin', $id);
 		if (!$id) {
 			exit_error(_('Cannot Process your request')._(': ')._('No ID specified'), 'home');
 		}
 		$group = group_get_object($id);
 		if ( !$group) {
-			exit_error("Invalid Project", 'home');
+			exit_error(_('Invalid Project'), 'home');
 		}
+		session_require_perm('project_admin', $id);
 		if (!$group->usesPlugin($projectsHierarchy->name)) {//check if the group has the projects-hierarchy plugin active
 			exit_error(sprintf(_('First activate the %s plugin through the Project\'s Admin Interface'), $projectsHierarchy->name), 'home');
 		}
@@ -125,12 +115,7 @@ switch ($type) {
 		break;
 	}
 	default: {
-		exit_error("No TYPE specified", 'home');
+		exit_error(_('No TYPE specified'), 'home');
 		break;
 	}
 }
-
-// Local Variables:
-// mode: php
-// c-file-style: "bsd"
-// End:

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

Summary of changes:
 .../actions/projectsHierarchyDocman.php            |   3 +-
 .../actions/updateGlobalConf.php                   |   1 -
 .../actions/updateProjectConf.php                  |   1 -
 .../actions/validateRelationship.php               |   2 +-
 .../common/projects-hierarchy-init.php             |   6 +-
 .../common/projects-hierarchyPlugin.class.php      | 139 ++++++++++-----------
 .../db/20161228-plugin-hierarchy-nodelegate.sql    |   2 +
 .../projects-hierarchy/include/hierarchy_utils.php |  22 +---
 .../view/admin/viewProjectConfiguration.php        |  13 +-
 .../projects-hierarchy/view/admin_project_link.php |   4 +-
 .../view/docman_project_link.php                   |   1 +
 .../projects-hierarchy/view/home_project_link.php  |   6 +-
 src/plugins/projects-hierarchy/www/index.php       |  49 +++-----
 13 files changed, 103 insertions(+), 146 deletions(-)
 create mode 100644 src/plugins/projects-hierarchy/db/20161228-plugin-hierarchy-nodelegate.sql


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list