| [ Index ] |
PHP Cross Reference of MantisBT |
[Summary view] [Print] [Text view]
1 <?php 2 # MantisBT - A PHP based bugtracking system 3 4 # MantisBT 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 # MantisBT 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 MantisBT. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * Word 2000 export page 19 * The bugs displayed in print_all_bug_page.php are saved in a .doc file 20 * The IE icon allows to see or directly print the same result 21 * 22 * @package MantisBT 23 * @copyright Copyright (C) 2000 - 2002 Kenzaburo Ito - kenito@300baud.org 24 * @copyright Copyright (C) 2002 - 2011 MantisBT Team - mantisbt-dev@lists.sourceforge.net 25 * @link http://www.mantisbt.org 26 * 27 * @uses core.php 28 * @uses access_api.php 29 * @uses authentication_api.php 30 * @uses bug_api.php 31 * @uses bugnote_api.php 32 * @uses category_api.php 33 * @uses config_api.php 34 * @uses constant_inc.php 35 * @uses custom_field_api.php 36 * @uses date_api.php 37 * @uses file_api.php 38 * @uses filter_api.php 39 * @uses gpc_api.php 40 * @uses helper_api.php 41 * @uses html_api.php 42 * @uses http_api.php 43 * @uses lang_api.php 44 * @uses prepare_api.php 45 * @uses print_api.php 46 * @uses profile_api.php 47 * @uses project_api.php 48 * @uses string_api.php 49 */ 50 51 /** 52 * MantisBT Core API's 53 */ 54 require_once ( 'core.php' ); 55 require_api( 'access_api.php' ); 56 require_api( 'authentication_api.php' ); 57 require_api( 'bug_api.php' ); 58 require_api( 'bugnote_api.php' ); 59 require_api( 'category_api.php' ); 60 require_api( 'config_api.php' ); 61 require_api( 'constant_inc.php' ); 62 require_api( 'custom_field_api.php' ); 63 require_api( 'date_api.php' ); 64 require_api( 'file_api.php' ); 65 require_api( 'filter_api.php' ); 66 require_api( 'gpc_api.php' ); 67 require_api( 'helper_api.php' ); 68 require_api( 'html_api.php' ); 69 require_api( 'http_api.php' ); 70 require_api( 'lang_api.php' ); 71 require_api( 'prepare_api.php' ); 72 require_api( 'print_api.php' ); 73 require_api( 'profile_api.php' ); 74 require_api( 'project_api.php' ); 75 require_api( 'string_api.php' ); 76 77 auth_ensure_user_authenticated(); 78 79 $f_type_page = gpc_get_string( 'type_page', 'word' ); 80 $f_search = gpc_get_string( 'search', false ); /** @todo need a better default */ 81 $f_offset = gpc_get_int( 'offset', 0 ); 82 $f_export = gpc_get_string( 'export' ); 83 $f_show_flag = gpc_get_bool( 'show_flag' ); 84 85 helper_begin_long_process(); 86 87 # word or html export 88 if ( $f_type_page != 'html' ) { 89 $t_export_title = helper_get_default_export_filename( '' ); 90 $t_export_title = preg_replace( '/[\/:*?"<>|]/', '', $t_export_title ); 91 $t_export_title .= '.doc'; 92 93 # Make sure that IE can download the attachments under https. 94 header( 'Pragma: public' ); 95 96 header( 'Content-Type: application/msword' ); 97 98 http_content_disposition_header( $t_export_title ); 99 } 100 101 # This is where we used to do the entire actual filter ourselves 102 $t_page_number = gpc_get_int( 'page_number', 1 ); 103 $t_per_page = -1; 104 $t_bug_count = null; 105 $t_page_count = null; 106 107 $result = filter_get_bug_rows( $t_page_number, $t_per_page, $t_page_count, $t_bug_count ); 108 $t_row_count = count( $result ); 109 ?> 110 111 <html xmlns:o="urn:schemas-microsoft-com:office:office" 112 xmlns:w="urn:schemas-microsoft-com:office:word" 113 xmlns="http://www.w3.org/TR/REC-html40"> 114 115 <?php 116 html_page_top1(); 117 html_head_end(); 118 html_body_begin(); 119 120 $f_bug_arr = explode( ',', $f_export ); 121 $t_count_exported = 0; 122 $t_date_format = config_get( 'normal_date_format' ); 123 $t_short_date_format = config_get( 'short_date_format' ); 124 125 $t_lang_bug_view_title = lang_get( 'bug_view_title' ); 126 $t_lang_id = lang_get( 'id' ); 127 $t_lang_category = lang_get( 'category' ); 128 $t_lang_severity = lang_get( 'severity' ); 129 $t_lang_reproducibility = lang_get( 'reproducibility' ); 130 $t_lang_date_submitted = lang_get( 'date_submitted' ); 131 $t_lang_last_update = lang_get( 'last_update' ); 132 $t_lang_reporter = lang_get( 'reporter' ); 133 $t_lang_assigned_to = lang_get( 'assigned_to' ); 134 $t_lang_platform = lang_get( 'platform' ); 135 $t_lang_due_date = lang_get( 'due_date' ); 136 $t_lang_os = lang_get( 'os' ); 137 $t_lang_os_version = lang_get( 'os_version' ); 138 $t_lang_fixed_in_version = lang_get( 'fixed_in_version' ); 139 $t_lang_resolution = lang_get( 'resolution' ); 140 $t_lang_priority = lang_get( 'priority' ); 141 $t_lang_product_build = lang_get( 'product_build' ); 142 $t_lang_eta = lang_get( 'eta' ); 143 $t_lang_status = lang_get( 'status' ); 144 $t_lang_product_version = lang_get( 'product_version' ); 145 $t_lang_no_bugnotes_msg = lang_get( 'no_bugnotes_msg' ); 146 $t_lang_projection = lang_get( 'projection' ); 147 $t_lang_target_version = lang_get( 'target_version' ); 148 $t_lang_summary = lang_get( 'summary' ); 149 $t_lang_description = lang_get( 'description' ); 150 $t_lang_steps_to_reproduce = lang_get( 'steps_to_reproduce' ); 151 $t_lang_additional_information = lang_get( 'additional_information' ); 152 $t_lang_bug_notes_title = lang_get( 'bug_notes_title' ); 153 $t_lang_system_profile = lang_get( 'system_profile' ); 154 $t_lang_attached_files = lang_get( 'attached_files' ); 155 156 $t_current_user_id = auth_get_current_user_id(); 157 $t_user_bugnote_order = user_pref_get_pref ( $t_current_user_id, 'bugnote_order' ); 158 159 for( $j=0; $j < $t_row_count; $j++ ) { 160 $t_bug = $result[$j]; 161 $t_id = $t_bug->id; 162 163 if ( $j % 50 == 0 ) { 164 # to save ram as report will list data once, clear cache after 50 bugs 165 bug_text_clear_cache(); 166 bug_clear_cache(); 167 bugnote_clear_cache(); 168 } 169 170 # display the available and selected bugs 171 if ( in_array( $t_id, $f_bug_arr ) || !$f_show_flag ) { 172 if ( $t_count_exported > 0 ) { 173 echo '<br style="mso-special-character: line-break; page-break-before: always">'; 174 } 175 176 $t_count_exported++; 177 178 $t_last_updated = date( $g_short_date_format, $t_bug->last_updated ); 179 180 # grab the project name 181 $t_project_name = project_get_field( $t_bug->project_id, 'name' ); 182 $t_category_name = category_full_name( $t_bug->category_id, false ); 183 ?> 184 <br /> 185 <table class="width100" cellspacing="1"> 186 <tr> 187 <td class="form-title" colspan="3"> 188 <?php echo $t_lang_bug_view_title ?> 189 </td> 190 </tr> 191 <tr> 192 <td class="print-spacer" colspan="6"> 193 <hr /> 194 </td> 195 </tr> 196 <tr class="print-category"> 197 <td class="print" width="16%"> 198 <?php echo sprintf( lang_get( 'label' ), $t_lang_id ) ?> 199 </td> 200 <td class="print" width="16%"> 201 <?php echo sprintf( lang_get( 'label' ), $t_lang_category ) ?> 202 </td> 203 <td class="print" width="16%"> 204 <?php echo sprintf( lang_get( 'label' ), $t_lang_severity ) ?> 205 </td> 206 <td class="print" width="16%"> 207 <?php echo sprintf( lang_get( 'label' ), $t_lang_reproducibility ) ?> 208 </td> 209 <td class="print" width="16%"> 210 <?php echo sprintf( lang_get( 'label' ), $t_lang_date_submitted ) ?> 211 </td> 212 <td class="print" width="16%"> 213 <?php echo sprintf( lang_get( 'label' ), $t_lang_last_update ) ?> 214 </td> 215 </tr> 216 <tr class="print"> 217 <td class="print"> 218 <?php echo $t_id ?> 219 </td> 220 <td class="print"> 221 <?php echo '[' . string_display_line( $t_project_name ) . '] ' . string_display_line( $t_category_name ) ?> 222 </td> 223 <td class="print"> 224 <?php echo get_enum_element( 'severity', $t_bug->severity ) ?> 225 </td> 226 <td class="print"> 227 <?php echo get_enum_element( 'reproducibility', $t_bug->reproducibility ) ?> 228 </td> 229 <td class="print"> 230 <?php echo date( $t_date_format, $t_bug->date_submitted ) ?> 231 </td> 232 <td class="print"> 233 <?php echo date( $t_date_format, $t_bug->last_updated ) ?> 234 </td> 235 </tr> 236 <tr> 237 <td class="print-spacer" colspan="6"> 238 <hr /> 239 </td> 240 </tr> 241 <tr class="print"> 242 <td class="print-category"> 243 <?php echo sprintf( lang_get( 'label' ), $t_lang_reporter ) ?> 244 </td> 245 <td class="print"> 246 <?php print_user_with_subject( $t_bug->reporter_id, $t_id ) ?> 247 </td> 248 <td class="print-category"> 249 <?php echo sprintf( lang_get( 'label' ), $t_lang_platform ) ?> 250 </td> 251 <td class="print"> 252 <?php echo string_display_line( $t_bug->platform ) ?> 253 </td> 254 <?php if ( access_has_bug_level( config_get( 'due_date_view_threshold' ), $t_id ) ) { ?> 255 <td class="print-category"> 256 <?php echo sprintf( lang_get( 'label' ), $t_lang_due_date ) ?> 257 </td> 258 <?php 259 if ( bug_is_overdue( $t_id ) ) { ?> 260 <td class="print-overdue"> 261 <?php 262 } else { ?> 263 <td class="print"> 264 <?php 265 } 266 if ( !date_is_null( $t_bug->due_date ) ) { 267 echo date( $t_short_date_format, $t_bug->due_date ); 268 print "\t\t</td>\n"; 269 } 270 } else { 271 ?> 272 <td class="print" colspan="2"> </td> 273 <?php } ?> 274 </tr> 275 <tr class="print"> 276 <td class="print-category"> 277 <?php echo sprintf( lang_get( 'label' ), $t_lang_assigned_to ) ?> 278 </td> 279 <td class="print"> 280 <?php 281 if ( access_has_bug_level( config_get( 'view_handler_threshold' ), $t_id ) ) { 282 print_user_with_subject( $t_bug->handler_id, $t_id ); 283 } 284 ?> 285 </td> 286 <td class="print-category"> 287 <?php echo sprintf( lang_get( 'label' ), $t_lang_os ) ?> 288 </td> 289 <td class="print"> 290 <?php echo string_display_line( $t_bug->os ) ?> 291 </td> 292 <td class="print" colspan="2"> </td> 293 </tr> 294 <tr class="print"> 295 <td class="print-category"> 296 <?php echo sprintf( lang_get( 'label' ), $t_lang_priority ) ?> 297 </td> 298 <td class="print"> 299 <?php echo get_enum_element( 'priority', $t_bug->priority ) ?> 300 </td> 301 <td class="print-category"> 302 <?php echo sprintf( lang_get( 'label' ), $t_lang_os_version ) ?> 303 </td> 304 <td class="print"> 305 <?php echo string_display_line( $t_bug->os_build ) ?> 306 </td> 307 <td class="print" colspan="2"> </td> 308 </tr> 309 <tr class="print"> 310 <td class="print-category"> 311 <?php echo sprintf( lang_get( 'label' ), $t_lang_status ) ?> 312 </td> 313 <td class="print"> 314 <?php echo get_enum_element( 'status', $t_bug->status ) ?> 315 </td> 316 <td class="print-category"> 317 <?php echo sprintf( lang_get( 'label' ), $t_lang_product_version ) ?> 318 </td> 319 <td class="print"> 320 <?php echo string_display_line( $t_bug->version ) ?> 321 </td> 322 <td class="print" colspan="2"> </td> 323 </tr> 324 <tr class="print"> 325 <td class="print-category"> 326 <?php echo sprintf( lang_get( 'label' ), $t_lang_product_build ) ?> 327 </td> 328 <td class="print"> 329 <?php echo string_display_line( $t_bug->build ) ?> 330 </td> 331 <td class="print-category"> 332 <?php echo sprintf( lang_get( 'label' ), $t_lang_resolution ) ?> 333 </td> 334 <td class="print"> 335 <?php echo get_enum_element( 'resolution', $t_bug->resolution ) ?> 336 </td> 337 <td class="print" colspan="2"> </td> 338 </tr> 339 <tr class="print"> 340 <td class="print-category"> 341 <?php echo sprintf( lang_get( 'label' ), $t_lang_projection ) ?> 342 </td> 343 <td class="print"> 344 <?php echo get_enum_element( 'projection', $t_bug->projection ) ?> 345 </td> 346 <td class="print-category"> 347   348 </td> 349 <td class="print"> 350   351 </td> 352 <td class="print" colspan="2"> </td> 353 </tr> 354 <tr class="print"> 355 <td class="print-category"> 356 <?php echo sprintf( lang_get( 'label' ), $t_lang_eta ) ?> 357 </td> 358 <td class="print"> 359 <?php echo get_enum_element( 'eta', $t_bug->eta ) ?> 360 </td> 361 <td class="print-category"> 362 <?php echo sprintf( lang_get( 'label' ), $t_lang_fixed_in_version ) ?> 363 </td> 364 <td class="print"> 365 <?php echo string_display_line( $t_bug->fixed_in_version ) ?> 366 </td> 367 <td class="print" colspan="2"> </td> 368 369 </tr> 370 <tr class="print"> 371 <td class="print-category"> 372   373 </td> 374 <td class="print"> 375   376 </td> 377 <td class="print-category"> 378 <?php echo sprintf( lang_get( 'label' ), $t_lang_target_version ) ?> 379 </td> 380 <td class="print"> 381 <?php echo string_display_line( $t_bug->target_version ) ?> 382 </td> 383 <td class="print" colspan="2"> </td> 384 </tr> 385 <?php 386 $t_related_custom_field_ids = custom_field_get_linked_ids( $t_bug->project_id ); 387 foreach( $t_related_custom_field_ids as $t_custom_field_id ) { 388 $t_def = custom_field_get_definition( $t_custom_field_id ); 389 ?> 390 <tr class="print"> 391 <td class="print-category"> 392 <?php echo sprintf( lang_get( 'label' ), lang_get_defaulted( $t_def['name'] ) ) ?> 393 </td> 394 <td class="print" colspan="5"> 395 <?php print_custom_field_value( $t_def, $t_custom_field_id, $t_id ); ?> 396 </td> 397 </tr> 398 <?php 399 } // foreach 400 ?> 401 <tr> 402 <td class="print-spacer" colspan="6"> 403 <hr /> 404 </td> 405 </tr> 406 <tr class="print"> 407 <td class="print-category"> 408 <?php echo sprintf( lang_get( 'label' ), $t_lang_summary ) ?> 409 </td> 410 <td class="print" colspan="5"> 411 <?php echo string_display_line_links( $t_bug->summary ) ?> 412 </td> 413 </tr> 414 <tr class="print"> 415 <td class="print-category"> 416 <?php echo sprintf( lang_get( 'label' ), $t_lang_description ) ?> 417 </td> 418 <td class="print" colspan="5"> 419 <?php echo string_display_line_links( $t_bug->description ) ?> 420 </td> 421 </tr> 422 <tr class="print"> 423 <td class="print-category"> 424 <?php echo sprintf( lang_get( 'label' ), $t_lang_steps_to_reproduce ) ?> 425 </td> 426 <td class="print" colspan="5"> 427 <?php echo string_display_line_links( $t_bug->steps_to_reproduce ) ?> 428 </td> 429 </tr> 430 <tr class="print"> 431 <td class="print-category"> 432 <?php echo sprintf( lang_get( 'label' ), $t_lang_additional_information ) ?> 433 </td> 434 <td class="print" colspan="5"> 435 <?php echo string_display_line_links( $t_bug->additional_information ) ?> 436 </td> 437 </tr> 438 <?php 439 # account profile description 440 if ( $t_bug->profile_id > 0 ) { 441 $t_profile_row = profile_get_row_direct( $t_bug->profile_id ); 442 $t_profile_description = string_display( $t_profile_row['description'] ); 443 444 ?> 445 <tr class="print"> 446 <td class="print-category"> 447 <?php echo $t_lang_system_profile ?> 448 </td> 449 <td class="print" colspan="5"> 450 <?php echo $t_profile_description ?> 451 </td> 452 </tr> 453 <?php 454 } # profile description 455 ?> 456 <tr class="print"> 457 <td class="print-category"> 458 <?php echo sprintf( lang_get( 'label' ), $t_lang_attached_files ) ?> 459 </td> 460 <td class="print" colspan="5"> 461 <?php 462 $t_attachments = file_get_visible_attachments( $t_id ); 463 $t_first_attachment = true; 464 $t_path = config_get_global( 'path' ); 465 466 foreach ( $t_attachments as $t_attachment ) { 467 if ( $t_first_attachment ) { 468 $t_first_attachment = false; 469 } else { 470 echo '<br />'; 471 } 472 473 $c_filename = string_display_line( $t_attachment['display_name'] ); 474 $c_download_url = $t_path . htmlspecialchars( $t_attachment['download_url'] ); 475 $c_filesize = number_format( $t_attachment['size'] ); 476 $c_date_added = date( $t_date_format, $t_attachment['date_added'] ); 477 echo "$c_filename ($c_filesize) <span class=\"italic\">$c_date_added</span><br />$c_download_url"; 478 479 if ( $t_attachment['preview'] && $t_attachment['type'] == 'image' && $f_type_page == 'html' ) { 480 echo '<br /><img src="', $t_attachment['download_url'], '" alt="', $t_attachment['alt'], '" /><br />'; 481 } 482 } 483 ?> 484 </td> 485 </tr> 486 <?php 487 $t_user_bugnote_limit = 0; 488 489 $t_bugnotes = bugnote_get_all_visible_bugnotes( $t_id, $t_user_bugnote_order, $t_user_bugnote_limit ); 490 ?> 491 <br /> 492 <table class="width100" cellspacing="1"> 493 <?php 494 # no bugnotes 495 if ( 0 == count( $t_bugnotes ) ) { 496 ?> 497 <tr> 498 <td class="print" colspan="2"> 499 <?php echo $t_lang_no_bugnotes_msg ?> 500 </td> 501 </tr> 502 <?php 503 } else { # print bugnotes ?> 504 <tr> 505 <td class="form-title" colspan="2"> 506 <?php echo $t_lang_bug_notes_title ?> 507 </td> 508 </tr> 509 <?php 510 foreach ( $t_bugnotes as $t_bugnote ) { 511 # prefix all bugnote data with v3_ 512 $t_date_submitted = date( $t_date_format, $t_bugnote->date_submitted ); 513 $t_last_modified = date( $t_date_format, $t_bugnote->last_modified ); 514 515 # grab the bugnote text and id and prefix with v3_ 516 $t_note = string_display_links( $t_bugnote->note ); 517 ?> 518 <tr> 519 <td class="print-spacer" colspan="2"> 520 <hr /> 521 </td> 522 </tr> 523 <tr> 524 <td class="nopad" width="20%"> 525 <table class="hide" cellspacing="1"> 526 <tr> 527 <td class="print"> 528 (<?php echo bugnote_format_id( $t_bugnote->id ) ?>) 529 </td> 530 </tr> 531 <tr> 532 <td class="print"> 533 <?php print_user( $t_bugnote->reporter_id ) ?>    534 </td> 535 </tr> 536 <tr> 537 <td class="print"> 538 <?php echo $t_date_submitted ?>    539 <?php if ( $t_bugnote->date_submitted != $t_bugnote->last_modified ) { 540 echo '<br />(' . lang_get( 'last_edited') . lang_get( 'word_separator' ) . $t_last_modified . ')'; 541 } ?> 542 </td> 543 </tr> 544 </table> 545 </td> 546 <td class="nopad" width="85%"> 547 <table class="hide" cellspacing="1"> 548 <tr> 549 <td class="print"> 550 <?php 551 switch ( $t_bugnote->note_type ) { 552 case REMINDER: 553 echo lang_get( 'reminder_sent_to' ) . ' '; 554 $t_note_attr = utf8_substr( $t_bugnote->note_attr, 1, utf8_strlen( $t_bugnote->note_attr ) - 2 ); 555 $t_to = array(); 556 foreach ( explode( '|', $t_note_attr ) as $t_recipient ) { 557 $t_to[] = prepare_user_name( $t_recipient ); 558 } 559 echo implode( ', ', $t_to ) . '<br />'; 560 default: 561 echo string_display_links( $t_bugnote->note ); 562 } 563 ?> 564 </td> 565 </tr> 566 </table> 567 </td> 568 </tr> 569 <?php 570 } # end for 571 } # end else 572 ?> 573 574 </table> 575 <?php # Bugnotes END ?> 576 </table> 577 578 579 <?php 580 echo '<br /><br />'; 581 } # end in_array 582 } # end main loop
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Jul 28 15:48:31 2011 | Cross-referenced by PHPXref 0.7 |