5 * Copyright 2006 (c) Fabien Regnier - Sogeti
6 * Copyright 2010-2011, Franck Villaume - Capgemini
7 * http://fusionforge.org
9 * This file is part of FusionForge. FusionForge is free software;
10 * you can redistribute it and/or modify it under the terms of the
11 * GNU General Public License as published by the Free Software
12 * Foundation; either version 2 of the Licence, or (at your option)
15 * FusionForge is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 echo '<h3>'._('Modify the hierarchy').'</h3>';
28 echo '<form action="/plugins/projects_hierarchy/add_son.php?group_id='.$group_id.'" method="POST" name="formson">';
31 echo '<td>'._('Select a project:').'</td><td>'.son_box($group_id,'sub_project_id','0').'</td><td> </td>' ;
33 echo '<td>'._('Commentary:').'</td><td> <input type="text" size="25" value="" name="com"></td>' ;
34 //echo type_son_box();
35 echo '<td><input type="submit" name="son" value="'._('Add son project').'"></td></tr></table></form>';
37 echo '<form action="/plugins/projects_hierarchy/add_link.php?group_id='.$group_id.'" method="POST" name="formlink">';
40 echo '<td>'._('Select a project:').'</td><td>'.link_box($group_id,'sub_project_id','0').'</td><td> </td>';
42 echo '<td>'._('Commentary:').'</td><td><input type="text" size="25" value="" name="com"></td>' ;
43 echo '<td><input type="submit" name="son" value="'._('Add a link').'"></td></tr></table></form>';
45 //select all the sons of the current project
46 $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
47 (groups.group_id = plugin_projects_hierarchy.sub_project_id
48 AND plugin_projects_hierarchy.project_id = $1)',
51 if (!$res_son || db_numrows($res_son) < 1) {
59 while($row_son = db_fetch_array($res_son)){
64 echo "<a href=\"/projects/".$row_son['unix_group_name']."/\">".$row_son['group_name']."</a>";
67 if($row_son['link_type'] == 'navi'){
68 echo _('Navigation link');
74 if($row_son['activated'] == 'f'){
77 print "<b>"._('Authorize')."</b>";
80 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>";
81 echo "<tr><td colspan='4'>"._('Commentary:')." <i>".$row_son['com']."</i>";
85 //select navigation link by father
86 $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
87 (groups.group_id = plugin_projects_hierarchy.project_id
88 AND plugin_projects_hierarchy.sub_project_id = $1 AND plugin_projects_hierarchy.link_type = $2) ',
89 array($group_id,'navi'))
91 if (!$res_son || db_numrows($res_son) < 1) {
102 while($row_son = db_fetch_array($res_son)){
106 //link to the project
107 echo "<a href=\"/projects/".$row_son['unix_group_name']."/\">".$row_son['group_name']."</a>";
110 if($row_son['link_type'] == 'navi'){
111 echo _('Navigation link');
113 echo _('Share link');
117 if($row_son['activated'] == 'f'){
119 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>";
121 print "<b>"._('Authorize')."</b>";
124 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>";
125 echo "<tr><td colspan='4'>"._('Commentary of father:')." <i>".$row_son['com']."</i></td>";
130 //research allowing father
131 $res_father = db_query_params('SELECT group_id,group_name,unix_group_name,project_id,com FROM groups,plugin_projects_hierarchy WHERE
132 groups.group_id = plugin_projects_hierarchy.project_id
133 AND plugin_projects_hierarchy.sub_project_id = $1
134 AND plugin_projects_hierarchy.activated = true AND plugin_projects_hierarchy.link_type = $2',
135 array($group_id, 'shar'))
136 or die (db_error ()) ;
137 if (!$res_father || db_numrows($res_father) < 1) {
139 //display of the father of the current project
140 echo '<table><tr><td colspan=\"2\">';
141 echo _('Project\'s parent');
143 while ($row_father = db_fetch_array($res_father)) {
146 echo "<a href=\"/projects/".$row_father['unix_group_name']."/\">".$row_father['group_name']."</a>";
148 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>";
153 //research waiting fathers
154 $res_wait = db_query_params('SELECT group_id,group_name,unix_group_name,project_id,link_type,com FROM groups,plugin_projects_hierarchy WHERE
155 groups.group_id = plugin_projects_hierarchy.project_id
156 AND plugin_projects_hierarchy.sub_project_id = $1
157 AND plugin_projects_hierarchy.activated = false AND plugin_projects_hierarchy.link_type = $2',
158 array ($group_id, 'shar'))
159 or die (db_error ()) ;
160 if (!$res_wait || db_numrows($res_wait) < 1) {
162 //display of waiting fathers
163 echo '<table><tr><td colspan=\"2\">';
164 echo _('Father waiting for validation');
166 while ($row_wait = db_fetch_array($res_wait)) {
169 echo "<a href=\"../../projects/".$row_wait['unix_group_name']."/\">".$row_wait['group_name']."</a>";
172 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>";
174 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>";
175 echo "</td><tr><td colspan='3'>"._('Commentary of father:')." <i>".$row_wait['com']."</i>";