[ Index ]
 

Code source de Mantis 1.1.0rc3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/ -> print_all_bug_page_word.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: print_all_bug_page_word.php,v 1.65.2.1 2007-10-13 22:34:17 giallu Exp $
  22      # --------------------------------------------------------
  23  ?>
  24  <?php
  25      # Word 2000 export page
  26      # The bugs displayed in print_all_bug_page.php are saved in a .doc file
  27      # The IE icon allows to see or directly print the same result
  28  ?>
  29  <?php
  30      require_once ( 'core.php' );
  31  
  32      $t_core_path = config_get( 'core_path' );
  33  
  34      require_once( $t_core_path.'current_user_api.php' );
  35      require_once( $t_core_path.'bug_api.php' );
  36      require_once( $t_core_path.'custom_field_api.php' );
  37      require_once( $t_core_path.'string_api.php' );
  38      require_once( $t_core_path.'date_api.php' );
  39  ?>
  40  <?php auth_ensure_user_authenticated() ?>
  41  <?php
  42      $f_type_page    = gpc_get_string( 'type_page', 'word' );
  43      $f_search        = gpc_get_string( 'search', false ); # @@@ need a better default
  44      $f_offset        = gpc_get_int( 'offset', 0 );
  45      $f_export        = gpc_get_string( 'export' );
  46      $f_show_flag    = gpc_get_bool( 'show_flag' );
  47  
  48      helper_begin_long_process();
  49  
  50      # word or html export
  51      if ( $f_type_page != 'html' ) {
  52          $t_export_title = helper_get_default_export_filename( '' );
  53          $t_export_title = ereg_replace( '[\/:*?"<>|]', '', $t_export_title );
  54  
  55          # Make sure that IE can download the attachments under https.
  56          header( 'Pragma: public' );
  57  
  58          header( 'Content-Type: application/msword' );
  59  
  60          if ( preg_match( "/MSIE/", $_SERVER["HTTP_USER_AGENT"] ) ) {
  61                          header( 'Content-Disposition: attachment; filename="' . urlencode( $t_export_title ) . '.doc"' );
  62                  } else {
  63                          header( 'Content-Disposition: attachment; filename="' . $t_export_title . '.doc"' );
  64                  }
  65      }
  66  
  67      # This is where we used to do the entire actual filter ourselves
  68      $t_page_number = gpc_get_int( 'page_number', 1 );
  69      $t_per_page = -1;
  70      $t_bug_count = null;
  71      $t_page_count = null;
  72  
  73      $result = filter_get_bug_rows( $t_page_number, $t_per_page, $t_page_count, $t_bug_count );
  74      $row_count = sizeof( $result );
  75  
  76  ?>
  77  
  78  <?php # Word Export ?>
  79  <html xmlns:o="urn:schemas-microsoft-com:office:office"
  80  xmlns:w="urn:schemas-microsoft-com:office:word"
  81  xmlns="http://www.w3.org/TR/REC-html40">
  82  
  83  <?php html_page_top1() ?>
  84  <?php html_head_end() ?>
  85  <?php html_body_begin() ?>
  86  
  87  <?php
  88      //$t_bug_arr_sort[$row_count]=-1;
  89      $f_bug_arr = explode_enum_string( $f_export );
  90  
  91      for( $j=0; $j < $row_count; $j++ ) {
  92  
  93          # prefix bug data with v_
  94          extract( $result[$j], EXTR_PREFIX_ALL, 'v' );
  95  
  96          # display the available and selected bugs
  97          if ( in_array( $v_id, $f_bug_arr ) || ( $f_show_flag==0 ) ) {
  98  
  99              $t_last_updated = date( $g_short_date_format, $v_last_updated );
 100  
 101              # grab the bugnote count
 102              $bugnote_count = bug_get_bugnote_count( $v_id );
 103  
 104              # grab the project name
 105              $t_project_name = project_get_field( $v_project_id, 'name' );
 106  
 107              # bug text infos
 108              $t_bug_text_table = config_get( 'mantis_bug_text_table' );
 109              $query3 = "SELECT *
 110                  FROM $t_bug_text_table
 111                  WHERE id='$v_bug_text_id'";
 112              $result3 = db_query( $query3 );
 113              $row = db_fetch_array( $result3 );
 114              extract( $row, EXTR_PREFIX_ALL, 'v2' );
 115  
 116              $v_os                         = string_display( $v_os );
 117              $v_os_build                    = string_display( $v_os_build );
 118              $v_platform                    = string_display( $v_platform );
 119              $v_version                     = string_display( $v_version );
 120              $v_summary                     = string_display_links( $v_summary );
 121              $v2_description             = string_display_links( $v2_description );
 122              $v2_steps_to_reproduce         = string_display_links( $v2_steps_to_reproduce );
 123              $v2_additional_information     = string_display_links( $v2_additional_information );
 124              ### note that dates are converted to unix format in filter_get_bug_rows
 125  ?>
 126  <br />
 127  <table class="width100" cellspacing="1">
 128  <tr>
 129      <td class="form-title" colspan="3">
 130          <?php echo lang_get( 'viewing_bug_advanced_details_title' ) ?>
 131      </td>
 132  </tr>
 133  <tr>
 134      <td class="print-spacer" colspan="6">
 135          <hr size="1" width="100%" />
 136      </td>
 137  </tr>
 138  <tr class="print-category">
 139      <td class="print" width="16%">
 140          <?php echo lang_get( 'id' ) ?>:
 141      </td>
 142      <td class="print" width="16%">
 143          <?php echo lang_get( 'category' ) ?>:
 144      </td>
 145      <td class="print" width="16%">
 146          <?php echo lang_get( 'severity' ) ?>:
 147      </td>
 148      <td class="print" width="16%">
 149          <?php echo lang_get( 'reproducibility' ) ?>:
 150      </td>
 151      <td class="print" width="16%">
 152          <?php echo lang_get( 'date_submitted' ) ?>:
 153      </td>
 154      <td class="print" width="16%">
 155          <?php echo lang_get( 'last_update' ) ?>:
 156      </td>
 157  </tr>
 158  <tr class="print">
 159      <td class="print">
 160          <?php echo $v_id ?>
 161      </td>
 162      <td class="print">
 163          <?php echo "[$t_project_name] $v_category" ?>
 164      </td>
 165      <td class="print">
 166          <?php echo get_enum_element( 'severity', $v_severity ) ?>
 167      </td>
 168      <td class="print">
 169          <?php echo get_enum_element( 'reproducibility', $v_reproducibility ) ?>
 170      </td>
 171      <td class="print">
 172          <?php print_date( config_get( 'normal_date_format' ), $v_date_submitted ) ?>
 173      </td>
 174      <td class="print">
 175          <?php print_date( config_get( 'normal_date_format' ), $v_last_updated ) ?>
 176      </td>
 177  </tr>
 178  <tr>
 179      <td class="print-spacer" colspan="6">
 180          <hr size="1" width="100%" />
 181      </td>
 182  </tr>
 183  <tr class="print">
 184      <td class="print-category">
 185          <?php echo lang_get( 'reporter' ) ?>:
 186      </td>
 187      <td class="print">
 188          <?php print_user_with_subject( $v_reporter_id, $v_id ) ?>
 189      </td>
 190      <td class="print-category">
 191          <?php echo lang_get( 'platform' ) ?>:
 192      </td>
 193      <td class="print">
 194          <?php echo $v_platform ?>
 195      </td>
 196      <td class="print" colspan="2">&nbsp;</td>
 197  </tr>
 198  <tr class="print">
 199      <td class="print-category">
 200          <?php echo lang_get( 'assigned_to' ) ?>:
 201      </td>
 202      <td class="print">
 203          <?php 
 204              if ( access_has_bug_level( config_get( 'view_handler_threshold' ), $v_id ) ) {
 205                  print_user_with_subject( $v_handler_id, $v_id ); 
 206              }
 207          ?>
 208      </td>
 209      <td class="print-category">
 210          <?php echo lang_get( 'os' ) ?>:
 211      </td>
 212      <td class="print">
 213          <?php echo $v_os ?>
 214      </td>
 215      <td class="print" colspan="2">&nbsp;</td>
 216  </tr>
 217  <tr class="print">
 218      <td class="print-category">
 219          <?php echo lang_get( 'priority' ) ?>:
 220      </td>
 221      <td class="print">
 222          <?php echo get_enum_element( 'priority', $v_priority ) ?>
 223      </td>
 224      <td class="print-category">
 225          <?php echo lang_get( 'os_version' ) ?>:
 226      </td>
 227      <td class="print">
 228          <?php echo $v_os_build ?>
 229      </td>
 230      <td class="print" colspan="2">&nbsp;</td>
 231  </tr>
 232  <tr class="print">
 233      <td class="print-category">
 234          <?php echo lang_get( 'status' ) ?>:
 235      </td>
 236      <td class="print">
 237          <?php echo get_enum_element( 'status', $v_status ) ?>
 238      </td>
 239      <td class="print-category">
 240          <?php echo lang_get( 'product_version' ) ?>:
 241      </td>
 242      <td class="print">
 243          <?php echo $v_version ?>
 244      </td>
 245      <td class="print" colspan="2">&nbsp;</td>
 246  </tr>
 247  <tr class="print">
 248      <td class="print-category">
 249          <?php echo lang_get( 'product_build' ) ?>:
 250      </td>
 251      <td class="print">
 252          <?php echo $v_build?>
 253      </td>
 254      <td class="print-category">
 255          <?php echo lang_get( 'resolution' ) ?>:
 256      </td>
 257      <td class="print">
 258          <?php echo get_enum_element( 'resolution', $v_resolution ) ?>
 259      </td>
 260      <td class="print" colspan="2">&nbsp;</td>
 261  </tr>
 262  <tr class="print">
 263      <td class="print-category">
 264          <?php echo lang_get( 'projection' ) ?>:
 265      </td>
 266      <td class="print">
 267          <?php echo get_enum_element( 'projection', $v_projection ) ?>
 268      </td>
 269      <td class="print-category">
 270          <?php
 271              if ( !config_get( 'enable_relationship' ) ) {
 272                  echo lang_get( 'duplicate_id' );
 273              } # MASC RELATIONSHIP
 274          ?>&nbsp;
 275      </td>
 276      <td class="print">
 277          <?php
 278              if ( !config_get( 'enable_relationship' ) ) {
 279                  print_duplicate_id( $v_duplicate_id );
 280              } # MASC RELATIONSHIP
 281          ?>&nbsp;
 282      </td>
 283      <td class="print" colspan="2">&nbsp;</td>
 284  </tr>
 285  <tr class="print">
 286      <td class="print-category">
 287          <?php echo lang_get( 'eta' ) ?>:
 288      </td>
 289      <td class="print">
 290          <?php echo get_enum_element( 'eta', $v_eta ) ?>
 291      </td>
 292      <td class="print" colspan="4">&nbsp;</td>
 293  </tr>
 294  <?php
 295  $t_related_custom_field_ids = custom_field_get_linked_ids( $v_project_id );
 296  foreach( $t_related_custom_field_ids as $t_id ) {
 297      $t_def = custom_field_get_definition( $t_id );
 298  ?>
 299  <tr class="print">
 300      <td class="print-category">
 301          <?php echo lang_get_defaulted( $t_def['name'] ) ?>:
 302      </td>
 303      <td class="print" colspan="5">
 304          <?php print_custom_field_value( $t_def, $t_id, $v_id ); ?>
 305      </td>
 306  </tr>
 307  <?php
 308  }       // foreach
 309  ?>
 310  <tr>
 311      <td class="print-spacer" colspan="6">
 312          <hr size="1" width="100%" />
 313      </td>
 314  </tr>
 315  <tr class="print">
 316      <td class="print-category">
 317          <?php echo lang_get( 'summary' ) ?>:
 318      </td>
 319      <td class="print" colspan="5">
 320          <?php echo $v_summary ?>
 321      </td>
 322  </tr>
 323  <tr class="print">
 324      <td class="print-category">
 325          <?php echo lang_get( 'description' ) ?>:
 326      </td>
 327      <td class="print" colspan="5">
 328          <?php echo $v2_description ?>
 329      </td>
 330  </tr>
 331  <tr class="print">
 332      <td class="print-category">
 333          <?php echo lang_get( 'steps_to_reproduce' ) ?>:
 334      </td>
 335      <td class="print" colspan="5">
 336          <?php echo $v2_steps_to_reproduce ?>
 337      </td>
 338  </tr>
 339  <tr class="print">
 340      <td class="print-category">
 341          <?php echo lang_get( 'additional_information' ) ?>:
 342      </td>
 343      <td class="print" colspan="5">
 344          <?php echo $v2_additional_information ?>
 345      </td>
 346  </tr>
 347  <?php
 348      # account profile description
 349      if ( $v_profile_id > 0 ) {
 350         $t_user_prof_table = config_get( 'mantis_user_profile_table' );
 351          $query4 = "SELECT description
 352                  FROM $t_user_prof_table
 353                  WHERE id='$v_profile_id'";
 354          $result4 = db_query( $query4 );
 355          $t_profile_description = '';
 356          if ( db_num_rows( $result4 ) > 0 ) {
 357              $t_profile_description = db_result( $result4, 0 );
 358          }
 359          $t_profile_description = string_display( $t_profile_description );
 360  
 361  ?>
 362  <tr class="print">
 363      <td class="print-category">
 364          <?php echo lang_get( 'system_profile' ) ?>
 365      </td>
 366      <td class="print" colspan="5">
 367          <?php echo $t_profile_description ?>
 368      </td>
 369  </tr>
 370  <?php
 371      } # profile description
 372  ?>
 373  <tr class="print">
 374      <td class="print-category">
 375          <?php echo lang_get( 'attached_files' ) ?>:
 376      </td>
 377      <td class="print" colspan="5">
 378          <?php
 379              $t_bug_file_table = config_get( 'mantis_bug_file_table' );
 380              $query5 = "SELECT filename, filesize, date_added
 381                      FROM $t_bug_file_table
 382                      WHERE bug_id='$v_id'";
 383              $result5 = db_query( $query5 );
 384              $num_files = db_num_rows( $result5 );
 385              for ( $i=0;$i<$num_files;$i++ ) {
 386                  $row = db_fetch_array( $result5 );
 387                  extract( $row, EXTR_PREFIX_ALL, 'v2' );
 388                  $v2_filename = file_get_display_name( $v2_filename );
 389                  $v2_filesize = round( $v2_filesize / 1024 );
 390                  $v2_date_added = date( config_get( 'normal_date_format' ), db_unixtimestamp( $v2_date_added ) );
 391  
 392                  switch ( $g_file_upload_method ) {
 393                      case DISK:    PRINT "$v2_filename ($v2_filesize KB) <span class=\"italic\">$v2_date_added</span>";
 394                              break;
 395                      case DATABASE:    PRINT "$v2_filename ($v2_filesize KB) <span class=\"italic\">$v2_date_added</span>";
 396                              break;
 397                  }
 398  
 399                  if ( $i != ( $num_files - 1 ) ) {
 400                      PRINT '<br />';
 401                  }
 402              }
 403          ?>
 404      </td>
 405  </tr>
 406  <?php
 407      # get the bugnote data
 408       if ( !access_has_bug_level( config_get( 'private_bugnote_threshold' ), $v_id ) ) {
 409           $t_restriction = 'AND view_state=' . VS_PUBLIC;
 410       } else {
 411           $t_restriction = '';
 412       }
 413  
 414      $t_bugnote_table        = config_get( 'mantis_bugnote_table' );
 415      $t_bugnote_text_table    = config_get( 'mantis_bugnote_text_table' );
 416      $t_bugnote_order = current_user_get_pref( 'bugnote_order' );
 417  
 418      $query6 = "SELECT *
 419              FROM $t_bugnote_table
 420              WHERE bug_id='$v_id' $t_restriction
 421              ORDER BY date_submitted $t_bugnote_order";
 422      $result6 = db_query( $query6 );
 423      $num_notes = db_num_rows( $result6 );
 424  ?>
 425  
 426  <?php # Bugnotes BEGIN ?>
 427  <br />
 428  <table class="width100" cellspacing="1">
 429  <?php
 430      # no bugnotes
 431      if ( 0 == $num_notes ) {
 432      ?>
 433  <tr>
 434      <td class="print" colspan="2">
 435          <?php echo lang_get( 'no_bugnotes_msg' ) ?>
 436      </td>
 437  </tr>
 438      <?php }
 439          else { # print bugnotes ?>
 440  <tr>
 441      <td class="form-title" colspan="2">
 442              <?php echo lang_get( 'bug_notes_title' ) ?>
 443      </td>
 444  </tr>
 445      <?php
 446          for ( $k=0; $k < $num_notes; $k++ ) {
 447              # prefix all bugnote data with v3_
 448              $row = db_fetch_array( $result6 );
 449              extract( $row, EXTR_PREFIX_ALL, 'v3' );
 450              $v3_date_submitted = date( config_get( 'normal_date_format' ), ( db_unixtimestamp( $v3_date_submitted ) ) );
 451              $v3_last_modified = date( config_get( 'normal_date_format' ), ( db_unixtimestamp( $v3_last_modified ) ) );
 452  
 453              # grab the bugnote text and id and prefix with v3_
 454              $query6 = "SELECT note, id
 455                      FROM $t_bugnote_text_table
 456                      WHERE id='$v3_bugnote_text_id'";
 457              $result7 = db_query( $query6 );
 458              $v3_note = db_result( $result7, 0, 0 );
 459              $v3_bugnote_text_id = db_result( $result7, 0, 1 );
 460  
 461              $v3_note = string_display_links( $v3_note );
 462      ?>
 463  <tr>
 464      <td class="print-spacer" colspan="2">
 465          <hr size="1" width="100%" />
 466      </td>
 467  </tr>
 468  <tr>
 469      <td class="nopad" valign="top" width="20%">
 470          <table class="hide" cellspacing="1">
 471          <tr>
 472              <td class="print">
 473                  (<?php echo bugnote_format_id( $v3_id ) ?>)
 474              </td>
 475          </tr>
 476          <tr>
 477              <td class="print">
 478                  <?php print_user( $v3_reporter_id ) ?>&nbsp;&nbsp;&nbsp;
 479              </td>
 480          </tr>
 481          <tr>
 482              <td class="print">
 483                  <?php echo $v3_date_submitted ?>&nbsp;&nbsp;&nbsp;
 484                  <?php if ( db_unixtimestamp( $v3_date_submitted ) != db_unixtimestamp( $v3_last_modified ) ) {
 485                      echo '<br />(' . lang_get( 'edited_on').' '. $v3_last_modified . ')';
 486                  } ?>
 487              </td>
 488          </tr>
 489          </table>
 490      </td>
 491      <td class="nopad" valign="top" width="85%">
 492          <table class="hide" cellspacing="1">
 493          <tr>
 494              <td class="print">
 495                  <?php
 496                      switch ( $v3_note_type ) {
 497                          case REMINDER:
 498                              echo lang_get( 'reminder_sent_to' ) . ': ';
 499                              $v3_note_attr = substr( $v3_note_attr, 1, strlen( $v3_note_attr ) - 2 );
 500                              $t_to = array();
 501                              foreach ( explode( '|', $v3_note_attr ) as $t_recipient ) {
 502                                  $t_to[] = prepare_user_name( $t_recipient );
 503                              }
 504                              echo implode( ', ', $t_to ) . '<br />';
 505                          default:
 506                              echo $v3_note;
 507                      }
 508                  ?>
 509              </td>
 510          </tr>
 511          </table>
 512      </td>
 513  </tr>
 514  <?php
 515          } # end for
 516      } # end else
 517  ?>
 518  
 519  </table>
 520  <?php # Bugnotes END ?>
 521  </table>
 522  
 523  
 524  <?php
 525  echo '<br /><br />';
 526          } # end in_array
 527  }  # end main loop
 528  ?>


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