[ Index ]

PHP Cross Reference of MantisBT

title

Body

[close]

/ -> view_all_inc.php (source)

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


Generated: Thu Jul 28 15:48:31 2011 Cross-referenced by PHPXref 0.7