[ 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_report_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_report_page.php,v 1.64.2.1 2007-10-13 22:32:53 giallu Exp $
  22      # --------------------------------------------------------
  23  
  24      # This file POSTs data to report_bug.php
  25  
  26      $g_allow_browser_cache = 1;
  27      require_once ( 'core.php' );
  28  
  29      $t_core_path = config_get( 'core_path' );
  30  
  31      require_once( $t_core_path.'file_api.php' );
  32      require_once( $t_core_path.'custom_field_api.php' );
  33      require_once( $t_core_path.'last_visited_api.php' );
  34  
  35      $f_master_bug_id = gpc_get_int( 'm_id', 0 );
  36  
  37      # this page is invalid for the 'All Project' selection except if this is a clone
  38      if ( ( ALL_PROJECTS == helper_get_current_project() ) && ( 0 == $f_master_bug_id ) ) {
  39          print_header_redirect( 'login_select_proj_page.php?ref=bug_report_page.php' );
  40      }
  41  
  42      if ( ADVANCED_ONLY == config_get( 'show_report' ) ) {
  43          print_header_redirect ( 'bug_report_advanced_page.php' .
  44                  ( 0 == $f_master_bug_id ) ? '' : '?m_id=' . $f_master_bug_id );
  45      }
  46  
  47      if( $f_master_bug_id > 0 ) {
  48          # master bug exists...
  49          bug_ensure_exists( $f_master_bug_id );
  50  
  51          # master bug is not read-only...
  52          if ( bug_is_readonly( $f_master_bug_id ) ) {
  53              error_parameters( $f_master_bug_id );
  54              trigger_error( ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR );
  55          }
  56  
  57          $t_bug = bug_prepare_edit( bug_get( $f_master_bug_id, true ) );
  58  
  59          # the user can at least update the master bug (needed to add the relationship)...
  60          access_ensure_bug_level( config_get( 'update_bug_threshold', null, $t_bug->project_id ), $f_master_bug_id );
  61  
  62          #@@@ (thraxisp) Note that the master bug is cloned into the same project as the master, independent of
  63          #       what the current project is set to.
  64          if( $t_bug->project_id != helper_get_current_project() ) {
  65              # in case the current project is not the same project of the bug we are viewing...
  66              # ... override the current project. This to avoid problems with categories and handlers lists etc.
  67              $g_project_override = $t_bug->project_id;
  68              $t_changed_project = true;
  69          } else {
  70              $t_changed_project = false;
  71          }
  72  
  73          access_ensure_project_level( config_get( 'report_bug_threshold' ) );
  74  
  75          $f_product_version        = $t_bug->version;
  76          $f_category                = $t_bug->category;
  77          $f_reproducibility        = $t_bug->reproducibility;
  78          $f_severity                = $t_bug->severity;
  79          $f_priority                = $t_bug->priority;
  80          $f_summary                = $t_bug->summary;
  81          $f_description            = $t_bug->description;
  82          $f_additional_info        = $t_bug->additional_information;
  83          $f_view_state            = $t_bug->view_state;
  84  
  85          $t_project_id            = $t_bug->project_id;
  86      } else {
  87          access_ensure_project_level( config_get( 'report_bug_threshold' ) );
  88  
  89          $f_product_version        = gpc_get_string( 'product_version', '' );
  90          $f_category                = gpc_get_string( 'category', config_get( 'default_bug_category' ) );
  91          $f_reproducibility        = gpc_get_int( 'reproducibility', config_get( 'default_bug_reproducibility' ) );
  92          $f_severity                = gpc_get_int( 'severity', config_get( 'default_bug_severity' ) );
  93          $f_priority                = gpc_get_int( 'priority', config_get( 'default_bug_priority' ) );
  94          $f_summary                = gpc_get_string( 'summary', '' );
  95          $f_description            = gpc_get_string( 'description', '' );
  96          $f_additional_info        = gpc_get_string( 'additional_info', config_get ( 'default_bug_additional_info' ) );
  97          $f_view_state            = gpc_get_int( 'view_state', config_get( 'default_bug_view_status' ) );
  98  
  99          $t_project_id            = helper_get_current_project();
 100  
 101          $t_changed_project        = false;
 102      }
 103  
 104      $f_report_stay            = gpc_get_bool( 'report_stay', false );
 105  
 106      html_page_top1( lang_get( 'report_bug_link' ) );
 107      html_page_top2();
 108  
 109      print_recently_visited();
 110  ?>
 111  
 112  <br />
 113  <div align="center">
 114  <form name="report_bug_form" method="post" <?php if ( file_allow_bug_upload() ) { echo 'enctype="multipart/form-data"'; } ?> action="bug_report.php">
 115  <table class="width75" cellspacing="1">
 116  
 117  
 118  <!-- Title -->
 119  <tr>
 120      <td class="form-title">
 121          <input type="hidden" name="m_id" value="<?php echo $f_master_bug_id ?>" />
 122          <input type="hidden" name="project_id" value="<?php echo $t_project_id ?>" />
 123          <input type="hidden" name="handler_id" value="0" />
 124          <?php echo lang_get( 'enter_report_details_title' ) ?>
 125      </td>
 126      <td class="right">
 127          <?php
 128              if ( BOTH == config_get( 'show_report' ) ) {
 129                  print_bracket_link( 'bug_report_advanced_page.php' .
 130                      ( $f_master_bug_id > 0 ? '?m_id=' . $f_master_bug_id : '' ), lang_get( 'advanced_report_link' ) );
 131              }
 132          ?>
 133      </td>
 134  </tr>
 135  
 136  
 137  <!-- Category -->
 138  <tr <?php echo helper_alternate_class() ?>>
 139      <td class="category" width="30%">
 140          <?php echo '<span class="required">*</span>', lang_get( 'category' ) ?> <?php print_documentation_link( 'category' ) ?>
 141      </td>
 142      <td width="70%">
 143          <?php if ( $t_changed_project ) {
 144              echo "[" . project_get_field( $t_bug->project_id, 'name' ) . "] ";
 145          } ?>
 146          <select <?php echo helper_get_tab_index() ?> name="category">
 147              <?php 
 148                  if ( is_blank( $f_category ) ) {
 149                      echo '<option value="" selected="selected">', string_attribute( lang_get( 'select_option' ) ), '</option>';
 150                  }
 151  
 152                  print_category_option_list( $f_category ); 
 153              ?>
 154          </select>
 155      </td>
 156  </tr>
 157  
 158  
 159  <!-- Reproducibility -->
 160  <tr <?php echo helper_alternate_class() ?>>
 161      <td class="category">
 162          <?php echo lang_get( 'reproducibility' ) ?> <?php print_documentation_link( 'reproducibility' ) ?>
 163      </td>
 164      <td>
 165          <select <?php echo helper_get_tab_index() ?> name="reproducibility">
 166              <?php print_enum_string_option_list( 'reproducibility', $f_reproducibility ) ?>
 167          </select>
 168      </td>
 169  </tr>
 170  
 171  
 172  <!-- Severity -->
 173  <tr <?php echo helper_alternate_class() ?>>
 174      <td class="category">
 175          <?php echo lang_get( 'severity' ) ?> <?php print_documentation_link( 'severity' ) ?>
 176      </td>
 177      <td>
 178          <select <?php echo helper_get_tab_index() ?> name="severity">
 179              <?php print_enum_string_option_list( 'severity', $f_severity ) ?>
 180          </select>
 181      </td>
 182  </tr>
 183  
 184  
 185  <!-- Priority (if permissions allow) -->
 186  <?php if ( access_has_project_level( config_get( 'handle_bug_threshold' ) ) ) { ?>
 187  <tr <?php echo helper_alternate_class() ?>>
 188      <td class="category">
 189          <?php echo lang_get( 'priority' ) ?> <?php print_documentation_link( 'priority' ) ?>
 190      </td>
 191      <td>
 192          <select <?php echo helper_get_tab_index() ?> name="priority">
 193              <?php print_enum_string_option_list( 'priority', $f_priority ) ?>
 194          </select>
 195      </td>
 196  </tr>
 197  <?php } ?>
 198  
 199  
 200  <!-- spacer -->
 201  <tr class="spacer">
 202      <td colspan="2"></td>
 203  </tr>
 204  
 205  <?php
 206      $t_show_version = ( ON == config_get( 'show_product_version' ) )
 207              || ( ( AUTO == config_get( 'show_product_version' ) )
 208                          && ( count( version_get_all_rows( $t_project_id ) ) > 0 ) );
 209      if ( $t_show_version ) {
 210  ?>
 211  <!-- Product Version -->
 212  <tr <?php echo helper_alternate_class() ?>>
 213      <td class="category">
 214          <?php echo lang_get( 'product_version' ) ?>
 215      </td>
 216      <td>
 217          <select <?php echo helper_get_tab_index() ?> name="product_version">
 218              <?php print_version_option_list( $f_product_version, $t_project_id, VERSION_RELEASED ) ?>
 219          </select>
 220      </td>
 221  </tr>
 222  <?php
 223      }
 224  ?>
 225  
 226  <!-- spacer -->
 227  <tr class="spacer">
 228      <td colspan="2"></td>
 229  </tr>
 230  
 231  
 232  <!-- Summary -->
 233  <tr <?php echo helper_alternate_class() ?>>
 234      <td class="category">
 235          <span class="required">*</span><?php echo lang_get( 'summary' ) ?> <?php print_documentation_link( 'summary' ) ?>
 236      </td>
 237      <td>
 238          <input <?php echo helper_get_tab_index() ?> type="text" name="summary" size="105" maxlength="128" value="<?php echo $f_summary ?>" />
 239      </td>
 240  </tr>
 241  
 242  
 243  <!-- Description -->
 244  <tr <?php echo helper_alternate_class() ?>>
 245      <td class="category">
 246          <span class="required">*</span><?php echo lang_get( 'description' ) ?> <?php print_documentation_link( 'description' ) ?>
 247      </td>
 248      <td>
 249          <textarea <?php echo helper_get_tab_index() ?> name="description" cols="80" rows="10"><?php echo $f_description ?></textarea>
 250      </td>
 251  </tr>
 252  
 253  
 254  <!-- Additional information -->
 255  <tr <?php echo helper_alternate_class() ?>>
 256      <td class="category">
 257          <?php echo lang_get( 'additional_information' ) ?> <?php print_documentation_link( 'additional_information' ) ?>
 258      </td>
 259      <td>
 260          <textarea <?php echo helper_get_tab_index() ?> name="additional_info" cols="80" rows="10"><?php echo $f_additional_info ?></textarea>
 261      </td>
 262  </tr>
 263  
 264  
 265  <!-- spacer -->
 266  <tr class="spacer">
 267      <td colspan="2"></td>
 268  </tr>
 269  
 270  
 271  <!-- Custom Fields -->
 272  <?php
 273      $t_custom_fields_found = false;
 274      $t_related_custom_field_ids = custom_field_get_linked_ids( $t_project_id );
 275      foreach( $t_related_custom_field_ids as $t_id ) {
 276          $t_def = custom_field_get_definition( $t_id );
 277          if( ( ( $t_def['display_report'] && !$t_def['advanced'] ) || $t_def['require_report']) && custom_field_has_write_access_to_project( $t_id, $t_project_id ) ) {
 278              $t_custom_fields_found = true;
 279  ?>
 280  <tr <?php echo helper_alternate_class() ?>>
 281      <td class="category">
 282          <?php if( $t_def['require_report'] ) { ?>
 283              <span class="required">*</span>
 284          <?php } ?>
 285          <?php echo string_display( lang_get_defaulted( $t_def['name'] ) ) ?>
 286      </td>
 287      <td>
 288          <?php print_custom_field_input( $t_def, ( $f_master_bug_id === 0 ) ? null : $f_master_bug_id ) ?>
 289      </td>
 290  </tr>
 291  <?php
 292          } # if (!$t_def['advanced']) && has write access
 293      } # foreach( $t_related_custom_field_ids as $t_id )
 294  ?>
 295  
 296  
 297  <?php if ( $t_custom_fields_found ) { ?>
 298  <!-- spacer -->
 299  <tr class="spacer">
 300      <td colspan="2"></td>
 301  </tr>
 302  <?php } ?>
 303  
 304  
 305  <!-- File Upload (if enabled) -->
 306  <?php if ( file_allow_bug_upload() ) {
 307      $t_max_file_size = (int)min( ini_get_number( 'upload_max_filesize' ), ini_get_number( 'post_max_size' ), config_get( 'max_file_size' ) );
 308  ?>
 309  <tr <?php echo helper_alternate_class() ?>>
 310      <td class="category">
 311          <?php echo lang_get( 'upload_file' ) ?>
 312          <?php echo '<span class="small">(' . lang_get( 'max_file_size' ) . ': ' . number_format( $t_max_file_size/1000 ) . 'k)</span>'?>
 313      </td>
 314      <td>
 315          <input type="hidden" name="max_file_size" value="<?php echo $t_max_file_size ?>" />
 316          <input <?php echo helper_get_tab_index() ?> name="file" type="file" size="60" />
 317      </td>
 318  </tr>
 319  <?php } ?>
 320  
 321  
 322  <!-- View Status -->
 323  <tr <?php echo helper_alternate_class() ?>>
 324      <td class="category">
 325          <?php echo lang_get( 'view_status' ) ?>
 326      </td>
 327      <td>
 328  <?php
 329      if ( access_has_project_level( config_get( 'set_view_status_threshold' ) ) ) {
 330  ?>
 331          <input <?php echo helper_get_tab_index() ?> type="radio" name="view_state" value="<?php echo VS_PUBLIC ?>" <?php check_checked( $f_view_state, VS_PUBLIC ) ?> /> <?php echo lang_get( 'public' ) ?>
 332          <input <?php echo helper_get_tab_index() ?> type="radio" name="view_state" value="<?php echo VS_PRIVATE ?>" <?php check_checked( $f_view_state, VS_PRIVATE ) ?> /> <?php echo lang_get( 'private' ) ?>
 333  <?php
 334      } else {
 335          echo get_enum_element( 'project_view_state', $f_view_state );
 336      }
 337  ?>
 338      </td>
 339  </tr>
 340  
 341  <!-- Relationship (in case of cloned bug creation...) -->
 342  <?php
 343      if( $f_master_bug_id > 0 ) {
 344  ?>
 345  <tr <?php echo helper_alternate_class() ?>>
 346      <td class="category">
 347          <?php echo lang_get( 'relationship_with_parent' ) ?>
 348      </td>
 349      <td>
 350          <?php relationship_list_box( /* none */ -2, "rel_type", false, true ) ?>
 351          <?php PRINT '<b>' . lang_get( 'bug' ) . ' ' . bug_format_id( $f_master_bug_id ) . '</b>' ?>
 352      </td>
 353  </tr>
 354  <?php
 355      }
 356  ?>
 357  
 358  <!-- Report Stay (report more bugs) -->
 359  <tr <?php echo helper_alternate_class() ?>>
 360      <td class="category">
 361          <?php echo lang_get( 'report_stay' ) ?> <?php print_documentation_link( 'report_stay' ) ?>
 362      </td>
 363      <td>
 364          <input <?php echo helper_get_tab_index() ?> type="checkbox" name="report_stay" <?php check_checked( $f_report_stay ) ?> /> (<?php echo lang_get( 'check_report_more_bugs' ) ?>)
 365      </td>
 366  </tr>
 367  
 368  
 369  <!-- Submit Button -->
 370  <tr>
 371      <td class="left">
 372          <span class="required"> * <?php echo lang_get( 'required' ) ?></span>
 373      </td>
 374      <td class="center">
 375          <input <?php echo helper_get_tab_index() ?> type="submit" class="button" value="<?php echo lang_get( 'submit_report_button' ) ?>" />
 376      </td>
 377  </tr>
 378  
 379  
 380  </table>
 381  </form>
 382  </div>
 383  
 384  <!-- Autofocus JS -->
 385  <?php if ( ON == config_get( 'use_javascript' ) ) { ?>
 386  <script type="text/javascript" language="JavaScript">
 387  <!--
 388      window.document.report_bug_form.category.focus();
 389  -->
 390  </script>
 391  <?php } ?>
 392  
 393  <?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