[Fusionforge-commits] r11837 - in trunk/src/plugins/projects_hierarchy: . common view www

Franck VILLAUME nerville at libremir.placard.fr.eu.org
Sat Dec 18 17:48:52 CET 2010


Author: nerville
Date: 2010-12-18 17:48:51 +0100 (Sat, 18 Dec 2010)
New Revision: 11837

Added:
   trunk/src/plugins/projects_hierarchy/view/
   trunk/src/plugins/projects_hierarchy/view/admin_project_link.php
   trunk/src/plugins/projects_hierarchy/view/project_home_link.php
Modified:
   trunk/src/plugins/projects_hierarchy/common/projects_hierarchy-init.php
   trunk/src/plugins/projects_hierarchy/common/projects_hierarchyPlugin.class.php
   trunk/src/plugins/projects_hierarchy/www/softwaremap.php
   trunk/src/plugins/projects_hierarchy/www/wait_son.php
Log:
start rewrite projects_hierarchy plugin

Modified: trunk/src/plugins/projects_hierarchy/common/projects_hierarchy-init.php
===================================================================
--- trunk/src/plugins/projects_hierarchy/common/projects_hierarchy-init.php	2010-12-18 16:43:59 UTC (rev 11836)
+++ trunk/src/plugins/projects_hierarchy/common/projects_hierarchy-init.php	2010-12-18 16:48:51 UTC (rev 11837)
@@ -1,7 +1,9 @@
 <?php
-
 /**
  *
+ * Copyright 2006 (c) Fabien Regnier - Sogeti
+ * http://fusionforge.org
+ *
  * This file is part of FusionForge.
  *
  * FusionForge is free software; you can redistribute it and/or modify
@@ -20,11 +22,11 @@
  */
 
 global $gfplugins;
-require_once $gfplugins.'projects_hierarchy/common/projects_hierarchyPlugin.class.php' ;
+require_once $gfplugins.'projects_hierarchy/common/projects_hierarchyPlugin.class.php';
 
-$projects_hierarchyPluginObject = new projects_hierarchyPlugin ;
+$projects_hierarchyPluginObject = new projects_hierarchyPlugin;
 
-register_plugin ($projects_hierarchyPluginObject) ;
+register_plugin($projects_hierarchyPluginObject);
 
 // Local Variables:
 // mode: php

Modified: trunk/src/plugins/projects_hierarchy/common/projects_hierarchyPlugin.class.php
===================================================================
--- trunk/src/plugins/projects_hierarchy/common/projects_hierarchyPlugin.class.php	2010-12-18 16:43:59 UTC (rev 11836)
+++ trunk/src/plugins/projects_hierarchy/common/projects_hierarchyPlugin.class.php	2010-12-18 16:48:51 UTC (rev 11837)
@@ -30,251 +30,48 @@
 		$this->text = _('Project Hierarchy'); // To show in the tabs, use...
 		$this->_addHook("groupisactivecheckbox"); // The "use ..." checkbox in editgroupinfo
 		$this->_addHook("groupisactivecheckboxpost"); //
