/
view_all_inc.php
259 lines (220 loc) · 7.64 KB
/
view_all_inc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
<?php
# MantisBT - A PHP based bugtracking system
# MantisBT 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.
#
# MantisBT 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 MantisBT. If not, see <http://www.gnu.org/licenses/>.
/**
* View all bugs include file
*
* @package MantisBT
* @copyright Copyright 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
* @copyright Copyright 2002 MantisBT Team - mantisbt-dev@lists.sourceforge.net
* @link http://www.mantisbt.org
*
* @uses category_api.php
* @uses columns_api.php
* @uses config_api.php
* @uses constant_inc.php
* @uses current_user_api.php
* @uses event_api.php
* @uses filter_api.php
* @uses gpc_api.php
* @uses helper_api.php
* @uses html_api.php
* @uses lang_api.php
* @uses print_api.php
*/
if( !defined( 'VIEW_ALL_INC_ALLOW' ) ) {
return;
}
require_api( 'category_api.php' );
require_api( 'columns_api.php' );
require_api( 'config_api.php' );
require_api( 'constant_inc.php' );
require_api( 'current_user_api.php' );
require_api( 'event_api.php' );
require_api( 'filter_api.php' );
require_api( 'gpc_api.php' );
require_api( 'helper_api.php' );
require_api( 'html_api.php' );
require_api( 'lang_api.php' );
require_api( 'print_api.php' );
$t_filter = current_user_get_bug_filter();
filter_init( $t_filter );
list( $t_sort, ) = explode( ',', $g_filter['sort'] );
list( $t_dir, ) = explode( ',', $g_filter['dir'] );
$g_checkboxes_exist = false;
$t_icon_path = config_get( 'icon_path' );
# Improve performance by caching category data in one pass
if( helper_get_current_project() > 0 ) {
category_get_all_rows( helper_get_current_project() );
} else {
$t_categories = array();
foreach ( $t_rows as $t_row ) {
$t_categories[] = $t_row->category_id;
}
category_cache_array_rows( array_unique( $t_categories ) );
}
$g_columns = helper_get_columns_to_view( COLUMNS_TARGET_VIEW_PAGE );
$t_col_count = count( $g_columns );
$t_filter_position = config_get( 'filter_position' );
# -- ====================== FILTER FORM ========================= --
if( ( $t_filter_position & FILTER_POSITION_TOP ) == FILTER_POSITION_TOP ) {
filter_draw_selection_area( $f_page_number );
}
# -- ====================== end of FILTER FORM ================== --
# -- ====================== BUG LIST ============================ --
html_status_legend( STATUS_LEGEND_POSITION_TOP, true );
?>
<br />
<form id="bug_action" method="get" action="bug_actiongroup_page.php">
<?php # CSRF protection not required here - form does not result in modifications ?>
<table id="buglist" class="width100" cellspacing="1">
<thead>
<tr class="buglist-nav">
<td class="form-title" colspan="<?php echo $t_col_count; ?>">
<span class="floatleft">
<?php
# -- Viewing range info --
$v_start = 0;
$v_end = 0;
if( count( $t_rows ) > 0 ) {
$v_start = $g_filter['per_page'] * ($f_page_number - 1) + 1;
$v_end = $v_start + count( $t_rows ) - 1;
}
echo lang_get( 'viewing_bugs_title' );
echo ' (' . $v_start . ' - ' . $v_end . ' / ' . $t_bug_count . ')';
?> </span>
<span class="floatleft small">
<?php
# -- Print and Export links --
echo ' ';
print_bracket_link( 'print_all_bug_page.php', lang_get( 'print_all_bug_page_link' ) );
echo ' ';
print_bracket_link( 'csv_export.php', lang_get( 'csv_export' ) );
echo ' ';
print_bracket_link( 'excel_xml_export.php', lang_get( 'excel_export' ) );
$t_event_menu_options = $t_links = event_signal( 'EVENT_MENU_FILTER' );
foreach ( $t_event_menu_options as $t_plugin => $t_plugin_menu_options ) {
foreach ( $t_plugin_menu_options as $t_callback => $t_callback_menu_options ) {
if( !is_array( $t_callback_menu_options ) ) {
$t_callback_menu_options = array( $t_callback_menu_options );
}
foreach ( $t_callback_menu_options as $t_menu_option ) {
if( $t_menu_option ) {
print_bracket_link_prepared( $t_menu_option );
}
}
}
}
?> </span>
<span class="floatright small"><?php
# -- Page number links --
$f_filter = gpc_get_int( 'filter', 0 );
print_page_links( 'view_all_bug_page.php', 1, $t_page_count, (int)$f_page_number, $f_filter );
?> </span>
</td>
</tr>
<?php # -- Bug list column header row -- ?>
<tr class="buglist-headers row-category">
<?php
$t_title_function = 'print_column_title';
foreach( $g_columns as $t_column ) {
helper_call_custom_function( $t_title_function, array( $t_column ) );
}
?>
</tr>
<?php # -- Spacer row -- ?>
<tr class="spacer">
<td colspan="<?php echo $t_col_count; ?>"></td>
</tr>
</thead><tbody>
<?php
/**
* Output Bug Rows
*
* @param array $p_rows An array of bug objects.
* @return void
*/
function write_bug_rows( array $p_rows ) {
global $g_columns, $g_filter;
$t_in_stickies = ( $g_filter && ( 'on' == $g_filter[FILTER_PROPERTY_STICKY] ) );
# pre-cache custom column data
columns_plugin_cache_issue_data( $p_rows, $g_columns );
# -- Loop over bug rows --
$t_rows = count( $p_rows );
for( $i=0; $i < $t_rows; $i++ ) {
$t_row = $p_rows[$i];
if( ( 0 == $t_row->sticky ) && ( 0 == $i ) ) {
$t_in_stickies = false;
}
if( ( 0 == $t_row->sticky ) && $t_in_stickies ) { # demarcate stickies, if any have been shown
?>
<tr>
<td class="left sticky-header" colspan="<?php echo count( $g_columns ); ?>"> </td>
</tr>
<?php
$t_in_stickies = false;
}
# choose color based on status
$t_status_label = html_get_status_css_class( $t_row->status, auth_get_current_user_id(), $t_row->project_id );
echo '<tr class="' . $t_status_label . '">';
$t_column_value_function = 'print_column_value';
foreach( $g_columns as $t_column ) {
helper_call_custom_function( $t_column_value_function, array( $t_column, $t_row ) );
}
echo '</tr>';
}
}
write_bug_rows( $t_rows );
# -- ====================== end of BUG LIST ========================= --
# -- ====================== MASS BUG MANIPULATION =================== --
# @@@ ideally buglist-footer would be in <tfoot>, but that's not possible due to global g_checkboxes_exist set via write_bug_rows()
?>
<tr class="buglist-footer">
<td class="left" colspan="<?php echo $t_col_count; ?>">
<span class="floatleft">
<?php
if( $g_checkboxes_exist ) {
echo '<input type="checkbox" id="bug_arr_all" name="bug_arr_all" value="all" class="check_all" />';
echo '<label for="bug_arr_all">' . lang_get( 'select_all' ) . '</label>';
}
if( $g_checkboxes_exist ) {
?>
<select name="action">
<?php print_all_bug_action_option_list( $t_unique_project_ids ) ?>
</select>
<input type="submit" class="button" value="<?php echo lang_get( 'ok' ); ?>" />
<?php
} else {
echo ' ';
}
?> </span>
<span class="floatright small">
<?php
$f_filter = gpc_get_int( 'filter', 0 );
print_page_links( 'view_all_bug_page.php', 1, $t_page_count, (int)$f_page_number, $f_filter );
?>
</span>
</td>
</tr>
<?php # -- ====================== end of MASS BUG MANIPULATION ========================= -- ?>
</tbody>
</table>
</form>
<?php
html_status_legend( STATUS_LEGEND_POSITION_BOTTOM, true );
# -- ====================== FILTER FORM ========================= --
if( ( $t_filter_position & FILTER_POSITION_BOTTOM ) == FILTER_POSITION_BOTTOM ) {
filter_draw_selection_area( $f_page_number );
}
# -- ====================== end of FILTER FORM ================== --