This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "FusionForge".
The branch, master has been updated via b18d3e3ea742fb4adbcd9d6b7b40704752e4ba67 (commit) via ca74cff8f089b4486313bd5b7c509c47c4f15e61 (commit) via 430a314c06d35cfaea179abaef3a84d1be36593c (commit) via c018049aab60badab2f2eccaaa1871d42491eab1 (commit) from 524fce6ab694367e3717ca6c63ae6e6a95fd018f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=b18d3e3ea742fb4adbcd9d6b7b40704752e4ba67 commit b18d3e3ea742fb4adbcd9d6b7b40704752e4ba67 Merge: 524fce6 ca74cff Author: Franck Villaume <franck.villa...@trivialdev.com> Date: Tue May 18 19:22:58 2021 +0200 Merge remote-tracking branch 'rhabacker/master-ticket-932' https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=ca74cff8f089b4486313bd5b7c509c47c4f15e61 commit ca74cff8f089b4486313bd5b7c509c47c4f15e61 Author: Aaron Nottbeck <aaron.nottb...@spie.com> Date: Tue Apr 13 10:28:44 2021 +0200 [#932] Add tracker admin page for showing and editing monitoring state of users diff --git a/src/common/tracker/ArtifactType.class.php b/src/common/tracker/ArtifactType.class.php index 4a85050..0d50cb0 100644 --- a/src/common/tracker/ArtifactType.class.php +++ b/src/common/tracker/ArtifactType.class.php @@ -578,7 +578,7 @@ class ArtifactType extends FFError { $user_id = user_getid(); } $MonitorElementObject = new MonitorElement('artifact_type'); - if (!$this->isMonitoring()) { + if (!$this->isMonitoring($user_id)) { if (!$MonitorElementObject->enableMonitoringByUserId($this->getID(), $user_id)) { $this->setError($MonitorElementObject->getErrorMessage()); return false; @@ -595,12 +595,15 @@ class ArtifactType extends FFError { } } - function isMonitoring() { - if (!session_loggedin()) { - return false; + function isMonitoring($user_id = -1) { + if ($user_id == -1) { + if (!session_loggedin()) { + return false; + } + $user_id = user_getid(); } $MonitorElementObject = new MonitorElement('artifact_type'); - return $MonitorElementObject->isMonitoredByUserId($this->getID(), user_getid()); + return $MonitorElementObject->isMonitoredByUserId($this->getID(), $user_id); } /** diff --git a/src/plugins/trackermonitor/include/tracker/views/form-showmonitor.php b/src/plugins/trackermonitor/include/tracker/views/form-showmonitor.php new file mode 100644 index 0000000..5a1e00f --- /dev/null +++ b/src/plugins/trackermonitor/include/tracker/views/form-showmonitor.php @@ -0,0 +1,66 @@ +<?php +// +//show which user has activated monitoring on this tracker. + +$title = sprintf(_('Show which user has activated monitoring on the tracker %s'),$ath->getName()); +$ath->adminHeader(array ('title'=>$title, 'modal'=>1)); + +switch (getStringFromRequest('func')) { + case 'monitor' : { + $start = getIntFromRequest('start'); + $stop = getIntFromRequest('stop'); + $user_id = getIntFromRequest('user_id'); + $groupMemberIds = array_map(function($user) { + return $user->getID(); + }, $group->getMembers()); + if (in_array($user_id,$groupMemberIds)) { + // Fix to prevent collision with the start variable used in browse. + $_GET['start'] = 0; + if ($start && $ath->isMonitoring($user_id)) + $feedback = _('Monitoring Started'); + elseif ($stop && !$ath->isMonitoring($user_id)) + $feedback = _('Monitoring Deactivated'); + else { + $ath->setMonitor($user_id); + $feedback=$ath->getErrorMessage(); + $ath->clearError(); + } + } else { + $feedback=_('User is not member of this project'); + } + break; + } +} +//Show list of monitors +echo '<h1>' ._('Users from this project with monitoring status').'</h1>'; +$headers = array( + _('User Name'), + _('E-Mail'), + _('Monitor'), +); +echo $GLOBALS['HTML']->listTableTop($headers); + +$users = $ath->Group->getUsers(); +foreach ($users as &$user) +{ + $link = '/tracker/admin/?group_id='.$group_id.'&atid='.$atid.'&show_monitor=1&func=monitor&user_id='.$user->getID(); + if ($ath->isMonitoring($user->getID())) { + $label = _('Stop Monitor'); + $link .= '&stop=1'; + } else { + $label = _('Monitor'); + $link .= '&start=1'; + } + echo '<tr>'; + echo '<td>'.$user->data_array['realname'].'</td>'; + echo '<td>'.$user->data_array['email'].'</td>'; + echo '<td>'.util_make_link($link, $label).'</td>'; + echo '</tr>'; +} +echo $GLOBALS['HTML']->listTableBottom(); +$ath->footer(array()); + +// Local Variables: +// mode: php +// c-file-style: "bsd" +// End: https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=430a314c06d35cfaea179abaef3a84d1be36593c commit 430a314c06d35cfaea179abaef3a84d1be36593c Author: Ralf Habacker <ralf.habac...@freenet.de> Date: Tue Apr 13 10:27:58 2021 +0200 [#932] Add tracker monitor plugin diff --git a/src/plugins/trackermonitor/README b/src/plugins/trackermonitor/README new file mode 100644 index 0000000..1fe0ae3 --- /dev/null +++ b/src/plugins/trackermonitor/README @@ -0,0 +1,3 @@ +TrackerMonitor plugin + +Allows the tracker administrator to view and edit the monitoring status for users diff --git a/src/plugins/trackermonitor/common/trackermonitor-init.php b/src/plugins/trackermonitor/common/trackermonitor-init.php new file mode 100644 index 0000000..fa2984d --- /dev/null +++ b/src/plugins/trackermonitor/common/trackermonitor-init.php @@ -0,0 +1,32 @@ +<?php + +/** + * + * 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 License, 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 this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +global $gfplugins; +require_once $gfplugins.'trackermonitor/include/TrackerMonitorPlugin.class.php' ; + +$trackermonitorPluginObject = new TrackerMonitorPlugin ; + +register_plugin ($trackermonitorPluginObject) ; + +// Local Variables: +// mode: php +// c-file-style: "bsd" +// End: diff --git a/src/plugins/trackermonitor/etc/trackermonitor.ini b/src/plugins/trackermonitor/etc/trackermonitor.ini new file mode 100644 index 0000000..1182471 --- /dev/null +++ b/src/plugins/trackermonitor/etc/trackermonitor.ini @@ -0,0 +1,7 @@ +[trackermonitor] + +; plugin_status is a string. +; valid means : production ready. +; Any other strings means it's under work or broken and plugin +; is available in installation_environment = development only. +plugin_status = 'valid' diff --git a/src/plugins/trackermonitor/httpd.conf b/src/plugins/trackermonitor/httpd.conf new file mode 100644 index 0000000..0249999 --- /dev/null +++ b/src/plugins/trackermonitor/httpd.conf @@ -0,0 +1,4 @@ +<Location /plugins/trackermonitor/> + SetEnv PLUGINNAME trackermonitor + SetEnv PLUGINVERSION 1.0-0 +</Location> diff --git a/src/plugins/trackermonitor/include/TrackerMonitorPlugin.class.php b/src/plugins/trackermonitor/include/TrackerMonitorPlugin.class.php new file mode 100644 index 0000000..c245061 --- /dev/null +++ b/src/plugins/trackermonitor/include/TrackerMonitorPlugin.class.php @@ -0,0 +1,54 @@ +<?php +/** + * TrackerMonitorPlugin Class + * + * 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 License, 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 this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +class TrackerMonitorPlugin extends Plugin { + function __construct($id=0) { + parent::__construct($id) ; + $this->name = "trackermonitor"; + $this->text = _("Tracker monitor status"); + $this->pkg_desc = _("Project administrators can view and edit tracker monitoring status for users"); + $this->_addHook('admin_tracker_add_actions'); + $this->_addHook("groupisactivecheckbox"); + $this->_addHook("groupisactivecheckboxpost"); + } + + function CallHook($hookname, &$params) { + global $gfplugins; + + if ($hookname == "admin_tracker_add_actions") { + $group_id = $params['group_id']; + $project = group_get_object($group_id); + if (!$project || !is_object($project) || $project->isError() || !$project->usesPlugin($this->name)) { + return; + } + $params['result']['show_monitor'] = array( + 'text' => _('User monitoring status'), + 'description' => _('Show which user has activated monitoring on this tracker.'), + 'page' => $gfplugins.'trackermonitor/include/tracker/views/form-showmonitor.php', + ); + } + } +} + +// Local Variables: +// mode: php +// c-file-style: "bsd" +// End: diff --git a/src/plugins/trackermonitor/include/TrackerMonitorPluginDescriptor.class.php b/src/plugins/trackermonitor/include/TrackerMonitorPluginDescriptor.class.php new file mode 100644 index 0000000..8a12733 --- /dev/null +++ b/src/plugins/trackermonitor/include/TrackerMonitorPluginDescriptor.class.php @@ -0,0 +1,27 @@ +<?php +/** + * 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 License, 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 this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +require_once 'common/plugin/PluginDescriptor.class.php'; + +class TrackerMonitorPluginDescriptor extends PluginDescriptor { + + function __construct() { + parent::__construct(_('TrackerMonitor'), 'v1.0', _("Project administrators can view and edit tracker monitoring status for users")); + } +} diff --git a/src/plugins/trackermonitor/include/TrackerMonitorPluginInfo.class.php b/src/plugins/trackermonitor/include/TrackerMonitorPluginInfo.class.php new file mode 100644 index 0000000..c26ff3c --- /dev/null +++ b/src/plugins/trackermonitor/include/TrackerMonitorPluginInfo.class.php @@ -0,0 +1,31 @@ +<?php +/** +/** + * 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 License, 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 this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +require_once 'common/plugin/PluginInfo.class.php'; +require_once 'TrackerMonitorPluginDescriptor.class.php'; + +class TrackerMonitorPluginInfo extends PluginInfo { + + function __construct(&$plugin) { + parent::__construct($plugin); + $this->setPluginDescriptor(new TrackerMonitorPluginDescriptor()); + } + +} https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=c018049aab60badab2f2eccaaa1871d42491eab1 commit c018049aab60badab2f2eccaaa1871d42491eab1 Author: Ralf Habacker <ralf.habac...@freenet.de> Date: Tue Mar 30 11:45:06 2021 +0200 [#932] Add hooks to extend tracker administration area diff --git a/src/common/tracker/actions/admin-tracker.php b/src/common/tracker/actions/admin-tracker.php index ba7a28b..a022cae 100644 --- a/src/common/tracker/actions/admin-tracker.php +++ b/src/common/tracker/actions/admin-tracker.php @@ -85,4 +85,15 @@ echo '<br />'; echo _('Permanently delete this tracker.'); echo '</p>'; +$hook_params = array('group_id' => $group_id, 'atid' => $ath->getID()); +plugin_hook_by_reference("admin_tracker_add_actions", $hook_params); +if (isset($hook_params['result'])) { + foreach($hook_params['result'] as $action => $values) { + echo '<p>'.util_make_link('/tracker/admin/?group_id='.$group_id.'&atid='.$ath->getID()."&$action=1", '<strong>'.$values['text'].'</strong>'); + echo '<br />'; + echo $values['description']; + echo '</p>'; + } +} + $ath->footer(); diff --git a/src/common/tracker/include/ArtifactTypeHtml.class.php b/src/common/tracker/include/ArtifactTypeHtml.class.php index 6f0a4f2..690f4d7 100644 --- a/src/common/tracker/include/ArtifactTypeHtml.class.php +++ b/src/common/tracker/include/ArtifactTypeHtml.class.php @@ -136,6 +136,13 @@ class ArtifactTypeHtml extends ArtifactType { $elementLi[] = array('content' => util_make_link('/tracker/admin/?group_id='.$group_id.'&atid='.$this->getID().'&add_canned=1', _('Manage Canned Responses'), array('title'=>_('Create/change generic response messages for the tracker.')))); $elementLi[] = array('content' => util_make_link('/tracker/admin/?group_id='.$group_id.'&atid='.$this->getID().'&clone_tracker=1', _('Apply Template Tracker'), array('title'=>_('Duplicate parameters and fields from a template trackers in this one.')))); $elementLi[] = array('content' => util_make_link('/tracker/admin/?group_id='.$group_id.'&atid='.$this->getID().'&delete=1', _('Delete'), array('title'=>_('Permanently delete this tracker.')))); + $hook_params = array('group_id' => $group_id, 'atid' => $this->getID()); + plugin_hook_by_reference("admin_tracker_add_actions", $hook_params); + if (isset($hook_params['result'])) { + foreach($hook_params['result'] as $action => $values) { + $elementLi[] = array('content' => util_make_link('/tracker/admin/?group_id='.$group_id.'&atid='.$this->getID()."&$action=1", $values['text'], array('title'=>$values['description']))); + } + } echo $HTML->html_list($elementLi); } diff --git a/src/docs/README.Plugins b/src/docs/README.Plugins index f1aa734..17741bb 100644 --- a/src/docs/README.Plugins +++ b/src/docs/README.Plugins @@ -564,6 +564,17 @@ TODO : document Auth plugins : Description: returns in $params['content'] an alternate content for /frs/download.php in $params['content_type'] the actual content-type to return + Hook name : admin_tracker_add_actions + Parameters : $params['group_id'] provides the group id for which actions should be added + $params['atid'] provides the artifact id for which actions should be added + Description: return an array in $params['result'] to add additional actions to the tracker + admin menu. The returned array consists of a list of the following structure: + 'myaction' = array( + 'text' => 'text for the displayed link', + 'description' => 'description of the action', + 'page' => 'path to the php file for displaying the menu page'), + ), + ... TODO (nerville) : document display_hierarchy TODO (lolando ?) : document role_normalize, role_translate_strings, role_has_permission, role_get_setting, list_roles_by_permission diff --git a/src/www/tracker/admin/index.php b/src/www/tracker/admin/index.php index dd40e03..f6c5d12 100644 --- a/src/www/tracker/admin/index.php +++ b/src/www/tracker/admin/index.php @@ -124,6 +124,17 @@ if ($group_id && $atid) { 'update_canned', 'delete_canned', 'update_box', 'update_opt', 'delete', 'delete_opt', 'deleteextrafield','update_type', 'effort_units', 'edit_formula' ); + + $hook_params = array('group_id' => $group_id, 'atid' => $atid); + plugin_hook_by_reference('admin_tracker_add_actions', $hook_params); + if (isset($hook_params['result'])) { + foreach($hook_params['result'] as $action => $values) { + if (!array_key_exists($action, $actions) && isset($values['page'])) { + $actions[] = $action; + } + } + } + $action = ''; foreach ($actions as $a) { if (getStringFromRequest($a)) { @@ -133,7 +144,11 @@ if ($group_id && $atid) { } } - if ($action == 'add_extrafield') { + if (is_array($hook_params['result'][$action])) { + + include $hook_params['result'][$action]['page']; + + } elseif ($action == 'add_extrafield') { include $gfcommon.'tracker/views/form-addextrafield.php'; ----------------------------------------------------------------------- Summary of changes: src/common/tracker/ArtifactType.class.php | 13 +++-- src/common/tracker/actions/admin-tracker.php | 11 ++++ .../tracker/include/ArtifactTypeHtml.class.php | 7 +++ src/docs/README.Plugins | 11 ++++ src/plugins/trackermonitor/README | 3 + .../common/trackermonitor-init.php} | 6 +- .../etc/trackermonitor.ini} | 2 +- src/plugins/trackermonitor/httpd.conf | 4 ++ .../include/TrackerMonitorPlugin.class.php | 54 ++++++++++++++++++ .../TrackerMonitorPluginDescriptor.class.php} | 17 ++---- .../include/TrackerMonitorPluginInfo.class.php} | 18 +++--- .../include/tracker/views/form-showmonitor.php | 66 ++++++++++++++++++++++ src/www/tracker/admin/index.php | 17 +++++- 13 files changed, 199 insertions(+), 30 deletions(-) create mode 100644 src/plugins/trackermonitor/README copy src/plugins/{helloworld/common/helloworld-init.php => trackermonitor/common/trackermonitor-init.php} (82%) copy src/plugins/{globalactivity/etc/globalactivity.ini => trackermonitor/etc/trackermonitor.ini} (92%) create mode 100644 src/plugins/trackermonitor/httpd.conf create mode 100644 src/plugins/trackermonitor/include/TrackerMonitorPlugin.class.php copy src/plugins/{extsubproj/common/extsubproj-init.php => trackermonitor/include/TrackerMonitorPluginDescriptor.class.php} (72%) copy src/plugins/{contribtracker/common/contribtracker-init.php => trackermonitor/include/TrackerMonitorPluginInfo.class.php} (70%) create mode 100644 src/plugins/trackermonitor/include/tracker/views/form-showmonitor.php hooks/post-receive -- FusionForge _______________________________________________ Fusionforge-commits mailing list Fusionforge-commits@lists.fusionforge.org http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits