$this->_addHook('display_hierarchy'); // to see the tree of projects
$this->_addHook('group_delete'); // clean tables on delete
$this->_addHook('project_admin_plugins'); // to show up in the admin page fro group
- $this->_addHook('site_admin_option_hook'); // to provide a link to the site wide administrative pages of plugin
+ $this->_addHook('site_admin_option_hook'); // to provide a link to the site wide administrative pages of plugin
+ $this->_addHook('display_hierarchy_submenu'); // to display a submenu in software map if projects-hierarchy plugin is used
+ $this->_addHook('docmansearch_has_hierarchy'); // used by the search menu in docman
}
function CallHook($hookname, &$params) {
$group = group_get_object($group_id);
if ($group->usesPlugin($this->name)) {
echo '<p>';
- echo util_make_link('/plugins/'.$this->name.'/?group_id='.$group_id.'&type=admin&pluginname='.$this->name, _('Hierarchy Admin'));
+ echo util_make_link('/plugins/'.$this->name.'/?group_id='.$group_id.'&type=admin&pluginname='.$this->name, _('Hierarchy Admin'), array('class'=>'tabtitle', 'title'=>_('Configure the projets-hierarchy plugin (docman, tree, delegate, globalconf features)')));
echo '</p>';
}
$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;
+ }
+ }
+ }
+ 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'];
+ }
+ $returned = true;
+ break;
+ }
}
return $returned;
}
* @access public
*/
function getAdminOptionLink() {
- return util_make_link('/plugins/'.$this->name.'/?type=globaladmin&pluginname='.$this->name,_('Global Hierarchy admin'));
+ 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)')));
}
/**
$res = db_query_params('insert into plugin_projects_hierarchy_global (tree, docman, delegate)
values ($1, $2, $3)',
+ array(
+ $confArr['tree'],
+ $confArr['docman'],
+ $confArr['delegate']
+ ));
+ if (!$res)
+ return false;
+
+ return true;
+ }
+
+ /**
+ * updateConf - update the configuration in database for this project
+ *
+ * @param array configuration array (tree, docman, delegate)
+ * @return bool true on success
+ */
+ function updateConf($project_id, $confArr) {
+ if (!isset($confArr['tree']) || !isset($confArr['docman']) || !isset($confArr['delegate']) || !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',
array(
$confArr['tree'],
$confArr['docman'],
$confArr['delegate'],
+ $confArr['globalconf'],
+ $project_id
));
if (!$res)
return false;