+		$this->_addHook("admin_project_link");
 		$this->_addHook("project_home_link"); // to see father and sons in project home
 		$this->_addHook("tree"); // to see the tree of projects
 		$this->_addHook("delete_link"); // to delete link
 	}
 
 	function CallHook ($hookname, &$params) {
-		global $use_projects_hierarchyplugin,$G_SESSION,$HTML;
-		if ($hookname == "tree") {
-			header('Location: ../plugins/projects_hierarchy/softwaremap.php');
-		} elseif ($hookname == "project_home_link") {
-			// ############################## Display link
-			$group_id = $params;
-			echo $HTML->boxTop(_('Linked projects'));
-			$cpt_project = 0 ;
-			// father request
-			$res = db_query_params('SELECT DISTINCT group_id,unix_group_name,group_name FROM groups,plugin_projects_hierarchy WHERE plugin_projects_hierarchy.link_type=$1 AND plugin_projects_hierarchy.activated=$2 AND groups.group_id=plugin_projects_hierarchy.project_id AND plugin_projects_hierarchy.sub_project_id=$3',
-						array ('shar',
-							't',
-							$group_id));
-			echo db_error();
-			while ($row = db_fetch_array($res)) {
-				echo html_image('ic/forum20g.png','20','20',array('alt'=>_('Link'))).'&nbsp;'._('Parent project').': <a href="'.forge_get_config('url_prefix').'/projects/'.$row['unix_group_name'].'/">' . $row['group_name'] . '</a><br/>';
-				$cpt_project ++;
+		global $G_SESSION, $HTML;
+		$returned = false;
+		switch($hookname) {
+			case "tree": {
+				header('Location: ../plugins/projects_hierarchy/softwaremap.php');
+				break;
 			}
-
-			if($cpt_project != 0) {
-			print '<hr size="1" />';
-			}
-			$cpt_temp = $cpt_project ;
-			// sons request
-			$res = db_query_params('SELECT DISTINCT group_id,unix_group_name,group_name,com FROM groups,plugin_projects_hierarchy WHERE plugin_projects_hierarchy.link_type=$1 AND plugin_projects_hierarchy.activated=$2 AND groups.group_id=plugin_projects_hierarchy.sub_project_id AND plugin_projects_hierarchy.project_id=$3',
-						array ('shar',
-							't',
-							$group_id));
-			echo db_error();
-			while ($row = db_fetch_array($res)) {
-				echo html_image('ic/forum20g.png','20','20',array('alt'=>_('Link'))).'&nbsp;'._('Child project').' : <a href="'.forge_get_config('url_prefix').'/projects/'.$row['unix_group_name'].'/">' . $row['group_name'] . '</a> : '.$row['com'].'<br/>';
-				$cpt_project ++;
-			}
-
-			if($cpt_project != $cpt_temp) {
-			print '<hr size="1" />';
-			}
-			$cpt_temp = $cpt_project ;
-
-			// links if project is father
-			$res = db_query_params('SELECT DISTINCT group_id,unix_group_name,group_name,com FROM groups,plugin_projects_hierarchy WHERE plugin_projects_hierarchy.link_type=$1 AND plugin_projects_hierarchy.activated=$2 AND groups.group_id=plugin_projects_hierarchy.sub_project_id AND plugin_projects_hierarchy.project_id=$3',
-						array ('navi',
-							't',
-							$group_id));
-			echo db_error();
-			while ($row = db_fetch_array($res)) {
-				echo html_image('ic/forum20g.png','20','20',array('alt'=>_('Link'))).'&nbsp;'._('Links')." : <a href=\"".forge_get_config('url_prefix')."/projects/".$row['unix_group_name']."/\">" . $row['group_name'] . "</a> :  ".$row['com']."<br/>";
-				$cpt_project ++;
-			}
-			// links if project is son
-			$res = db_query_params('SELECT DISTINCT group_id,unix_group_name,group_name,com FROM groups,plugin_projects_hierarchy WHERE plugin_projects_hierarchy.link_type=$1 AND plugin_projects_hierarchy.activated=$2 AND groups.group_id=plugin_projects_hierarchy.project_id AND plugin_projects_hierarchy.sub_project_id=$3',
-						array('navi',
-							't',
-							$group_id));
-			echo db_error();
-			while ($row = db_fetch_array($res)) {
-				echo html_image('ic/forum20g.png','20','20',array('alt'=>_('Link'))).'&nbsp;'._('Links')." : <a href=\"".forge_get_config('url_prefix')."/projects/".$row['unix_group_name']."/\">" . $row['group_name'] . "</a><br/>";
-				$cpt_project ++;
-			}
-
-			if($cpt_project != $cpt_temp){ 
-			print '<hr size="1" />';
-			}
-
-			if($cpt_project == 0){ 
-			echo _('No linked project avalaible');
-			print '<hr size="1" />';
-			}
-
-			echo $HTML->boxBottom();
-		} elseif ($hookname == "admin_project_link") {
-			global $gfplugins;
-			require_once $gfplugins.'/projects_hierarchy/www/hierarchy_utils.php';
-
-			$group_id = $params ;
-			echo $HTML->boxMiddle(_('Modify the hierarchy'));
-			echo '<form action="../../plugins/projects_hierarchy/add_son.php?group_id='.$group_id.'" method="POST" name="formson">';
-
-			//select box of sons
-			echo '<table><tr>';
-			echo '<td>'._('Select a project:').'</td><td>'.son_box($group_id,'sub_project_id','0').'</td><td>&nbsp;</td>' ;
-			echo '</tr><tr>' ;
-			echo '<td>'._('Commentary:').'</td><td> <input type="text" size="25" value="" name="com"></td>' ;
-			//echo type_son_box();
-			echo '<td><input type="submit" name="son" value="'._('Add son project').'"></td></tr></table></form>';
-			echo '<br/>';
-			echo '<form action="../../plugins/projects_hierarchy/add_link.php?group_id='.$group_id.'" method="POST" name="formlink">';
-
-			//select box of sons
-			echo '<table><tr>';
-			echo '<td>'._('Select a project:').'</td><td>'.link_box($group_id,'sub_project_id','0').'</td><td>&nbsp;</td>';
-			echo '</tr><tr>' ;
-			echo '<td>'._('Commentary:').'</td><td><input type="text" size="25" value="" name="com"></td>' ;
-			echo '<td><input type="submit" name="son" value="'._('Add a link').'"></td></tr></table></form>';
-			echo '<br/>';
-			//select all the sons of the current project
-			$res_son = db_query_params ('SELECT group_id,group_name,unix_group_name,sub_project_id, activated,link_type,com FROM groups,plugin_projects_hierarchy WHERE 
-							(groups.group_id = plugin_projects_hierarchy.sub_project_id 
-							AND plugin_projects_hierarchy.project_id = $1)',
-							array ($group_id))
-				or die (db_error ());
-			if (!$res_son || db_numrows($res_son) < 1) {
-				$cpt_son = 0;
-			} else {
-				//display of sons
-				$cpt_son = 1;
-				echo _('Link list');
-				echo '<table>';
-				$i = 0;
-				while($row_son = db_fetch_array($res_son)){
-						$i++;
-						echo '<tr>';
-						echo '<td>';
-						//link to the project
-						echo "<a href=\"../../projects/".$row_son['unix_group_name']."/\">".$row_son['group_name']."</a>";
-						echo '</td>'; 
-
-						echo '<td>';
-						if($row_son['link_type'] == 'navi'){
-						echo _('Navigation link');
-						}
-						else {
-						echo _('Share link');
-						}
-						echo '</td>';
-						
-						echo '<td>';
-						if($row_son['activated'] == 'f'){
-							echo _('Waiting');
-						}
-						else {
-							print "<b>"._('Authorize')."</b>";
-						}
-						echo '</td>';
-						echo "<td><a href='#' onclick='if(confirm(\""._('Do you really want to delete this link?')."\")){window.location.href=\"../../plugins/projects_hierarchy/del_son.php?group_id=".$group_id."&sub_group_id=".$row_son['sub_project_id']."\"}'}>"._('Delete')."</a></td>";
-						echo "<tr><td colspan='4'>"._('Commentary:')." <i>".$row_son['com']."</i>";
-						echo '</td></tr>';
-					}
-			}
-			//select  navigation link by father
-			$res_son = db_query_params('SELECT group_id,group_name,unix_group_name,project_id, activated,link_type,com FROM groups,plugin_projects_hierarchy WHERE 
-							(groups.group_id = plugin_projects_hierarchy.project_id 
-							AND plugin_projects_hierarchy.sub_project_id = $1 AND plugin_projects_hierarchy.link_type = $2) ',
-							array($group_id,'navi'))
-				or die (db_error ());
-			if (!$res_son || db_numrows($res_son) < 1) {
-				if($cpt_son == 1 ){
-				echo '</table>';
+			case "project_home_link": {
+				$group_id = $params;
+				$project = group_get_object($group_id);
+				if ($project->usesPlugin($this->name)) {
+					include($this->name.'/view/'.$hookname.'.php');
 				}
-			} else {
-				//display of sons 
-				if($cpt_son != 1 ){
-					echo _('Link list');
-					echo '<table>';
-				}
-
-				$i = 0;
-				while($row_son = db_fetch_array($res_son)){
-					$i++;
-					echo '<tr>';
-					echo '<td>';
-					//link to the project
-					echo "<a href=\"../../projects/".$row_son['unix_group_name']."/\">".$row_son['group_name']."</a>";
-					echo '</td>'; 
-					echo '<td>';
-					if($row_son[link_type] == 'navi'){
-						echo _('Navigation link');
-					} else {
-						echo _('Share link');
-					}
-					echo '</td>';
-					echo '<td>';
-					if($row_son[activated] == 'f'){
-						//echo _('Waiting');
-						echo "<td><a href='#' onclick='if(confirm(\""._('Do you really want to authorize this project?')."\")){window.location.href=\"../../plugins/projects_hierarchy/wait_son.php?sub_group_id=".$group_id."&group_id=".$row_son['project_id']."\"}'}>"._('Authorize')."</a></td>";
-					} else {
-						print "<b>"._('Authorize')."</b>";
-					}
-					echo '</td>';
-					echo "<td><a href='#' onclick='if(confirm(\""._('Do you really want to delete this link?')."\")){window.location.href=\"../../plugins/projects_hierarchy/del_father.php?group_id=".$row_son['project_id']."&sub_group_id=".$group_id."\"}'}>"._('Delete')."</a></td>";
-					echo "<tr><td colspan='4'>"._('Commentary of father:')." <i>".$row_son['com']."</i></td>";
-					echo '</tr>';
-				}
-				echo '</table>';
+				$returned = true;
+				break;
 			}
-			//research allowing father
-			$res_father = db_query_params('SELECT group_id,group_name,unix_group_name,project_id,com FROM groups,plugin_projects_hierarchy WHERE 
-							groups.group_id = plugin_projects_hierarchy.project_id
-							AND plugin_projects_hierarchy.sub_project_id = $1
-							AND plugin_projects_hierarchy.activated = true AND plugin_projects_hierarchy.link_type = $2',
-							array($group_id, 'shar'))
-				or die (db_error ()) ;
-			if (!$res_father || db_numrows($res_father) < 1) {
-			} else {
-				//display of the father of the current project
-				echo '<table><tr><td colspan=\"2\">';
-				echo _('Project\'s parent');
-				echo '</td></tr>';
-				while ($row_father = db_fetch_array($res_father)) {
-					echo '<tr>';
-					echo '<td>';
-					echo "<a href=\"../../projects/".$row_father['unix_group_name']."/\">".$row_father['group_name']."</a>";
-					echo '</td><td>';
-					echo "<td><a href='#' onclick='if(confirm(\""._('Do you really want to delete this link?')."\")){window.location.href=\"../../plugins/projects_hierarchy/del_father.php?sub_group_id=".$group_id."&group_id=".$row_father['group_id']."\"}'}>"._('Delete')."</a></td>";
-					echo '</td></tr>';
+			case "admin_project_link": {
+				global $gfplugins;
+				require_once $gfplugins.'projects_hierarchy/www/hierarchy_utils.php';
+				$group_id = $params;
+				$project = group_get_object($group_id);
+				if ($project->usesPlugin($this->name)) {
+					include($this->name.'/view/'.$hookname.'.php');
 				}
-				echo '</table>';
+				$returned = true;
+				break;
 			}
-			//research waiting fathers
-			$res_wait = db_query_params('SELECT group_id,group_name,unix_group_name,project_id,link_type,com FROM groups,plugin_projects_hierarchy WHERE 
-							groups.group_id = plugin_projects_hierarchy.project_id 
-							AND plugin_projects_hierarchy.sub_project_id = $1
-							AND plugin_projects_hierarchy.activated = false AND plugin_projects_hierarchy.link_type = $2',
-							array ($group_id, 'shar'))
-				or die (db_error ()) ;
-			if (!$res_wait || db_numrows($res_wait) < 1) {
-			} else { 
-				//display of waiting fathers
-				echo '<table><tr><td colspan=\"2\">';
-				echo _('Father waiting for validation');
-				echo '</td></tr>';
-				while ($row_wait = db_fetch_array($res_wait)) {
-					echo '<tr>';
-					echo '<td>';
-					echo "<a href=\"../../projects/".$row_wait['unix_group_name']."/\">".$row_wait['group_name']."</a>";
-					echo '</td>';
-					echo'<td>';
-					echo "<td><a href='#' onclick='if(confirm(\""._('Do you really want to authorize this project?')."\")){window.location.href=\"../../plugins/projects_hierarchy/wait_son.php?sub_group_id=".$group_id."&group_id=".$row_wait['group_id']."\"}'}>"._('Do you really want to authorize this project?')."</a></td>";
-					echo '</td><td>';
-					echo "<td><a href='#' onclick='if(confirm(\""._('Do you really want to delete this link?')."\")){window.location.href=\"../../plugins/projects_hierarchy/del_father.php?sub_group_id=".$group_id."&group_id=".$row_wait['group_id']."\"}'}>"._('Delete')."</a></td>";
-					echo "</td><tr><td colspan='3'>"._('Commentary of father:')." <i>".$row_wait['com']."</i>";
-					echo '</td></tr>';
-				}
-				echo '</table>';
-			}
-		} elseif ($hookname == "delete_link") {
-			$res_son = db_query_params('DELETE FROM plugin_projects_hierarchy WHERE project_id = $1 OR sub_project_id = $2 ',
+			case "delete_link": {
+				$res_son = db_query_params('DELETE FROM plugin_projects_hierarchy WHERE project_id = $1 OR sub_project_id = $2 ',
 							array($params, $params));
+				$returned = true;
+				break;
+			}
 		}
+		return $returned;
 	}
 }
 

Added: trunk/src/plugins/projects_hierarchy/view/admin_project_link.php
===================================================================
--- trunk/src/plugins/projects_hierarchy/view/admin_project_link.php	                        (rev 0)
+++ trunk/src/plugins/projects_hierarchy/view/admin_project_link.php	2010-12-18 16:48:51 UTC (rev 11837)
@@ -0,0 +1,182 @@
+<?php
+/**
+ * projects_hierarchyPlugin Class
+ *
+ * Copyright 2006 (c) Fabien Regnier - Sogeti
+ * Copyright 2010 (c) Franck Villaume - Capgemini
+ * http://fusionforge.org
+ *
+ * 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 FusionForge; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ */
+
+echo $HTML->boxMiddle(_('Modify the hierarchy'));
+echo '<form action="../../plugins/projects_hierarchy/add_son.php?group_id='.$group_id.'" method="POST" name="formson">';
+
+//select box of sons
+echo '<table><tr>';
+echo '<td>'._('Select a project:').'</td><td>'.son_box($group_id,'sub_project_id','0').'</td><td>&nbsp;</td>' ;
+echo '</tr><tr>' ;
+echo '<td>'._('Commentary:').'</td><td> <input type="text" size="25" value="" name="com"></td>' ;
+//echo type_son_box();
+echo '<td><input type="submit" name="son" value="'._('Add son project').'"></td></tr></table></form>';
+echo '<br/>';
+echo '<form action="../../plugins/projects_hierarchy/add_link.php?group_id='.$group_id.'" method="POST" name="formlink">';
+
+//select box of sons
+echo '<table><tr>';
+echo '<td>'._('Select a project:').'</td><td>'.link_box($group_id,'sub_project_id','0').'</td><td>&nbsp;</td>';
+echo '</tr><tr>' ;
+echo '<td>'._('Commentary:').'</td><td><input type="text" size="25" value="" name="com"></td>' ;
+echo '<td><input type="submit" name="son" value="'._('Add a link').'"></td></tr></table></form>';
+echo '<br/>';
+//select all the sons of the current project
+$res_son = db_query_params ('SELECT group_id,group_name,unix_group_name,sub_project_id, activated,link_type,com FROM groups,plugin_projects_hierarchy WHERE 
+			(groups.group_id = plugin_projects_hierarchy.sub_project_id 
+			AND plugin_projects_hierarchy.project_id = $1)',
+			array ($group_id))
+		or die (db_error ());
+if (!$res_son || db_numrows($res_son) < 1) {
+	$cpt_son = 0;
+} else {
+	//display of sons
+	$cpt_son = 1;
+	echo _('Link list');
+	echo '<table>';
+	$i = 0;
+	while($row_son = db_fetch_array($res_son)){
+		$i++;
+		echo '<tr>';
+		echo '<td>';
+		//link to the project
+		echo "<a href=\"../../projects/".$row_son['unix_group_name']."/\">".$row_son['group_name']."</a>";
+		echo '</td>'; 
+		echo '<td>';
+		if($row_son['link_type'] == 'navi'){
+			echo _('Navigation link');
+		} else {
+			echo _('Share link');
+		}
+		echo '</td>';
+		echo '<td>';
+		if($row_son['activated'] == 'f'){
+			echo _('Waiting');
+		} else {
+			print "<b>"._('Authorize')."</b>";
+		}
+		echo '</td>';
+		echo "<td><a href='#' onclick='if(confirm(\""._('Do you really want to delete this link?')."\")){window.location.href=\"../../plugins/projects_hierarchy/del_son.php?group_id=".$group_id."&sub_group_id=".$row_son['sub_project_id']."\"}'}>"._('Delete')."</a></td>";
+		echo "<tr><td colspan='4'>"._('Commentary:')." <i>".$row_son['com']."</i>";
+		echo '</td></tr>';
+	}
+}
+//select  navigation link by father
+$res_son = db_query_params('SELECT group_id,group_name,unix_group_name,project_id, activated,link_type,com FROM groups,plugin_projects_hierarchy WHERE 
+			(groups.group_id = plugin_projects_hierarchy.project_id 
+			AND plugin_projects_hierarchy.sub_project_id = $1 AND plugin_projects_hierarchy.link_type = $2) ',
+			array($group_id,'navi'))
+	or die (db_error ());
+if (!$res_son || db_numrows($res_son) < 1) {
+	if($cpt_son == 1 ){
+		echo '</table>';
+	}
+} else {
+	//display of sons 
+	if($cpt_son != 1 ){
+		echo _('Link list');
+		echo '<table>';
+	}
+
+	$i = 0;
+	while($row_son = db_fetch_array($res_son)){
+		$i++;
+		echo '<tr>';
+		echo '<td>';
+		//link to the project
+		echo "<a href=\"../../projects/".$row_son['unix_group_name']."/\">".$row_son['group_name']."</a>";
+		echo '</td>'; 
+		echo '<td>';
+		if($row_son[link_type] == 'navi'){
+			echo _('Navigation link');
+		} else {
+			echo _('Share link');
+		}
+		echo '</td>';
+		echo '<td>';
+		if($row_son[activated] == 'f'){
+			//echo _('Waiting');
+			echo "<td><a href='#' onclick='if(confirm(\""._('Do you really want to authorize this project?')."\")){window.location.href=\"../../plugins/projects_hierarchy/wait_son.php?sub_group_id=".$group_id."&group_id=".$row_son['project_id']."\"}'}>"._('Authorize')."</a></td>";
+		} else {
+			print "<b>"._('Authorize')."</b>";
+		}
+		echo '</td>';
+		echo "<td><a href='#' onclick='if(confirm(\""._('Do you really want to delete this link?')."\")){window.location.href=\"../../plugins/projects_hierarchy/del_father.php?group_id=".$row_son['project_id']."&sub_group_id=".$group_id."\"}'}>"._('Delete')."</a></td>";
+		echo "<tr><td colspan='4'>"._('Commentary of father:')." <i>".$row_son['com']."</i></td>";
+		echo '</tr>';
+	}
+	echo '</table>';
+}
+//research allowing father
+$res_father = db_query_params('SELECT group_id,group_name,unix_group_name,project_id,com FROM groups,plugin_projects_hierarchy WHERE 
+				groups.group_id = plugin_projects_hierarchy.project_id
+				AND plugin_projects_hierarchy.sub_project_id = $1
+				AND plugin_projects_hierarchy.activated = true AND plugin_projects_hierarchy.link_type = $2',
+				array($group_id, 'shar'))
+	or die (db_error ()) ;
+if (!$res_father || db_numrows($res_father) < 1) {
+} else {
+	//display of the father of the current project
+	echo '<table><tr><td colspan=\"2\">';
+	echo _('Project\'s parent');
+	echo '</td></tr>';
+	while ($row_father = db_fetch_array($res_father)) {
+		echo '<tr>';
+		echo '<td>';
+		echo "<a href=\"../../projects/".$row_father['unix_group_name']."/\">".$row_father['group_name']."</a>";
+		echo '</td><td>';
+		echo "<td><a href='#' onclick='if(confirm(\""._('Do you really want to delete this link?')."\")){window.location.href=\"../../plugins/projects_hierarchy/del_father.php?sub_group_id=".$group_id."&group_id=".$row_father['group_id']."\"}'}>"._('Delete')."</a></td>";
+		echo '</td></tr>';
+	}
+	echo '</table>';
+}
+//research waiting fathers
+$res_wait = db_query_params('SELECT group_id,group_name,unix_group_name,project_id,link_type,com FROM groups,plugin_projects_hierarchy WHERE 
+				groups.group_id = plugin_projects_hierarchy.project_id 
+				AND plugin_projects_hierarchy.sub_project_id = $1
+				AND plugin_projects_hierarchy.activated = false AND plugin_projects_hierarchy.link_type = $2',
+				array ($group_id, 'shar'))
+	or die (db_error ()) ;
+if (!$res_wait || db_numrows($res_wait) < 1) {
+} else { 
+	//display of waiting fathers
+	echo '<table><tr><td colspan=\"2\">';
+	echo _('Father waiting for validation');
+	echo '</td></tr>';
+	while ($row_wait = db_fetch_array($res_wait)) {
+		echo '<tr>';
+		echo '<td>';
+		echo "<a href=\"../../projects/".$row_wait['unix_group_name']."/\">".$row_wait['group_name']."</a>";
+		echo '</td>';
+		echo'<td>';
+		echo "<td><a href='#' onclick='if(confirm(\""._('Do you really want to authorize this project?')."\")){window.location.href=\"../../plugins/projects_hierarchy/wait_son.php?sub_group_id=".$group_id."&group_id=".$row_wait['group_id']."\"}'}>"._('Do you really want to authorize this project?')."</a></td>";
+		echo '</td><td>';
+		echo "<td><a href='#' onclick='if(confirm(\""._('Do you really want to delete this link?')."\")){window.location.href=\"../../plugins/projects_hierarchy/del_father.php?sub_group_id=".$group_id."&group_id=".$row_wait['group_id']."\"}'}>"._('Delete')."</a></td>";
+		echo "</td><tr><td colspan='3'>"._('Commentary of father:')." <i>".$row_wait['com']."</i>";
+		echo '</td></tr>';
+	}
+	echo '</table>';
+}
+?>
\ No newline at end of file

Added: trunk/src/plugins/projects_hierarchy/view/project_home_link.php
===================================================================
--- trunk/src/plugins/projects_hierarchy/view/project_home_link.php	                        (rev 0)
+++ trunk/src/plugins/projects_hierarchy/view/project_home_link.php	2010-12-18 16:48:51 UTC (rev 11837)
@@ -0,0 +1,91 @@
+<?php
+/**
+ * projects_hierarchyPlugin Class
+ *
+ * Copyright 2006 (c) Fabien Regnier - Sogeti
+ * Copyright 2010 (c) Franck Villaume - Capgemini
+ * http://fusionforge.org
+ *
+ * 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 FusionForge; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ */
+ 
+echo $HTML->boxTop(_('Linked projects'));
+$cpt_project = 0 ;
+// father request
+$res = db_query_params('SELECT DISTINCT group_id,unix_group_name,group_name FROM groups,plugin_projects_hierarchy WHERE plugin_projects_hierarchy.link_type=$1 AND plugin_projects_hierarchy.activated=$2 AND groups.group_id=plugin_projects_hierarchy.project_id AND plugin_projects_hierarchy.sub_project_id=$3',
+			array ('shar',
+				't',
+				$group_id));
+echo db_error();
+while ($row = db_fetch_array($res)) {
+	echo html_image('ic/forum20g.png','20','20',array('alt'=>_('Link'))).'&nbsp;'._('Parent project').': <a href="'.forge_get_config('url_prefix').'/projects/'.$row['unix_group_name'].'/">' . $row['group_name'] . '</a><br/>';
+	$cpt_project ++;
+}
+
+if($cpt_project != 0) {
+	print '<hr size="1" />';
+}
+$cpt_temp = $cpt_project;
+// sons request
+$res = db_query_params('SELECT DISTINCT group_id,unix_group_name,group_name,com FROM groups,plugin_projects_hierarchy WHERE plugin_projects_hierarchy.link_type=$1 AND plugin_projects_hierarchy.activated=$2 AND groups.group_id=plugin_projects_hierarchy.sub_project_id AND plugin_projects_hierarchy.project_id=$3',
+			array ('shar',
+				't',
+				$group_id));
+echo db_error();
+while ($row = db_fetch_array($res)) {
+	echo html_image('ic/forum20g.png','20','20',array('alt'=>_('Link'))).'&nbsp;'._('Child project').' : <a href="'.forge_get_config('url_prefix').'/projects/'.$row['unix_group_name'].'/">' . $row['group_name'] . '</a> : '.$row['com'].'<br/>';
+	$cpt_project ++;
+}
+
+if($cpt_project != $cpt_temp) {
+	print '<hr size="1" />';
+}
+$cpt_temp = $cpt_project ;
+
+// links if project is father
+$res = db_query_params('SELECT DISTINCT group_id,unix_group_name,group_name,com FROM groups,plugin_projects_hierarchy WHERE plugin_projects_hierarchy.link_type=$1 AND plugin_projects_hierarchy.activated=$2 AND groups.group_id=plugin_projects_hierarchy.sub_project_id AND plugin_projects_hierarchy.project_id=$3',
+			array ('navi',
+				't',
+				$group_id));
+echo db_error();
+while ($row = db_fetch_array($res)) {
+	echo html_image('ic/forum20g.png','20','20',array('alt'=>_('Link'))).'&nbsp;'._('Links')." : <a href=\"".forge_get_config('url_prefix')."/projects/".$row['unix_group_name']."/\">" . $row['group_name'] . "</a> :  ".$row['com']."<br/>";
+	$cpt_project ++;
+}
+
+// links if project is son
+$res = db_query_params('SELECT DISTINCT group_id,unix_group_name,group_name,com FROM groups,plugin_projects_hierarchy WHERE plugin_projects_hierarchy.link_type=$1 AND plugin_projects_hierarchy.activated=$2 AND groups.group_id=plugin_projects_hierarchy.project_id AND plugin_projects_hierarchy.sub_project_id=$3',
+			array('navi',
+				't',
+				$group_id));
+echo db_error();
+while ($row = db_fetch_array($res)) {
+	echo html_image('ic/forum20g.png','20','20',array('alt'=>_('Link'))).'&nbsp;'._('Links')." : <a href=\"".forge_get_config('url_prefix')."/projects/".$row['unix_group_name']."/\">" . $row['group_name'] . "</a><br/>";
+	$cpt_project ++;
+}
+
+if($cpt_project != $cpt_temp){ 
+	print '<hr size="1" />';
+}
+
+if($cpt_project == 0){ 
+	echo _('No linked project avalaible');
+	print '<hr size="1" />';
+}
+
+echo $HTML->boxBottom();
+?>
\ No newline at end of file

Modified: trunk/src/plugins/projects_hierarchy/www/softwaremap.php
===================================================================
--- trunk/src/plugins/projects_hierarchy/www/softwaremap.php	2010-12-18 16:43:59 UTC (rev 11836)
+++ trunk/src/plugins/projects_hierarchy/www/softwaremap.php	2010-12-18 16:48:51 UTC (rev 11837)
@@ -26,7 +26,7 @@
  */
 
 session_start();
-require_once('../../env.inc.php');    
+require_once('../../env.inc.php');
 require_once $gfcommon.'include/pre.php';
 require_once $gfwww.'include/trove.php';
 
@@ -47,7 +47,7 @@
 $form_cat = intval($form_cat);
 
 // get info about current folder
-$res_trove_cat = db_query_params ('
+$res_trove_cat = db_query_params('
 	SELECT *
 	FROM trove_cat
 	WHERE trove_cat_id=$1 ORDER BY fullname',
@@ -75,357 +75,335 @@
 	<hr />';
 
 if(@$_SESSION['cat'] != 't'){
-		$row_trove_cat = db_fetch_array($res_trove_cat);
-		
-		// #####################################
-		// this section limits search and requeries if there are discrim elements
-		
-		$discrim_url = '';
-		$discrim_desc = '';
-		
-		$qpa_alias = db_construct_qpa () ;
-		$qpa_and = db_construct_qpa () ;
+	$row_trove_cat = db_fetch_array($res_trove_cat);
 
-		if (isset($discrim) && $discrim) {
-			unset ($discrim_queryalias);
-			unset ($discrim_queryand);
-			unset ($discrim_url_b);
-		
-			// commas are ANDs
-			$expl_discrim = explode(',',$discrim);
-		
-			// need one link for each "get out of this limit" links
-			$discrim_url = '&discrim=';
-		
-			$lims=sizeof($expl_discrim);
-			if ($lims > 6) {
-				$lims=6;
-			}
-		
-			// one per argument	
-			for ($i=0;$i<$lims;$i++) {
-				// make sure these are all ints, no url trickery
-				$expl_discrim[$i] = intval($expl_discrim[$i]);
-		
+	// #####################################
+	// this section limits search and requeries if there are discrim elements
 
-				// need one aliased table for everything
-				$qpa_alias = db_construct_qpa ($qpa_alias,
-							       sprintf (', trove_agg trove_agg_%d',
-									$i)) ;
-		
-				// need additional AND entries for aliased tables
-				$qpa_and = db_construct_qpa ($qpa_and,
-							     sprintf (' AND trove_agg_%d.trove_cat_id=$%d AND trove_agg_%d.group_id=trove_agg.group_id ',
-								      $i, $i+1, $i),
-							     array ($expl_discrim[$i])) ;
+	$discrim_url = '';
+	$discrim_desc = '';
 
+	$qpa_alias = db_construct_qpa();
+	$qpa_and = db_construct_qpa();
 
-				// must build query string for all urls
-				if ($i==0) {
-					$discrim_url .= $expl_discrim[$i];
-				} else {
-					$discrim_url .= ','.$expl_discrim[$i];
-				}
-				// must also do this for EACH "get out of this limit" links
-				// convoluted logic to build urls for these, but works quickly
-				for ($j=0;$j<sizeof($expl_discrim);$j++) {
-					if ($i!=$j) {
-						if (!$discrim_url_b[$j]) {
-							$discrim_url_b[$j] = '&discrim='.$expl_discrim[$i];
-						} else {
-							$discrim_url_b[$j] .= ','.$expl_discrim[$i];
-						}
+	if (isset($discrim) && $discrim) {
+		unset($discrim_queryalias);
+		unset($discrim_queryand);
+		unset($discrim_url_b);
+
+		// commas are ANDs
+		$expl_discrim = explode(',',$discrim);
+
+		// need one link for each "get out of this limit" links
+		$discrim_url = '&discrim=';
+
+		$lims = sizeof($expl_discrim);
+		if ($lims > 6) {
+			$lims = 6;
+		}
+
+		// one per argument
+		for ($i = 0; $i < $lims; $i++) {
+			// make sure these are all ints, no url trickery
+			$expl_discrim[$i] = intval($expl_discrim[$i]);
+
+			// need one aliased table for everything
+			$qpa_alias = db_construct_qpa($qpa_alias,
+							sprintf(', trove_agg trove_agg_%d',
+							$i));
+
+			// need additional AND entries for aliased tables
+			$qpa_and = db_construct_qpa($qpa_and,
+							sprintf(' AND trove_agg_%d.trove_cat_id=$%d AND trove_agg_%d.group_id=trove_agg.group_id ',
+								$i, $i +1 , $i),
+							array($expl_discrim[$i]));
+
+			// must build query string for all urls
+			if ($i == 0) {
+				$discrim_url .= $expl_discrim[$i];
+			} else {
+				$discrim_url .= ','.$expl_discrim[$i];
+			}
+			// must also do this for EACH "get out of this limit" links
+			// convoluted logic to build urls for these, but works quickly
+			for ($j = 0; $j < sizeof($expl_discrim); $j++) {
+				if ($i != $j) {
+					if (!$discrim_url_b[$j]) {
+						$discrim_url_b[$j] = '&discrim='.$expl_discrim[$i];
+					} else {
+						$discrim_url_b[$j] .= ','.$expl_discrim[$i];
 					}
 				}
-		
 			}
-		
-			// build text for top of page on what viewier is seeing
-			$discrim_desc = '<span style="color:red;font-size:smaller">'._('Now limiting view to projects in the following categories').':
+		}
+
+		// build text for top of page on what viewier is seeing
+		$discrim_desc = '<span style="color:red;font-size:smaller">'._('Now limiting view to projects in the following categories').':
 		</span>';
-			
-			for ($i=0;$i<sizeof($expl_discrim);$i++) {
-				$discrim_desc .= '<br /> &nbsp; &nbsp; &nbsp; '
-					.trove_getfullpath($expl_discrim[$i])
-					.' <a href="softwaremap.php?form_cat='.$form_cat
-					.$discrim_url_b[$i].'">['._('Remove This Filter').']'
-					.'</a>';
-			}
-			$discrim_desc .= "<hr />\n";
-		} 
-		
-		// #######################################
-		
-		print '<p>'. (isset($discrim_desc) ? $discrim_desc : '') . '</p>';
-		
-		// ######## two column table for key on right
-		// first print all parent cats and current cat
-		print '<table width="100%" border="0" cellspacing="0" cellpadding="0">
+
+		for ($i=0;$i<sizeof($expl_discrim);$i++) {
+			$discrim_desc .= '<br /> &nbsp; &nbsp; &nbsp; '
+				.trove_getfullpath($expl_discrim[$i])
+				.' <a href="softwaremap.php?form_cat='.$form_cat
+				.$discrim_url_b[$i].'">['._('Remove This Filter').']'
+				.'</a>';
+		}
+		$discrim_desc .= "<hr />\n";
+	}
+
+	// #######################################
+
+	print '<p>'. (isset($discrim_desc) ? $discrim_desc : '') . '</p>';
+	// ######## two column table for key on right
+	// first print all parent cats and current cat
+	print '<table width="100%" border="0" cellspacing="0" cellpadding="0">
 		<tr valign="top"><td><span style="font-family:arial,helvetica">';
-		$folders = explode(" :: ",$row_trove_cat['fullpath']);
-		$folders_ids = explode(" :: ",$row_trove_cat['fullpath_ids']);
-		$folders_len = count($folders);
-		for ($i=0;$i<$folders_len;$i++) {
-			for ($sp=0;$sp<($i*2);$sp++) {
-				print " &nbsp; ";
-			}
-			echo html_image("ic/ofolder15.png",'15','13',array());
-			print "&nbsp; ";
-			// no anchor for current cat
-			if ($folders_ids[$i] != $form_cat) {
-				print '<a href="softwaremap.php?form_cat='
-					.$folders_ids[$i].$discrim_url.'">';
-			} else {
-				print '<strong>';
-			}
-			print $folders[$i];
-			if ($folders_ids[$i] != $form_cat) {
-				print '</a>';
-			} else {
-				print '</strong>';
-			}
-			print "<br />\n";
+	$folders = explode(" :: ", $row_trove_cat['fullpath']);
+	$folders_ids = explode(" :: ", $row_trove_cat['fullpath_ids']);
+	$folders_len = count($folders);
+	for ($i = 0; $i < $folders_len; $i++) {
+		for ($sp = 0; $sp < ($i*2); $sp++) {
+			print " &nbsp; ";
 		}
-		
-		// print subcategories
-		$res_sub = db_query_params ('
+		echo html_image("ic/ofolder15.png",'15','13',array());
+		print "&nbsp; ";
+		// no anchor for current cat
+		if ($folders_ids[$i] != $form_cat) {
+			print '<a href="softwaremap.php?form_cat='
+				.$folders_ids[$i].$discrim_url.'">';
+		} else {
+			print '<strong>';
+		}
+		print $folders[$i];
+		if ($folders_ids[$i] != $form_cat) {
+			print '</a>';
+		} else {
+			print '</strong>';
+		}
+		print "<br />\n";
+	}
+
+	// print subcategories
+	$res_sub = db_query_params('
 			SELECT trove_cat.trove_cat_id AS trove_cat_id,
-				trove_cat.fullname AS fullname,
-				trove_treesums.subprojects AS subprojects
+			trove_cat.fullname AS fullname,
+			trove_treesums.subprojects AS subprojects
 			FROM trove_cat LEFT JOIN trove_treesums USING (trove_cat_id) 
 			WHERE (
 				trove_treesums.limit_1=0 
 				OR trove_treesums.limit_1 IS NULL
 			) AND trove_cat.parent=$1
 			ORDER BY fullname
-		',
-			array ($form_cat));
-		echo db_error();
-		
-		while ($row_sub = db_fetch_array($res_sub)) {
-			for ($sp=0;$sp<($folders_len*2);$sp++) {
-				print " &nbsp; ";
-			}
-			print ('<a href="softwaremap.php?form_cat='.$row_sub['trove_cat_id'].$discrim_url.'">');
-			echo html_image("ic/cfolder15.png",'15','13',array());
-			print ('&nbsp; '.$row_sub['fullname'].'</a> <em>('.
-				sprintf(_('%1$s projects'), $row_sub['subprojects']?$row_sub['subprojects']:'0')
-				.')</em><br />');
-				
+			',
+			array($form_cat));
+	echo db_error();
+
+	while ($row_sub = db_fetch_array($res_sub)) {
+		for ($sp=0;$sp<($folders_len*2);$sp++) {
+			print " &nbsp; ";
 		}
-		// ########### right column: root level
-		print '</span></td><td><span style="font-family:arial,helvetica">';
-		// here we print list of root level categories, and use open folder for current
-		$res_rootcat = db_query_params ('
+		print ('<a href="softwaremap.php?form_cat='.$row_sub['trove_cat_id'].$discrim_url.'">');
+		echo html_image("ic/cfolder15.png",'15','13',array());
+		print ('&nbsp; '.$row_sub['fullname'].'</a> <em>('.
+			sprintf(_('%1$s projects'), $row_sub['subprojects']?$row_sub['subprojects']:'0')
+			.')</em><br />');
+	}
+	// ########### right column: root level
+	print '</span></td><td><span style="font-family:arial,helvetica">';
+	// here we print list of root level categories, and use open folder for current
+	$res_rootcat = db_query_params ('
 			SELECT trove_cat_id,fullname
 			FROM trove_cat
 			WHERE parent=0
 			AND trove_cat_id!=0
 			ORDER BY fullname',
 			array ());
-		echo db_error();
-		
-		print _('Browse By').':';
-		while ($row_rootcat = db_fetch_array($res_rootcat)) {
-			// print open folder if current, otherwise closed
-			// also make anchor if not current
-			print ('<br />');
-			if (($row_rootcat['trove_cat_id'] == $row_trove_cat['root_parent'])
+	echo db_error();
+
+	print _('Browse By').':';
+	while ($row_rootcat = db_fetch_array($res_rootcat)) {
+		// print open folder if current, otherwise closed
+		// also make anchor if not current
+		print ('<br />');
+		if (($row_rootcat['trove_cat_id'] == $row_trove_cat['root_parent'])
 				|| ($row_rootcat['trove_cat_id'] == $row_trove_cat['trove_cat_id'])) {
-				echo html_image('ic/ofolder15.png','15','13',array());
-				print ('&nbsp; <strong>'.$row_rootcat['fullname']."</strong>\n");
-			} else {
-				print ('<a href="softwaremap.php?form_cat='
-					.$row_rootcat['trove_cat_id'].$discrim_url.'">');
-				echo html_image('ic/cfolder15.png','15','13',array());
-				print ('&nbsp; '.$row_rootcat['fullname']."\n");
-				print ('</a>');
-			}
+			echo html_image('ic/ofolder15.png','15','13',array());
+			print ('&nbsp; <strong>'.$row_rootcat['fullname']."</strong>\n");
+		} else {
+			print ('<a href="softwaremap.php?form_cat='
+				.$row_rootcat['trove_cat_id'].$discrim_url.'">');
+			echo html_image('ic/cfolder15.png','15','13',array());
+			print ('&nbsp; '.$row_rootcat['fullname']."\n");
+			print ('</a>');
 		}
-		print '</span></td></tr></table>';
-		?>
-		<hr />
-		<?php
-		// one listing for each project
-		
-		$qpa = db_construct_qpa () ;
-		$qpa = db_construct_qpa ($qpa, 'SELECT * FROM trove_agg') ;
-		$qpa = db_join_qpa ($qpa, $qpa_alias) ;
-		$qpa = db_construct_qpa ($qpa, ' WHERE trove_agg.trove_cat_id=$1', array ($form_cat)) ;
-		$qpa = db_join_qpa ($qpa, $qpa_and) ;
-		$qpa = db_construct_qpa ($qpa, ' ORDER BY trove_agg.trove_cat_id ASC, trove_agg.ranking ASC') ;
-		$res_grp = db_query_qpa ($qpa, $TROVE_HARDQUERYLIMIT, 0, SYS_DB_TROVE);
+	}
+	print '</span></td></tr></table>';
+?>
+<hr />
+<?php
+	// one listing for each project
 
-		echo db_error();
-		$querytotalcount = db_numrows($res_grp);
-			
-		// #################################################################
-		// limit/offset display
-		
-		// no funny stuff with get vars
-		
-		if (!isset($page) || !is_numeric($page)) {
-			$page = 1;
+	$qpa = db_construct_qpa();
+	$qpa = db_construct_qpa($qpa, 'SELECT * FROM trove_agg');
+	$qpa = db_join_qpa($qpa, $qpa_alias);
+	$qpa = db_construct_qpa($qpa, ' WHERE trove_agg.trove_cat_id=$1', array ($form_cat));
+	$qpa = db_join_qpa($qpa, $qpa_and);
+	$qpa = db_construct_qpa($qpa, ' ORDER BY trove_agg.trove_cat_id ASC, trove_agg.ranking ASC');
+	$res_grp = db_query_qpa($qpa, $TROVE_HARDQUERYLIMIT, 0, SYS_DB_TROVE);
+
+	echo db_error();
+	$querytotalcount = db_numrows($res_grp);
+
+	// #################################################################
+	// limit/offset display
+	// no funny stuff with get vars
+
+	if (!isset($page) || !is_numeric($page)) {
+		$page = 1;
+	}
+
+	// store this as a var so it can be printed later as well
+	$html_limit = '<span style="text-align:center;font-size:smaller">';
+	if ($querytotalcount == $TROVE_HARDQUERYLIMIT){
+		$html_limit .= 'More than ';
+		$html_limit .= sprintf(_('More than <strong>%1$s</strong> projects in result set.'), $querytotalcount);
+	}
+	$html_limit .= sprintf(ngettext('<strong>%1$s</strong> project in result set.', '<strong>%1$s</strong> projects in result set.', $querytotalcount), $querytotalcount);
+
+	// only display pages stuff if there is more to display
+	if ($querytotalcount > $TROVE_BROWSELIMIT) {
+		$html_limit .= ' Displaying '.$TROVE_BROWSELIMIT.' per page. Projects sorted by activity ranking.<br />';
+
+		// display all the numbers
+		for ($i = 1; $i <= ceil($querytotalcount/$TROVE_BROWSELIMIT); $i++) {
+			$html_limit .= ' ';
+			if ($page != $i) {
+				$html_limit .= '<a href="softwaremap.php?form_cat='.$form_cat;
+				$html_limit .= $discrim_url.'&page='.$i;
+				$html_limit .= '">';
+			} else $html_limit .= '<strong>';
+			$html_limit .= '&lt;'.$i.'&gt;';
+			if ($page != $i) {
+				$html_limit .= '</a>';
+			} else $html_limit .= '</strong>';
+			$html_limit .= ' ';
 		}
-		
-		// store this as a var so it can be printed later as well
-		$html_limit = '<span style="text-align:center;font-size:smaller">';
-		if ($querytotalcount == $TROVE_HARDQUERYLIMIT){
-			$html_limit .= 'More than ';
-			$html_limit .= sprintf(_('More than <strong>%1$s</strong> projects in result set.'), $querytotalcount);
-			
-			}
-		$html_limit .= sprintf(ngettext('<strong>%1$s</strong> project in result set.', '<strong>%1$s</strong> projects in result set.', $querytotalcount), $querytotalcount);
-		
-		// only display pages stuff if there is more to display
-		if ($querytotalcount > $TROVE_BROWSELIMIT) {
-			$html_limit .= ' Displaying '.$TROVE_BROWSELIMIT.' per page. Projects sorted by activity ranking.<br />';
-		
-			// display all the numbers
-			for ($i=1;$i<=ceil($querytotalcount/$TROVE_BROWSELIMIT);$i++) {
-				$html_limit .= ' ';
-				if ($page != $i) {
-					$html_limit .= '<a href="softwaremap.php?form_cat='.$form_cat;
-					$html_limit .= $discrim_url.'&page='.$i;
-					$html_limit .= '">';
-				} else $html_limit .= '<strong>';
-				$html_limit .= '&lt;'.$i.'&gt;';
-				if ($page != $i) {
-					$html_limit .= '</a>';
-				} else $html_limit .= '</strong>';
-				$html_limit .= ' ';
-			}
+	}
+
+	$html_limit .= '</span>';
+	print $html_limit."<hr />\n";
+
+	// #################################################################
+	// print actual project listings
+	// note that the for loop starts at 1, not 0
+	for ($i_proj = 1; $i_proj <= $querytotalcount; $i_proj++) { 
+		$row_grp = db_fetch_array($res_grp);
+
+		// check to see if row is in page range
+		if (($i_proj > (($page-1)*$TROVE_BROWSELIMIT)) && ($i_proj <= ($page*$TROVE_BROWSELIMIT))) {
+			$viewthisrow = 1;
+		} else {
+			$viewthisrow = 0;
 		}
-		
-		$html_limit .= '</span>';
-		
-		print $html_limit."<hr />\n";
-		
-		// #################################################################
-		// print actual project listings
-		// note that the for loop starts at 1, not 0
-		for ($i_proj=1;$i_proj<=$querytotalcount;$i_proj++) { 
-			$row_grp = db_fetch_array($res_grp);
-		
-			// check to see if row is in page range
-			if (($i_proj > (($page-1)*$TROVE_BROWSELIMIT)) && ($i_proj <= ($page*$TROVE_BROWSELIMIT))) {
-				$viewthisrow = 1;
-			} else {
-				$viewthisrow = 0;
-			}	
-		
-			if ($row_grp && $viewthisrow) {
-				print '<table border="0" cellpadding="0" width="100%"><tr valign="top"><td colspan="2"><span style="font-family:arial,helvetica">';
-				print '$i_proj. '.util_make_link ('/projects/'. strtolower($row_grp['unix_group_name']) .'/','<strong>'.htmlspecialchars($row_grp['group_name']).'</strong> ');
-				if ($row_grp['short_description']) {
-					print "- " . htmlspecialchars($row_grp['short_description']);
-				}
-		
-				print '<br />&nbsp;';
-				// extra description
-				print '</span></td></tr><tr valign="top"><td><span style="font-family:arial,helvetica">';
-				// list all trove categories
-				print trove_getcatlisting($row_grp['group_id'],1,0);
-		
-				print '</span></td>'."\n".'<td align="right"><span style="font-family:arial,helvetica">'; // now the right side of the display
-				print 'Activity Percentile: <strong>'. number_format($row_grp['percentile'],2) .'</strong>';
-				print '<br />Activity Ranking: <strong>'. number_format($row_grp['ranking'],2) .'</strong>';
-				print '<br />Register Date: <strong>'.date(_('Y-m-d H:i'),$row_grp['register_time']).'</strong>';
-				print '</span></td></tr>';
-		                print '</table>';
-				print '<hr />';
-			} // end if for row and range chacking
-		}
-		
-		// print bottom navigation if there are more projects to display
-		if ($querytotalcount > $TROVE_BROWSELIMIT) {
-			print $html_limit;
-		}
-		
-		
-		// print '<p><FONT size="-1">This listing was produced by the following query: '
-		//	.$query_projlist.'</FONT>';
-}
-else {
-		function build_tree() {
-			global $project_name ;
-			$res = db_query_params ('select p1.group_id as father_id,p1.unix_group_name as father_unix_name,p1.group_name as father_name,p2.group_id as son_id,p2.unix_group_name as son_unix_name,p2.group_name as son_name from groups as p1,groups as p2,plugin_projects_hierarchy where p1.group_id=plugin_projects_hierarchy.project_id and p2.group_id=plugin_projects_hierarchy.sub_project_id and plugin_projects_hierarchy.activated=$1 AND plugin_projects_hierarchy.link_type=$2',
+
+		if ($row_grp && $viewthisrow) {
+			print '<table border="0" cellpadding="0" width="100%"><tr valign="top"><td colspan="2"><span style="font-family:arial,helvetica">';
+			print '$i_proj. '.util_make_link ('/projects/'. strtolower($row_grp['unix_group_name']) .'/','<strong>'.htmlspecialchars($row_grp['group_name']).'</strong> ');
+			if ($row_grp['short_description']) {
+				print "- " . htmlspecialchars($row_grp['short_description']);
+			}
+
+			print '<br />&nbsp;';
+			// extra description
+			print '</span></td></tr><tr valign="top"><td><span style="font-family:arial,helvetica">';
+			// list all trove categories
+			print trove_getcatlisting($row_grp['group_id'],1,0);
+
+			print '</span></td>'."\n".'<td align="right"><span style="font-family:arial,helvetica">'; // now the right side of the display
+			print 'Activity Percentile: <strong>'. number_format($row_grp['percentile'],2) .'</strong>';
+			print '<br />Activity Ranking: <strong>'. number_format($row_grp['ranking'],2) .'</strong>';
+			print '<br />Register Date: <strong>'.date(_('Y-m-d H:i'),$row_grp['register_time']).'</strong>';
+			print '</span></td></tr>';
+			print '</table>';
+			print '<hr />';
+		} // end if for row and range chacking
+	}
+
+	// print bottom navigation if there are more projects to display
+	if ($querytotalcount > $TROVE_BROWSELIMIT) {
+		print $html_limit;
+	}
+
+
+	// print '<p><FONT size="-1">This listing was produced by the following query: '
+	//	.$query_projlist.'</FONT>';
+} else {
+	function build_tree() {
+		global $project_name;
+		$res = db_query_params('select p1.group_id as father_id,p1.unix_group_name as father_unix_name,p1.group_name as father_name,p2.group_id as son_id,p2.unix_group_name as son_unix_name,p2.group_name as son_name from groups as p1,groups as p2,plugin_projects_hierarchy where p1.group_id=plugin_projects_hierarchy.project_id and p2.group_id=plugin_projects_hierarchy.sub_project_id and plugin_projects_hierarchy.activated=$1 AND plugin_projects_hierarchy.link_type=$2',
 			array ('t',
 				'shar'));
-			echo db_error();
-			// construction du tableau associatif
-			// key = name of the father
-			// value = list of sons
-			$tree = array();
-			while ($row = db_fetch_array($res)) {
-				//$tree[$row['father_name']][] = $row['son_name'];
-				$tree[$row['father_id']][] = $row['son_id'];
-				//get the unix name of the project 
-				$project_name[$row['father_id']][0] = $row['father_name'];
-				$project_name[$row['son_id']][0] = $row['son_name'];
-				$project_name[$row['father_id']][1] = $row['father_unix_name'];
-				$project_name[$row['son_id']][1] = $row['son_unix_name'];
+		echo db_error();
+		// construction du tableau associatif
+		// key = name of the father
+		// value = list of sons
+		$tree = array();
+		while ($row = db_fetch_array($res)) {
+			//$tree[$row['father_name']][] = $row['son_name'];
+			$tree[$row['father_id']][] = $row['son_id'];
+			//get the unix name of the project 
+			$project_name[$row['father_id']][0] = $row['father_name'];
+			$project_name[$row['son_id']][0] = $row['son_name'];
+			$project_name[$row['father_id']][1] = $row['father_unix_name'];
+			$project_name[$row['son_id']][1] = $row['son_unix_name'];
 			}
-			return $tree;
-		}
-		
-		function aff_tree($tree, $lvl) {
-			global $project_name ;
-			
-			echo "<br/>";
-			$arbre = "" ;
-			$cpt_pere = 0 ;
-			
-			while (list($key, $sons) = each($tree)) {
-				//echo $key . "<br/>";
-				//we build a array with id of father and son.
-				//If no father --> 0
+		return $tree;
+	}
+
+	function aff_tree($tree, $lvl) {
+		global $project_name ;
+
+		echo "<br/>";
+		$arbre = array();
+		$cpt_pere = 0;
+
+		while (list($key, $sons) = each($tree)) {
+			//echo $key . "<br/>";
+			//we build a array with id of father and son.
+			//If no father --> 0
 			// Really don't know why there is a warning there, and added @
-				if(@!$arbre[$key] != 0){ 
-					$arbre[$key] = 0 ;
-				}
-				$cpt_pere = $key;
-				foreach ($sons as $son) {
-					//echo "&nbsp;" . $son . "<br/>";
-					$arbre[$son] = $cpt_pere; 
-				}
-				
+			if(@!$arbre[$key] != 0){ 
+				$arbre[$key] = 0 ;
 			}
-			
-			echo '<table ><tr><td>';
-			
-			?>
-			<script type="text/javascript">
-				<!--
+			$cpt_pere = $key;
+			foreach ($sons as $son) {
+				//echo "&nbsp;" . $son . "<br/>";
+				$arbre[$son] = $cpt_pere; 
+			}
+		}
+
+		echo '<table ><tr><td>';
+
+		?>
+		<script type="text/javascript">
 			//add files dtress.css, dtree.js et du dossier img
-				d = new dTree('d');	
-				d.add(0,-1,'<?php echo _('Project Tree');?>');
-				<?php
+			d = new dTree('d');
+			d.add(0,-1,'<?php echo _('Project Tree');?>');
+			<?php
 				reset($arbre);
 				//construction automatique de l'arbre format : (num_fils, num_pere,nom,nom_unix)
 				while (list($key2, $sons2) = each($arbre)) {
 					echo "d.add('".$key2."','".$sons2."','".$project_name[$key2][0]."','".util_make_url( '/projects/'.$project_name[$key2][1] .'/', $project_name[$key2][1] ) ."');";
 				}
-				?>
-		
-				document.write(d);
-		
-				
-			</script>
-			<?php
-			echo '</td></tr></table>';
-		}
-		
-		/*function aff_node($node, $lvl) {
-			for ($i = 0; $i < $lvl; ++$i) {
-				echo "&nbsp;";
-			}
-			echo $node . "<br/>";
-		}*/
-		
-		$tree = build_tree();
-		aff_tree($tree, 0);
+			?>
+			document.write(d);
+		</script>
+		<?php
+		echo '</td></tr></table>';
+	}
 
+	$tree = build_tree();
+	aff_tree($tree, 0);
 }
 
 $HTML->footer(array());
@@ -434,5 +412,4 @@
 // mode: php
 // c-file-style: "bsd"
 // End:
-
 ?>

Modified: trunk/src/plugins/projects_hierarchy/www/wait_son.php
===================================================================
--- trunk/src/plugins/projects_hierarchy/www/wait_son.php	2010-12-18 16:43:59 UTC (rev 11836)
+++ trunk/src/plugins/projects_hierarchy/www/wait_son.php	2010-12-18 16:48:51 UTC (rev 11837)
@@ -21,26 +21,26 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-require_once('../../env.inc.php');    
+require_once('../../env.inc.php');
 require_once $gfcommon.'include/pre.php';
 
 $group_id = getIntFromRequest('group_id');
 $sub_group_id = getIntFromRequest('sub_group_id');
 
-session_require_perm ('project_admin', $group_id) ;
+session_require_perm('project_admin', $group_id);
 //update the link when the son allow the father
 db_begin();
-db_query_params ('UPDATE plugin_projects_hierarchy SET activated = true WHERE project_id  = $1 AND sub_project_id = $2',
-		 array ($group_id, $sub_group_id)
+db_query_params('UPDATE plugin_projects_hierarchy SET activated = true WHERE project_id  = $1 AND sub_project_id = $2',
+		array($group_id, $sub_group_id)
 	) or die(db_error());
 db_commit();
 
-$project = group_get_object ($group_id) ;
-$subproject = group_get_object ($sub_project_id) ;
+$project = group_get_object($group_id);
+$subproject = group_get_object($sub_group_id);
 
 //plugin webcal
-$params[0] =  $sub_group_id;
-$params[1] =  $group_id;
+$params[0] = $sub_group_id;
+$params[1] = $group_id;
 
 plugin_hook('add_cal_link_father',$params);
 
@@ -49,20 +49,19 @@
 
 Parent Project Full Name: %1$s
 Child Project Full Name: %2$s'),
-		   $project->getPublicName(),
-		   $subproject->getPublicName());
+			$project->getPublicName(),
+			$subproject->getPublicName());
 
-$admins = $project->getAdmins() ;
-if (count ($admins) < 1) {
-    $this->setError(_("There is no administrator to send the mail."));
-    return false;
+$admins = $project->getAdmins();
+if (count($admins) < 1) {
+	$project->setError(_("There is no administrator to send the mail."));
 }
 
 foreach ($admins as $u) {
 	util_send_message($u->getEmail(),
-			  sprintf(_('New Parent %1$s Relation Validated'),
-				  $project->getPublicName()),
-			  $message);
+			sprintf(_('New Parent %1$s Relation Validated'),
+				$project->getPublicName()),
+			$message);
 }
 
 header("Location: ".util_make_url ('/project/admin/index.php?group_id='.$sub_group_id));




More information about the Fusionforge-commits mailing list