*
* Copyright 2006 (c) Fabien Regnier - Sogeti
* Copyright 2010-2011, Franck Villaume - Capgemini
+ * Copyright 2012-2013, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
break;
}
case "group_delete": {
- if ($params['group']->usesPlugins($this->name)) {
+ if ($params['group']->usesPlugin($this->name)) {
if ($this->remove($params['group_id'])) {
$returned = true;
}
break;
}
case "display_hierarchy_submenu": {
- // Use to display a submenu in software map page if at least one project has a valid relationship
- $res1 = db_query_params('SELECT g.group_name FROM plugins p, group_plugin gp, groups g WHERE plugin_name = $1 and gp.group_id = g.group_id and p.plugin_id = gp.plugin_id',
- array($this->name));
- if ($res1) {
- 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)
- $row = db_fetch_array($res2);
- if ($row['used']) {
- $hierarchy_used = true;
+ $globalConf = $this->getGlobalconf();
+ if ($globalConf['tree']) {
+ // Use to display a submenu in software map page if at least one project has a valid relationship
+ $res1 = db_query_params('SELECT g.group_name FROM plugins p, group_plugin gp, groups g WHERE plugin_name = $1 and gp.group_id = g.group_id and p.plugin_id = gp.plugin_id',
+ array($this->name));
+ if ($res1) {
+ 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)
+ $row = db_fetch_array($res2);
+ if ($row['used']) {
+ $hierarchy_used = true;
+ }
}
}
- }
- if (isset($hierarchy_used)) {
- $hierarMenuTitle[] = _('Per Category');
- $hierarMenuTitle[] = _('Per Hierarchy');
- $hierarMenuAttr[] = array('title' => _('Browse per category the available projects. Some projects might not appear here they do not choose any categories'), 'class' => 'tabtitle-nw');
- $hierarMenuAttr[] = array('title' => _('Browse per hierarchy. Projects can share relationship between projects, as father and sons'), 'class' => 'tabtitle');
- $hierarMenuUrl[] = '/softwaremap/trove_list.php?cat=c';
- $hierarMenuUrl[] = '/softwaremap/trove_list.php?cat=h';
- echo ($HTML->subMenu($hierarMenuTitle, $hierarMenuUrl, $hierarMenuAttr));
+ if (isset($hierarchy_used)) {
+ $hierarMenuTitle[] = _('Per Category');
+ $hierarMenuTitle[] = _('Per Hierarchy');
+ $hierarMenuAttr[] = array('title' => _('Browse per category the available projects. Some projects might not appear here they do not choose any categories'), 'class' => 'tabtitle-nw');
+ $hierarMenuAttr[] = array('title' => _('Browse per hierarchy. Projects can share relationship between projects, as father and sons'), 'class' => 'tabtitle');
+ $hierarMenuUrl[] = '/softwaremap/trove_list.php?cat=c';
+ $hierarMenuUrl[] = '/softwaremap/trove_list.php?cat=h';
+ echo ($HTML->subMenu($hierarMenuTitle, $hierarMenuUrl, $hierarMenuAttr));
+ }
}
$returned = true;
break;
}
case "docmansearch_has_hierarchy": {
- $group_id = $params['group_id'];
- $group = group_get_object($group_id);
- if ($group->usesPlugin($this->name)) {
- $qpa = $params['qpa'];
+ if ($params['includesubprojects']) {
+ $group_id = $params['group_id'];
+ $group = group_get_object($group_id);
+ if ($group->usesPlugin($this->name)) {
+ $arrayChilds= $this->getFamily($group_id, 'child', true, 'validated');
+ foreach ( $arrayChilds as $childId ) {
+ $params['qpa'] = db_construct_qpa($params['qpa'], ' OR group_id = $1', array($childId));
+ }
+ }
}
$returned = true;
break;
// value = list of sons
$tree = array();
while ($row = db_fetch_array($res)) {
- if (forge_check_perm('project_read', $row['father_id'])) {
+ if (forge_check_perm('project_read', $row['father_id']) && forge_check_perm('project_read', $row['son_id'])) {
$tree[$row['father_id']][] = $row['son_id'];
//get the unix name of the project
$project_name[$row['father_id']][0] = $row['father_name'];
* @access public
*/
function getAdminOptionLink() {
- return util_make_link('/plugins/'.$this->name.'/?type=globaladmin&pluginname='.$this->name,_('Global Hierarchy admin'), array('class'=>'tabtitle', 'title'=>_('Configure the projets-hierarchy plugin (docman, tree, delegate, globalconf features)')));
+ return util_make_link('/plugins/'.$this->name.'/?type=globaladmin',_('Global Hierarchy admin'), array('class'=>'tabtitle', 'title'=>_('Configure the projets-hierarchy plugin (docman, tree, delegate, globalconf features)')));
}
/**
WHERE status = $1
AND group_id != $2
AND group_id <> ALL ($3)
- AND group_id IN (select group_id from group_plugin,plugins where group_plugin.plugin_id = plugins.plugin_id and plugins.plugin_name = $4);',
+ AND group_id IN (select group_id from group_plugin,plugins where group_plugin.plugin_id = plugins.plugin_id and plugins.plugin_name = $4)
+ AND group_id NOT IN (select sub_project_id from plugin_projects_hierarchy_relationship);',
array('A',
$group_id,
db_int_array_to_any_clause($family),