[ Index ]
 

Code source de Mantis 1.1.0rc3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/ -> bug_change_status_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      # --------------------------------------------------------
  21      # $Id: bug_change_status_page.php,v 1.28.2.1 2007-10-13 22:32:36 giallu Exp $
  22      # --------------------------------------------------------
  23  ?>
  24  <?php
  25      require_once ( 'core.php' );
  26  
  27      $t_core_path = config_get( 'core_path' );
  28  
  29      require_once( $t_core_path.'bug_api.php' );
  30      require_once( $t_core_path.'custom_field_api.php' );
  31  
  32      require_once( $t_core_path.'relationship_api.php' );
  33  ?>
  34  <?php
  35      $f_bug_id = gpc_get_int( 'bug_id' );
  36      $t_bug = bug_get( $f_bug_id );
  37      
  38      if( $t_bug->project_id != helper_get_current_project() ) {
  39          # in case the current project is not the same project of the bug we are viewing...
  40          # ... override the current project. This to avoid problems with categories and handlers lists etc.
  41          $g_project_override = $t_bug->project_id;
  42      }
  43      
  44      $f_new_status = gpc_get_int( 'new_status' );
  45      $f_reopen_flag = gpc_get_int( 'reopen_flag', OFF );
  46  
  47      if ( ! ( ( access_has_bug_level( access_get_status_threshold( $f_new_status, bug_get_field( $f_bug_id, 'project_id' ) ), $f_bug_id ) ) ||
  48                  ( ( bug_get_field( $f_bug_id, 'reporter_id' ) == auth_get_current_user_id() ) &&
  49                          ( ( ON == config_get( 'allow_reporter_reopen' ) ) ||
  50                                  ( ON == config_get( 'allow_reporter_close' ) ) ) ) ||
  51                  ( ( ON == $f_reopen_flag ) && ( access_has_bug_level( config_get( 'reopen_bug_threshold' ), $f_bug_id ) ) )
  52              ) ) {
  53          access_denied();
  54      }
  55  
  56      # get new issue handler if set, otherwise default to original handler
  57      $f_handler_id = gpc_get_int( 'handler_id', bug_get_field( $f_bug_id, 'handler_id' ) );
  58  
  59      if ( ASSIGNED == $f_new_status ) {
  60          $t_bug_sponsored = sponsorship_get_amount( sponsorship_get_all_ids( $f_bug_id ) ) > 0;
  61          if ( $t_bug_sponsored ) {
  62              if ( !access_has_bug_level( config_get( 'assign_sponsored_bugs_threshold' ), $f_bug_id ) ) {
  63                  trigger_error( ERROR_SPONSORSHIP_ASSIGNER_ACCESS_LEVEL_TOO_LOW, ERROR );
  64              }
  65          }
  66  
  67          if ( $f_handler_id != NO_USER ) {
  68              if ( !access_has_bug_level( config_get( 'handle_bug_threshold' ), $f_bug_id, $f_handler_id ) ) {
  69                  trigger_error( ERROR_HANDLER_ACCESS_TOO_LOW, ERROR );
  70              }
  71  
  72              if ( $t_bug_sponsored ) {
  73                  if ( !access_has_bug_level( config_get( 'handle_sponsored_bugs_threshold' ), $f_bug_id, $f_handler_id ) ) {
  74                      trigger_error( ERROR_SPONSORSHIP_HANDLER_ACCESS_LEVEL_TOO_LOW, ERROR );
  75                  }
  76              }
  77          }
  78      }
  79  
  80      $t_status_label = str_replace( " ", "_", get_enum_to_string( config_get( 'status_enum_string' ), $f_new_status ) );
  81      $t_resolved = config_get( 'bug_resolved_status_threshold' );
  82  
  83      $t_bug = bug_get( $f_bug_id );
  84  
  85      html_page_top1( bug_format_summary( $f_bug_id, SUMMARY_CAPTION ) );
  86      html_page_top2();
  87  
  88      print_recently_visited();
  89  ?>
  90  
  91  <br />
  92  <div align="center">
  93  <form method="post" action="bug_update.php">
  94  <table class="width75" cellspacing="1">
  95  
  96  
  97  <!-- Title -->
  98  <tr>
  99      <td class="form-title" colspan="2">
 100          <input type="hidden" name="bug_id" value="<?php echo $f_bug_id ?>" />
 101          <input type="hidden" name="status" value="<?php echo $f_new_status ?>" />
 102          <?php echo lang_get( $t_status_label . '_bug_title' ) ?>
 103      </td>
 104  </tr>
 105  
 106  <?php
 107  # relationship warnings
 108  if ( ON == config_get( 'enable_relationship' ) ) {
 109      if ( $t_resolved <= $f_new_status ) {
 110          if ( relationship_can_resolve_bug( $f_bug_id ) == false ) {
 111              echo "<tr><td colspan=\"2\">" . lang_get( 'relationship_warning_blocking_bugs_not_resolved_2' ) . "</td></tr>";
 112          }
 113      }
 114  }
 115  ?>
 116  
 117  <?php
 118  $t_current_resolution = $t_bug->resolution;
 119  $t_bug_is_open = in_array( $t_current_resolution, array( OPEN, REOPENED ) );
 120  if ( ( $t_resolved <= $f_new_status ) && ( ( CLOSED > $f_new_status ) || ( $t_bug_is_open ) ) ) { ?>
 121  <!-- Resolution -->
 122  <tr <?php echo helper_alternate_class() ?>>
 123      <td class="category">
 124          <?php echo lang_get( 'resolution' ) ?>
 125      </td>
 126      <td>
 127          <select name="resolution">
 128              <?php 
 129                  $t_resolution = $t_bug_is_open ? FIXED : $t_current_resolution;
 130                  print_enum_string_option_list( "resolution", $t_resolution );
 131              ?>
 132          </select>
 133      </td>
 134  </tr>
 135  <?php } ?>
 136  
 137  <?php
 138  if ( ( $t_resolved <= $f_new_status ) && ( CLOSED > $f_new_status ) ) { ?>
 139  <!-- Duplicate ID -->
 140  <tr <?php echo helper_alternate_class() ?>>
 141      <td class="category">
 142          <?php echo lang_get( 'duplicate_id' ) ?>
 143      </td>
 144      <td>
 145          <input type="text" name="duplicate_id" maxlength="7" />
 146      </td>
 147  </tr>
 148  <?php } ?>
 149  
 150  <?php
 151  if ( ( $t_resolved > $f_new_status ) &&
 152          access_has_bug_level( config_get( 'update_bug_assign_threshold', config_get( 'update_bug_threshold')), $f_bug_id) ) { ?>
 153  <!-- Assigned To -->
 154  <tr <?php echo helper_alternate_class() ?>>
 155      <td class="category">
 156          <?php echo lang_get( 'assigned_to' ) ?>
 157      </td>
 158      <td>
 159          <select name="handler_id">
 160              <option value="0"></option>
 161              <?php print_assign_to_option_list( $t_bug->handler_id, $t_bug->project_id ) ?>
 162          </select>
 163      </td>
 164  </tr>
 165  <?php } ?>
 166  
 167  <!-- Custom Fields -->
 168  <?php
 169  # @@@ thraxisp - I undid part of the change for #5068 for #5527
 170  #  We really need to say what fields are shown in which statusses. For now,
 171  #  this page will show required custom fields in update mode, or 
 172  #  display or required fields on resolve or close
 173  $t_custom_status_label = "update"; # Don't show custom fields by default
 174  if ( ( $f_new_status == $t_resolved ) &&
 175              ( CLOSED > $f_new_status ) ) {
 176      $t_custom_status_label = "resolved";
 177  }
 178  if ( CLOSED == $f_new_status ) {
 179      $t_custom_status_label = "closed";
 180  }
 181  
 182  $t_related_custom_field_ids = custom_field_get_linked_ids( bug_get_field( $f_bug_id, 'project_id' ) );
 183  
 184  foreach( $t_related_custom_field_ids as $t_id ) {
 185      $t_def = custom_field_get_definition( $t_id );
 186      $t_display = $t_def['display_' . $t_custom_status_label];
 187      $t_require = $t_def['require_' . $t_custom_status_label];
 188      
 189      if ( ( "update" == $t_custom_status_label ) && ( ! $t_require ) ) {
 190          continue;
 191      }
 192      if ( in_array( $t_custom_status_label, array( "resolved", "closed" ) ) && ! ( $t_display || $t_require ) ) {
 193          continue;
 194      }
 195      if ( custom_field_has_write_access( $t_id, $f_bug_id ) ) {
 196  ?>
 197  <tr <?php echo helper_alternate_class() ?>>
 198      <td class="category">
 199          <?php if ( $t_require ) {?><span class="required">*</span><?php } ?><?php echo lang_get_defaulted( $t_def['name'] ) ?>
 200      </td>
 201      <td>
 202          <?php
 203              print_custom_field_input( $t_def, $f_bug_id );
 204          ?>
 205      </td>
 206  </tr>
 207  <?php
 208      } #  custom_field_has_write_access( $t_id, $f_bug_id ) )
 209      else if ( custom_field_has_read_access( $t_id, $f_bug_id ) ) {
 210  ?>
 211      <tr <?php echo helper_alternate_class() ?>>
 212          <td class="category">
 213              <?php echo lang_get_defaulted( $t_def['name'] ) ?>
 214          </td>
 215          <td>
 216              <?php print_custom_field_value( $t_def, $t_id, $f_bug_id );            ?>
 217          </td>
 218      </tr>
 219  <?php
 220      } # custom_field_has_read_access( $t_id, $f_bug_id ) )
 221  } # foreach( $t_related_custom_field_ids as $t_id )
 222  ?>
 223  
 224  <?php
 225  if ( ( $f_new_status >= $t_resolved ) && access_has_bug_level( config_get( 'handle_bug_threshold' ), $f_bug_id ) ) {
 226      $t_show_version = ( ON == config_get( 'show_product_version' ) )
 227          || ( ( AUTO == config_get( 'show_product_version' ) )
 228                      && ( count( version_get_all_rows( $t_bug->project_id ) ) > 0 ) );
 229      if ( $t_show_version ) {
 230  ?>
 231  <!-- Fixed in Version -->
 232  <tr <?php echo helper_alternate_class() ?>>
 233      <td class="category">
 234          <?php echo lang_get( 'fixed_in_version' ) ?>
 235      </td>
 236      <td>
 237          <select name="fixed_in_version">
 238              <?php print_version_option_list( bug_get_field( $f_bug_id, 'fixed_in_version' ),
 239                              bug_get_field( $f_bug_id, 'project_id' ), VERSION_ALL ) ?>
 240          </select>
 241      </td>
 242  </tr>
 243  <?php }
 244      } ?>
 245  
 246  <?php
 247  if ( ( $f_new_status >= $t_resolved ) && ( CLOSED > $f_new_status ) ) { ?>
 248  <!-- Close Immediately (if enabled) -->
 249  <?php if ( ( ON == config_get( 'allow_close_immediately' ) )
 250                  && ( access_has_bug_level( access_get_status_threshold( CLOSED ), $f_bug_id ) ) ) { ?>
 251  <tr <?php echo helper_alternate_class() ?>>
 252      <td class="category">
 253          <?php echo lang_get( 'close_immediately' ) ?>
 254      </td>
 255      <td>
 256          <input type="checkbox" name="close_now" />
 257      </td>
 258  </tr>
 259  <?php } ?>
 260  <?php } ?>
 261  
 262  <?php
 263      if ( ON == $f_reopen_flag ) {
 264          # bug was re-opened
 265          printf("    <input type=\"hidden\" name=\"resolution\" value=\"%s\" />\n",  config_get( 'bug_reopen_resolution' ) );
 266      }
 267  ?>
 268  
 269  <!-- Bugnote -->
 270  <tr <?php echo helper_alternate_class() ?>>
 271      <td class="category">
 272          <?php echo lang_get( 'add_bugnote_title' ) ?>
 273      </td>
 274      <td class="center">
 275          <textarea name="bugnote_text" cols="80" rows="10"></textarea>
 276      </td>
 277  </tr>
 278  <?php if ( access_has_bug_level( config_get( 'private_bugnote_threshold' ), $f_bug_id ) ) { ?>
 279  <tr <?php echo helper_alternate_class() ?>>
 280      <td class="category">
 281          <?php echo lang_get( 'view_status' ) ?>
 282      </td>
 283      <td>
 284  <?php
 285          $t_default_bugnote_view_status = config_get( 'default_bugnote_view_status' );
 286          if ( access_has_bug_level( config_get( 'set_view_status_threshold' ), $f_bug_id ) ) {
 287  ?>
 288              <input type="checkbox" name="private" <?php check_checked( $t_default_bugnote_view_status, VS_PRIVATE ); ?> />
 289  <?php
 290              echo lang_get( 'private' );
 291          } else {
 292              echo get_enum_element( 'project_view_state', $t_default_bugnote_view_status );
 293          }
 294  ?>
 295      </td>
 296  </tr>
 297  <?php } ?>
 298  
 299  <?php if ( config_get('time_tracking_enabled') ) { ?>
 300  <?php if ( access_has_bug_level( config_get( 'private_bugnote_threshold' ), $f_bug_id ) ) { ?>
 301  <?php if ( access_has_bug_level( config_get( 'time_tracking_edit_threshold' ), $f_bug_id ) ) { ?>
 302  <tr <?php echo helper_alternate_class() ?>>
 303      <td class="category">
 304          <?php echo lang_get( 'time_tracking' ) ?>
 305      </td>
 306      <td>
 307          <input type="text" name="time_tracking" size="5" value="0:00" />
 308      </td>
 309  </tr>
 310  <?php } ?>
 311  <?php } ?>
 312  <?php } ?>
 313  
 314  <!-- Submit Button -->
 315  <tr>
 316      <td class="center" colspan="2">
 317          <input type="submit" class="button" value="<?php echo lang_get( $t_status_label . '_bug_button' ) ?>" />
 318      </td>
 319  </tr>
 320  
 321  
 322  </table>
 323  </form>
 324  </div>
 325  
 326  <br />
 327  <?php
 328      include( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'bug_view_inc.php' );
 329      include( dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'bugnote_view_inc.php' );
 330  ?>
 331  
 332  <?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