[ Index ]
 

Code source de Mantis 1.1.0rc3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/ -> bugnote_view_inc.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: bugnote_view_inc.php,v 1.46.2.1 2007-10-13 22:33:10 giallu Exp $
  22      # --------------------------------------------------------
  23  ?>
  24  <?php
  25      # This include file prints out the list of bugnotes attached to the bug
  26      # $f_bug_id must be set and be set to the bug id
  27  ?>
  28  <?php
  29      $t_core_path = config_get( 'core_path' );
  30  
  31      require_once( $t_core_path.'current_user_api.php' );
  32  ?>
  33  <?php
  34      # grab the user id currently logged in
  35      $t_user_id = auth_get_current_user_id();
  36  
  37      if ( !access_has_bug_level( config_get( 'private_bugnote_threshold' ), $f_bug_id ) ) {
  38          $t_restriction = 'AND ( view_state=' . VS_PUBLIC . ' OR reporter_id = ' . $t_user_id . ')';
  39      } else {
  40          $t_restriction = '';
  41      }
  42  
  43      $t_bugnote_table        = config_get( 'mantis_bugnote_table' );
  44      $t_bugnote_text_table    = config_get( 'mantis_bugnote_text_table' );
  45      $t_bugnote_order        = current_user_get_pref( 'bugnote_order' );
  46  
  47      # get the bugnote data
  48      $query = "SELECT *
  49              FROM $t_bugnote_table
  50              WHERE bug_id='$f_bug_id' $t_restriction
  51              ORDER BY date_submitted $t_bugnote_order, id $t_bugnote_order";
  52      $result = db_query( $query );
  53      $num_notes = db_num_rows( $result );
  54  ?>
  55  
  56  <?php # Bugnotes BEGIN ?>
  57  <a name="bugnotes" id="bugnotes" /><br />
  58  
  59  <?php 
  60      collapse_open( 'bugnotes' );
  61  ?>
  62  <table class="width100" cellspacing="1">
  63  <?php
  64      # no bugnotes
  65      if ( 0 == $num_notes ) {
  66  ?>
  67  <tr>
  68      <td class="center" colspan="2">
  69          <?php echo lang_get( 'no_bugnotes_msg' ) ?>
  70      </td>
  71  </tr>
  72  <?php } else { # print bugnotes ?>
  73  <tr>
  74      <td class="form-title" colspan="2">
  75  <?php
  76          collapse_icon( 'bugnotes' ); ?>
  77          <?php echo lang_get( 'bug_notes_title' ) ?>
  78      </td>
  79  </tr>
  80  <?php
  81      $t_normal_date_format = config_get( 'normal_date_format' );
  82      $t_total_time = 0;
  83  
  84      for ( $i=0; $i < $num_notes; $i++ ) {
  85          # prefix all bugnote data with v3_
  86          $row = db_fetch_array( $result );
  87          extract( $row, EXTR_PREFIX_ALL, 'v3' );
  88          if ( db_unixtimestamp( $v3_date_submitted ) != db_unixtimestamp( $v3_last_modified ) )
  89              $t_bugnote_modified = true;
  90          else
  91              $t_bugnote_modified = false;
  92  
  93          $v3_date_submitted = date( $t_normal_date_format, ( db_unixtimestamp( $v3_date_submitted ) ) );
  94          $v3_last_modified = date( $t_normal_date_format, ( db_unixtimestamp( $v3_last_modified ) ) );
  95  
  96          # grab the bugnote text and id and prefix with v3_
  97          $query = "SELECT note
  98                  FROM $t_bugnote_text_table
  99                  WHERE id='$v3_bugnote_text_id'";
 100          $result2 = db_query( $query );
 101          $row = db_fetch_array( $result2 );
 102  
 103          $v3_note = $row['note'];
 104          $v3_note = string_display_links( $v3_note );
 105          $t_bugnote_id_formatted = bugnote_format_id( $v3_id );
 106  
 107          if ( 0 != $v3_time_tracking ) {
 108              $v3_time_tracking_hhmm = db_minutes_to_hhmm( $v3_time_tracking );
 109              $v3_note_type = TIME_TRACKING;   // for older entries that didn't set the type
 110              $t_total_time += $v3_time_tracking;
 111          } else {
 112              $v3_time_tracking_hhmm = '';
 113          }
 114  
 115          if ( VS_PRIVATE == $v3_view_state ) {
 116              $t_bugnote_css        = 'bugnote-private';
 117              $t_bugnote_note_css    = 'bugnote-note-private';
 118          } else {
 119              $t_bugnote_css        = 'bugnote-public';
 120              $t_bugnote_note_css    = 'bugnote-note-public';
 121          }
 122  ?>
 123  <tr class="bugnote" id="c<?php echo $v3_id ?>">
 124          <td class="<?php echo $t_bugnote_css ?>">
 125          <?php if ( ON  == config_get("show_avatar") ) print_avatar( $v3_reporter_id ); ?>
 126          <span class="small">(<?php echo $t_bugnote_id_formatted ?>)</span><br />
 127          <?php
 128              echo print_user( $v3_reporter_id );
 129          ?>
 130          <span class="small"><?php
 131              if ( user_exists( $v3_reporter_id ) ) {
 132                  $t_access_level = access_get_project_level( null, $v3_reporter_id );
 133                  echo '(', get_enum_element( 'access_levels', $t_access_level ), ')';
 134              } 
 135          ?></span>
 136          <?php if ( VS_PRIVATE == $v3_view_state ) { ?>
 137          <span class="small">[ <?php echo lang_get( 'private' ) ?> ]</span>
 138          <?php } ?>
 139          <br />
 140          <span class="small"><?php echo $v3_date_submitted ?></span><br />
 141          <?php
 142          if ( $t_bugnote_modified ) {
 143              echo '<span class="small">'.lang_get( 'edited_on').' '.$v3_last_modified.'</span><br />';
 144          }
 145          ?>
 146          <br /><div class="small">
 147          <?php
 148              # bug must be open to be editable
 149              if ( !bug_is_readonly( $f_bug_id ) ) {
 150                  $t_can_edit_note = false;
 151                  $t_can_delete_note = false;
 152  
 153                  # admins and the bugnote creator can edit/delete this bugnote
 154                  if ( ( access_has_bug_level( config_get( 'manage_project_threshold' ), $f_bug_id ) ) ||
 155                      ( ( $v3_reporter_id == $t_user_id ) && ( ON == config_get( 'bugnote_allow_user_edit_delete' ) ) ) ) {
 156                      $t_can_edit_note = true;
 157                      $t_can_delete_note = true;
 158                  }
 159  
 160                  # users above update_bugnote_threshold should be able to edit this bugnote
 161                  if ( $t_can_edit_note || access_has_bug_level( config_get( 'update_bugnote_threshold' ), $f_bug_id ) ) {
 162                      print_button( 'bugnote_edit_page.php?bugnote_id='.$v3_id, lang_get( 'bugnote_edit_link' ) );
 163                  }
 164  
 165                  # users above delete_bugnote_threshold should be able to delete this bugnote
 166                  if ( $t_can_delete_note || access_has_bug_level( config_get( 'delete_bugnote_threshold' ), $f_bug_id ) ) {
 167                      echo " ";
 168                      print_button( 'bugnote_delete.php?bugnote_id='.$v3_id, lang_get( 'delete_link' ) );
 169                  }
 170  
 171                  if ( access_has_bug_level( config_get( 'private_bugnote_threshold' ), $f_bug_id ) &&
 172                      access_has_bug_level( config_get( 'change_view_status_threshold' ), $f_bug_id ) ) {
 173                      if ( VS_PRIVATE == $v3_view_state ) {
 174                          echo " ";
 175                          print_button('bugnote_set_view_state.php?private=0&amp;bugnote_id='.$v3_id, lang_get( 'make_public' ));
 176                      } else {
 177                          echo " ";
 178                          print_button('bugnote_set_view_state.php?private=1&amp;bugnote_id='.$v3_id, lang_get( 'make_private' ));
 179                      }
 180                  }
 181              }
 182          ?>
 183          </div>
 184      </td>
 185      <td class="<?php echo $t_bugnote_note_css ?>">
 186          <?php
 187              switch ( $v3_note_type ) {
 188                  case REMINDER:
 189                      echo '<em>' . lang_get( 'reminder_sent_to' ) . ': ';
 190                      $v3_note_attr = substr( $v3_note_attr, 1, strlen( $v3_note_attr ) - 2 );
 191                      $t_to = array();
 192                      foreach ( explode( '|', $v3_note_attr ) as $t_recipient ) {
 193                          $t_to[] = prepare_user_name( $t_recipient );
 194                      }
 195                      echo implode( ', ', $t_to ) . '</em><br /><br />';
 196                  case TIME_TRACKING:
 197                      if ( access_has_bug_level( config_get( 'time_tracking_view_threshold' ), $f_bug_id ) ) {
 198                          echo '<b><big>', $v3_time_tracking_hhmm, '</big></b><br /><br />';
 199                      }
 200                      break;
 201              }
 202  
 203              echo $v3_note;
 204          ?>
 205      </td>
 206  </tr>
 207  <tr class="spacer">
 208      <td colspan="2"></td>
 209  </tr>
 210  <?php
 211          } # end for loop
 212  
 213          if ( $t_total_time > 0 ) {
 214              echo '<tr><td colspan="2">', sprintf ( lang_get( 'total_time_for_issue' ), db_minutes_to_hhmm( $t_total_time ) ), '</td></tr>';
 215          }
 216      } # end else
 217  ?>
 218  </table>
 219  
 220  <?php 
 221      collapse_closed( 'bugnotes' );
 222  ?>
 223  
 224  <table class="width100" cellspacing="1">
 225  <tr>
 226      <td class="form-title" colspan="2">
 227          <?php collapse_icon( 'bugnotes' ); ?>
 228          <?php echo lang_get( 'bug_notes_title' ) ?>
 229      </td>
 230  </tr>
 231  </table>
 232  <?php
 233      collapse_end( 'bugnotes' );
 234  ?>
 235  
 236  <?php # Bugnotes END ?>


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