[ Index ]
 

Code source de Mantis 1.1.0rc3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/ -> view_filters_page.php (source)

   1  <?php
   2  # Mantis - a php based bugtracking system
   3  
   4  # Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
   5  # Copyright (C) 2002 - 2007  Mantis Team   - mantisbt-dev@lists.sourceforge.net
   6  
   7  # Mantis is free software: you can redistribute it and/or modify
   8  # it under the terms of the GNU General Public License as published by
   9  # the Free Software Foundation, either version 2 of the License, or
  10  # (at your option) any later version.
  11  #
  12  # Mantis is distributed in the hope that it will be useful,
  13  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15  # GNU General Public License for more details.
  16  #
  17  # You should have received a copy of the GNU General Public License
  18  # along with Mantis.  If not, see <http://www.gnu.org/licenses/>.
  19  ?>
  20  <?php
  21      require_once ( 'core.php' );
  22      $t_core_path = config_get( 'core_path' );
  23  
  24      require_once( $t_core_path.'compress_api.php' );
  25      require_once( $t_core_path.'filter_api.php' );
  26      require_once( $t_core_path.'relationship_api.php' );
  27      require_once( $t_core_path.'current_user_api.php' );
  28      require_once( $t_core_path.'bug_api.php' );
  29      require_once( $t_core_path.'string_api.php' );
  30      require_once( $t_core_path.'date_api.php' );
  31      require_once( $t_core_path.'tag_api.php' );
  32  
  33      auth_ensure_user_authenticated();
  34  
  35      compress_enable();
  36  
  37      html_page_top1();
  38      html_page_top2();
  39  
  40      $t_target_field = gpc_get_string( 'target_field', '' );
  41  
  42      if ( ON == config_get( 'use_javascript' ) ) {
  43          ?>
  44          <body onload="SetInitialFocus();">
  45  
  46          <script type="text/javascript" language="JavaScript">
  47          <!--
  48  		function SetInitialFocus() {
  49              <?php
  50              global $t_target_field;
  51              if ( $t_target_field ) {
  52                  $f_view_type = gpc_get_string( 'view_type', '' );
  53                  if ( ( 'hide_status[]' == $t_target_field ) && ( 'advanced' == $f_view_type ) ) {
  54                      print "field_to_focus = \"show_status[]\";";
  55                  } else {
  56                      print "field_to_focus = \"$t_target_field\";";
  57                  }
  58              } else {
  59                  print "field_to_focus = null;";
  60              }
  61              ?>
  62              if ( field_to_focus ) {
  63                  eval( "document.filters['" + field_to_focus + "'].focus()" );
  64              }
  65  
  66              SwitchDateFields();
  67          }
  68  
  69  		function SwitchDateFields() {
  70              // All fields need to be enabled to go back to the script
  71              document.filters.start_month.disabled = ! document.filters.do_filter_by_date.checked;
  72              document.filters.start_day.disabled = ! document.filters.do_filter_by_date.checked;
  73              document.filters.start_year.disabled = ! document.filters.do_filter_by_date.checked;
  74              document.filters.end_month.disabled = ! document.filters.do_filter_by_date.checked;
  75              document.filters.end_day.disabled = ! document.filters.do_filter_by_date.checked;
  76              document.filters.end_year.disabled = ! document.filters.do_filter_by_date.checked;
  77  
  78              return true;
  79          }
  80          // -->
  81          </script>
  82  
  83          <?php
  84      }
  85  
  86      # @@@ thraxisp - could this be replaced by a call to filter_draw_selection_area2
  87  
  88      $t_filter = current_user_get_bug_filter();
  89      $t_filter = filter_ensure_valid_filter( $t_filter );
  90      $t_project_id = helper_get_current_project();
  91  
  92      $t_current_user_access_level = current_user_get_access_level();
  93      $t_accessible_custom_fields_ids = array();
  94      $t_accessible_custom_fields_names = array();
  95      $t_accessible_custom_fields_type = array() ;
  96      $t_accessible_custom_fields_values = array();
  97      $t_filter_cols = config_get( 'filter_custom_fields_per_row' );
  98      $t_custom_cols = 1;
  99      $t_custom_rows = 0;
 100  
 101      #get valid target fields
 102      $t_fields = helper_get_columns_to_view();
 103      $t_n_fields = count( $t_fields );
 104      for ( $i=0; $i < $t_n_fields; $i++ ) {
 105          if ( in_array( $t_fields[$i], array( 'selection', 'edit', 'bugnotes_count', 'attachment' ) ) ) {
 106              unset( $t_fields[$i] );
 107          }
 108      }
 109  
 110      if ( ON == config_get( 'filter_by_custom_fields' ) ) {
 111          $t_custom_cols = $t_filter_cols;
 112          $t_custom_fields = custom_field_get_linked_ids( $t_project_id );
 113  
 114          foreach ( $t_custom_fields as $t_cfid ) {
 115              $t_field_info = custom_field_cache_row( $t_cfid, true );
 116              if ( $t_field_info['access_level_r'] <= $t_current_user_access_level ) {
 117                  $t_accessible_custom_fields_ids[] = $t_cfid;
 118                  $t_accessible_custom_fields_names[] = $t_field_info['name'];
 119                  $t_accessible_custom_fields_types[] = $t_field_info['type'];
 120                  $t_accessible_custom_fields_values[] = custom_field_distinct_values( $t_cfid, $t_project_id );
 121                  $t_fields[] = "custom_" . $t_field_info['name'];
 122              }
 123          }
 124  
 125          if ( sizeof( $t_accessible_custom_fields_ids ) > 0 ) {
 126              $t_per_row = config_get( 'filter_custom_fields_per_row' );
 127              $t_custom_rows = ceil( sizeof( $t_accessible_custom_fields_ids ) / $t_per_row );
 128          }
 129      }
 130  
 131      if ( ! in_array( $t_target_field, $t_fields ) ) {
 132          $t_target_field = '';
 133      }
 134      
 135      $f_for_screen = gpc_get_bool( 'for_screen', true );
 136  
 137      $t_action  = "view_all_set.php?f=3";
 138  
 139      if ( $f_for_screen == false ) {
 140          $t_action  = "view_all_set.php";
 141      }
 142  
 143      $f_default_view_type = 'simple';
 144      if ( ADVANCED_DEFAULT == config_get( 'view_filters' ) ) {
 145          $f_default_view_type = 'advanced';
 146      }
 147  
 148      $f_view_type = gpc_get_string( 'view_type', $f_default_view_type );
 149      if ( ADVANCED_ONLY == config_get( 'view_filters' ) ) {
 150          $f_view_type = 'advanced';
 151      }
 152      if ( SIMPLE_ONLY == config_get( 'view_filters' ) ) {
 153          $f_view_type = 'simple';
 154      }
 155      if ( ! in_array( $f_view_type, array( 'simple', 'advanced' ) ) ) {
 156          $f_view_type = $f_default_view_type;
 157      }    
 158  
 159      $t_select_modifier = '';
 160      if ( 'advanced' == $f_view_type ) {
 161          $t_select_modifier = 'multiple="multiple" size="10" ';
 162      }
 163  
 164      $t_show_version = ( ON == config_get( 'show_product_version' ) )
 165              || ( ( AUTO == config_get( 'show_product_version' ) )
 166                          && ( count( version_get_all_rows_with_subs( $t_project_id ) ) > 0 ) );
 167  ?>
 168  <br />
 169  <form method="post" name="filters" action="<?php echo $t_action; ?>">
 170  <input type="hidden" name="type" value="1" />
 171  <input type="hidden" name="view_type" value="<?php PRINT $f_view_type; ?>" />
 172  <?php
 173      if ( $f_for_screen == false )
 174      {
 175          print "<input type=\"hidden\" name=\"print\" value=\"1\" />";
 176          print "<input type=\"hidden\" name=\"offset\" value=\"0\" />";
 177      }
 178  ?>
 179  <table class="width100" cellspacing="1">
 180  <tr>
 181      <td class="right" colspan="<?php PRINT ( 8 * $t_custom_cols ); ?>">
 182      <?php
 183          $f_switch_view_link = 'view_filters_page.php?target_field=' . $t_target_field . '&amp;view_type=';
 184  
 185          if ( ( SIMPLE_ONLY != config_get( 'view_filters' ) ) && ( ADVANCED_ONLY != config_get( 'view_filters' ) ) ) {
 186              if ( 'advanced' == $f_view_type ) {
 187                  print_bracket_link( $f_switch_view_link . 'simple', lang_get( 'simple_filters' ) );
 188              } else {
 189                  print_bracket_link( $f_switch_view_link . 'advanced', lang_get( 'advanced_filters' ) );
 190              }
 191          }
 192      ?>
 193      </td>
 194  </tr>
 195  <tr class="row-category2">
 196      <td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"><?php echo lang_get( 'reporter' ) ?></td>
 197      <td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"><?php echo lang_get( 'monitored_by' ) ?></td>
 198      <td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"><?php echo lang_get( 'assigned_to' ) ?></td>
 199      <td class="small-caption" colspan="<?php echo ( 2 * $t_custom_cols ); ?>"><?php echo lang_get( 'category' ) ?></td>
 200      <td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"><?php echo lang_get( 'severity' ) ?></td>
 201      <td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"><?php echo lang_get( 'resolution' ) ?></td>
 202      <td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"><?php echo lang_get( 'profile' ) ?></td>
 203      <!-- <td colspan="<?php echo ( ( $t_filter_cols - 8 ) * $t_custom_cols ); ?>">&nbsp;</td> -->
 204  </tr>
 205  <tr class="row-1">
 206      <!-- Reporter -->
 207      <td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
 208          <?php print_filter_reporter_id(); ?>
 209      </td>
 210      <!-- Monitored by -->
 211      <td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
 212          <?php print_filter_user_monitor(); ?>
 213      </td>
 214      <!-- Handler -->
 215      <td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
 216          <?php print_filter_handler_id(); ?>
 217      </td>
 218      <!-- Category -->
 219      <td valign="top" colspan="<?php echo ( 2 * $t_custom_cols ); ?>">
 220          <?php print_filter_show_category(); ?>
 221      </td>
 222      <!-- Severity -->
 223      <td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
 224          <?php print_filter_show_severity(); ?>
 225      </td>
 226      <!-- Resolution -->
 227      <td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
 228          <?php print_filter_show_resolution(); ?>
 229      </td>
 230      <!-- Profile -->
 231      <td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
 232          <?php print_filter_show_profile(); ?>
 233      </td>
 234      <!-- <td colspan="<?php echo ( ( $t_filter_cols - 8 ) * $t_custom_cols ); ?>">&nbsp;</td> -->
 235  </tr>
 236  
 237  <tr class="row-category2">
 238      <td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"><?php echo lang_get( 'status' ) ?></td>
 239      <td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
 240      <?php
 241      if ( 'simple' == $f_view_type ) {
 242          echo lang_get( 'hide_status' );
 243      } else {
 244          echo '&nbsp;';
 245      }
 246      ?>
 247      </td>
 248      <td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"><?php echo lang_get( 'product_build' ) ?></td>
 249      <?php if ( $t_show_version ) { ?>
 250          <td class="small-caption" colspan="<?php echo ( 2 * $t_custom_cols ); ?>"><?php echo lang_get( 'product_version' ) ?></td>
 251          <td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"><?php echo lang_get( 'fixed_in_version' ) ?></td>
 252      <?php } else { ?>
 253          <td class="small-caption" colspan="<?php echo ( 2 * $t_custom_cols ); ?>">&nbsp;</td>
 254          <td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">&nbsp;</td>
 255      <?php } ?>
 256      <td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"><?php echo lang_get( 'priority' ) ?></td>
 257      <td class="small-caption" colspan="<?php echo ( ( $t_filter_cols - 7 ) * $t_custom_cols ); ?>">&nbsp;</td>
 258  </tr>
 259  <tr class="row-1">
 260      <!-- Status -->
 261      <td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
 262          <?php print_filter_show_status(); ?>
 263      </td>
 264      <!-- Hide Status -->
 265      <td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
 266      <?php
 267      if ( 'simple' == $f_view_type ) {
 268          print_filter_hide_status();
 269      } else {
 270          echo '&nbsp;';
 271      }
 272      ?>
 273      </td>
 274      <!-- Build -->
 275      <td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
 276           <?php print_filter_show_build(); ?>
 277      </td>
 278      <!-- Version -->
 279      <td valign="top" colspan="<?php echo ( 2 * $t_custom_cols ); ?>">
 280           <?php if ( $t_show_version ) {
 281               print_filter_show_version();
 282           } else {
 283               echo "&nbsp;";
 284           } ?>
 285      </td>
 286      <!-- Fixed in Version -->
 287      <td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
 288           <?php if ( $t_show_version ) {
 289               print_filter_show_fixed_in_version();
 290           } else {
 291               echo "&nbsp;";
 292           } ?>
 293       </td>
 294      <!-- Priority -->
 295      <td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
 296          <?php print_filter_show_priority(); ?>
 297      </td>
 298      <td colspan="<?php echo ( ( $t_filter_cols - 7 ) * $t_custom_cols ); ?>">&nbsp;</td>
 299  </tr>
 300  
 301  <tr class="row-category2">
 302      <td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"><?php echo lang_get( 'show' ) ?></td>
 303      <td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"><?php echo lang_get( 'view_status' ) ?></td>
 304      <td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"><?php echo lang_get( 'sticky' ) ?></td>
 305      <td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"><?php echo lang_get( 'changed' ) ?></td>
 306      <td class="small-caption" colspan="<?php echo ( 3 * $t_custom_cols ); ?>">
 307          <input type="checkbox" name="do_filter_by_date" <?php
 308              check_checked( $t_filter['do_filter_by_date'], 'on' );
 309              if ( ON == config_get( 'use_javascript' ) ) {
 310                  print "onclick=\"SwitchDateFields();\""; } ?> />
 311          <?php echo lang_get( 'use_date_filters' ) ?>
 312      </td>
 313      <td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
 314          <?php echo lang_get( 'bug_relationships' ) ?>
 315      </td>
 316      <!-- <td colspan="<?php echo ( ( $t_filter_cols - 8 ) * $t_custom_cols ); ?>">&nbsp;</td> -->
 317  </tr>
 318  <tr class="row-2">
 319      <!-- Number of bugs per page -->
 320      <td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
 321          <?php print_filter_per_page(); ?>
 322      </td>
 323      <!-- View Status -->
 324      <td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
 325          <?php print_filter_view_state(); ?>
 326      </td>
 327      <!-- Show Sticky bugs -->
 328      <td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
 329          <?php print_filter_sticky_issues(); ?>
 330      </td>
 331      <!-- Highlight changed bugs -->
 332      <td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
 333          <?php print_filter_highlight_changed(); ?>
 334      </td>
 335      <td valign="top" class="left" colspan="<?php echo ( 3 * $t_custom_cols ); ?>">
 336          <?php print_filter_do_filter_by_date( true ); # hide checkbox as it's already been shown ?>
 337      </td>
 338      <td valign="top" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
 339          <?php print_filter_relationship_type(); ?>
 340      </td>
 341      <!-- <td colspan="<?php echo ( ( $t_filter_cols - 8 ) * $t_custom_cols ); ?>">&nbsp;</td> -->
 342  </tr>
 343  
 344  <?php
 345  if ( ON == config_get( 'filter_by_custom_fields' ) ) {
 346  ?>
 347      <?php # -- Custom Field Searching -- ?>
 348      <?php
 349      if ( sizeof( $t_accessible_custom_fields_ids ) > 0 ) {
 350          $t_per_row = config_get( 'filter_custom_fields_per_row' );
 351          $t_num_rows = ceil( sizeof( $t_accessible_custom_fields_ids ) / $t_per_row );
 352          $t_base = 0;
 353  
 354          for ( $i = 0; $i < $t_num_rows; $i++ ) {
 355              ?>
 356              <tr class="row-category2">
 357              <?php
 358              for( $j = 0; $j < $t_per_row; $j++ ) {
 359                  echo '<td class="small-caption" colspan="' . ( 1 * $t_filter_cols ) . '">';
 360                  if ( isset( $t_accessible_custom_fields_names[$t_base + $j] ) ) {
 361                      echo string_display( lang_get_defaulted( $t_accessible_custom_fields_names[$t_base + $j] ) );
 362                  } else {
 363                      echo '&nbsp;';
 364                  }
 365                  echo '</td>';
 366              }
 367              ?>
 368              </tr>
 369              <tr class="row-2">
 370              <?php
 371              for ( $j = 0; $j < $t_per_row; $j++ ) {
 372                  echo '<td colspan="' . ( 1 * $t_filter_cols ) . '">';
 373                  if ( isset( $t_accessible_custom_fields_ids[$t_base + $j] ) ) {
 374                      print_filter_custom_field($t_accessible_custom_fields_ids[$t_base + $j]);
 375                  } else {
 376                      echo '&nbsp;';
 377                  }
 378                  echo '</td>';
 379              }
 380  
 381              ?>
 382              </tr>
 383              <?php
 384              $t_base += $t_per_row;
 385          }
 386      }
 387  }
 388  
 389  if ( 'simple' == $f_view_type ) {
 390      $t_project_cols = 0;
 391  } else {
 392      $t_project_cols = 3;
 393  }
 394  ?>
 395  
 396  <tr class="row-1">
 397      <td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>" valign="top">
 398          <?php PRINT lang_get( 'sort' ) ?>:
 399      </td>
 400      <td valign="top" colspan="<?php echo ( ( $t_filter_cols - 1 - $t_project_cols ) * $t_custom_cols ); ?>">
 401          <?php
 402              print_filter_show_sort();
 403          ?>
 404      </td>
 405      <?php
 406          if ( 'advanced' == $f_view_type ) {
 407      ?>
 408              <td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>" valign="top">
 409                  <?php PRINT lang_get( 'email_project' ) ?>:
 410              </td>
 411              <td valign="top" colspan="<?php echo( 2 * $t_custom_cols ); ?>">
 412                  <?php
 413                      print_filter_project_id();
 414                  ?>
 415              </td>
 416      <?php
 417          }
 418      ?>
 419  </tr>
 420  <tr class="row-category2">
 421  <td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"><?php echo lang_get( 'search' ) ?></td>
 422  <td class="small-caption" colspan="<?php echo ( ( $t_filter_cols - 2 ) * $t_custom_cols ); ?>"><?php echo lang_get( 'tags' ) ?></td>
 423  <td class="small-caption" colspan="<?php echo ( 1 * $t_custom_cols ); ?>"></td>
 424  </tr>
 425  <tr>
 426      <!-- Search field -->
 427      <td colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
 428          <input type="text" size="16" name="search" value="<?php echo string_html_specialchars( $t_filter['search'] ); ?>" />
 429      </td>
 430  
 431      <td class="small-caption" colspan="<?php echo ( ( $t_filter_cols - 2 ) * $t_custom_cols ); ?>"><?php print_filter_tag_string() ?></td>
 432  
 433      <!-- Submit button -->
 434      <td class="right" colspan="<?php echo ( 1 * $t_custom_cols ); ?>">
 435          <input type="submit" name="filter" class="button" value="<?php echo lang_get( 'filter_button' ) ?>" />
 436      </td>
 437  </tr>
 438  </table>
 439  </form>
 440  
 441  <?php html_page_bottom1( __FILE__ ) ?>


Généré le : Thu Nov 29 09:42:17 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics