2 # MantisBT - A PHP based bugtracking system
4 # MantisBT is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 2 of the License, or
7 # (at your option) any later version.
9 # MantisBT is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with MantisBT. If not, see <http://www.gnu.org/licenses/>.
18 * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
19 * @copyright Copyright (C) 2002 - 2010 MantisBT Team - mantisbt-dev@lists.sourceforge.net
20 * @link http://www.mantisbt.org
23 * @uses access_api.php
25 * @uses category_api.php
26 * @uses config_api.php
27 * @uses constant_inc.php
28 * @uses current_user_api.php
30 * @uses filter_api.php
31 * @uses filter_constants_inc.php
32 * @uses helper_api.php
36 * @uses project_api.php
37 * @uses string_api.php
40 require_api( 'access_api.php' );
41 require_api( 'bug_api.php' );
42 require_api( 'category_api.php' );
43 require_api( 'config_api.php' );
44 require_api( 'constant_inc.php' );
45 require_api( 'current_user_api.php' );
46 require_api( 'file_api.php' );
47 require_api( 'filter_api.php' );
48 require_api( 'filter_constants_inc.php' );
49 require_api( 'helper_api.php' );
50 require_api( 'icon_api.php' );
51 require_api( 'lang_api.php' );
52 require_api( 'print_api.php' );
53 require_api( 'project_api.php' );
54 require_api( 'string_api.php' );
56 $t_filter = current_user_get_bug_filter();
58 if( $t_filter === false ) {
59 $t_filter = filter_get_default();
62 $t_sort = $t_filter['sort'];
63 $t_dir = $t_filter['dir'];
65 $t_checkboxes_exist = false;
67 $t_icon_path = config_get( 'icon_path' );
68 $t_update_bug_threshold = config_get( 'update_bug_threshold' );
69 $t_bug_resolved_status_threshold = config_get( 'bug_resolved_status_threshold' );
70 $t_hide_status_default = config_get( 'hide_status_default' );
71 $t_default_show_changed = config_get( 'default_show_changed' );
73 $c_filter['assigned'] = array(
74 FILTER_PROPERTY_CATEGORY
=> Array(
75 '0' => META_FILTER_ANY
,
77 FILTER_PROPERTY_SEVERITY_ID
=> Array(
78 '0' => META_FILTER_ANY
,
80 FILTER_PROPERTY_STATUS_ID
=> Array(
81 '0' => META_FILTER_ANY
,
83 FILTER_PROPERTY_HIGHLIGHT_CHANGED
=> $t_default_show_changed,
84 FILTER_PROPERTY_REPORTER_ID
=> Array(
85 '0' => META_FILTER_ANY
,
87 FILTER_PROPERTY_HANDLER_ID
=> Array(
88 '0' => $t_current_user_id,
90 FILTER_PROPERTY_RESOLUTION_ID
=> Array(
91 '0' => META_FILTER_ANY
,
93 FILTER_PROPERTY_PRODUCT_BUILD
=> Array(
94 '0' => META_FILTER_ANY
,
96 FILTER_PROPERTY_PRODUCT_VERSION
=> Array(
97 '0' => META_FILTER_ANY
,
99 FILTER_PROPERTY_HIDE_STATUS_ID
=> Array(
100 '0' => $t_bug_resolved_status_threshold,
102 FILTER_PROPERTY_MONITOR_USER_ID
=> Array(
103 '0' => META_FILTER_ANY
,
106 $url_link_parameters['assigned'] = FILTER_PROPERTY_HANDLER_ID
. '=' . $t_current_user_id . '&' . FILTER_PROPERTY_HIDE_STATUS_ID
. '=' . $t_bug_resolved_status_threshold;
108 $c_filter['recent_mod'] = array(
109 FILTER_PROPERTY_CATEGORY
=> Array(
110 '0' => META_FILTER_ANY
,
112 FILTER_PROPERTY_SEVERITY_ID
=> Array(
113 '0' => META_FILTER_ANY
,
115 FILTER_PROPERTY_STATUS_ID
=> Array(
116 '0' => META_FILTER_ANY
,
118 FILTER_PROPERTY_HIGHLIGHT_CHANGED
=> $t_default_show_changed,
119 FILTER_PROPERTY_REPORTER_ID
=> Array(
120 '0' => META_FILTER_ANY
,
122 FILTER_PROPERTY_HANDLER_ID
=> Array(
123 '0' => META_FILTER_ANY
,
125 FILTER_PROPERTY_RESOLUTION_ID
=> Array(
126 '0' => META_FILTER_ANY
,
128 FILTER_PROPERTY_PRODUCT_BUILD
=> Array(
129 '0' => META_FILTER_ANY
,
131 FILTER_PROPERTY_PRODUCT_VERSION
=> Array(
132 '0' => META_FILTER_ANY
,
134 FILTER_PROPERTY_HIDE_STATUS_ID
=> Array(
135 '0' => META_FILTER_NONE
,
137 FILTER_PROPERTY_MONITOR_USER_ID
=> Array(
138 '0' => META_FILTER_ANY
,
141 $url_link_parameters['recent_mod'] = FILTER_PROPERTY_HIDE_STATUS_ID
. '=none';
143 $c_filter['reported'] = array(
144 FILTER_PROPERTY_CATEGORY
=> Array(
145 '0' => META_FILTER_ANY
,
147 FILTER_PROPERTY_SEVERITY_ID
=> Array(
148 '0' => META_FILTER_ANY
,
150 FILTER_PROPERTY_STATUS_ID
=> Array(
151 '0' => META_FILTER_ANY
,
153 FILTER_PROPERTY_HIGHLIGHT_CHANGED
=> $t_default_show_changed,
154 FILTER_PROPERTY_REPORTER_ID
=> Array(
155 '0' => $t_current_user_id,
157 FILTER_PROPERTY_HANDLER_ID
=> Array(
158 '0' => META_FILTER_ANY
,
160 FILTER_PROPERTY_SORT_FIELD_NAME
=> 'last_updated',
161 FILTER_PROPERTY_RESOLUTION_ID
=> Array(
162 '0' => META_FILTER_ANY
,
164 FILTER_PROPERTY_PRODUCT_BUILD
=> Array(
165 '0' => META_FILTER_ANY
,
167 FILTER_PROPERTY_PRODUCT_VERSION
=> Array(
168 '0' => META_FILTER_ANY
,
170 FILTER_PROPERTY_HIDE_STATUS_ID
=> Array(
171 '0' => $t_hide_status_default,
173 FILTER_PROPERTY_MONITOR_USER_ID
=> Array(
174 '0' => META_FILTER_ANY
,
177 $url_link_parameters['reported'] = FILTER_PROPERTY_REPORTER_ID
. '=' . $t_current_user_id . '&' . FILTER_PROPERTY_HIDE_STATUS_ID
. '=' . $t_hide_status_default;
179 $c_filter['resolved'] = array(
180 FILTER_PROPERTY_CATEGORY
=> Array(
181 '0' => META_FILTER_ANY
,
183 FILTER_PROPERTY_SEVERITY_ID
=> Array(
184 '0' => META_FILTER_ANY
,
186 FILTER_PROPERTY_STATUS_ID
=> Array(
187 '0' => $t_bug_resolved_status_threshold,
189 FILTER_PROPERTY_HIGHLIGHT_CHANGED
=> $t_default_show_changed,
190 FILTER_PROPERTY_REPORTER_ID
=> Array(
191 '0' => META_FILTER_ANY
,
193 FILTER_PROPERTY_HANDLER_ID
=> Array(
194 '0' => META_FILTER_ANY
,
196 FILTER_PROPERTY_RESOLUTION_ID
=> Array(
197 '0' => META_FILTER_ANY
,
199 FILTER_PROPERTY_PRODUCT_BUILD
=> Array(
200 '0' => META_FILTER_ANY
,
202 FILTER_PROPERTY_PRODUCT_VERSION
=> Array(
203 '0' => META_FILTER_ANY
,
205 FILTER_PROPERTY_HIDE_STATUS_ID
=> Array(
206 '0' => $t_hide_status_default,
208 FILTER_PROPERTY_MONITOR_USER_ID
=> Array(
209 '0' => META_FILTER_ANY
,
212 $url_link_parameters['resolved'] = FILTER_PROPERTY_STATUS_ID
. '=' . $t_bug_resolved_status_threshold . '&' . FILTER_PROPERTY_HIDE_STATUS_ID
. '=' . $t_bug_resolved_status_threshold;
214 $c_filter['unassigned'] = array(
215 FILTER_PROPERTY_CATEGORY
=> Array(
216 '0' => META_FILTER_ANY
,
218 FILTER_PROPERTY_SEVERITY_ID
=> Array(
219 '0' => META_FILTER_ANY
,
221 FILTER_PROPERTY_STATUS_ID
=> Array(
222 '0' => META_FILTER_ANY
,
224 FILTER_PROPERTY_HIGHLIGHT_CHANGED
=> $t_default_show_changed,
225 FILTER_PROPERTY_REPORTER_ID
=> Array(
226 '0' => META_FILTER_ANY
,
228 FILTER_PROPERTY_HANDLER_ID
=> Array(
229 '0' => META_FILTER_NONE
,
231 FILTER_PROPERTY_RESOLUTION_ID
=> Array(
232 '0' => META_FILTER_ANY
,
234 FILTER_PROPERTY_PRODUCT_BUILD
=> Array(
235 '0' => META_FILTER_ANY
,
237 FILTER_PROPERTY_PRODUCT_VERSION
=> Array(
238 '0' => META_FILTER_ANY
,
240 FILTER_PROPERTY_HIDE_STATUS_ID
=> Array(
241 '0' => $t_hide_status_default,
243 FILTER_PROPERTY_MONITOR_USER_ID
=> Array(
244 '0' => META_FILTER_ANY
,
247 $url_link_parameters['unassigned'] = FILTER_PROPERTY_HANDLER_ID
. '=[none]' . '&' . FILTER_PROPERTY_HIDE_STATUS_ID
. '=' . $t_hide_status_default;
249 # TODO: check. handler value looks wrong
251 $c_filter['monitored'] = array(
252 FILTER_PROPERTY_CATEGORY
=> Array(
253 '0' => META_FILTER_ANY
,
255 FILTER_PROPERTY_SEVERITY_ID
=> Array(
256 '0' => META_FILTER_ANY
,
258 FILTER_PROPERTY_STATUS_ID
=> Array(
259 '0' => META_FILTER_ANY
,
261 FILTER_PROPERTY_HIGHLIGHT_CHANGED
=> $t_default_show_changed,
262 FILTER_PROPERTY_REPORTER_ID
=> Array(
263 '0' => META_FILTER_ANY
,
265 FILTER_PROPERTY_HANDLER_ID
=> Array(
266 '0' => META_FILTER_ANY
,
268 FILTER_PROPERTY_RESOLUTION_ID
=> Array(
269 '0' => META_FILTER_ANY
,
271 FILTER_PROPERTY_PRODUCT_BUILD
=> Array(
272 '0' => META_FILTER_ANY
,
274 FILTER_PROPERTY_PRODUCT_VERSION
=> Array(
275 '0' => META_FILTER_ANY
,
277 FILTER_PROPERTY_HIDE_STATUS_ID
=> Array(
278 '0' => $t_hide_status_default,
280 FILTER_PROPERTY_MONITOR_USER_ID
=> Array(
281 '0' => $t_current_user_id,
284 $url_link_parameters['monitored'] = FILTER_PROPERTY_MONITOR_USER_ID
. '=' . $t_current_user_id . '&' . FILTER_PROPERTY_HIDE_STATUS_ID
. '=' . $t_hide_status_default;
287 $c_filter['feedback'] = array(
288 FILTER_PROPERTY_CATEGORY
=> Array(
289 '0' => META_FILTER_ANY
,
291 FILTER_PROPERTY_SEVERITY_ID
=> Array(
292 '0' => META_FILTER_ANY
,
294 FILTER_PROPERTY_STATUS_ID
=> Array(
295 '0' => config_get( 'bug_feedback_status' ),
297 FILTER_PROPERTY_HIGHLIGHT_CHANGED
=> $t_default_show_changed,
298 FILTER_PROPERTY_REPORTER_ID
=> Array(
299 '0' => $t_current_user_id,
301 FILTER_PROPERTY_HANDLER_ID
=> Array(
302 '0' => META_FILTER_ANY
,
304 FILTER_PROPERTY_RESOLUTION_ID
=> Array(
305 '0' => META_FILTER_ANY
,
307 FILTER_PROPERTY_PRODUCT_BUILD
=> Array(
308 '0' => META_FILTER_ANY
,
310 FILTER_PROPERTY_PRODUCT_VERSION
=> Array(
311 '0' => META_FILTER_ANY
,
313 FILTER_PROPERTY_HIDE_STATUS_ID
=> Array(
314 '0' => $t_hide_status_default,
316 FILTER_PROPERTY_MONITOR_USER_ID
=> Array(
317 '0' => META_FILTER_ANY
,
320 $url_link_parameters['feedback'] = FILTER_PROPERTY_REPORTER_ID
. '=' . $t_current_user_id . '&' . FILTER_PROPERTY_STATUS_ID
. '=' . config_get( 'bug_feedback_status' ) . '&' . FILTER_PROPERTY_HIDE_STATUS_ID
. '=' . $t_hide_status_default;
322 $c_filter['verify'] = array(
323 FILTER_PROPERTY_CATEGORY
=> Array(
324 '0' => META_FILTER_ANY
,
326 FILTER_PROPERTY_SEVERITY_ID
=> Array(
327 '0' => META_FILTER_ANY
,
329 FILTER_PROPERTY_STATUS_ID
=> Array(
330 '0' => $t_bug_resolved_status_threshold,
332 FILTER_PROPERTY_HIGHLIGHT_CHANGED
=> $t_default_show_changed,
333 FILTER_PROPERTY_REPORTER_ID
=> Array(
334 '0' => $t_current_user_id,
336 FILTER_PROPERTY_HANDLER_ID
=> Array(
337 '0' => META_FILTER_ANY
,
339 FILTER_PROPERTY_RESOLUTION_ID
=> Array(
340 '0' => META_FILTER_ANY
,
342 FILTER_PROPERTY_PRODUCT_BUILD
=> Array(
343 '0' => META_FILTER_ANY
,
345 FILTER_PROPERTY_PRODUCT_VERSION
=> Array(
346 '0' => META_FILTER_ANY
,
348 FILTER_PROPERTY_HIDE_STATUS_ID
=> Array(
349 '0' => $t_hide_status_default,
351 FILTER_PROPERTY_MONITOR_USER_ID
=> Array(
352 '0' => META_FILTER_ANY
,
355 $url_link_parameters['verify'] = FILTER_PROPERTY_REPORTER_ID
. '=' . $t_current_user_id . '&' . FILTER_PROPERTY_STATUS_ID
. '=' . $t_bug_resolved_status_threshold;
357 $c_filter['my_comments'] = array(
358 FILTER_PROPERTY_CATEGORY
=> Array(
359 '0' => META_FILTER_ANY
,
361 FILTER_PROPERTY_SEVERITY_ID
=> Array(
362 '0' => META_FILTER_ANY
,
364 FILTER_PROPERTY_STATUS_ID
=> Array(
365 '0' => META_FILTER_ANY
,
367 FILTER_PROPERTY_HIGHLIGHT_CHANGED
=> $t_default_show_changed,
368 FILTER_PROPERTY_REPORTER_ID
=> Array(
369 '0' => META_FILTER_ANY
,
371 FILTER_PROPERTY_HANDLER_ID
=> Array(
372 '0' => META_FILTER_ANY
,
374 FILTER_PROPERTY_RESOLUTION_ID
=> Array(
375 '0' => META_FILTER_ANY
,
377 FILTER_PROPERTY_PRODUCT_BUILD
=> Array(
378 '0' => META_FILTER_ANY
,
380 FILTER_PROPERTY_PRODUCT_VERSION
=> Array(
381 '0' => META_FILTER_ANY
,
383 FILTER_PROPERTY_HIDE_STATUS_ID
=> Array(
384 '0' => $t_hide_status_default,
386 FILTER_PROPERTY_MONITOR_USER_ID
=> Array(
387 '0' => META_FILTER_ANY
,
389 FILTER_PROPERTY_NOTE_USER_ID
=> Array(
390 '0' => META_FILTER_MYSELF
,
394 $url_link_parameters['my_comments'] = FILTER_PROPERTY_NOTE_USER_ID
. '=' . META_FILTER_MYSELF
. '&' . FILTER_PROPERTY_HIDE_STATUS_ID
. '=' . $t_hide_status_default;
395 $rows = filter_get_bug_rows( $f_page_number, $t_per_page, $t_page_count, $t_bug_count, $c_filter[$t_box_title] );
397 # Improve performance by caching category data in one pass
398 if( helper_get_current_project() == 0 ) {
399 $t_categories = array();
400 foreach( $rows as $t_row ) {
401 $t_categories[] = $t_row->category_id
;
404 category_cache_array_rows( array_unique( $t_categories ) );
407 $t_filter = array_merge( $c_filter[$t_box_title], $t_filter );
409 $box_title = lang_get( 'my_view_title_' . $t_box_title );
411 # -- ====================== BUG LIST ========================= --
414 <table
class="width100" cellspacing
="1">
416 # -- Navigation header row --?>
419 # -- Viewing range info --?>
420 <td
class="form-title" colspan
="2">
422 print_link( 'view_all_set.php?type=1&temporary=y&' . $url_link_parameters[$t_box_title], $box_title, false, 'subtle' );
424 print_bracket_link( 'view_all_set.php?type=1&temporary=y&' . $url_link_parameters[$t_box_title], '^', true, 'subtle' );
426 if( count( $rows ) > 0 ) {
427 $v_start = $t_filter[FILTER_PROPERTY_ISSUES_PER_PAGE
] * ( $f_page_number - 1 ) +
1;
428 $v_end = $v_start +
count( $rows ) - 1;
434 echo "($v_start - $v_end / $t_bug_count)";
440 # -- Loop over bug rows and create $v_* variables --
441 $t_count = count( $rows );
442 for( $i = 0;$i < $t_count; $i++
) {
445 $t_summary = string_display_line_links( $t_bug->summary
);
446 $t_last_updated = date( config_get( 'normal_date_format' ), $t_bug->last_updated
);
448 # choose color based on status
449 $status_color = get_status_color( $t_bug->status
);
451 # Check for attachments
452 $t_attachment_count = 0;
453 if(( file_can_view_bug_attachments( $t_bug->id
) ) ) {
454 $t_attachment_count = file_bug_attachment_count( $t_bug->id
);
457 # grab the project name
458 $project_name = project_get_field( $t_bug->project_id
, 'name' );
461 <tr bgcolor
="<?php echo $status_color?>">
463 # -- Bug ID and details link + Pencil shortcut --?>
464 <td
class="center" valign
="top" width
="0" nowrap
="nowrap">
467 print_bug_link( $t_bug->id
);
471 if( !bug_is_readonly( $t_bug->id
) && access_has_bug_level( $t_update_bug_threshold, $t_bug->id
) ) {
472 echo '<a href="' . string_get_bug_update_url( $t_bug->id
) . '"><img border="0" src="' . $t_icon_path . 'update.png' . '" alt="' . lang_get( 'update_bug_button' ) . '" /></a>';
475 if( ON
== config_get( 'show_priority_text' ) ) {
476 print_formatted_priority_string( $t_bug->status
, $t_bug->priority
);
478 print_status_icon( $t_bug->priority
);
481 if( 0 < $t_attachment_count ) {
482 echo '<a href="' . string_get_bug_view_url( $t_bug->id
) . '#attachments">';
483 echo '<img border="0" src="' . $t_icon_path . 'attachment.png' . '"';
484 echo ' alt="' . lang_get( 'attachment_alt' ) . '"';
485 echo ' title="' . $t_attachment_count . ' ' . lang_get( 'attachments' ) . '"';
489 if( VS_PRIVATE
== $t_bug->view_state
) {
490 echo '<img src="' . $t_icon_path . 'protected.gif" width="8" height="15" alt="' . lang_get( 'private' ) . '" />';
498 <td
class="left" valign
="top" width
="100%">
501 if( ON
== config_get( 'show_bug_project_links' ) && helper_get_current_project() != $t_bug->project_id
) {
502 echo '[', string_display_line( project_get_name( $t_bug->project_id
) ), '] ';
508 # type project name if viewing 'all projects' or bug is in subproject
509 echo string_display_line( category_full_name( $t_bug->category_id
, true, $t_bug->project_id
) );
511 if( $t_bug->last_updated
> strtotime( '-' . $t_filter[FILTER_PROPERTY_HIGHLIGHT_CHANGED
] . ' hours' ) ) {
512 echo ' - <b>' . $t_last_updated . '</b>';
514 echo ' - ' . $t_last_updated;
521 # -- end of Repeating bug row --
524 # -- ====================== end of BUG LIST ========================= --
528 // Free the memory allocated for the rows in this box since it is not longer needed.