src/plugins/extratabs/www/index.php -text
src/plugins/extsubproj/NAME -text
src/plugins/extsubproj/README -text
+src/plugins/extsubproj/actions/addExtSubProj.php -text
src/plugins/extsubproj/bin/db-delete.pl -text
src/plugins/extsubproj/bin/db-upgrade.pl -text
src/plugins/extsubproj/common/extsubproj-init.php -text
src/plugins/extsubproj/packaging/install/plugin-extsubproj -text
src/plugins/extsubproj/packaging/links/plugin-extsubproj -text
src/plugins/extsubproj/view/admin/viewGlobalConfiguration.php -text
+src/plugins/extsubproj/view/admin/viewProjectConfiguration.php -text
src/plugins/extsubproj/www/index.php -text
src/plugins/fckeditor/common/fckeditorPlugin.class.php -text
src/plugins/fckeditor/etc/fckeditor.ini -text
--- /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 $pluginExtSubProj;
+global $group_id;
+
+$confArr = array();
+$confArr['newsubprojecturl'] = getStringFromRequest('newsubprojecturl');
+
+/*
+if (!$pluginExtSubProj->updateConf($group_id, $confArr)) {
+ $error_msg = _('Failed to update configuration.');
+ session_redirect('/plugins/'.$pluginExtSubProj->name.'/?type=admin&group_id='.$group_id.'&pluginname='.$pluginExtSubProj->name.'&error_msg='.urlencode($error_msg));
+}
+*/
+$feedback = _('Sub project succesfully added.').$confArr['newsubprojecturl'];
+session_redirect('/plugins/'.$pluginExtSubProj->name.'/?type=admin&group_id='.$group_id.'&pluginname='.$pluginExtSubProj->name.'&feedback='.urlencode($feedback));
+?>
$this->_addHook("user_personal_links");//to make a link to the user's personal part of the plugin
$this->_addHook("usermenu");
$this->_addHook("groupmenu"); // To put into the project tabs
- $this->_addHook("groupisactivecheckbox"); // The "use ..." checkbox in editgroupinfo
- $this->_addHook("groupisactivecheckboxpost"); //
+
$this->_addHook("userisactivecheckbox"); // The "use ..." checkbox in user account
$this->_addHook("userisactivecheckboxpost"); //
- $this->_addHook("project_admin_plugins"); // to show up in the admin page fro group
*/
+ $this->_addHook("groupisactivecheckbox"); // The "use ..." checkbox in editgroupinfo
+ $this->_addHook("groupisactivecheckboxpost"); //
+ $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
}
// Use this to provide a link to the site wide administrative pages for your plugin
echo '<li>'.$this->getAdminOptionLink().'</li>';
}
+
+ function project_admin_plugins(&$params) {
+ $group_id = $params['group_id'];
+ $group = group_get_object($group_id);
+ if ($group->usesPlugin($this->name)) {
+ echo '<p>';
+ echo $this->getProjectAdminLink($group_id);
+ echo '</p>';
+ }
+ }
+
/**
* getAdminOptionLink - return the admin link url
*
function getAdminOptionLink() {
return util_make_link('/plugins/'.$this->name.'/?type=globaladmin&pluginname='.$this->name,_('External subprojects admin'), array('class'=>'tabtitle', 'title'=>_('Configure the External subprojects plugin')));
}
-
+ /**
+ * getProjectAdminLink - return the project admin link url
+ *
+ * @return string html url
+ * @access public
+ */
+ function getProjectAdminLink($group_id) {
+ return util_make_link('/plugins/'.$this->name.'/?group_id='.$group_id.'&type=admin&pluginname='.$this->name, _('External subprojects Admin'), array('class'=>'tabtitle', 'title'=>_('Configure the External subprojects plugin')));
+ }
+ function getProjectAdminAddExtSubProjAction($group_id) {
+ return '?group_id='.$group_id.'&type=admin&pluginname='.$this->name.'&action=addExtSubProj';
+ }
/**
* getHeader - initialize header and js
* @param string type : user, project (aka group)
return true;
}
+ /**
+ * getProjectAdminView - display the project admin view
+ * @return boolean
+ */
+ function getProjectAdminView() {
+ global $gfplugins, $use_tooltips;
+ include $gfplugins.$this->name.'/view/admin/viewProjectConfiguration.php';
+ return true;
+ }
+
+ /**
+ * getConf - return the configuration defined at project level
+ *
+ * @param integer the group id
+ * @return array the configuration array
+ */
+ function getConf($project_id) {
+ $resConf = db_query_params('SELECT * from plugin_extsubproj_subprojects where project_id=$1',array($project_id));
+ if (!$resConf) {
+ return false;
+ }
+
+ $row = db_numrows($resConf);
+
+ if ($row == null || count($row) > 2) {
+ return false;
+ }
+
+ $resArr = db_fetch_array($resConf);
+ $returnArr = array();
+
+ foreach($resArr as $column => $value) {
+ if ($value == 't') {
+ $returnArr[$column] = true;
+ } else {
+ $returnArr[$column] = false;
+ }
+ }
+
+ return $returnArr;
+ }
+
+
// function CallHook ($hookname, &$params) {
// global $use_extsubprojplugin,$G_SESSION,$HTML;
/*
etc/gforge/plugins/extsubproj
+usr/share/gforge/plugins/extsubproj/actions
usr/share/gforge/plugins/extsubproj/common
usr/share/gforge/plugins/extsubproj/view
usr/share/gforge/plugins/extsubproj/www
+plugins/extsubproj/actions/* usr/share/@OLDPACKAGE@/plugins/extsubproj/actions/
plugins/extsubproj/common/* usr/share/@OLDPACKAGE@/plugins/extsubproj/common/
plugins/extsubproj/view/* usr/share/@OLDPACKAGE@/plugins/extsubproj/view/
plugins/extsubproj/include/* usr/share/@OLDPACKAGE@/plugins/extsubproj/include/
--- /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 $pluginExtSubProj;
+global $use_tooltips;
+global $group_id;
+
+/*$pluginExtSubProjProjectConf = $pluginExtSubProj->getConf($group_id);
+if (!$pluginExtSubProjProjectConf) {
+ echo '<div class="error">'._('Cannot retrieve data from DB').'</div>';
+} else {
+*/
+ echo $HTML->boxTop(_("Manage project's external subprojects"));
+
+ echo '<form method="post" action="'.$pluginExtSubProj->getProjectAdminAddExtSubProjAction($group_id).'">';
+ echo '<table>';
+
+ echo '<tr><td><label id="extSubProj-newsubprojecturl" ';
+ if ($use_tooltips)
+ echo 'class="tabtitle-nw" title="'._('URL of the new subproject.').'"';
+ echo ' >'._('URL').'</label></td><td><input type="text" name="newsubprojecturl"';
+ echo '/></td></tr>';
+
+ echo '</table>';
+ echo '<input type="submit" value="'._('Add').'" />';
+ echo '</form>';
+
+ echo $HTML->boxBottom();
+//}
+?>
}
$type = getStringFromRequest('type');
-$plugin = plugin_get_object('extsubproj');
+global $pluginExtSubProj;
+$pluginExtSubProj = plugin_get_object('extsubproj');
if (!$type) {
exit_error("Cannot Process your request: No TYPE specified", 'home'); // you can create items in Base.tab and customize this messages
if ( !$group) {
exit_error("Invalid Project", 'home');
}
- if (!$group->usesPlugin($plugin->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'), $plugin->name), 'home');
+ if (!$group->usesPlugin($pluginExtSubProj->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'), $pluginExtSubProj->name), 'home');
}
session_require_perm('project_admin', $id);
case "removeChild":
case "removeParent":
case "validateRelationship": {
- include($gfplugins.$plugin->name.'/actions/'.$action.'.php');
+ include($gfplugins.$pluginExtSubProj->name.'/actions/'.$action.'.php');
break;
}*/
default: {
- $plugin->redirect($_SERVER['HTTP_REFERER'], 'error_msg', _('Unknown action.'));
+ $pluginExtSubProj->redirect($_SERVER['HTTP_REFERER'], 'error_msg', _('Unknown action.'));
break;
}
}
/*
case 'updateGlobalConf': {
global $gfplugins;
- include($gfplugins.$plugin->name.'/actions/'.$action.'.php');
+ include($gfplugins.$pluginExtSubProj->name.'/actions/'.$action.'.php');
break;
}*/
default: {
}
}
- $plugin->getHeader('globaladmin');
- $plugin->getGlobalAdminView();
- $plugin->getFooter('globaladmin');
+ $pluginExtSubProj->getHeader('globaladmin');
+ $pluginExtSubProj->getGlobalAdminView();
+ $pluginExtSubProj->getFooter('globaladmin');
break;
}
+ // project admin
case "admin": {
if (!session_loggedin()) {
exit_not_logged_in();
if ( !$group) {
exit_error("Invalid Project", 'home');
}
- if (!$group->usesPlugin($plugin->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'), $plugin->name), 'home');
+ if (!$group->usesPlugin($pluginExtSubProj->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'), $pluginExtSubProj->name), 'home');
}
$action = getStringFromRequest('action');
switch ($action) {
- /*
- case 'updateProjectConf': {
+ case 'addExtSubProj': {
global $gfplugins;
- include($gfplugins.$plugin->name.'/actions/'.$action.'.php');
+ include($gfplugins.$pluginExtSubProj->name.'/actions/'.$action.'.php');
break;
}
- */
default: {
+ // do nothing, see getProjectAdminView() below
break;
}
}
// params needed by site_project_header() inside getHeader()
$params = array(
- 'toptab' => $plugin->name,
+ 'toptab' => $pluginExtSubProj->name,
'group' => $id);
- $plugin->getHeader('admin', $params);
- //$plugin->getProjectAdminView();
- $plugin->redirect($_SERVER['HTTP_REFERER'], 'error_msg', _('Unknown action.'));
- $plugin->getFooter('admin');
+ $pluginExtSubProj->getHeader('admin', $params);
+ $pluginExtSubProj->getProjectAdminView();
+ $pluginExtSubProj->getFooter('admin');
break;
}
default: {