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/>.
19 * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
20 * @copyright Copyright (C) 2002 - 2010 MantisBT Team - mantisbt-dev@lists.sourceforge.net
21 * @link http://www.mantisbt.org
23 * @uses category_api.php
24 * @uses columns_api.php
25 * @uses config_api.php
26 * @uses constant_inc.php
27 * @uses current_user_api.php
29 * @uses filter_api.php
31 * @uses helper_api.php
37 require_api( 'category_api.php' );
38 require_api( 'columns_api.php' );
39 require_api( 'config_api.php' );
40 require_api( 'constant_inc.php' );
41 require_api( 'current_user_api.php' );
42 require_api( 'event_api.php' );
43 require_api( 'filter_api.php' );
44 require_api( 'gpc_api.php' );
45 require_api( 'helper_api.php' );
46 require_api( 'html_api.php' );
47 require_api( 'lang_api.php' );
48 require_api( 'print_api.php' );
50 $t_filter = current_user_get_bug_filter();
52 # NOTE: this check might be better placed in current_user_get_bug_filter()
54 $t_filter = filter_get_default();
57 list( $t_sort, ) = explode( ',', $t_filter['sort'] );
58 list( $t_dir, ) = explode( ',', $t_filter['dir'] );
60 $t_checkboxes_exist = false;
62 $t_icon_path = config_get( 'icon_path' );
63 $t_update_bug_threshold = config_get( 'update_bug_threshold' );
65 # Improve performance by caching category data in one pass
66 if ( helper_get_current_project() > 0 ) {
67 category_get_all_rows( helper_get_current_project() );
69 $t_categories = array();
70 foreach ($rows as $t_row) {
71 $t_categories[] = $t_row->category_id
;
73 category_cache_array_rows( array_unique( $t_categories ) );
75 $t_columns = helper_get_columns_to_view( COLUMNS_TARGET_VIEW_PAGE
);
77 $col_count = count( $t_columns );
79 $t_filter_position = config_get( 'filter_position' );
81 # -- ====================== FILTER FORM ========================= --
82 if ( ( $t_filter_position & FILTER_POSITION_TOP
) == FILTER_POSITION_TOP
) {
83 filter_draw_selection_area( $f_page_number );
85 # -- ====================== end of FILTER FORM ================== --
88 # -- ====================== BUG LIST ============================ --
90 $t_status_legend_position = config_get( 'status_legend_position' );
92 if ( $t_status_legend_position == STATUS_LEGEND_POSITION_TOP ||
$t_status_legend_position == STATUS_LEGEND_POSITION_BOTH
) {
96 /** @todo (thraxisp) this may want a browser check ( MS IE >= 5.0, Mozilla >= 1.0, Safari >=1.2, ...) */
97 if ( ( ON
== config_get( 'dhtml_filters' ) ) && ( ON
== config_get( 'use_javascript' ) ) ){
99 <script type
="text/javascript" language
="JavaScript">
101 var string_loading
= '<?php echo lang_get( 'loading
' );?>';
105 html_javascript_link( 'xmlhttprequest.js');
106 html_javascript_link( 'addLoadEvent.js');
107 html_javascript_link( 'dynamic_filters.js');
111 <form name
="bug_action" method
="get" action
="bug_actiongroup_page.php">
112 <?php
# CSRF protection not required here - form does not result in modifications ?>
113 <table id
="buglist" class="width100" cellspacing
="1">
115 <td
class="form-title" colspan
="<?php echo $col_count; ?>">
116 <span
class="floatleft">
118 # -- Viewing range info --
123 if ( count( $rows ) > 0 ) {
124 $v_start = $t_filter['per_page'] * ($f_page_number - 1) +
1;
125 $v_end = $v_start +
count( $rows ) - 1;
128 echo lang_get( 'viewing_bugs_title' );
129 echo " ($v_start - $v_end / $t_bug_count)";
132 <span
class="floatleft small">
134 # -- Print and Export links --
136 print_bracket_link( 'print_all_bug_page.php', lang_get( 'print_all_bug_page_link' ) );
138 print_bracket_link( 'csv_export.php', lang_get( 'csv_export' ) );
140 print_bracket_link( 'excel_xml_export.php', lang_get( 'excel_export' ) );
142 $t_event_menu_options = $t_links = event_signal( 'EVENT_MENU_FILTER' );
144 foreach ( $t_event_menu_options as $t_plugin => $t_plugin_menu_options ) {
145 foreach ( $t_plugin_menu_options as $t_callback => $t_callback_menu_options ) {
146 if ( !is_array( $t_callback_menu_options ) ) {
147 $t_callback_menu_options = array( $t_callback_menu_options );
150 foreach ( $t_callback_menu_options as $t_menu_option ) {
151 print_bracket_link_prepared( $t_menu_option );
157 <span
class="floatright small"><?php
158 # -- Page number links --
159 $f_filter = gpc_get_int( 'filter', 0);
160 print_page_links( 'view_all_bug_page.php', 1, $t_page_count, (int)$f_page_number, $f_filter );
164 <?php
# -- Bug list column header row -- ?>
165 <tr
class="row-category">
167 foreach( $t_columns as $t_column ) {
168 $t_title_function = 'print_column_title';
169 helper_call_custom_function( $t_title_function, array( $t_column ) );
174 <?php
# -- Spacer row -- ?>
176 <td colspan
="<?php echo $col_count; ?>"></td
>
179 function write_bug_rows ( $p_rows )
181 global $t_columns, $t_filter;
183 $t_in_stickies = ( $t_filter && ( 'on' == $t_filter['sticky_issues'] ) );
185 # pre-cache custom column data
186 columns_plugin_cache_issue_data( $p_rows );
188 # -- Loop over bug rows --
190 $t_rows = count( $p_rows );
191 for( $i=0; $i < $t_rows; $i++
) {
192 $t_row = $p_rows[$i];
194 if ( ( 0 == $t_row->sticky
) && ( 0 == $i ) ) {
195 $t_in_stickies = false;
197 if ( ( 0 == $t_row->sticky
) && $t_in_stickies ) { # demarcate stickies, if any have been shown
200 <td
class="left" colspan
="<?php echo count( $t_columns ); ?>" bgcolor
="#999999"> 
;</td
>
203 $t_in_stickies = false;
206 # choose color based on status
207 $status_color = get_status_color( $t_row->status
);
209 echo '<tr bgcolor="', $status_color, '" border="1" valign="top">';
211 foreach( $t_columns as $t_column ) {
212 $t_column_value_function = 'print_column_value';
213 helper_call_custom_function( $t_column_value_function, array( $t_column, $t_row ) );
221 write_bug_rows($rows);
222 # -- ====================== end of BUG LIST ========================= --
224 # -- ====================== MASS BUG MANIPULATION =================== --
227 <td
class="left" colspan
="<?php echo $col_count; ?>">
228 <span
class="floatleft">
230 if ( $t_checkboxes_exist && ON
== config_get( 'use_javascript' ) ) {
231 echo "<input type=\"checkbox\" name=\"all_bugs\" value=\"all\" onclick=\"checkall('bug_action', this.form.all_bugs.checked)\" /><span class=\"small\">" . lang_get( 'select_all' ) . '</span>';
234 if ( $t_checkboxes_exist ) {
236 <select name
="action">
237 <?php
print_all_bug_action_option_list() ?
>
239 <input type
="submit" class="button" value
="<?php echo lang_get( 'ok' ); ?>" />
245 <span
class="floatright small">
247 $f_filter = gpc_get_int( 'filter', 0);
248 print_page_links( 'view_all_bug_page.php', 1, $t_page_count, (int)$f_page_number, $f_filter );
253 <?php
# -- ====================== end of MASS BUG MANIPULATION ========================= -- ?>
259 if ( $t_status_legend_position == STATUS_LEGEND_POSITION_BOTTOM ||
$t_status_legend_position == STATUS_LEGEND_POSITION_BOTH
) {
260 html_status_legend();
263 # -- ====================== FILTER FORM ========================= --
264 if ( ( $t_filter_position & FILTER_POSITION_BOTTOM
) == FILTER_POSITION_BOTTOM
) {
265 filter_draw_selection_area( $f_page_number );
267 # -- ====================== end of FILTER FORM ================== --