3 * Copyright (C) 2013 Vitaliy Pylypiv <vitaliy.pylypiv@gmail.com>
4 * Copyright 2016, Stéphane-Eymeric Bredthauer - TrivialDev
6 * This file is part of FusionForge.
8 * FusionForge is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published
10 * by the Free Software Foundation; either version 2 of the License,
11 * or (at your option) any later version.
13 * FusionForge is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 require_once $gfplugins.'taskboard/common/TaskBoard.class.php';
26 class TaskBoardHtml extends TaskBoard {
28 // the header that displays for the user portion of the plugin
29 function header($params) {
32 html_use_tablesorter();
33 use_stylesheet('/plugins/taskboard/css/agile-board.css');
34 use_javascript('/plugins/taskboard/js/agile-board.js');
37 $group_id = $this->Group->getID();
38 $taskboard_id = $this->getID();
39 $params['toptab'] = 'taskboard';
40 $params['group'] = $group_id;
42 $labels[] = _('View Task Boards');
43 $links[] = '/plugins/taskboard/?group_id='.$group_id;
44 $attr = array(array('title' => _('Get the list of available taskboards')));
45 if (session_loggedin()) {
46 if (forge_check_perm('tracker_admin', $group_id)) {
47 $labels[] = _('Task Boards Administration');
48 $links[] = '/plugins/taskboard/admin/?group_id='.$group_id;
49 $attr[] = array('title' => _('Global administration for taskboards.'));
53 $labels[] = $this->getName();
54 $links[] = '/plugins/taskboard/?group_id='.$group_id.'&taskboard_id='.$taskboard_id;
55 $attr[] = array('title' => _('View this taskboard.'));
57 if( $this->getReleaseField()) {
58 $labels[] = _('Releases');
59 $links[] = '/plugins/taskboard/releases/?group_id='.$group_id.'&taskboard_id='.$taskboard_id;
60 $attr[] = array('title' => _('Manage releases.'));
64 if (session_loggedin()) {
65 if (forge_check_perm('tracker_admin', $group_id)) {
66 $release_id = getIntFromRequest('release_id','');
67 $view = getStringFromRequest('view','');
69 if( $view == 'edit_release' ) {
70 $labels[] = _('Delete release');
71 $links[] = '/plugins/taskboard/releases/?group_id='.$group_id.'&taskboard_id='.$taskboard_id.'&release_id='.$release_id.'&view=delete_release';
74 $labels[] = _('Edit release');
75 $links[] = '/plugins/taskboard/releases/?group_id='.$group_id.'&taskboard_id='.$taskboard_id.'&release_id='.$release_id.'&view=edit_release';
81 $labels[] = _('Administration');
82 $links[] = '/plugins/taskboard/admin/?group_id='.$group_id.'&taskboard_id='.$taskboard_id;
83 $attr[] = array('title' => _('Administration for this taskboard.'));
86 if ($view == 'edit_column') {
87 $labels[] = _('Configure Columns');
88 $links[] = '/plugins/taskboard/admin/?group_id='.$group_id.'&taskboard_id='.$taskboard_id.'&view=columns';
90 $column_id = getIntFromRequest('column_id', '');
92 $labels[] = _('Delete Column');
93 $links[] = '/plugins/taskboard/admin/?group_id='.$group_id.'&taskboard_id='.$taskboard_id.'&column_id='.$column_id.'&view=delete_column';
99 $params['submenu'] = $HTML->subMenu($labels, $links, $attr);
100 site_project_header($params);
103 function trackersColorChooser( $name, $color='Silver' ) {
104 if( method_exists($this->TrackersAdapter, 'trackersColorChooser' ) ) {
105 return $this->TrackersAdapter->trackersColorChooser( $name, $color );
107 $l_aColors = array( 'White', 'Khaki', 'Gold', 'LawnGreen', 'PaleGreen', 'Salmon', 'PeachPuff', 'LightBlue', 'Silver' );
108 return $this->_colorChooser( $name, $l_aColors, 'Silver', $color );
112 function colorBgChooser($name, $color='Silver') {
113 $l_aColors = array('White', 'Khaki', 'Gold', 'LawnGreen', 'PaleGreen', 'Salmon', 'PeachPuff', 'LightBlue', 'Silver');
114 return $this->_colorChooser($name, $l_aColors, 'Silver', $color);
117 private function _colorChooser( $name, $colors, $default_color, $selected_color=NULL ) {
118 $ret = '<table><tr>';
119 if( !$selected_color ) {
120 $selected_color = $default_color;
122 foreach( $colors as $color ) {
124 if( $color == $selected_color ) {
125 $selected = ' checked';
127 $ret .= '<td style="background-color: '.$color.'; padding: 0;"><input type="radio" name="'.$name.'" value="'.$color.'" style="margin: 6px;"'.$selected.'></td>';
129 $ret .= '</tr></table>';