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 - 2011 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 if ( !defined( 'MY_VIEW_INC_ALLOW' ) ) {
44 require_api( 'access_api.php' );
45 require_api( 'bug_api.php' );
46 require_api( 'category_api.php' );
47 require_api( 'config_api.php' );
48 require_api( 'constant_inc.php' );
49 require_api( 'current_user_api.php' );
50 require_api( 'file_api.php' );
51 require_api( 'filter_api.php' );
52 require_api( 'filter_constants_inc.php' );
53 require_api( 'helper_api.php' );
54 require_api( 'icon_api.php' );
55 require_api( 'lang_api.php' );
56 require_api( 'print_api.php' );
57 require_api( 'project_api.php' );
58 require_api( 'string_api.php' );
60 $t_filter = current_user_get_bug_filter();
61 if( $t_filter === false ) {
62 $t_filter = filter_get_default();
65 $t_sort = $t_filter['sort'];
66 $t_dir = $t_filter['dir'];
68 $t_icon_path = config_get( 'icon_path' );
69 $t_update_bug_threshold = config_get( 'update_bug_threshold' );
70 $t_bug_resolved_status_threshold = config_get( 'bug_resolved_status_threshold' );
71 $t_hide_status_default = config_get( 'hide_status_default' );
72 $t_default_show_changed = config_get( 'default_show_changed' );
74 $c_filter['assigned'] = array(
75 FILTER_PROPERTY_CATEGORY_ID
=> Array(
76 '0' => META_FILTER_ANY
,
78 FILTER_PROPERTY_SEVERITY
=> Array(
79 '0' => META_FILTER_ANY
,
81 FILTER_PROPERTY_STATUS
=> Array(
82 '0' => META_FILTER_ANY
,
84 FILTER_PROPERTY_HIGHLIGHT_CHANGED
=> $t_default_show_changed,
85 FILTER_PROPERTY_REPORTER_ID
=> Array(
86 '0' => META_FILTER_ANY
,
88 FILTER_PROPERTY_HANDLER_ID
=> Array(
89 '0' => $t_current_user_id,
91 FILTER_PROPERTY_RESOLUTION
=> Array(
92 '0' => META_FILTER_ANY
,
94 FILTER_PROPERTY_BUILD
=> Array(
95 '0' => META_FILTER_ANY
,
97 FILTER_PROPERTY_VERSION
=> Array(
98 '0' => META_FILTER_ANY
,
100 FILTER_PROPERTY_HIDE_STATUS
=> Array(
101 '0' => $t_bug_resolved_status_threshold,
103 FILTER_PROPERTY_MONITOR_USER_ID
=> Array(
104 '0' => META_FILTER_ANY
,
107 $url_link_parameters['assigned'] = FILTER_PROPERTY_HANDLER_ID
. '=' . $t_current_user_id . '&' . FILTER_PROPERTY_HIDE_STATUS
. '=' . $t_bug_resolved_status_threshold;
109 $c_filter['recent_mod'] = array(
110 FILTER_PROPERTY_CATEGORY_ID
=> Array(
111 '0' => META_FILTER_ANY
,
113 FILTER_PROPERTY_SEVERITY
=> Array(
114 '0' => META_FILTER_ANY
,
116 FILTER_PROPERTY_STATUS
=> Array(
117 '0' => META_FILTER_ANY
,
119 FILTER_PROPERTY_HIGHLIGHT_CHANGED
=> $t_default_show_changed,
120 FILTER_PROPERTY_REPORTER_ID
=> Array(
121 '0' => META_FILTER_ANY
,
123 FILTER_PROPERTY_HANDLER_ID
=> Array(
124 '0' => META_FILTER_ANY
,
126 FILTER_PROPERTY_RESOLUTION
=> Array(
127 '0' => META_FILTER_ANY
,
129 FILTER_PROPERTY_BUILD
=> Array(
130 '0' => META_FILTER_ANY
,
132 FILTER_PROPERTY_VERSION
=> Array(
133 '0' => META_FILTER_ANY
,
135 FILTER_PROPERTY_HIDE_STATUS
=> Array(
136 '0' => META_FILTER_NONE
,
138 FILTER_PROPERTY_MONITOR_USER_ID
=> Array(
139 '0' => META_FILTER_ANY
,
142 $url_link_parameters['recent_mod'] = FILTER_PROPERTY_HIDE_STATUS
. '=none';
144 $c_filter['reported'] = array(
145 FILTER_PROPERTY_CATEGORY_ID
=> Array(
146 '0' => META_FILTER_ANY
,
148 FILTER_PROPERTY_SEVERITY
=> Array(
149 '0' => META_FILTER_ANY
,
151 FILTER_PROPERTY_STATUS
=> Array(
152 '0' => META_FILTER_ANY
,
154 FILTER_PROPERTY_HIGHLIGHT_CHANGED
=> $t_default_show_changed,
155 FILTER_PROPERTY_REPORTER_ID
=> Array(
156 '0' => $t_current_user_id,
158 FILTER_PROPERTY_HANDLER_ID
=> Array(
159 '0' => META_FILTER_ANY
,
161 FILTER_PROPERTY_SORT_FIELD_NAME
=> 'last_updated',
162 FILTER_PROPERTY_RESOLUTION
=> Array(
163 '0' => META_FILTER_ANY
,
165 FILTER_PROPERTY_BUILD
=> Array(
166 '0' => META_FILTER_ANY
,
168 FILTER_PROPERTY_VERSION
=> Array(
169 '0' => META_FILTER_ANY
,
171 FILTER_PROPERTY_HIDE_STATUS
=> Array(
172 '0' => $t_hide_status_default,
174 FILTER_PROPERTY_MONITOR_USER_ID
=> Array(
175 '0' => META_FILTER_ANY
,
178 $url_link_parameters['reported'] = FILTER_PROPERTY_REPORTER_ID
. '=' . $t_current_user_id . '&' . FILTER_PROPERTY_HIDE_STATUS
. '=' . $t_hide_status_default;
180 $c_filter['resolved'] = array(
181 FILTER_PROPERTY_CATEGORY_ID
=> Array(
182 '0' => META_FILTER_ANY
,
184 FILTER_PROPERTY_SEVERITY
=> Array(
185 '0' => META_FILTER_ANY
,
187 FILTER_PROPERTY_STATUS
=> Array(
188 '0' => $t_bug_resolved_status_threshold,
190 FILTER_PROPERTY_HIGHLIGHT_CHANGED
=> $t_default_show_changed,
191 FILTER_PROPERTY_REPORTER_ID
=> Array(
192 '0' => META_FILTER_ANY
,
194 FILTER_PROPERTY_HANDLER_ID
=> Array(
195 '0' => META_FILTER_ANY
,
197 FILTER_PROPERTY_RESOLUTION
=> Array(
198 '0' => META_FILTER_ANY
,
200 FILTER_PROPERTY_BUILD
=> Array(
201 '0' => META_FILTER_ANY
,
203 FILTER_PROPERTY_VERSION
=> Array(
204 '0' => META_FILTER_ANY
,
206 FILTER_PROPERTY_HIDE_STATUS
=> Array(
207 '0' => $t_hide_status_default,
209 FILTER_PROPERTY_MONITOR_USER_ID
=> Array(
210 '0' => META_FILTER_ANY
,
213 $url_link_parameters['resolved'] = FILTER_PROPERTY_STATUS
. '=' . $t_bug_resolved_status_threshold . '&' . FILTER_PROPERTY_HIDE_STATUS
. '=' . $t_bug_resolved_status_threshold;
215 $c_filter['unassigned'] = array(
216 FILTER_PROPERTY_CATEGORY_ID
=> Array(
217 '0' => META_FILTER_ANY
,
219 FILTER_PROPERTY_SEVERITY
=> Array(
220 '0' => META_FILTER_ANY
,
222 FILTER_PROPERTY_STATUS
=> Array(
223 '0' => META_FILTER_ANY
,
225 FILTER_PROPERTY_HIGHLIGHT_CHANGED
=> $t_default_show_changed,
226 FILTER_PROPERTY_REPORTER_ID
=> Array(
227 '0' => META_FILTER_ANY
,
229 FILTER_PROPERTY_HANDLER_ID
=> Array(
230 '0' => META_FILTER_NONE
,
232 FILTER_PROPERTY_RESOLUTION
=> Array(
233 '0' => META_FILTER_ANY
,
235 FILTER_PROPERTY_BUILD
=> Array(
236 '0' => META_FILTER_ANY
,
238 FILTER_PROPERTY_VERSION
=> Array(
239 '0' => META_FILTER_ANY
,
241 FILTER_PROPERTY_HIDE_STATUS
=> Array(
242 '0' => $t_hide_status_default,
244 FILTER_PROPERTY_MONITOR_USER_ID
=> Array(
245 '0' => META_FILTER_ANY
,
248 $url_link_parameters['unassigned'] = FILTER_PROPERTY_HANDLER_ID
. '=[none]' . '&' . FILTER_PROPERTY_HIDE_STATUS
. '=' . $t_hide_status_default;
250 # TODO: check. handler value looks wrong
252 $c_filter['monitored'] = array(
253 FILTER_PROPERTY_CATEGORY_ID
=> Array(
254 '0' => META_FILTER_ANY
,
256 FILTER_PROPERTY_SEVERITY
=> Array(
257 '0' => META_FILTER_ANY
,
259 FILTER_PROPERTY_STATUS
=> Array(
260 '0' => META_FILTER_ANY
,
262 FILTER_PROPERTY_HIGHLIGHT_CHANGED
=> $t_default_show_changed,
263 FILTER_PROPERTY_REPORTER_ID
=> Array(
264 '0' => META_FILTER_ANY
,
266 FILTER_PROPERTY_HANDLER_ID
=> Array(
267 '0' => META_FILTER_ANY
,
269 FILTER_PROPERTY_RESOLUTION
=> Array(
270 '0' => META_FILTER_ANY
,
272 FILTER_PROPERTY_BUILD
=> Array(
273 '0' => META_FILTER_ANY
,
275 FILTER_PROPERTY_VERSION
=> Array(
276 '0' => META_FILTER_ANY
,
278 FILTER_PROPERTY_HIDE_STATUS
=> Array(
279 '0' => $t_hide_status_default,
281 FILTER_PROPERTY_MONITOR_USER_ID
=> Array(
282 '0' => $t_current_user_id,
285 $url_link_parameters['monitored'] = FILTER_PROPERTY_MONITOR_USER_ID
. '=' . $t_current_user_id . '&' . FILTER_PROPERTY_HIDE_STATUS
. '=' . $t_hide_status_default;
288 $c_filter['feedback'] = array(
289 FILTER_PROPERTY_CATEGORY_ID
=> Array(
290 '0' => META_FILTER_ANY
,
292 FILTER_PROPERTY_SEVERITY
=> Array(
293 '0' => META_FILTER_ANY
,
295 FILTER_PROPERTY_STATUS
=> Array(
296 '0' => config_get( 'bug_feedback_status' ),
298 FILTER_PROPERTY_HIGHLIGHT_CHANGED
=> $t_default_show_changed,
299 FILTER_PROPERTY_REPORTER_ID
=> Array(
300 '0' => $t_current_user_id,
302 FILTER_PROPERTY_HANDLER_ID
=> Array(
303 '0' => META_FILTER_ANY
,
305 FILTER_PROPERTY_RESOLUTION
=> Array(
306 '0' => META_FILTER_ANY
,
308 FILTER_PROPERTY_BUILD
=> Array(
309 '0' => META_FILTER_ANY
,
311 FILTER_PROPERTY_VERSION
=> Array(
312 '0' => META_FILTER_ANY
,
314 FILTER_PROPERTY_HIDE_STATUS
=> Array(
315 '0' => $t_hide_status_default,
317 FILTER_PROPERTY_MONITOR_USER_ID
=> Array(
318 '0' => META_FILTER_ANY
,
321 $url_link_parameters['feedback'] = FILTER_PROPERTY_REPORTER_ID
. '=' . $t_current_user_id . '&' . FILTER_PROPERTY_STATUS
. '=' . config_get( 'bug_feedback_status' ) . '&' . FILTER_PROPERTY_HIDE_STATUS
. '=' . $t_hide_status_default;
323 $c_filter['verify'] = array(
324 FILTER_PROPERTY_CATEGORY_ID
=> Array(
325 '0' => META_FILTER_ANY
,
327 FILTER_PROPERTY_SEVERITY
=> Array(
328 '0' => META_FILTER_ANY
,
330 FILTER_PROPERTY_STATUS
=> Array(
331 '0' => $t_bug_resolved_status_threshold,
333 FILTER_PROPERTY_HIGHLIGHT_CHANGED
=> $t_default_show_changed,
334 FILTER_PROPERTY_REPORTER_ID
=> Array(
335 '0' => $t_current_user_id,
337 FILTER_PROPERTY_HANDLER_ID
=> Array(
338 '0' => META_FILTER_ANY
,
340 FILTER_PROPERTY_RESOLUTION
=> Array(
341 '0' => META_FILTER_ANY
,
343 FILTER_PROPERTY_BUILD
=> Array(
344 '0' => META_FILTER_ANY
,
346 FILTER_PROPERTY_VERSION
=> Array(
347 '0' => META_FILTER_ANY
,
349 FILTER_PROPERTY_HIDE_STATUS
=> Array(
350 '0' => $t_hide_status_default,
352 FILTER_PROPERTY_MONITOR_USER_ID
=> Array(
353 '0' => META_FILTER_ANY
,
356 $url_link_parameters['verify'] = FILTER_PROPERTY_REPORTER_ID
. '=' . $t_current_user_id . '&' . FILTER_PROPERTY_STATUS
. '=' . $t_bug_resolved_status_threshold;
358 $c_filter['my_comments'] = array(
359 FILTER_PROPERTY_CATEGORY_ID
=> Array(
360 '0' => META_FILTER_ANY
,
362 FILTER_PROPERTY_SEVERITY
=> Array(
363 '0' => META_FILTER_ANY
,
365 FILTER_PROPERTY_STATUS
=> Array(
366 '0' => META_FILTER_ANY
,
368 FILTER_PROPERTY_HIGHLIGHT_CHANGED
=> $t_default_show_changed,
369 FILTER_PROPERTY_REPORTER_ID
=> Array(
370 '0' => META_FILTER_ANY
,
372 FILTER_PROPERTY_HANDLER_ID
=> Array(
373 '0' => META_FILTER_ANY
,
375 FILTER_PROPERTY_RESOLUTION
=> Array(
376 '0' => META_FILTER_ANY
,
378 FILTER_PROPERTY_BUILD
=> Array(
379 '0' => META_FILTER_ANY
,
381 FILTER_PROPERTY_VERSION
=> Array(
382 '0' => META_FILTER_ANY
,
384 FILTER_PROPERTY_HIDE_STATUS
=> Array(
385 '0' => $t_hide_status_default,
387 FILTER_PROPERTY_MONITOR_USER_ID
=> Array(
388 '0' => META_FILTER_ANY
,
390 FILTER_PROPERTY_NOTE_USER_ID
=> Array(
391 '0' => META_FILTER_MYSELF
,
395 $url_link_parameters['my_comments'] = FILTER_PROPERTY_NOTE_USER_ID
. '=' . META_FILTER_MYSELF
. '&' . FILTER_PROPERTY_HIDE_STATUS
. '=' . $t_hide_status_default;
396 $rows = filter_get_bug_rows( $f_page_number, $t_per_page, $t_page_count, $t_bug_count, $c_filter[$t_box_title] );
398 # Improve performance by caching category data in one pass
399 if( helper_get_current_project() == 0 ) {
400 $t_categories = array();
401 foreach( $rows as $t_row ) {
402 $t_categories[] = $t_row->category_id
;
405 category_cache_array_rows( array_unique( $t_categories ) );
408 $t_filter = array_merge( $c_filter[$t_box_title], $t_filter );
410 $box_title = lang_get( 'my_view_title_' . $t_box_title );
412 # -- ====================== BUG LIST ========================= --
415 <table
class="width100 my-buglist" cellspacing
="1">
417 # -- Navigation header row --?>
419 <tr
class="my-buglist-nav">
421 # -- Viewing range info --?>
422 <td
class="form-title" colspan
="2">
424 print_link( 'view_all_set.php?type=1&temporary=y&' . $url_link_parameters[$t_box_title], $box_title, false, '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 "<span class=\"my-buglist-count\">($v_start - $v_end / $t_bug_count)</span>";
440 # -- Loop over bug rows and create $v_* variables --
441 $t_count = count( $rows );
442 if( $t_count == 0 ) {
443 echo '<tr><td> </td></tr>';
445 for( $i = 0;$i < $t_count; $i++
) {
448 $t_summary = string_display_line_links( $t_bug->summary
);
449 $t_last_updated = date( config_get( 'normal_date_format' ), $t_bug->last_updated
);
451 # choose color based on status
452 $status_label = html_get_status_css_class( $t_bug->status
);
454 # Check for attachments
455 $t_attachment_count = 0;
456 # TODO: factor in the allow_view_own_attachments configuration option
457 # instead of just using a global check.
458 if(( file_can_view_bug_attachments( $t_bug->id
, null ) ) ) {
459 $t_attachment_count = file_bug_attachment_count( $t_bug->id
);
462 # grab the project name
463 $project_name = project_get_field( $t_bug->project_id
, 'name' );
465 if ( VS_PRIVATE
== $t_bug->view_state
) {
466 $t_bug_class = 'my-buglist-private';
472 <tr
class="my-buglist-bug <?php echo $t_bug_class?> <?php echo $status_label; ?>">
474 # -- Bug ID and details link + Pencil shortcut --?>
475 <td
class="center nowrap my-buglist-id">
478 print_bug_link( $t_bug->id
);
482 if( !bug_is_readonly( $t_bug->id
) && access_has_bug_level( $t_update_bug_threshold, $t_bug->id
) ) {
483 echo '<a class="edit" href="' . string_get_bug_update_url( $t_bug->id
) . '"><img src="' . $t_icon_path . 'update.png' . '" alt="' . lang_get( 'update_bug_button' ) . '" /></a>';
486 if( ON
== config_get( 'show_priority_text' ) ) {
487 print_formatted_priority_string( $t_bug->status
, $t_bug->priority
);
489 print_status_icon( $t_bug->priority
);
492 if ( $t_attachment_count > 0 ) {
493 $t_href = string_get_bug_view_url( $t_bug->id
) . '#attachments';
494 $t_href_title = sprintf( lang_get( 'view_attachments_for_issue' ), $t_attachment_count, $t_bug->id
);
495 $t_alt_text = $t_attachment_count . lang_get( 'word_separator' ) . lang_get( 'attachments' );
496 echo "<a class=\"attachments\" href=\"$t_href\" title=\"$t_href_title\"><img src=\"${t_icon_path}attachment.png\" alt=\"$t_alt_text\" title=\"$t_alt_text\" /></a>";
499 if( VS_PRIVATE
== $t_bug->view_state
) {
500 echo '<img src="' . $t_icon_path . 'protected.gif" width="8" height="15" alt="' . lang_get( 'private' ) . '" />';
508 <td
class="left my-buglist-description">
510 if( ON
== config_get( 'show_bug_project_links' ) && helper_get_current_project() != $t_bug->project_id
) {
511 echo '<span class="small project">[', string_display_line( project_get_name( $t_bug->project_id
) ), '] </span>';
513 $t_bug_url = string_get_bug_view_url( $t_bug->id
, null );
514 $t_bug_url_title = string_html_specialchars( sprintf( lang_get( 'label' ), lang_get( 'issue_id' ) . $t_bug->id
) . lang_get( 'word_separator' ) . $t_bug->summary
);
515 echo "<span class=\"small summary\"><a href=\"$t_bug_url\" title=\"$t_bug_url_title\">$t_summary</a></span><br />";
518 # type project name if viewing 'all projects' or bug is in subproject
519 echo '<span class="small category">', string_display_line( category_full_name( $t_bug->category_id
, true, $t_bug->project_id
) ), '</span>';
521 echo '<span class="small last-modified"> - ';
522 if( $t_bug->last_updated
> strtotime( '-' . $t_filter[FILTER_PROPERTY_HIGHLIGHT_CHANGED
] . ' hours' ) ) {
523 echo '<strong>' . $t_last_updated . '</strong>';
525 echo $t_last_updated;
532 # -- end of Repeating bug row --
535 # -- ====================== end of BUG LIST ========================= --
540 // Free the memory allocated for the rows in this box since it is not longer needed.