src/plugins/projects_hierarchy/etc/projects_hierarchy.ini -text
src/plugins/projects_hierarchy/include/hierarchy_utils.php -text
src/plugins/projects_hierarchy/view/admin/viewGlobalConfiguration.php -text
+src/plugins/projects_hierarchy/view/admin/viewProjectConfiguration.php -text
src/plugins/projects_hierarchy/view/admin_project_link.php -text
src/plugins/projects_hierarchy/view/docman_project_link.php -text
src/plugins/projects_hierarchy/view/home_project_link.php -text
}
break;
}
+ case "site_admin_option_hook": {
+ echo '<li>'.$this->getAdminOptionLink().'</li>';
+ $returned = true;
+ break;
+ }
case "project_admin_plugins": {
// this displays the link in the project admin options page to it's administration
$group_id = $params['group_id'];
$returned = true;
break;
}
- case "site_admin_option_hook": {
- echo '<li>'.$this->getAdminOptionLink().'</li>';
- $returned = true;
- break;
- }
}
return $returned;
}
*/
function add($group_id) {
if (!$this->exists($group_id)) {
- $res = db_query_params('INSERT INTO plugin_projects_hierarchy (project_id) VALUES ($1)', array($group_id));
+ $globalConf = $this->getGlobalConf();
+ $res = db_query_params('INSERT INTO plugin_projects_hierarchy (project_id, tree, docman, delegate) VALUES ($1)', array($group_id, $globalConf['tree'], $globalConf['docman'], $globalConf['delegate']));
if (!$res)
return false;
-
}
return true;
}
session_require_global_perm('forge_admin');
global $gfwww;
require_once($gfwww.'admin/admin_utils.php');
- site_admin_header(array('title'=>_('Site Global Hierarchy Admin'), 'toptab' => ''));
+ site_admin_header(array('title'=>_('Site Global Hierarchy Admin'), 'toptab'=>''));
$returned = true;
break;
}
+ case 'admin':
default: {
+ site_project_header();
+ $returned = true;
break;
}
}
return $returnArr;
}
+ function getProjectAdminView() {
+ global $gfplugins, $use_tooltips;
+ include $gfplugins.$this->name.'/view/admin/viewProjectConfiguration.php';
+ return true;
+ }
+
/**
* getFooter - display footer
*/
- function getFooter() {
- site_admin_footer(array());
+ function getFooter($type) {
+ global $gfplugins;
+ $returned = false;
+ switch ($type) {
+ case 'globaladmin': {
+ session_require_global_perm('forge_admin');
+ site_admin_footer(array());
+ break;
+ }
+ case 'admin':
+ default: {
+ site_project_footer(array());
+ break;
+ }
+ }
+ return $returned;
}
/**
--- /dev/null
+<?php
+/**
+ * Projects Hierarchy plugin
+ *
+ * Copyright 2011, 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 Licence, 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.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+global $HTML;
+global $projectsHierarchy;
+global $use_tooltips;
+
+$projectsHierarchyGlobalConf = $projectsHierarchy->getGlobalconf();
+
+echo $HTML->boxTop(_('Manage project configuration'));
+echo '<form method="post" action="?type=admin&&pluginname='.$projectsHierarchy->name.'&action=updateProjectConf">';
+echo '<table>';
+
+echo '<tr><td><label id="projectsHierarchy-delegate" ';
+if ($use_tooltips)
+ echo 'title="'._('Enable full rights and configuration delegation to parent.').'"';
+echo ' >'._('Enable delegate').'</label></td><td><input type="checkbox" name="delegate" value="1"';
+if ($projectsHierarchyProjectConf['delegate'])
+ echo 'checked="checked" ';
+
+echo '/></td></tr>';
+echo '<tr><td><label id="projectsHierarchy-globalconf" ';
+if ($use_tooltips)
+ echo 'title="'._('Use forge global configuration. Superseed any configuration done at project level.').'"';
+echo ' >'._('Use forge global configuration').'</label></td><td><input type="checkbox" name="globalconf" value="1"';
+if ($projectsHierarchyProjectConf['globalconf'])
+ echo 'checked="checked" ';
+
+echo '/></td></tr>';
+
+echo '</table>';
+echo '<input type="submit" value="'._('Update').'" />';
+echo '</form>';
+echo $HTML->boxBottom();
+?>
switch ($type) {
case "group": {
+ if (!session_loggedin()) {
+ exit_not_logged_in();
+ }
$id = getStringFromRequest('id');
if (!$id) {
exit_error("Cannot Process your request: No ID specified", 'home');
break;
}
case "globaladmin": {
+ if (!session_loggedin()) {
+ exit_not_logged_in();
+ }
+ session_require_global_perm('forge_admin');
$action = getStringFromRequest('action');
switch ($action) {
case 'updateGlobalConf': {
}
$projectsHierarchy->getHeader('globaladmin');
$projectsHierarchy->getGlobalAdminView();
- $projectsHierarchy->getFooter();
+ $projectsHierarchy->getFooter('globaladmin');
break;
}
+ case "admin": {
+ if (!session_loggedin()) {
+ exit_not_logged_in();
+ }
+ session_require_perm('project_admin', $id);
+ $id = getStringFromRequest('group_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');
+ }
+ 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');
+ }
+ $action = getStringFromRequest('action');
+ switch ($action) {
+ case 'updateProjectConf': {
+ global $gfplugins;
+ include($gfplugins.$projectsHierarchy->name.'/actions/'.$action.'.php');
+ break;
+ }
+ }
+ $projectsHierarchy->getHeader('admin');
+ $projectsHierarchy->getProjectAdminView();
+ $projectsHierarchy->getFooter('admin');
+ }
default: {
exit_error("No TYPE specified", 'home');
break;