[ Index ]

PHP Cross Reference of MantisBT

title

Body

[close]

/ -> bug_revision_view_page.php (source)

   1  <?php
   2  # Mantis - a php based bugtracking system
   3  
   4  # Mantis 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  # Mantis 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 Mantis.  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 core.php
  24   * @uses access_api.php
  25   * @uses bug_api.php
  26   * @uses bugnote_api.php
  27   * @uses bug_revision_api.php
  28   * @uses config_api.php
  29   * @uses constant_inc.php
  30   * @uses form_api.php
  31   * @uses gpc_api.php
  32   * @uses helper_api.php
  33   * @uses html_api.php
  34   * @uses lang_api.php
  35   * @uses print_api.php
  36   * @uses string_api.php
  37   * @uses user_api.php
  38   */
  39  
  40  /**
  41   * MantisBT Core API's
  42   */
  43  require_once ( 'core.php' );
  44  require_api( 'access_api.php' );
  45  require_api( 'bug_api.php' );
  46  require_api( 'bugnote_api.php' );
  47  require_api( 'bug_revision_api.php' );
  48  require_api( 'config_api.php' );
  49  require_api( 'constant_inc.php' );
  50  require_api( 'form_api.php' );
  51  require_api( 'gpc_api.php' );
  52  require_api( 'helper_api.php' );
  53  require_api( 'html_api.php' );
  54  require_api( 'lang_api.php' );
  55  require_api( 'print_api.php' );
  56  require_api( 'string_api.php' );
  57  require_api( 'user_api.php' );
  58  
  59  $f_bug_id = gpc_get_int( 'bug_id', 0 );
  60  $f_bugnote_id = gpc_get_int( 'bugnote_id', 0 );
  61  $f_rev_id = gpc_get_int( 'rev_id', 0 );
  62  
  63  $t_title = '';
  64  
  65  if ( $f_bug_id ) {
  66      $t_bug_id = $f_bug_id;
  67      $t_bug_data = bug_get( $t_bug_id, true );
  68      $t_bug_revisions = array_reverse( bug_revision_list( $t_bug_id ), true );
  69  
  70      $t_title = lang_get( 'issue_id' ) . $t_bug_id;
  71  
  72  } else if ( $f_bugnote_id ) {
  73      $t_bug_id = bugnote_get_field( $f_bugnote_id, 'bug_id' );
  74      $t_bug_data = bug_get( $t_bug_id, true );
  75  
  76      $t_bug_revisions = array_reverse( bug_revision_list( $t_bug_id, REV_ANY, $f_bugnote_id ), true );
  77  
  78      $t_title = lang_get( 'bugnote' ) . ' ' . $f_bugnote_id;
  79  
  80  } else if ( $f_rev_id ) {
  81      $t_bug_revisions = array_reverse( bug_revision_like( $f_rev_id ), true );
  82  
  83      if ( count( $t_bug_revisions ) < 1 ) {
  84          trigger_error( ERROR_GENERIC, ERROR );
  85      }
  86  
  87      $t_bug_id = $t_bug_revisions[$f_rev_id]['bug_id'];
  88      $t_bug_data = bug_get( $t_bug_id, true );
  89  
  90      $t_title = lang_get( 'issue_id' ) . $t_bug_id;
  91  
  92  } else {
  93      trigger_error( ERROR_GENERIC, ERROR );
  94  }
  95  
  96  function show_revision( $t_revision ) {
  97      static $s_can_drop = null;
  98      static $s_drop_token = null;
  99      static $s_user_access = null;
 100  
 101      if ( is_null( $s_can_drop ) ) {
 102          $s_can_drop = access_has_bug_level( config_get( 'bug_revision_drop_threshold' ), $t_revision['bug_id'] );
 103          $s_drop_token = form_security_param( 'bug_revision_drop' );
 104      }
 105  
 106      switch( $t_revision['type'] ) {
 107      case REV_DESCRIPTION:
 108          $t_label = lang_get( 'description' );
 109          break;
 110      case REV_STEPS_TO_REPRODUCE:
 111          $t_label = lang_get( 'steps_to_reproduce' );
 112          break;
 113      case REV_ADDITIONAL_INFO:
 114          $t_label = lang_get( 'additional_information' );
 115          break;
 116  
 117      case REV_BUGNOTE:
 118          if ( is_null( $s_user_access ) ) {
 119              $s_user_access = access_has_bug_level( config_get( 'private_bugnote_threshold' ), $t_revision['bug_id'] );
 120          }
 121  
 122          if ( !$s_user_access ) {
 123              return null;
 124          }
 125  
 126          $t_label = lang_get( 'bugnote' );
 127          break;
 128  
 129      default:
 130          $t_label = '';
 131      }
 132  
 133  $t_by_string = sprintf( lang_get( 'revision_by' ), string_display_line( date( config_get( 'normal_date_format' ), $t_revision['timestamp'] ) ), string_display_line( user_get_name( $t_revision['user_id'] ) ) );
 134  
 135  ?>
 136  <tr class="spacer"><td><a id="revision-<?php echo $t_revision['id'] ?>"></a></td></tr>
 137  
 138  <tr <?php echo helper_alternate_class() ?>>
 139  <th class="category"><?php echo lang_get( 'revision' ) ?></th>
 140  <td colspan="2"><?php echo $t_by_string ?></td>
 141  <td class="center" width="5%">
 142  <?php if ( $s_can_drop ) {
 143      print_bracket_link( 'bug_revision_drop.php?id=' . $t_revision['id'] . $s_drop_token, lang_get( 'revision_drop' ) );
 144  } ?>
 145  </tr>
 146  
 147  <tr <?php echo helper_alternate_class() ?>>
 148  <th class="category"><?php echo $t_label ?></th>
 149  <td colspan="3"><?php echo string_display_links( $t_revision['value'] ) ?></td>
 150  </tr>
 151  
 152      <?php
 153  }
 154  
 155  html_page_top( bug_format_summary( $t_bug_id, SUMMARY_CAPTION ) );
 156  
 157  print_recently_visited();
 158  
 159  ?>
 160  
 161  <br/>
 162  <table class="width100" cellspacing="1">
 163  
 164  <tr>
 165  <td class="form-title" colspan="2"><?php echo lang_get( 'view_revisions' ), ': ', $t_title ?></td>
 166  <td class="right" colspan="2">
 167  <?php
 168  if ( !$f_bug_id && !$f_bugnote_id ) { print_bracket_link( '?bug_id=' . $t_bug_id, lang_get( 'all_revisions' ) ); }
 169  print_bracket_link( 'view.php?id=' . $t_bug_id, lang_get( 'back_to_issue' ) );
 170  ?>
 171  </td>
 172  </tr>
 173  
 174  <tr <?php echo helper_alternate_class() ?>>
 175  <th class="category" width="15%"><?php echo lang_get( 'summary' ) ?></th>
 176  <td colspan="3"><?php echo bug_format_summary( $t_bug_id, SUMMARY_FIELD ) ?></td>
 177  </tr>
 178  
 179  <?php foreach( $t_bug_revisions as $t_rev ) {
 180      show_revision( $t_rev );
 181  } ?>
 182  
 183  </table>
 184  
 185  <?php
 186  html_page_bottom();
 187  


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