1<?php 2# --------------------------------------------------------------------- 3# truc is a tool for requirement and use case tracking 4# Copyright (C) 2006 ASDIS - http://sf.net/projects/truc 5# 6# (rth) Initial truc version based on rth 7# Copyright (C) 2005 George Holbrook - rth@lists.sourceforge.net 8# 9# This program is distributed under the terms and conditions of the GPL 10# See the README and LICENSE files for details 11#---------------------------------------------------------------------- 12 13#-------------------------------------------------------------------------------------------------- 14# This function and the two following functions have the wrong names 15# Maybe this should be html_window_title, the next html_page_title, and the last html_print_header. 16# Just a thought 17#-------------------------------------------------------------------------------------------------- 18function html_window_title() { 19 20 print"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n"; 21 print"<html>\n"; 22 print"<head>\n"; 23 print"<meta http-equiv='Content-type' content='text/html;charset=utf-8'>\n"; 24 print"<title>". WINDOW_TITLE ."</title>\n"; 25 print"<link rel=stylesheet type='text/css' media='screen' href='./css/default.php'>\n"; 26 print"<link rel=stylesheet type='text/css' media='print, embossed' href='./css/print.php'>\n"; 27 28 # Include javascript file if USE_JAVASCRIPT constant is ON 29 if( USE_JAVASCRIPT ) { 30 html_head_javascript(); 31 } 32 print"</head>\n"; 33} 34 35# --------------------------------------------------------------------- 36# Include javascript file 37# --------------------------------------------------------------------- 38function html_head_javascript() { 39 40 echo"<script type='text/JavaScript' src='api/javascript_api.js'></script>\n"; 41} 42 43#----------------------------------------- 44# Sets main title on page 45#----------------------------------------- 46function html_page_title( $page_title ) { 47 48 49 if( trim($page_title) == '' ) { 50 $page_title = PAGE_TITLE; 51 } 52 global $render_page_title,$project_name; 53 $render_page_title=$page_title; 54 $render_page_title=str_replace($project_name ." - ","",$render_page_title); 55} 56 57# --------------------------------------------------------------------- 58# This function will display the user name, date and time, and project listbox accross the top of the page 59# The project list box will only appear if the user has access to more than one project 60# --------------------------------------------------------------------- 61function html_page_header( &$db, $current_proj ) { 62 63 global $render_page_title; 64 $logout_url = "logout.php"; 65 66 $s_user_properties = session_get_user_properties(); 67 print "<div class='page2'><div class='header'> 68 <table border=\"00\" cellspacing=\"4\" cellpadding=\"10\"><tr><!--<td valign=\"top\" align=\"left\" width=\"1\"><img src=\"images/logo.png\"></td>--><td align=\"left\" valign=\"bottom\"><span class=\"FontPageHeader\"><a href='http://truc.sf.net'>TRUC</a><br/></span><span style=\"font-family:arial;font-size:11pt;color:black\">Tracking Requirements & Use Cases <small style='color:#555555;font-size:8pt'>created by <a href='http://asdis.com' target='_blank' style='font-weight:bold;color:#01166B;text-decoration:none'>ASDIS</a></small><br/></span></td><td valign=\"bottom\" align=\"right\"><span style=\"font-family:verdana,arial;font-size:8pt;color:#e5e5e5;font-weight:normal\"><!-- version --></span></td>"; 69 print"<td width='5%' valign=bottom style='white-space:nowrap' class=\"menu_right\" align='right'>".date_get_short_dt().", ".$s_user_properties['username']." (<a href='".$logout_url."'>".lang_get( 'logout_link' )."</a>)"; 70 $s_user_projects= session_get_user_projects(); 71 72 $project_properties = session_get_project_properties(); 73 74 if( $s_user_projects > 1 ) { # display the project list box 75 print"<form method=post name=form_set_project action='login_switch_proj.php'>\n"; 76 77 # Check for Javascript 78 print"<noscript>\n"; 79 print"<input type=hidden name=javascript_disabled value=true>\n"; 80 print"</noscript>\n"; 81 82 # login variables set, so there is no need to do if( isset($_GET[login][page]) ) 83 # in login_switch_proj.php 84 print"<input type=hidden name='login[page]' value=''>\n"; 85 print"<input type=hidden name='login[get]' value=''>\n"; 86 print"<input type=hidden name='uname' value='".$s_user_properties['username']."'>\n"; 87 88 # Check for Javascript 89 print"<noscript>\n"; 90 print"<input type=hidden name=non_javascript_browser value=true>\n"; 91 print"</noscript>\n"; 92 93 if( session_use_javascript() ) { 94 print " \n"; 95 } else { 96 print"<input type=submit value='". lang_get('switch_project') ."'>\n"; 97 } 98 99 print"<select name='login[switch_project]' onchange='document.forms.form_set_project.submit();'>\n"; 100 html_print_list_box_from_array( $s_user_projects, $project_properties['project_name'] ); 101 print"</select>\n"; 102 print"</form>\n"; 103 } else { # don't display the project list box 104 } 105 106 print "</td>"; 107 108 print"</tr></table> 109 </div>"; 110 111 112} 113 114# ----------------------------------------------------------------- 115# This function will generate the main menu at the top of every page 116# The TRUC_URL is defined in the config_inc.php file 117# ----------------------------------------------------------------- 118function html_print_menu() { 119 120 $home_url = "home_page.php"; 121 $req_url = "requirement_page.php"; 122 $test_url = "test_page.php"; 123 $release_url = "release_page.php"; 124 $results_url = "results_page.php"; 125 $bug_url = "bug_page.php"; 126 $reports_url = "report_page.php"; 127 $admin_url = "admin_page.php"; 128 $user_url = "user_edit_my_account_page.php"; 129 $help_url = "help_index.php"; 130 $folderview_url = "requirement_associations_page.php"; 131 $logout_url = "logout.php"; 132 133 # set user url if user has admin rights 134 $s_user_properties = session_get_user_properties(); 135 $user_id = $s_user_properties['user_id']; 136 137 $s_project_properties = session_get_project_properties(); 138 $project_name = $s_project_properties['project_name']; 139 $project_id = $s_project_properties['project_id']; 140 141 if( user_has_rights($project_id, $user_id, ADMIN) ) { 142 $user_url = "user_manage_page.php"; 143 } 144 145 # Get the session variables from the results page and append them on the query string if they are set 146 $s_results = session_get_display_options("results"); 147 148 if( isset( $s_results['release_id'] ) ) { 149 $results_url = $results_url . "?release_id=" .$s_results['release_id']; 150 } 151 if( isset( $s_results['build_id'] ) ) { 152 $results_url = $results_url . "&build_id=" .$s_results['build_id']; 153 } 154 if( isset( $s_results['testset_id'] ) ) { 155 $results_url = $results_url . "&testset_id=" .$s_results['testset_id']; 156 } 157 if( isset( $s_results['test_id'] ) ) { 158 $results_url = "results_test_run_page.php?test_id=" .$s_results['test_id'] ."&testset_id=". $s_results['testset_id']; 159 } 160 print"<div class='print_not'>"; 161 print"<table id='the_menu' class=width100 cellspacing=0>\n"; 162 print"<tr>\n"; 163 print"<td class=menu>\n"; 164 165// print"<a href='$results_url'>" . lang_get( 'results_link' ) . "</a> | \n"; 166// print"<a href='$bug_url'>" . lang_get( 'bug_link' ) . "</a> | \n"; 167 168 global $page; //=basename(__FILE__); 169 $query_str = ""; 170 171 if( isset($_SERVER['QUERY_STRING']) ) { 172 $query_str = "?".$_SERVER['QUERY_STRING']; 173 } 174 175 $menu_items=array(lang_get( 'home_link' ) => $home_url, 176 lang_get( 'req_link' ) =>$req_url, 177 lang_get( 'test_link' ) => $test_url, 178// lang_get( 'req_folder_view' ) => $folderview_url, 179// lang_get( 'release_link' ) => $release_url, 180// lang_get( 'reports_link' ) => $reports_url, 181 lang_get( 'admin_link' ) => $admin_url, 182 lang_get( 'user_link' ) => $user_url, 183// lang_get( 'help_link' ) => $help_url, 184 lang_get( 'logout_link' ) => $logout_url 185 ); 186 foreach($menu_items as $menu_page => $menu_url) { 187 188 if( $page == $menu_url || $page.$query_str == $menu_url || (substr($page,0,strpos($page,"_"))."_page" == substr($menu_url,0,strlen($menu_url)-4))) { 189 print "<a class='selected' href='".TRUC_URL."$menu_url'>" . $menu_page ."</a> "; 190 } else { 191 print "<a href='".TRUC_URL."$menu_url'>" . $menu_page ."</a> "; 192 } 193 } 194 195 196 print"</td>\n"; 197 print"</tr>\n"; 198 print"</table>\n"; 199 print"</div>"; // DON'T PRINT 200 print"<div class='page'>"; 201 global $render_page_title; 202 print"<h1>$render_page_title</h1>\n"; 203 if (!defined('NO_FOLDER_VIEW')) { 204 print"<table><tr><td valign='top' class='folderview'>"; 205 206$rows_top_level_requirements = requirement_get( $project_id, 207 $page_number = 0, 208 $order_by=REQ_FILENAME, 209 $order_dir="ASC", 210 null, 211 null, 212 null, 213 null, 214 null, 215 $filter_show_versions='latest', 216 null, 217 null, 218 null, 219 $csv_name=null, 220 $root_node=true ); 221 222# tree array 223$tree = array(); 224 225echo " <b>$project_name</b><br/>"; 226if( $rows_top_level_requirements ) { 227 228 # get the children of the top level requirements 229 foreach( $rows_top_level_requirements as $row_req ) { 230 231 $root_node = $row_req[REQ_ID]; 232 233 $root_node_name = $row_req[REQ_FILENAME]; 234 235 # build the tree array 236 237 $tree[] = array( "uid" => $root_node, 238 "name" => $root_node_name, 239 "children" => requirement_get_children($root_node), 240 "requirement" => true ); 241 } 242 243 # print the tree array as html 244 html_dynamic_tree( "requirements", $tree, $root_node=true ); 245 246} 247 248 print "</td>"; 249 } 250 251 print "<td valign='top'>"; 252 253} 254 255# ---------------------------------------------------------------- 256# Prints a menu of values seperated by " | " 257# 258# INPUT: 259# current page 260# array of menu items and their urls 261# OUTPUT: 262# html menu 263# ---------------------------------------------------------------- 264function html_print_sub_menu($page, $menu_items) { 265 266 $test_add_url = TRUC_URL . "main.php"; 267 $test_workflow_url = TRUC_URL . "main.php"; 268 $query_str = ""; 269 270 if( isset($_SERVER['QUERY_STRING']) ) { 271 $query_str = "?".$_SERVER['QUERY_STRING']; 272 } 273 274 print"<div class='print_not'><div class='sub_menu' align='center'>\n"; 275 print"<ul>\n"; 276 277 $i = 1; 278 $array_size = count($menu_items); 279 280 foreach($menu_items as $menu_page => $menu_url) { 281 282 $parsed_url = parse_url($menu_url); 283 $url_page = basename($parsed_url['path']); 284 285 286 if( $page == $menu_url || $page.$query_str == $menu_url ) { 287 print "<li><a href='$menu_url' class='selected'>" . $menu_page ."</a></li>"; 288 } else { 289 print "<li><a href='$menu_url'>" . $menu_page ."</a></li>"; 290 } 291 292 # if not the last element in the menu 293 if ($i != $array_size) { 294 print ""; 295 } 296 297 $i++; 298 } 299 300 print"</div></div>\n"; 301 302} 303 304# ----------------------------------------------------------------------- 305# Display the menu when drilling down to view a testset 306# The page, $table_display_properties and $filter parameters should allow 307# us to reuse this function on different pages 308# INPUT: 309# db, page and project_id 310# table_display_properties contains release, build and testset data 311# filter 312# OUTPUT: 313# Corresponding testset information 314# ----------------------------------------------------------------------- 315function html_test_results_menu( &$db, $page, $project_id, $table_display_properties=null, $filter=null ) { 316 317 318 $release_tbl = RELEASE_TBL; 319 $f_release_id = RELEASE_TBL .".". RELEASE_ID; 320 $f_project_id = RELEASE_TBL .".". PROJECT_ID; 321 $f_release_name = RELEASE_TBL .".". RELEASE_NAME; 322 $f_release_archive = RELEASE_TBL .".". RELEASE_ARCHIVE; 323 324 $build_tbl = BUILD_TBL; 325 $f_build_id = BUILD_TBL .".". BUILD_ID; 326 $f_build_rel_id = BUILD_TBL .".". BUILD_REL_ID; 327 $f_build_name = BUILD_TBL .".". BUILD_NAME; 328 $f_build_archive = BUILD_TBL .".". BUILD_ARCHIVE; 329 330 $testset_tbl = TS_TBL; 331 $f_testset_id = TS_TBL .".". TS_ID; 332 $f_testset_name = TS_TBL .".". TS_NAME; 333 334 $test_tbl = TEST_TBL; 335 $f_test_id = TEST_ID; 336 $f_test_name = TEST_NAME; 337 338 $test_run_page = "results_test_run_page.php"; 339 340 $release_id = $table_display_properties['release_id']; 341 $build_id = $table_display_properties['build_id']; 342 $testset_id = $table_display_properties['testset_id']; 343 $test_id = $table_display_properties['test_id']; 344 345 if( empty( $filter['release_id'] ) ) { 346 $show_all = true; 347 } else { 348 $show_all = false; 349 } 350 351 //<!--Table for holding all other tables--> 352 print"<table class='hide100'>\n"; 353 print"<tr>\n"; 354 print"<td>\n"; 355 356 # Release Name 357 print"<table align='left'>\n"; 358 print"<tr>\n"; 359 print"<td class='sub_menu' nowrap><b><a href='$page?release_id=all'>". lang_get( 'release_name' ) ."</a></b></td>\n"; 360 print"</tr>\n"; 361 362 # if the user has not selected a release show all releases 363 if ( ( empty($release_id) || $release_id == 'all') && $show_all == true ) { 364 365 $q = "SELECT DISTINCT $f_release_name, $f_release_id FROM $release_tbl WHERE $f_project_id = '$project_id' AND $f_release_archive = 'N' ORDER BY $f_release_id"; 366 $rs =& db_query( $db, $q); 367 $rows =& db_fetch_array( $db, $rs ); 368 369 if($rows) { 370 371 foreach($rows as $row_release) { 372 $rel_id = $row_release[RELEASE_ID]; 373 $rel_name = $row_release[RELEASE_NAME]; 374 print"<tr>\n"; 375 print"<td class='sub_menu'><a href='$page?release_id=$rel_id'>$rel_name</a></td>\n"; 376 print"</tr>\n"; 377 } 378 } else { 379 380 print"<tr>\n"; 381 print"<td class='error'>".lang_get('no_releases_in_project')."</td>\n"; 382 print"</tr>\n"; 383 } 384 385 print"</table>\n"; 386 } else { # Show the selected release and the build information 387 388 $q_rel_name = "SELECT $f_release_name FROM $release_tbl WHERE $f_release_id = '$table_display_properties[release_id]'"; 389 $release_name = db_get_one( $db, $q_rel_name ); 390 391 print"<tr>\n"; 392 print"<td class='sub_menu' nowrap>$release_name</td>\n"; 393 print"</tr>\n"; 394 print"</table>\n"; 395 396 print"<table align='left'>\n"; 397 print"<tr>\n"; 398 print"<td class='sub_menu'> </td>\n"; 399 print"</tr>\n"; 400 print"</table>\n"; 401 402 $q_build = "SELECT DISTINCT $f_build_name, $f_build_id FROM $build_tbl WHERE $f_build_archive = 'N' AND $f_build_rel_id = '$table_display_properties[release_id]' ORDER BY $f_build_name"; 403 $rs_build =& db_query( $db, $q_build ); 404 $num_build = db_num_rows( $db, $rs_build ); 405 406 print"<table align='left'>\n"; 407 print"<tr>\n"; 408 print"<td class='sub_menu' nowrap><b><a href='$page?release_id=$table_display_properties[release_id]&build_id=all'>". lang_get('build_name') ."</a></b></td>\n"; 409 print"</tr>\n"; 410 411 # if the user has not selected a build, show all builds 412 if ( ( empty( $build_id ) || $build_id == 'all' ) && $show_all == true ) { 413 if($num_build == 0) { # if there are no builds display a message 414 print"<tr>\n"; 415 print"<td class='sub_menu'>". lang_get('builds_none') ." </td>\n"; 416 print"</tr>\n"; 417 print"</table>\n"; 418 } else { # Show all builds associated to the selected release 419 while($row_build =& db_fetch_row( $db, $rs_build ) ) { 420 421 $b_name = $row_build[BUILD_NAME]; 422 $b_id = $row_build[BUILD_ID]; 423 print"<tr>\n"; 424 print"<td class='sub_menu'><a href='$page?release_id=$table_display_properties[release_id]&build_id=$b_id'>$b_name</a></td>\n"; 425 print"</tr>\n"; 426 } 427 print"</table>\n"; 428 } 429 } else { # show the selected build and testset information 430 $q_build_name = "SELECT $f_build_name FROM $build_tbl WHERE $f_build_id = '$table_display_properties[build_id]'"; 431 $build_name = db_get_one( $db, $q_build_name ); 432 433 print"<tr>\n"; 434 print"<td class='sub_menu'>$build_name</td>\n"; 435 print"</tr>\n"; 436 print"</table>"; 437 438 print"<table align='left'>\n"; 439 print"<tr>\n"; 440 print"<td class='sub_menu'> </td>\n"; 441 print"</tr>\n"; 442 print"</table>\n"; 443 444 # MAY NEED TO CHANGE THE LOGIC TO EXCLUDE ALL 445 # WHEN A USER CLICKS ALL THE TABLE SHOULD APPEAR WITHOUT A SELECTED 446 # if the 447 if( isset( $table_display_properties['testset_id'] ) && $table_display_properties['testset_id'] != 'all' ) { 448 $q_testset_name = "SELECT $f_testset_name FROM $testset_tbl WHERE $f_testset_id = '$table_display_properties[testset_id]'"; 449 $testset_name = db_get_one( $db, $q_testset_name ); 450 print"<table align='left'>\n"; 451 print"<tr>\n"; 452 print"<td class='sub_menu' nowrap><b><a href='$page?release_id=$table_display_properties[release_id]&build_id=$table_display_properties[build_id]&testset_id=all'>" .lang_get('testset_name'). "</a></b></td>\n"; 453 print"</tr>\n"; 454 //print"<tr><td class='sub_menu'>$testset_name</td></tr>\n"; 455 print"<tr>\n"; 456 print"<td class='sub_menu'><a href='$page?release_id=$table_display_properties[release_id]&build_id=$table_display_properties[build_id]&testset_id=$table_display_properties[testset_id]&test_id=none'>$testset_name</a></td>\n"; 457 print"</tr>\n"; 458 print"</table>\n"; 459 } 460 461 if( !empty($testset_id) && $testset_id != 'all' && !empty($test_id) && $test_id != 'none') { 462 463 $q_testname = "SELECT $f_test_name FROM $test_tbl WHERE $f_test_id = '$table_display_properties[test_id]'"; 464 $test_name = db_get_one( $db, $q_testname ); 465 466 # Only display the link if not on the test run page 467 $current_page = basename($_SERVER["PHP_SELF"]); 468 if( $test_run_page!=$current_page ) { 469 470 $test_name = "<a href='$test_run_page?release_id=$table_display_properties[release_id]&build_id=$table_display_properties[build_id]&testset_id=$table_display_properties[testset_id]&test_id=$table_display_properties[test_id]'>$test_name</a>"; 471 } 472 473 print"<table>\n"; 474 print"<tr>\n"; 475 print"<td class='sub_menu' nowrap><b>" .lang_get('test_run'). "</b></td>\n"; 476 print"</tr>\n"; 477 print"<tr><td class='sub_menu'>$test_name</td></tr>\n"; 478 print"</table>\n"; 479 } 480 } 481 } 482 483 print"</td>\n"; 484 print"</tr>\n"; 485 print"</table>\n"; 486 487} 488 489# ----------------------------------------------------------------------- 490# Display the menu when drilling down to view a testset 491# The page, $table_display_properties and $filter parameters should allow 492# us to reuse this function on different pages 493# INPUT: 494# db, page and project_id 495# table_display_properties contains release, build and testset data 496# filter 497# OUTPUT: 498# Corresponding testset information 499# ----------------------------------------------------------------------- 500function html_testset_menu( &$db, $page, $project_id, $table_display_properties=null ) { 501 502 $release_tbl = RELEASE_TBL; 503 $f_release_id = RELEASE_TBL .".". RELEASE_ID; 504 $f_project_id = RELEASE_TBL .".". PROJECT_ID; 505 $f_release_name = RELEASE_TBL .".". RELEASE_NAME; 506 $f_release_archive = RELEASE_TBL .".". RELEASE_ARCHIVE; 507 $build_tbl = BUILD_TBL; 508 $f_build_id = BUILD_TBL .".". BUILD_ID; 509 $f_build_rel_id = BUILD_TBL .".". BUILD_REL_ID; 510 $f_build_name = BUILD_TBL .".". BUILD_NAME; 511 $f_build_archive = BUILD_TBL .".". BUILD_ARCHIVE; 512 $testset_tbl = TS_TBL; 513 $f_testset_id = TS_TBL .".". TS_ID; 514 $f_testset_name = TS_TBL .".". TS_NAME; 515 $test_tbl = TEST_TBL; 516 $f_test_id = TEST_ID; 517 $f_test_name = TEST_NAME; 518 519 if( isset($_GET['testset_menu_release_id']) ) { 520 $release_id = $_GET['testset_menu_release_id']; 521 } 522 523 if( isset($_GET['testset_menu_build_id']) ) { 524 $build_id = $_GET['testset_menu_build_id']; 525 } 526 527 if( isset($_GET['testset_menu_testset_id']) ) { 528 $testset_id = $_GET['testset_menu_testset_id']; 529 } 530 531 if( empty( $filter['release_id'] ) ) { 532 $show_all = true; 533 } else { 534 $show_all = false; 535 } 536 537 $q = " SELECT DISTINCT $f_release_name, 538 $f_release_id 539 FROM $release_tbl 540 WHERE $f_project_id = '$project_id' 541 AND $f_release_archive = 'N' 542 ORDER BY $f_release_id"; 543 544 $rs = db_query($db, $q); 545 546 //<!--Table for holding all other tables--> 547 print"<table class='hide100'>\n"; 548 print"<tr>\n"; 549 print"<td>\n"; 550 551 # Release Name 552 print"<table align='left'>\n"; 553 print"<tr>\n"; 554 print"<td class='sub_menu' nowrap><b><a href='$page?testset_menu_release_id=all'>". lang_get( 'release_name' ) ."</a></b></td>\n"; 555 print"</tr>\n"; 556 557 # if the user has not selected a release show all releases 558 if ( ( !isset( $release_id ) || $release_id == 'all') ) { 559 560 while( $row = db_fetch_row( $db, $rs ) ) { 561 562 $rel_id = $row[RELEASE_ID]; 563 $rel_name = $row[RELEASE_NAME]; 564 print"<tr>\n"; 565 print"<td class='sub_menu'><a href='$page?testset_menu_release_id=$rel_id'>$rel_name</a></td>\n"; 566 print"</tr>\n"; 567 } 568 569 print"</table>\n"; 570 } else { # Show the selected release and the build information 571 572 $q_rel_name = " SELECT $f_release_name 573 FROM $release_tbl 574 WHERE $f_release_id = $release_id"; 575 576 $release_name = db_get_one( $db, $q_rel_name ); 577 578 print"<tr>\n"; 579 print"<td class='sub_menu' nowrap>$release_name</td>\n"; 580 print"</tr>\n"; 581 print"</table>\n"; 582 583 print"<table align='left'>\n"; 584 print"<tr>\n"; 585 print"<td class='sub_menu'> </td>\n"; 586 print"</tr>\n"; 587 print"</table>\n"; 588 589 $q_build = "SELECT DISTINCT $f_build_name, 590 $f_build_id 591 FROM $build_tbl 592 WHERE $f_build_archive = 'N' 593 AND $f_build_rel_id = $release_id 594 ORDER BY $f_build_name"; 595 596 $rs_build = db_query($db, $q_build); 597 $num_build = db_num_rows($db, $rs_build); 598 599 # Build Name 600 print"<table align='left'>\n"; 601 print"<tr>\n"; 602 print"<td class='sub_menu' nowrap><b><a href='$page?testset_menu_release_id=$release_id&testset_menu_build_id=all'>". lang_get('build_name') ."</a></b></td>\n"; 603 print"</tr>\n"; 604 605 # if the user has not selected a build, show all builds 606 if ( ( !isset( $build_id ) || $build_id == 'all' ) && $show_all == true ) { 607 if($num_build == 0) { # if there are no builds display a message 608 print"<tr>\n"; 609 print"<td class='sub_menu'>". lang_get('builds_none') ." </td>\n"; 610 print"</tr>\n"; 611 print"</table>\n"; 612 } else { # Show all builds associated to the selected release 613 while($row_build = db_fetch_row( $db, $rs_build ) ) { 614 615 $b_name = $row_build[BUILD_NAME]; 616 $b_id = $row_build[BUILD_ID]; 617 print"<tr>\n"; 618 print"<td class='sub_menu'><a href='$page?testset_menu_release_id=$release_id&testset_menu_build_id=$b_id'>$b_name</a></td>\n"; 619 print"</tr>\n"; 620 } 621 print"</table>\n"; 622 } 623 } else { # show the selected build and testset information 624 $q_build_name = " SELECT $f_build_name 625 FROM $build_tbl 626 WHERE $f_build_id = $build_id"; 627 628 $build_name = db_get_one( $db, $q_build_name ); 629 630 print"<tr>\n"; 631 print"<td class='sub_menu'>$build_name</td>\n"; 632 print"</tr>\n"; 633 print"</table>"; 634 635 print"<table align='left'>\n"; 636 print"<tr>\n"; 637 print"<td class='sub_menu'> </td>\n"; 638 print"</tr>\n"; 639 print"</table>\n"; 640 641 # Testset Name 642 print"<table align='left'>\n"; 643 print"<tr>\n"; 644 print"<td class='sub_menu' nowrap><b><a href='$page?testset_menu_release_id=$release_id&testset_menu_build_id=$build_id&testset_menu_testset_id=all'>" .lang_get('testset_name'). "</a></b></td>\n"; 645 print"</tr>\n"; 646 647 if( isset( $testset_id ) && $testset_id != 'all' ) { 648 649 650 $q_testset_name = " SELECT $f_testset_name 651 FROM $testset_tbl 652 WHERE $f_testset_id = $testset_id"; 653 654 $testset_name = db_get_one( $db, $q_testset_name ); 655 656 print"<tr>\n"; 657 print"<td class='sub_menu'>$testset_name</td>\n"; 658 print"</tr>\n"; 659 print"</table>\n"; 660 661 } else { 662 663 $testset_tbl = TS_TBL; 664 $db_testset_id = TS_TBL .".". TS_ID; 665 $db_testset_name = TS_TBL .".". TS_NAME; 666 $db_testset_build_id = TS_TBL .".". TS_BUILD_ID; 667 668 $q = " SELECT $db_testset_name, 669 $db_testset_id 670 FROM $testset_tbl 671 WHERE $db_testset_build_id = $build_id 672 ORDER BY $db_testset_name ASC"; 673 674 $rows = db_fetch_array($db, db_query($db, $q)); 675 676 if( $rows ) { 677 678 foreach( $rows as $row ) { 679 680 $testset_name = $row[TS_NAME]; 681 $testset_id = $row[TS_ID]; 682 683 print"<tr>\n"; 684 print"<td class='sub_menu'><a href='$page?testset_menu_release_id=$release_id&" 685 . "testset_menu_build_id=$build_id&" 686 . "testset_menu_testset_id=$testset_id" 687 . "'>$testset_name</a></td>\n"; 688 print"</tr>\n"; 689 } 690 print"</table>\n"; 691 692 } else { 693 echo"<br>\n"; 694 echo"<p class='error'>". lang_get( 'no_testsets' ) ."</p>\n"; 695 } 696 } 697 } 698 } 699 700 print"</td>\n"; 701 print"</tr>\n"; 702 print"</table>\n"; 703} 704 705 706# ----------------------------------------------------------------------- 707# Display the menu when drilling down to view a testset 708# The page, $table_display_properties and $filter parameters should allow 709# us to reuse this function on different pages 710# INPUT: 711# db, page and project_id 712# table_display_properties contains release, build and testset data 713# filter 714# OUTPUT: 715# Corresponding testset information 716# ----------------------------------------------------------------------- 717function html_browse_release_menu( &$db, 718 $page, 719 $project_id, 720 $display_property_group="", 721 $show_build=true, 722 $show_testset=true ) { 723 724 $release_tbl = RELEASE_TBL; 725 $f_release_id = RELEASE_TBL .".". RELEASE_ID; 726 $f_project_id = RELEASE_TBL .".". PROJECT_ID; 727 $f_release_name = RELEASE_TBL .".". RELEASE_NAME; 728 $f_release_archive = RELEASE_TBL .".". RELEASE_ARCHIVE; 729 $f_release_date = RELEASE_TBL .".". RELEASE_DATE_RECEIVED; 730 731 $build_tbl = BUILD_TBL; 732 $f_build_id = BUILD_TBL .".". BUILD_ID; 733 $f_build_rel_id = BUILD_TBL .".". BUILD_REL_ID; 734 $f_build_name = BUILD_TBL .".". BUILD_NAME; 735 $f_build_archive = BUILD_TBL .".". BUILD_ARCHIVE; 736 $f_build_date = BUILD_TBL .".". BUILD_DATE_REC; 737 738 $testset_tbl = TS_TBL; 739 $f_testset_id = TS_TBL .".". TS_ID; 740 $f_testset_name = TS_TBL .".". TS_NAME; 741 $f_testset_date = TS_TBL .".". TS_DATE_CREATED; 742 743 $test_tbl = TEST_TBL; 744 $f_test_id = TEST_ID; 745 $f_test_name = TEST_NAME; 746 747 if( isset($_GET["$display_property_group"."_release_id"]) ) { 748 $release_id = $_GET["$display_property_group"."_release_id"]; 749 } 750 751 if( isset($_GET["$display_property_group"."_build_id"]) ) { 752 $build_id = $_GET["$display_property_group"."_build_id"]; 753 } 754 755 if( isset($_GET["$display_property_group"."_testset_id"]) ) { 756 $testset_id = $_GET["$display_property_group"."_testset_id"]; 757 } 758 759 if( empty( $filter["release_id"] ) ) { 760 $show_all = true; 761 } else { 762 $show_all = false; 763 } 764 765 //<!--Table for holding all other tables--> 766 print"<table class='hide100'>\n"; 767 print"<tr>\n"; 768 print"<td>\n"; 769 770 # Release Name 771 print"<table align='left'>\n"; 772 print"<tr>\n"; 773 print"<td class='sub_menu' nowrap><b><a href='$page?$display_property_group"."_release_id=all'>". lang_get( 'release_name' ) ."</a></b></td>\n"; 774 print"</tr>\n"; 775 776 # if the user has not selected a release show all releases 777 if ( ( !isset( $release_id ) || $release_id == 'all') ) { 778 779 $q = "SELECT DISTINCT $f_release_name, $f_release_id FROM $release_tbl WHERE $f_project_id = '$project_id' AND $f_release_archive = 'N' ORDER BY $f_release_id"; 780 $rs =& db_query( $db, $q); 781 $rows =& db_fetch_array( $db, $rs ); 782 783 if($rows) { 784 785 foreach($rows as $row_release) { 786 $rel_id = $row_release[RELEASE_ID]; 787 $rel_name = $row_release[RELEASE_NAME]; 788 print"<tr>\n"; 789 print"<td class='sub_menu'><a href='$page?_release_id=$rel_id'>$rel_name</a></td>\n"; 790 print"</tr>\n"; 791 } 792 } else { 793 794 print"<tr>\n"; 795 print"<td class='error'>".lang_get('no_releases_in_project')."</td>\n"; 796 print"</tr>\n"; 797 } 798 799 print"</table>\n"; 800 } else { # Show the selected release and the build information 801 802 $q_rel_name = " SELECT $f_release_name 803 FROM $release_tbl 804 WHERE $f_release_id = $release_id"; 805 806 $release_name = db_get_one( $db, $q_rel_name ); 807 808 print"<tr>\n"; 809 print"<td class='sub_menu' nowrap>$release_name</td>\n"; 810 print"</tr>\n"; 811 print"</table>\n"; 812 813 print"<table align='left'>\n"; 814 print"<tr>\n"; 815 print"<td class='sub_menu'> </td>\n"; 816 print"</tr>\n"; 817 print"</table>\n"; 818 819 if( $show_build ) { 820 821 822 $q_build = "SELECT DISTINCT $f_build_name, 823 $f_build_id 824 FROM $build_tbl 825 WHERE $f_build_archive = 'N' 826 AND $f_build_rel_id = $release_id 827 ORDER BY $f_build_date ASC"; 828 829 $rs_build = db_query($db, $q_build); 830 $num_build = db_num_rows($db, $rs_build); 831 832 # Build Name 833 print"<table align='left'>\n"; 834 print"<tr>\n"; 835 print"<td class='sub_menu' nowrap><b><a href='$page?$display_property_group"."_release_id=$release_id&$display_property_group"."_build_id=all'>". lang_get('build_name') ."</a></b></td>\n"; 836 print"</tr>\n"; 837 838 # if the user has not selected a build, show all builds 839 if ( ( !isset( $build_id ) || $build_id == 'all' ) && $show_all == true ) { 840 if($num_build == 0) { # if there are no builds display a message 841 print"<tr>\n"; 842 print"<td class='sub_menu'>". lang_get('builds_none') ." </td>\n"; 843 print"</tr>\n"; 844 print"</table>\n"; 845 } else { # Show all builds associated to the selected release 846 while($row_build = db_fetch_row( $db, $rs_build ) ) { 847 848 $b_name = $row_build[BUILD_NAME]; 849 $b_id = $row_build[BUILD_ID]; 850 print"<tr>\n"; 851 print"<td class='sub_menu'><a href='$page?$display_property_group"."_release_id=$release_id&$display_property_group"."_build_id=$b_id'>$b_name</a></td>\n"; 852 print"</tr>\n"; 853 } 854 print"</table>\n"; 855 } 856 } else { # show the selected build and testset information 857 $q_build_name = " SELECT $f_build_name 858 FROM $build_tbl 859 WHERE $f_build_id = $build_id"; 860 861 $build_name = db_get_one( $db, $q_build_name ); 862 863 print"<tr>\n"; 864 print"<td class='sub_menu'>$build_name</td>\n"; 865 print"</tr>\n"; 866 print"</table>"; 867 868 print"<table align='left'>\n"; 869 print"<tr>\n"; 870 print"<td class='sub_menu'> </td>\n"; 871 print"</tr>\n"; 872 print"</table>\n"; 873 874 if( $show_testset ) { 875 876 # Testset Name 877 print"<table align='left'>\n"; 878 print"<tr>\n"; 879 print"<td class='sub_menu' nowrap><b><a href='$page?$display_property_group"."_release_id=$release_id&$display_property_group"."_build_id=$build_id&$display_property_group"."_testset_id=all'>" .lang_get('testset_name'). "</a></b></td>\n"; 880 print"</tr>\n"; 881 882 if( isset( $testset_id ) && $testset_id != 'all' ) { 883 884 885 $q_testset_name = " SELECT $f_testset_name 886 FROM $testset_tbl 887 WHERE $f_testset_id = $testset_id"; 888 889 $testset_name = db_get_one( $db, $q_testset_name ); 890 891 print"<tr>\n"; 892 print"<td class='sub_menu'>$testset_name</td>\n"; 893 print"</tr>\n"; 894 print"</table>\n"; 895 896 } else { 897 898 $testset_tbl = TS_TBL; 899 $db_testset_id = TS_TBL .".". TS_ID; 900 $db_testset_name = TS_TBL .".". TS_NAME; 901 $db_testset_build_id = TS_TBL .".". TS_BUILD_ID; 902 903 $q = " SELECT $db_testset_name, 904 $db_testset_id 905 FROM $testset_tbl 906 WHERE $db_testset_build_id = $build_id 907 ORDER BY $f_testset_date ASC"; 908 909 $rows = db_fetch_array($db, db_query($db, $q)); 910 911 if( $rows ) { 912 913 foreach( $rows as $row ) { 914 915 $testset_name = $row[TS_NAME]; 916 $testset_id = $row[TS_ID]; 917 918 print"<tr>\n"; 919 print"<td class='sub_menu'><a href='$page?$display_property_group"."_release_id=$release_id&" 920 . "$display_property_group"."_build_id=$build_id&" 921 . "$display_property_group"."_testset_id=$testset_id" 922 . "'>$testset_name</a></td>\n"; 923 print"</tr>\n"; 924 } 925 print"</table>\n"; 926 927 } else { 928 print"<tr>\n"; 929 print"<td class='sub_menu'><br>"; 930 echo"<p class='error'>". lang_get( 'no_testsets' ) ."</p>\n"; 931 print"</tr>\n"; 932 print"</table>\n"; 933 } 934 } 935 } 936 } 937 } 938 } 939 940 print"</td>\n"; 941 print"</tr>\n"; 942 print"</table>\n"; 943} 944 945 946function html_project_manage_menu() { 947 global $page; 948 $selected_project_properties = session_get_properties("project_manage"); 949 $selected_project_id = $selected_project_properties['project_id']; 950 951 $manage_pages = array( 952 lang_get('edit_project')." (".project_get_name($selected_project_id).")" => 'project_manage_page.php', 953 lang_get('add_release') => 'project_manage_release_page.php', 954 lang_get('req_area_covered') => 'project_manage_reqareacovered_page.php', 955 lang_get('req_functionality') => 'project_manage_reqfunctionality_page.php', 956 lang_get('req_doc_type') => 'project_manage_reqdoctype_page.php' 957 958 959 960 961 ); 962 html_print_sub_menu($page,$manage_pages); 963/* 964 print"<div align='center'>\n"; 965 print"<table class='sub-menu' rules=cols>\n"; 966 print"<tr><td class='menu'>"; 967 968 $str = ""; 969*/ 970/* 971 foreach($manage_pages as $key => $value) { 972 973 if( stristr($_SERVER['PHP_SELF'], $key)===false ) { 974 $str .= " <a href='$key'>$value</a> |\n"; 975 } else { 976 $str .= " $value |\n"; 977 } 978 } 979 980 print substr($str, 0, -2); 981 print"</td></tr>"; 982 983 print"</table>\n"; 984 985 print"</div>\n"; 986 987 print"<br>"; 988*/} 989 990 991function html_project_manage_tests_menu() { 992 993 $selected_project_properties = session_get_properties("project_manage"); 994 $selected_project_id = $selected_project_properties['project_id']; 995 996 $manage_pages = array( 997 'project_manage_testareatested_page.php' => lang_get('area_tested'), 998 'project_manage_testdoctype_page.php' => lang_get('test_doc_type'), 999 'project_manage_testenvironment_page.php' => lang_get('environment'), 1000 'project_manage_testmachines_page.php' => lang_get('test_machine'), 1001 'project_manage_testtype_page.php' => lang_get('testtype') ); 1002 1003 print"<div align='center'>\n"; 1004 print"<table class='sub-menu' rules=cols>\n"; 1005 print"<tr><td class='menu'>"; 1006 1007 $str = ""; 1008 1009 foreach($manage_pages as $key => $value) { 1010 1011 if( stristr($_SERVER['PHP_SELF'], $key)===false ) { 1012 $str .= " <a href='$key'>$value</a> |\n"; 1013 } else { 1014 $str .= " $value |\n"; 1015 } 1016 } 1017 1018 print substr($str, 0, -2); 1019 print"</td></tr>"; 1020 1021 print"</table>\n"; 1022 1023 print"</div>\n"; 1024 print"<br>\n"; 1025} 1026 1027function html_project_manage_bugs_menu() { 1028 1029 $selected_project_properties = session_get_properties("project_manage"); 1030 $selected_project_id = $selected_project_properties['project_id']; 1031 1032 $manage_pages = array( 1033 'project_manage_bug_component_page.php' => lang_get('bug_component_link') ); 1034 1035 print"<div align='center'>\n"; 1036 print"<table class='sub-menu' rules=cols>\n"; 1037 print"<tr><td class='menu'>"; 1038 1039 $str = ""; 1040 1041 foreach($manage_pages as $key => $value) { 1042 1043 if( stristr($_SERVER['PHP_SELF'], $key)===false ) { 1044 $str .= " <a href='$key'>$value</a> |\n"; 1045 } else { 1046 $str .= " $value |\n"; 1047 } 1048 } 1049 1050 print substr($str, 0, -2); 1051 print"</td></tr>"; 1052 1053 print"</table>\n"; 1054 print"</div>\n"; 1055 print"<br>\n"; 1056} 1057 1058 1059#-------------------------------------------------------------------------------------------------- 1060# This function will place focus on a form field if you pass in the form name and obj name 1061# Its best to pass in variables if your using a form. I think this will work well on most browsers 1062#-------------------------------------------------------------------------------------------------- 1063function html_print_body( $form_name=null, $obj_name=null ) { 1064 1065 if( empty($form_name) && empty($obj_name) ) { 1066 print"<body>\n"; 1067 } 1068 else { 1069 print"<body onload='document.$form_name.$obj_name.focus();'>\n"; 1070 } 1071} 1072/* 1073# ------------------------------------------------------- 1074# This function is intended to make all table headers consistant. 1075# Pass in a page, field, order_by, and $order_dir and the header 1076# will be a hyperlink. Pass only the first parameter and the 1077# function will just list the table header without making it a link. 1078# If javascript param is included, then the javascript is included 1079# in the a tag. 1080# ------------------------------------------------------- 1081function html_tbl_print_header( $header, 1082 $page=null, 1083 $field=null, 1084 $order_by=null, 1085 $order_dir=null, 1086 $javascript=null ) { 1087 1088 if($javascript) { 1089 $javascript = "onClick=\"sortPage('$field');return false\""; 1090 } 1091 1092 switch( $order_dir ) { 1093 case( $field != $order_by ): 1094 $image=""; 1095 break; 1096 case( $order_dir=="ASC" ): 1097 $image = " <img src='". IMG_SRC ."down.gif' border=0 alt='Ascending'>"; 1098 break; 1099 case( $order_dir=="DESC" ): 1100 $image = " <img src='". IMG_SRC ."up.gif' border=0 alt='Descending'>"; 1101 break; 1102 default: 1103 $image=""; 1104 } 1105 1106 if( $field !== null ) { 1107 1108 print"<th nowrap><a $javascript href=\"$page?order_by=$field&tbl_header=true\">$header$image</a></th>"; 1109 } else { 1110 1111 print"<th nowrap>$header</th>"; 1112 } 1113} 1114*/ 1115function html_tbl_print_header( $header, 1116 $field=null, 1117 $order_by=null, 1118 $order_dir=null, 1119 $page=null,$colspan=null,$center=null ) { 1120 1121 switch( $order_dir ) { 1122 case( $field != $order_by ): 1123 $image=""; 1124 break; 1125 case( $order_dir=="ASC" ): 1126 $image = " <img src='images/down.gif' border=0 alt='Ascending'>"; 1127 $new_order_dir = "DESC"; 1128 break; 1129 case( $order_dir=="DESC" ): 1130 $image = " <img src='images/up.gif' border=0 alt='Descending'>"; 1131 $new_order_dir = "ASC"; 1132 break; 1133 default: 1134 $image=""; 1135 } 1136 1137 1138 if( $field !== null ) { 1139 1140 print"<th "; 1141 if ($center!=null) echo 'style="text-align:center" '; 1142 if ($colspan!=null) echo "colspan='$colspan' "; 1143 print"nowrap>\n"; 1144 1145 if( !is_null($page) ) { 1146 print"<form method=post action='$page'>\n"; 1147 print"<input type=hidden name='table_header' value='true'>\n"; 1148 } 1149 print"<input type=hidden name='order_dir' value='$order_dir'>\n"; 1150 print"<input type=hidden name='$header' value='$field'>\n"; 1151 print"<input type=submit name='change_order_by' value='$header' class='sort-header'>$image\n"; 1152 1153 if( !is_null($page) ) { 1154 print"</form>\n"; 1155 } 1156 print"</th>\n"; 1157 } else { 1158 1159 print"<th "; 1160 if ($center!=null) echo 'style="text-align:center" '; 1161 if ($colspan!=null) echo "colspan='$colspan' "; 1162 print"nowrap>$header</th>\n"; 1163 } 1164 1165} 1166 1167function html_tbl_change_order_dir( $direction ) { 1168 1169 if( $direction == 'ASC' ) { 1170 $direction = 'DESC'; 1171 } elseif( $direction == 'DESC' ) { 1172 $direction = 'ASC'; 1173 } 1174 print"direction in change_order_direction function = $direction<br>"; 1175 return $direction; 1176} 1177 1178 1179# -------------------------------------------------------------------------- 1180# Display alernating row colors for html tables. 1181# COMMENTS: 1182# This function will set the row style if it's not already set and then alternate the row style. 1183# The background colors are defined in properties_inc.php as constants 1184# USAGE: 1185# $row_style = html_tbl_alternate_bgcolor( $row_style ); 1186# print"<tr class=$row_style>"; 1187# --------------------------------------------------------------------------- 1188function html_tbl_alternate_bgcolor( $style ) { 1189 1190 if( empty( $style ) ) { 1191 $style = ROW2_STYLE; 1192 } 1193 else if( $style == ROW2_STYLE ) { 1194 $style = ROW1_STYLE; 1195 } 1196 else { 1197 $style = ROW2_STYLE; 1198 } 1199 return $style; 1200} 1201 1202# ------------------------------------------------------------------------------------ 1203# DISPLAY THE PROPER ICON THAT IDENTIFIES A TEST AS MANUAL AUTOMATED OR BOTH 1204# ------------------------------------------------------------------------------------ 1205/* jsc: automated and load_test are deprecated! */ 1206function html_print_testtype_icon( $manual, $automated, $load_test="NO" ) { 1207 if( $manual == 'YES') 1208 return "<img src='".IMG_SRC."manual.gif' title='". lang_get('manual_test') ."' alt=M>"; 1209 1210 return "<img src='".IMG_SRC."auto.gif' title='". lang_get('automated_test') ."' alt=A>"; 1211 1212} 1213 1214# ------------------------------------------------------------------------------------ 1215# DISPLAY THE TEXT IF THE TEST IS PERFORMED BY AN USER OR THE SYSTEM 1216# ------------------------------------------------------------------------------------ 1217function html_print_testtype( $manual) { 1218 if( $manual == 'YES') return lang_get('by_user'); 1219 return lang_get('by_system'); 1220 1221} 1222 1223 1224# ------------------------------------------------------------------------------------ 1225# DISPLAY THE PROPER ICON THAT IDENTIFIES A TEST AS PASSED OR FAILED 1226# ------------------------------------------------------------------------------------ 1227function html_teststatus_icon( $test_status ) { 1228 1229 if( $test_status == 'Passed' ) { 1230 1231 return"<img src='./images/pass.gif' title=Passed alt=Pass>"; 1232 } elseif( $test_status == 'Failed') { 1233 1234 return"<img src='./images/fail.gif' title=Failed alt=Fail>"; 1235 } 1236} 1237 1238# ------------------------------------------------------------------------------------ 1239# This function will display the html page footer 1240# COMMENTS: 1241# This will print out the time it takes to load an html page if you turn the DEBUG option 1242# in properties_inc.php = ON. 1243# ------------------------------------------------------------------------------------ 1244function html_print_footer() { 1245 global $g_timer; 1246 $admin_email = ADMIN_EMAIL; 1247 print "</td></table></div> <!-- div.page --></div>"; 1248 print"<div class='footer'>" . WINDOW_TITLE ." :: ". lang_get('copywrite') . " :: ". lang_get('contact_admin') ." <a href='mailto:$admin_email'>". lang_get('rth_admin_email') ."</a>"; 1249 1250 if ( ON == DEBUG ) { 1251 print "<br/>"; 1252 $g_timer->print_times(); 1253 } 1254 print "</div>"; 1255 1256 1257 1258 print"</body>\n"; 1259 print"</html>\n"; 1260} 1261 1262# ------------------------------------------------------------------------------------- 1263# Redirect the user 1264# INPUT: 1265# The url inluding any query strings 1266# The delay ( default = 1 second ) 1267# ------------------------------------------------------------------------------------- 1268function html_redirect($url, $delay=null) { 1269 1270 if( empty( $delay ) ) { 1271 $delay = '1'; 1272 } 1273 1274 print"<meta http-equiv='Refresh' content='$delay; URL=$url'>"; 1275 1276 exit; 1277} 1278 1279/* 1280# -------------------------------------------------------------------------------------- 1281# Populate list box with Manual/Auto values 1282# INPUT 1283# the selected value (not required) 1284# COMMENTS: 1285# Print the manual automated list box. I think we should call this list box test type. 1286# Make this test type so that we can account for Load Tests, Unit Tests, etc (Richard's idea) 1287# I've set it up so we can add a value to the language file and add that value here to update 1288# the values in the list box. Maybe it should be an array of the values in the language file? 1289# Don't know what we'd call the current TestType field 1290# -------------------------------------------------------------------------------------- 1291function html_manauto_list_box( $selected=null ) { 1292 1293 $all = lang_get('all'); 1294 $manual = lang_get('manual'); 1295 $automated = lang_get('automated'); 1296 $man_auto = lang_get('man_auto'); 1297 1298 # Might need to make the value = the db name 1299 1300 if( $selected != '' ) { 1301 print"<option value=''></option>"; 1302 } 1303 if( $selected != $manual ) { 1304 print"<option value='$manual'>$manual</option>"; 1305 } 1306 if( $selected != $automated ) { 1307 print"<option value='$automated'>$automated</option>"; 1308 } 1309 if( $selected != $man_auto ) { 1310 print"<option value='$man_auto'>$man_auto</option>"; 1311 } 1312 1313 print"<option selected value='$selected'>$selected</option>"; 1314} 1315*/ 1316 1317/* 1318# ---------------------------------------------------------------------------- 1319# Query a database and populate a list box with the query result 1320# INPUT: 1321# database you want to query 1322# table you want to query 1323# field you want to query 1324# the selected value of the html ( not required ) 1325# COMMENTS: 1326# Same as html_print_list_box except that this function will not print out 1327# the value "all" in the list box 1328# ----------------------------------------------------------------------------- 1329function html_list_box( &$database, $table, $field, $selected=null ) { 1330 1331 $q = "SELECT DISTINCT $field FROM $table WHERE $field != ''"; 1332 1333 1334 //print"$q<br>"; 1335 1336 # ALTER WHERE CLAUSE TO ELIMINATE DUPLICATE ENTRIES IN THE LIST BOX 1337 if( $selected == '' ) { 1338 $q_clause = " ORDER BY $field"; 1339 } 1340 else { 1341 $q_clause = " AND $field != '$selected' ORDER BY $field"; 1342 } 1343 1344 # RUN QUERY 1345 $q = $q . $q_clause; 1346 $rs =& db_query( $database, $q ); 1347 $num = db_num_rows( $database, $rs ); 1348 //$row = array(); 1349 1350 if( $num > 0 ) { 1351 1352 $row = db_fetch_array( $database, $num, $rs ); 1353 1354 for($i=0; $i < sizeof( $row ); $i++) { 1355 1356 extract( $row[$i], EXTR_PREFIX_ALL, 'v' ); 1357 1358 $val = ${'v_' . $field}; 1359 1360 if( $val != '' ) { 1361 print"<option value='$val'>$val</option>"; 1362 } 1363 } 1364 1365 print"<option selected value='$selected'>$selected</option>"; 1366 1367 } 1368 else { # DISPLAY NOTHING IF THERE IS NOTHING IN THE DB 1369 print"<td class=center> </td>"; 1370 } 1371} 1372*/ 1373 1374# ---------------------------------------------------------------------------- 1375# Query a database and populate a list box with the query result (include "all" as a value) 1376# INPUT: 1377# database you want to query 1378# table you want to query 1379# field you want to query 1380# the selected value of the html ( not required ) 1381# COMMENTS: 1382# The function will eliminate duplicate entries from the list box and ignore blanks 1383# We may want to add a second field input which is optional $field2=null so that 1384# we could query for an id and name field using id as the option value 1385# and name as the display option. It is the function used to populate list boxes 1386# when filtering a table 1387# ----------------------------------------------------------------------------- 1388function html_print_list_box( &$database, $table, $field, $project_id, $selected=null ) { 1389 1390 $db_project_id = PROJECT_ID; 1391 $q = "SELECT DISTINCT $field FROM $table WHERE $db_project_id = '$project_id' AND $field != ''"; 1392 1393 //print"$q<br>"; 1394 1395 # ALTER WHERE CLAUSE TO ELIMINATE DUPLICATE ENTRIES IN THE LIST BOX 1396 if( $selected == '' || $selected == 'all' ) { 1397 $q_clause = " ORDER BY $field"; 1398 } 1399 else { 1400 $q_clause = " AND $field != '$selected' ORDER BY $field"; 1401 } 1402 1403 # RUN QUERY 1404 $q = $q . $q_clause; 1405 $rs =& db_query( $database, $q ); 1406 $num =& db_num_rows( $database, $rs ); 1407 //$row = array(); 1408 1409 if( $num > 0 ) { 1410 1411 if( $selected != 'all' ) { 1412 print"<option value=all>". lang_get('all') ."</option>"; 1413 } 1414 1415 $row = db_fetch_array( $database, $rs ); 1416 1417 for($i=0; $i < sizeof( $row ); $i++) { 1418 1419 extract( $row[$i], EXTR_PREFIX_ALL, 'v' ); 1420 1421 $val = ${'v_' . $field}; 1422 1423 if( $val != '' ) { 1424 print"<option value='$val'>$val</option>"; 1425 } 1426 } 1427 1428 print"<option selected value='$selected'>$selected</option>"; 1429 1430 } 1431 else { # DISPLAY NOTHING IF THERE ARE NO BA_OWNERS 1432 print"<td class=center> </td>"; 1433 } 1434} 1435 1436 1437/* 1438# ---------------------------------------------------------------------------- 1439# This function will query a db, add a where clause to the query and print the result set in a list box 1440# INPUT: 1441# database you want to query 1442# table you want to query 1443# field you want to query 1444# the where condition ( a field name ) such as WHERE table_id = '' 1445# where_value - the value after the = in the where clause 1446# the selected value of the html ( not required ) 1447# COMMENTS: 1448# The function will eliminate duplicate entries from the list box and ignore blanks 1449# We may want to add a second field input which is optional $field2=null so that 1450# we could query for an id and name field using id as the option value 1451# and name as the display option. 1452# ----------------------------------------------------------------------------- 1453function html_print_list_box_with_where( &$database, $table, $field, $where_condition, $where_value, $selected=null ) { 1454 1455 $q = "SELECT DISTINCT $field FROM $table WHERE $where_condition = $where_value AND $field != ''"; 1456 print"$q<br>"; 1457 1458 # ALTER WHERE CLAUSE TO ELIMINATE DUPLICATE ENTRIES IN THE LIST BOX 1459 if( $selected == '' || $selected == 'all' ) { 1460 $q_clause = " ORDER BY $field"; 1461 } 1462 else { 1463 $q_clause = " AND $field != '$selected' ORDER BY $field"; 1464 } 1465 1466 # RUN QUERY 1467 $q = $q . $q_clause; 1468 $rs =& db_query( $database, $q ); 1469 $num = db_num_rows( $database, $rs ); 1470 //$row = array(); 1471 1472 if( $num > 0 ) { 1473 1474 if( $selected != 'all' ) { 1475 print"<option value=all>". lang_get('all') ."</option>"; 1476 } 1477 1478 $row = db_fetch_array( $database, $num, $rs ); 1479 1480 for($i=0; $i < sizeof( $row ); $i++) { 1481 1482 extract( $row[$i], EXTR_PREFIX_ALL, 'v' ); 1483 1484 $val = ${'v_' . $field}; 1485 1486 if( $val != '' ) { 1487 print"<option value='$val'>$val</option>"; 1488 } 1489 } 1490 1491 print"<option selected value='$selected'>$selected</option>"; 1492 1493 } 1494 else { # DISPLAY NOTHING IF THERE ARE NO BA_OWNERS 1495 print"<td class=center> </td>"; 1496 } 1497} 1498*/ 1499/* 1500# ---------------------------------------------------------------------- 1501# This function will query a db, join two tables and print the result set in a list box 1502# INPUT: 1503# $db - database you want to query 1504# $table1 - table you want to select from (combined with field to fetch the values) 1505# $table2 - table you want to join 1506# $field - value you want to return in the list box 1507# $join_field - field to join in the ON portion of the query ( this field is combined with table1 and table2 to create ON clause) 1508# $where_table - 1509# $where_field - These two values are joined to create the where condition 1510# $selected - The selected value 1511# $all - when set to true, all is added to list box 1512# ------------------------------------------------------------------------- 1513function html_print_list_box_with_join( &$database, $table1, $table2, $field, $join_field, $where_table, $where_field, $where_value, $project_id, $selected=null, $all=null ) { 1514 1515 1516 $db_project_id = PROJECT_ID; 1517 $f1 = $table1 .".". $field; 1518 $join1 = $table1 .".". $join_field; 1519 $join2 = $table2 .".". $join_field; 1520 $where_field = $where_table .".". $where_field; 1521 1522 $q = "SELECT DISTINCT $f1 FROM $table1 INNER JOIN $table2 ON $join1 = $join2 WHERE $where_field = '$where_value' AND $f1 != ''"; 1523 print"$q<br>"; 1524 1525 # ALTER WHERE CLAUSE TO ELIMINATE DUPLICATE ENTRIES IN THE LIST BOX 1526 if( $selected == '' || $selected == 'all' ) { 1527 $q_clause = " ORDER BY $field"; 1528 } 1529 else { 1530 $q_clause = " AND $field != '$selected' ORDER BY $field"; 1531 } 1532 1533 # RUN QUERY 1534 $q = $q . $q_clause; 1535 $rs =& db_query( $database, $q ); 1536 $num = db_num_rows( $database, $rs ); 1537 //$row = array(); 1538 if( $num > 0 ) { 1539 1540 if( $selected != 'all' && $all=='all' ) { 1541 print"<option value=all>". lang_get('all') ."</option>"; 1542 } 1543 1544 $row = db_fetch_array( $database, $num, $rs ); 1545 1546 for($i=0; $i < sizeof( $row ); $i++) { 1547 1548 extract( $row[$i], EXTR_PREFIX_ALL, 'v' ); 1549 1550 $val = ${'v_' . $field}; 1551 1552 if( $val != '' ) { 1553 print"<option value='$val'>$val</option>"; 1554 } 1555 } 1556 1557 print"<option selected value='$selected'>$selected</option>"; 1558 1559 } 1560 else { # DISPLAY NOTHING IF THERE ARE NO BA_OWNERS 1561 print"<td class=center> </td>"; 1562 } 1563} 1564*/ 1565 1566# ---------------------------------------------------------------------- 1567# Print option items using an indexed array. 1568# INPUT: 1569# $array_options - The <option> items 1570# e.g. array("Michael Daly", "Taylor Holbrook") 1571# $selected - The selected value(s) 1572# e.g. 1) 'Michael Daly' 1573# e.g. 2) array('Michael Daly', 'Taylor Holbrook') 1574# 1575# OUTPUT: 1576# e.g. 1) 1577# <option value='Michael Daly' selected>Michael Daly</option> 1578# <option value='Michael Daly'>Taylor Holbrook</option> 1579# 1580# NOTE: If this function does not do what you want it to, look at 1581# html_print_list_box_from_key_array 1582# ---------------------------------------------------------------------- 1583function html_print_list_box_from_array( $array_options, $selected='' ) { 1584 1585 foreach($array_options as $option) { 1586 1587 # if selected is an array of values 1588 if( is_array($selected) ) { 1589 # find out if this option is a selected value 1590 if ( util_array_value_search($option, $selected) ) { 1591 $selected_html = "selected"; 1592 } else { 1593 $selected_html = ""; 1594 } 1595 1596 # if selected is a single value 1597 } else { 1598 # find out if this option is a selected value 1599 if ($option == $selected) { 1600 $selected_html = "selected"; 1601 } else { 1602 $selected_html = ""; 1603 } 1604 } 1605 1606 print"<option value='$option' $selected_html>$option</option>\n"; 1607 } 1608} 1609 1610# ---------------------------------------------------------------------- 1611# Print option items using an associative array. 1612# INPUT: 1613# $array_options - The <option> items 1614# e.g. array("mdaly@liberty.com"=>"Michael Daly", "tholbrook@liberty.com"=>"Taylor Holbrook") 1615# $selected - The selected value(s) 1616# e.g. 1) 'mdaly@liberty.com' 1617# e.g. 2) array('mdaly@liberty.com', 'tholbrook@liberty.com') 1618# 1619# OUTPUT: 1620# e.g. 1) 1621# <option value='mdaly@liberty.com' selected>Michael Daly</option> 1622# <option value='tholbrook@liberty.com'>Taylor Holbrook</option> 1623# 1624# NOTE: If this function does not do what you want it to, look at 1625# html_print_list_box_from_array 1626# ---------------------------------------------------------------------- 1627function html_print_list_box_from_key_array( $array_options, $selected=null ) { 1628 1629 foreach($array_options as $option_value => $option_text) { 1630 1631 # if selected is an array of values 1632 if( is_array($selected) ) { 1633 1634 # find out if this option is a selected value 1635 if ( util_array_value_search($option_value, $selected) ) { 1636 $selected_html = "selected"; 1637 } else { 1638 $selected_html = ""; 1639 } 1640 1641 # if selected is a single value 1642 } else { 1643 # find out if this option is a selected value 1644 if( $option_value == $selected ) { 1645 $selected_html = "selected"; 1646 } else { 1647 $selected_html = ""; 1648 } 1649 } 1650 1651 print"<option value='$option_value' $selected_html>$option_text</option>\n"; 1652 } 1653} 1654 1655# ---------------------------------------------------------------------------- 1656# Prints the user rights options for a form select. 1657# ---------------------------------------------------------------------------- 1658function html_print_user_rights_list_box( $selected="" ) { 1659 1660 $user_rights_list_box = array( USER=>lang_get('user'), 1661 DEVELOPER=>lang_get('developer'), 1662 MANAGER=>lang_get('manager') ); 1663 1664 html_print_list_box_from_key_array( $user_rights_list_box, 1665 $selected ); 1666} 1667 1668# ---------------------------------------------------------------------------- 1669# Prints the table offset details including "showing records x - y", csv_url 1670# and "first, prev, 1 2 ... next last" 1671# If use_javascript is set then, the function is added to the onClick event of 1672# the a tags. 1673# ---------------------------------------------------------------------------- 1674function html_table_offset( $row_count, $per_page, $page_number, $order_by=null, $order_dir=null, $csv_url=null ) { 1675 1676 # First page number 1677 $page_one = 1; 1678 1679 # Make sure page count is at least 1 1680 $page_count = ceil($row_count / $per_page ); 1681 if( $page_count < 1 ) { 1682 $page_count = 1; 1683 } 1684 1685 # Set page_num = 1 in case the user hasn't yet chosen a page number 1686 if( empty($page_number) ) { 1687 $page_number = 1; 1688 } 1689 1690 # Make sure page_number isn't past the last page. 1691 if( $page_number > $page_count ) { 1692 $page_number = $page_count; 1693 } 1694 1695 # offset = (page number - 1) * records per page 1696 # if page number = 1, offset = 0, returning record 0 through 25 (page) 1697 # if page number = 2, offset = 25 1698 # if page number = 3, offset = 50 1699 $offset = ( ($page_number - 1) * $per_page ); 1700 1701 # Show the number of records displayed and the total number of records 1702 if( $row_count == '0' ) { 1703 return; 1704 1705 } else { 1706 $lower_count = $offset + 1; 1707 } 1708 1709 # upper count is the last record displayed on the page 1710 $upper_count = $offset + $per_page; 1711 $upper_count = ($upper_count > $row_count) ? $row_count : $upper_count; 1712 1713 $page_numbers_array = array(); 1714 $number_page_links_shown = 10; 1715 1716 # Calculate first and last pages 1717 $first_page_link_shown = max( $page_one, $page_number - $number_page_links_shown/2 ); 1718 $first_page_link_shown = min( $first_page_link_shown, $page_count - $number_page_links_shown ); 1719 $first_page_link_shown = max( $first_page_link_shown, $page_one ); 1720 $last_page_link_shown = $first_page_link_shown + $number_page_links_shown; 1721 $last_page_link_shown = min( $last_page_link_shown, $page_count ); 1722 1723 # Page numbers array 1724 for ( $i = $first_page_link_shown ; $i <= $last_page_link_shown ; $i++ ) { 1725 if ( $i == $page_number ) { 1726 array_push( $page_numbers_array, "<input type=submit name=page_number value=$i disabled class='page-numbers-disabled'>" ); 1727 } else { 1728 array_push( $page_numbers_array, "<input type=submit name=page_number value=$i class='page-numbers'>" ); 1729 } 1730 } 1731 1732 print"<input type=hidden name='order_dir' value='$order_dir'>\n"; 1733 print"<input type=hidden name='order_by' value='$order_by'>\n"; 1734 1735 print"<input type=hidden name=first_page_number value=1>\n"; 1736 print"<input type=hidden name=previous_page_number value=".($page_number-1).">\n"; 1737 print"<input type=hidden name=next_page_number value=".($page_number+1).">\n"; 1738 print"<input type=hidden name=last_page_number value=$page_count>\n"; 1739 print"<input type=hidden name=page_number value=$page_number>\n"; 1740 1741 print"<table class=hide100>\n"; 1742 print"<tr>\n"; 1743 1744 # Showing x - y of z 1745 print"<td class='left'>\n"; 1746 print"Showing $lower_count - $upper_count of $row_count\n"; 1747 print"</td>\n"; 1748 1749 1750 print"<td class='right'>\n"; 1751 echo"[\n"; 1752 1753 # First and previous links 1754 if ( 1 < $page_number ) { 1755 $disabled = "class='page-numbers'"; 1756 } else { 1757 $disabled = "disabled class='page-numbers-disabled'"; 1758 } 1759 echo"<input type=submit name=page_number value='".lang_get('first')."' $disabled >\n"; 1760 echo"<input type=submit name=page_number value='".lang_get('previous')."' $disabled >\n"; 1761 1762 # ... 1763 if ( $first_page_link_shown > 1 ) { 1764 echo( " ... " ); 1765 } 1766 1767 # Print page numbers 1768 echo "".implode( "\n", $page_numbers_array )."\n"; 1769 1770 # ... 1771 if ( $last_page_link_shown < $page_count ) { 1772 echo( " ... " ); 1773 } 1774 1775 # Next and last links 1776 if ( $page_number < $page_count ) { 1777 $disabled = "class='page-numbers'"; 1778 } else { 1779 $disabled = "disabled class='page-numbers-disabled'"; 1780 } 1781 echo"<input type=submit name=page_number value='".lang_get('next')."' $disabled>\n"; 1782 echo"<input type=submit name=page_number value='".lang_get('last')."' $disabled>\n"; 1783 1784 echo"]\n"; 1785 1786 echo"</td>\n"; 1787 echo"</tr>\n"; 1788 echo"</table>\n"; 1789} 1790 1791# ------------------------------------------------------------------------------------ 1792# Prints html for displaying file type icon 1793# ------------------------------------------------------------------------------------ 1794function html_file_type( $file_name ) { 1795 1796 $file_type = util_get_filetype( $file_name ); 1797 1798 switch($file_type) 1799 { 1800 case 'xls': 1801 return"<IMG SRC='". ICON_SRC . "/xls.jpg' alt='xls' title='microsoft excel document'>"; 1802 break; 1803 case 'doc': 1804 return"<IMG SRC='". ICON_SRC . "/doc.jpg' alt='doc' title='microsoft word document'>"; 1805 break; 1806 case 'txt': 1807 return"<IMG SRC='". ICON_SRC . "/file.gif' alt='txt' title='plain text file'>"; 1808 break; 1809 case 'rtf': 1810 return"<IMG SRC='". ICON_SRC . "/doc.jpg' alt='rtf' title='rich text document'>"; 1811 break; 1812 case 'pdf': 1813 return"<IMG SRC='". ICON_SRC . "/pdf.jpg' alt='pdf' title='pdf'>"; 1814 break; 1815 case 'html': 1816 return"<IMG SRC='". ICON_SRC . "/html.jpg' alt='html' title='html document'>"; 1817 break; 1818 case 'htm': 1819 return"<IMG SRC='". ICON_SRC . "/htm.jpg' alt='html' title='html document'>"; 1820 break; 1821 case 'jpg': 1822 return"<IMG SRC='". ICON_SRC . "/jpg.jpg' alt='jpg' title='jpg image'>"; 1823 break; 1824 case 'gif': 1825 return"<IMG SRC='". ICON_SRC . "/gif.jpg' alt='gif' title='gif image'>"; 1826 break; 1827 default: 1828 return" "; 1829 } 1830} 1831 1832# ------------------------------------------------------------------------------------ 1833# Returns html for displaying info icon 1834# ------------------------------------------------------------------------------------ 1835function html_info_icon( $text ) { 1836 1837 if( $text ) { 1838 return "<img src='images/info.gif' title=\"$text\" alt='Info'>"; 1839 } else { 1840 return " \n"; 1841 } 1842} 1843 1844# ------------------------------------------------------------------------------------ 1845# Prints the html for the no records found message 1846# ------------------------------------------------------------------------------------ 1847function html_no_records_found_message( $message ) { 1848 1849 print"<div class=center>\n"; 1850 print"<table class=hide100>\n"; 1851 print"<tr>\n"; 1852 print"<td>$message</td>\n"; 1853 print"</tr>\n"; 1854 print"</table>\n"; 1855 print"</div>\n"; 1856 1857} 1858 1859#------------------------------------------------------------------------------------------ 1860# Prints all html including <html>, <head> and <body> tags, with an operation successful 1861# message in the body. 1862# 1863# INPUT: 1864# page title 1865# redirect page 1866# OUTPUT: 1867# Entire html page with redirect 1868#------------------------------------------------------------------------------------------ 1869function html_print_operation_successful( $page_title, $redirect_page ) { 1870 1871 global $db; 1872 1873 1874 $s_project_properties = session_get_project_properties(); 1875 $project_name = $s_project_properties['project_name']; 1876 1877 html_window_title(); 1878 html_print_body(); 1879 global $project_id; 1880 if ($project_id!=0) $project_name=project_get_name($project_id); else $project_name=$s_project_properties['project_name']; 1881 html_page_title($project_name ." - ". lang_get($page_title) ); 1882 html_page_header( $db, $project_name ); 1883 html_print_menu(); 1884 print"<div class=operation-successful>".lang_get('operation_successful')."<br/><br/><a href='".$redirect_page."'>Continue</a></div>"; 1885 html_print_footer(); 1886 html_redirect($redirect_page); 1887 exit; 1888} 1889 1890 1891 1892#------------------------------------------------------------------------------------------ 1893# Prints all html including <html>, <head> and <body> tags, with an operation failed 1894# message in the body. 1895# 1896# INPUT: 1897# page title 1898# redirect page 1899# OUTPUT: 1900# Entire html page with redirect 1901#------------------------------------------------------------------------------------------ 1902function html_print_operation_failed( $page_title, $message,$redirect_page ) { 1903 1904 global $db; 1905 1906 1907 $s_project_properties = session_get_project_properties(); 1908 $project_name = $s_project_properties['project_name']; 1909 1910 html_window_title(); 1911 html_print_body(); 1912 html_page_title($project_name ." - ". lang_get($page_title) ); 1913 html_page_header( $db, $project_name ); 1914 html_print_menu(); 1915 print"<div class=operation-successful>".lang_get('operation_failed')."<br/><p class=error>".$message."</p><br/><br/><a href='".$redirect_page."'>Continue</a></div>"; 1916 html_print_footer(); 1917 exit; 1918} 1919 1920#------------------------------------------------------------------------------------------ 1921# Prints a road map of where the user is in relation to other release pages. 1922# The function will loop through an array, format and print out the keys in the same order. 1923# 1924# A case can be provided in the switch statement to custom format certain keys, i.e. adding 1925# a hyperlink to a key. 1926# 1927# INPUT: 1928# Array of keys 1929# OUTPUT: 1930# Formatted html roadmap map of where the current pageis in relation to other pages. 1931#------------------------------------------------------------------------------------------ 1932function html_release_map( $map ) { 1933 $release_properties = session_get_properties("release"); 1934 1935 $html_top_row = "<tr>\n"; 1936 $html_bottom_row = "<tr>\n"; 1937 1938 foreach($map as $key) { 1939 switch($key) { 1940 case "release_link": 1941 $release_name = admin_get_release_name($release_properties['release_id']); 1942 1943 $html_top_row .= "<td class='sub_menu' nowrap>"; 1944 $html_top_row .= "<b><a href=project_manage_release_page.php>". lang_get( 'release_name' ) ."</a></b>"; 1945 $html_top_row .= "</td>\n"; 1946 1947 $html_bottom_row .= "<td class='sub_menu' nowrap>"; 1948 $html_bottom_row .= "$release_name"; 1949 $html_bottom_row .= "</td>\n"; 1950 break; 1951 case "build_link": 1952 $build_name = admin_get_build_name($release_properties['build_id']); 1953 1954 $html_top_row .= "<td class='sub_menu' nowrap>"; 1955 $html_top_row .= "<b><a href=build_page.php>". lang_get( 'build_name' ) ."</a></b>"; 1956 $html_top_row .= "</td>\n"; 1957 1958 $html_bottom_row .= "<td class='sub_menu' nowrap>"; 1959 $html_bottom_row .= "$build_name"; 1960 $html_bottom_row .= "</td>\n"; 1961 break; 1962 case "testset_link": 1963 $testset_name = admin_get_testset_name($release_properties['testset_id']); 1964 1965 $html_top_row .= "<td class='sub_menu' nowrap>"; 1966 $html_top_row .= "<b><a href=testset_page.php>". lang_get( 'testset_name' ) ."</a></b>"; 1967 $html_top_row .= "</td>\n"; 1968 1969 $html_bottom_row .= "<td class='sub_menu' nowrap>"; 1970 $html_bottom_row .= "$testset_name"; 1971 $html_bottom_row .= "</td>\n"; 1972 break; 1973 case "copy_testset_link": 1974 $testset_name = admin_get_testset_name($release_properties['testset_id']); 1975 1976 $html_top_row .= "<td class='sub_menu' rowspan=2 nowrap>"; 1977 $html_top_row .= "<b><a href=testset_page.php>". lang_get( 'copy_testset_to' ) ."</a></b>"; 1978 $html_top_row .= "</td>\n"; 1979 1980 $html_bottom_row .= "<td></td>\n"; 1981 1982 break; 1983 default: 1984 1985 $html_top_row .= "<td class='sub_menu' nowrap><b>$key</b></td>\n"; 1986 1987 $html_bottom_row .= "<td></td>\n"; 1988 1989 } 1990 1991 $html_top_row .= "<td class='sub_menu' rowspan=2 nowrap> </td>\n"; 1992 } 1993 1994 $html_top_row .= "</tr>\n"; 1995 $html_bottom_row .= "</tr>\n"; 1996 1997 print"<br/><table width=1 cellspacing=2>\n"; 1998 print$html_top_row; 1999 print$html_bottom_row; 2000 print"</table>\n"; 2001} 2002 2003/* 2004 2005function html_release_map( $map ) { 2006 $release_properties = session_get_properties("release"); 2007 2008 $html = "<table>\n"; 2009 $html .= "<tr>\n"; 2010 $html .= "<td>\n"; 2011 2012 foreach($map as $key) { 2013 switch($key) { 2014 case "release_link": 2015 $release_name = admin_get_release_name($release_properties['release_id']); 2016 2017 $html .= "<table align=left>\n"; 2018 $html .= "<tr>\n"; 2019 $html .= "<td class='sub_menu' nowrap>\n"; 2020 $html .= "<b><a href=release_page.php>". lang_get( 'release_name' ) ."</a></b>\n"; 2021 $html .= "</td>\n"; 2022 $html .= "</tr>\n"; 2023 $html .= "<tr>\n"; 2024 $html .= "<td class='sub_menu' nowrap>\n"; 2025 $html .= "$release_name\n"; 2026 $html .= "</td>\n"; 2027 $html .= "</tr>\n"; 2028 $html .= "</table>\n"; 2029 break; 2030 case "build_link": 2031 $build_name = admin_get_build_name($release_properties['build_id']); 2032 2033 $html .= "<table align=left>\n"; 2034 $html .= "<tr>\n"; 2035 $html .= "<td class='sub_menu' nowrap>\n"; 2036 $html .= "<b><a href=build_page.php>". lang_get( 'build_name' ) ."</a></b>\n"; 2037 $html .= "</td>\n"; 2038 $html .= "</tr>\n"; 2039 $html .= "<tr>\n"; 2040 $html .= "<td class='sub_menu' nowrap>\n"; 2041 $html .= "$build_name\n"; 2042 $html .= "</td>\n"; 2043 $html .= "</tr>\n"; 2044 $html .= "</table>\n"; 2045 break; 2046 case "testset_link": 2047 $testset_name = admin_get_testset_name($release_properties['testset_id']); 2048 2049 $html .= "<table align=left>\n"; 2050 $html .= "<tr>\n"; 2051 $html .= "<td class='sub_menu' nowrap>\n"; 2052 $html .= "<b><a href=testset_page.php>". lang_get( 'testset_name' ) ."</a></b>\n"; 2053 $html .= "</td>\n"; 2054 $html .= "</tr>\n"; 2055 $html .= "<tr>\n"; 2056 $html .= "<td class='sub_menu' nowrap>\n"; 2057 $html .= "$testset_name\n"; 2058 $html .= "</td>\n"; 2059 $html .= "</tr>\n"; 2060 $html .= "</table>\n"; 2061 break; 2062 case "copy_testset_link": 2063 $testset_name = admin_get_testset_name($release_properties['testset_id']); 2064 2065 $html .= "<table align=left>\n"; 2066 $html .= "<tr>\n"; 2067 $html .= "<td class='sub_menu' rowspan=2 nowrap>\n"; 2068 $html .= "<b><a href=testset_page.php>". lang_get( 'copy_testset_to' ) ."</a></b>\n"; 2069 $html .= "</td>\n"; 2070 $html .= "</tr>\n"; 2071 $html .= "</table>\n"; 2072 break; 2073 default: 2074 $html .= "<table align=left>\n"; 2075 $html .= "<tr>\n"; 2076 $html .= "<td class='sub_menu' nowrap><b>$key</b></td>\n"; 2077 $html .= "</tr>\n"; 2078 $html .= "</table>\n"; 2079 } 2080 } 2081 2082 $html .= "</td>\n"; 2083 $html .= "</tr>\n"; 2084 $html .= "</table>\n"; 2085 2086 print $html; 2087 2088*/ 2089 2090function html_project_manage_map( $map ) { 2091 2092 $release_properties = session_get_properties("project_manage"); 2093 $project_manage = session_get_properties('project_manage'); 2094 2095 $html = "<table>\n"; 2096 $html .= "<tr>\n"; 2097 $html .= " <td>\n"; 2098 2099 foreach($map as $key) { 2100 2101 $hyperlink = ""; 2102 2103 switch($key) { 2104 case"project_manage_link": 2105 $hyperlink = "project_manage_page.php"; 2106 $text = project_get_name($project_manage['project_id']); 2107 break; 2108 case"area_tested_link": 2109 $hyperlink = "project_manage_areatested_page.php"; 2110 $text = lang_get('area_tested'); 2111 break; 2112 case"environment_link": 2113 $hyperlink = "project_manage_environment_page.php"; 2114 $text = lang_get('environment'); 2115 break; 2116 case"machine_link": 2117 $hyperlink = "project_manage_machines_page.php"; 2118 $text = lang_get('machine'); 2119 break; 2120 case"reqareacovered_link": 2121 $hyperlink = "project_manage_reqareacovered_page.php"; 2122 $text = lang_get('req_area_covered'); 2123 break; 2124 case"reqdoctype_link": 2125 $hyperlink = "project_manage_reqdoctype_page.php"; 2126 $text = lang_get('req_doc_type'); 2127 break; 2128 case"reqfunctionality_link": 2129 $hyperlink = "project_manage_reqfunctionality_page.php"; 2130 $text = lang_get('req_functionality'); 2131 break; 2132 case"testdoctype_link": 2133 $hyperlink = "project_manage_testdoctype_page.php"; 2134 $text = lang_get('test_doc_type'); 2135 break; 2136 case"testtype_link": 2137 $hyperlink = "project_manage_testtype_page.php"; 2138 $text = lang_get('testtype'); 2139 break; 2140 case"bug_category_link": 2141 $hyperlink = "project_manage_bug_category_page.php"; 2142 $text = lang_get('bug_category'); 2143 break; 2144 case"bug_component_link": 2145 $hyperlink = "project_manage_bug_component_page.php"; 2146 $text = lang_get('bug_component'); 2147 break; 2148 } 2149 2150 if($hyperlink) { 2151 2152 $html .= "<table align=left>\n"; 2153 $html .= "<tr>\n"; 2154 $html .= "<td class='sub_menu' nowrap><b><a href='$hyperlink'>$text</a></b></td>\n"; 2155 $html .= "</tr>\n"; 2156 $html .= "</table>\n"; 2157 } else { 2158 2159 $html .= "<table align=left>\n"; 2160 $html .= "<tr>\n"; 2161 $html .= "<td class='sub_menu' nowrap><b>$key</b></td>\n"; 2162 $html .= "</tr>\n"; 2163 $html .= "</table>\n"; 2164 } 2165 } 2166 2167 $html .= " </td>\n"; 2168 $html .= "</tr>\n"; 2169 $html .= "</table>\n"; 2170 2171 print $html; 2172} 2173 2174function html_print_tabs($tabs, $selected_tab) { 2175 2176 $i = 1; 2177 2178/* 2179 print"<table class=hide100>\n"; 2180 print"<tr>\n"; 2181 foreach($tabs as $key => $value) { 2182 if($i!=$selected_tab) { 2183 print"<td><a href='$value'>$key</a></td>\n"; 2184 } else { 2185 print"<td>$key</td>\n"; 2186 } 2187 $i++; 2188 } 2189 print"</tr>\n"; 2190 print"</table>\n"; 2191*/ 2192 foreach($tabs as $key => $value) { 2193 if($i!=$selected_tab) { 2194 print"<a href='$value'>$key</a>"; 2195 } else { 2196 print"$key"; 2197 } 2198 2199 if($i!=sizeof($tabs)) { 2200 print" | "; 2201 } 2202 $i++; 2203 } 2204} 2205 2206 2207# display's a dynamic tree with +/- boxes to expand/collapse the nodes 2208# 2209# $session_variable 2210# name of the session variable used to store the expanded nodes 2211# $tree_array 2212# the tree data structure 2213# $root_node 2214# first node from which all others in $tree_array stem from 2215function html_dynamic_tree( $session_variable, $tree_array, $root_node, $highlighted=null, $column_map=array() ) { 2216 2217 # Get the expanded tree array from the session 2218 $s_display_options = session_get_display_options($session_variable); 2219 $expanded = $s_display_options["filter"]["tree"]; 2220 2221 # Add expanded node (if there is one) 2222 if( isset($_GET['expand']) ) { 2223 2224 $expanded[] = $_GET['expand']; 2225 } 2226 2227 # Remove collapsed node (if there is one) 2228 if( isset($_GET['collapse']) ) { 2229 2230 $expanded = array_diff( $expanded, array($_GET['collapse']) ); 2231 } 2232 2233 # Create variable to update the session 2234 $update_expanded = array("tree"=>$expanded); 2235 2236 # Update the tree variable in the session and get the returned value 2237 $s_display_options = session_set_display_options($session_variable, $update_expanded); 2238 $expanded = $s_display_options["filter"]["tree"]; 2239 2240 global $db; 2241 2242 # images html 2243 $img_tree_T = "<img align='absmiddle' border=0 src='".IMG_SRC."tree_dots_t.gif' alt=''>"; 2244 $img_tree_L = "<img align='absmiddle' border=0 src='".IMG_SRC."tree_dots_l.gif' alt=''>"; 2245 $img_tree_column = "<img align='absmiddle' border=0 src='".IMG_SRC."tree_dots_column.gif' alt=''>"; 2246 $img_tree_plus = "<img align='absmiddle' border=0 src='".IMG_SRC."tree_dots_plus.gif' alt=''>"; 2247 $img_tree_plus_b = "<img align='absmiddle' border=0 src='".IMG_SRC."tree_dots_plus_b.gif' alt=''>"; 2248 $img_tree_minus = "<img align='absmiddle' border=0 src='".IMG_SRC."tree_dots_minus.gif' alt=''>"; 2249 $img_tree_minus_b = "<img align='absmiddle' border=0 src='".IMG_SRC."tree_dots_minus_b.gif' alt=''>"; 2250 $img_tree_folder = "<img align='absmiddle' border=0 src='".IMG_SRC."tree_folder.gif' alt=''>"; 2251 $img_tree_folder_b = "<img align='absmiddle' border=0 src='".IMG_SRC."tree_folder_b.gif' alt=''>"; 2252 2253 $img_spacer = "<img align='absmiddle' border=0 src='".IMG_SRC."1px_transparent.gif' width=15 height=1 alt=''>"; 2254 2255 $column = $img_tree_column.$img_spacer; 2256 2257 # display each child node 2258 for( $i=0; $i<sizeof($tree_array); $i++ ) { 2259 2260 $req_id = $tree_array[$i]['uid']; 2261 2262 echo$img_spacer; 2263 2264 foreach($column_map as $column_type) { 2265 2266 if($column_type=="|") { 2267 2268 echo$column; 2269 } elseif($column_type==" ") { 2270 2271 echo$img_spacer; 2272 } 2273 } 2274 2275 2276/* if( $i == 0 && $i != sizeof($tree_array)-1 && empty($tree_array[$i]["children"]) ) // echo ""; 2277 echo $img_tree_T; 2278 // first & not last & no childs 2279 */ 2280 2281 # if the last node 2282 if( $i == sizeof($tree_array)-1 ) { 2283 2284 # if the last node has no children 2285 if( empty($tree_array[$i]["children"]) ) { 2286 2287 echo $img_tree_L; 2288 2289 # if the last node has children 2290 } else { 2291 2292 # if last node has children and the node is in the expanded array 2293 if( util_array_value_search($req_id, $expanded) ) { 2294 if(!empty($_GET['req_id']) && $_GET['req_id']==$req_id) 2295 echo"<a class='selected' href='?collapse=$req_id#$req_id'>".$img_tree_minus_b.$img_tree_folder_b."</a>"; 2296 else 2297 echo"<a href='?collapse=$req_id#$req_id'>".$img_tree_minus_b.$img_tree_folder_b."</a>"; 2298 2299 # if last node has children and the node is not in the expanded array 2300 } else { 2301 2302 if(!empty($_GET['req_id']) && $_GET['req_id']==$req_id) echo"<a class='selected' href='?expand=$req_id#$req_id'>".$img_tree_plus_b.$img_tree_folder."</a>"; 2303 else 2304 echo"<a href='?expand=$req_id#$req_id'>".$img_tree_plus_b.$img_tree_folder."</a>"; 2305 } 2306 } 2307 2308 $column_type = array(" "); 2309 2310 # if not the last node 2311 } else { 2312 2313 # if not the last node and the node has no children 2314 if( empty($tree_array[$i]["children"]) ) { 2315 echo $img_tree_T; 2316 } else { 2317 2318 # if not the last node and the node is in the expanded array 2319 if( util_array_value_search($req_id, $expanded) ) { 2320 2321 echo"<a href='?collapse=$req_id#$req_id'>".$img_tree_minus.$img_tree_folder_b."</a>"; 2322 2323 # if not the last node and the node is not in the expanded array 2324 } else { 2325 2326 echo"<a href='?expand=$req_id#$req_id'>".$img_tree_plus.$img_tree_folder."</a>"; 2327 } 2328 } 2329 2330 $column_type = array("|"); 2331 } 2332 2333 # prints a closed folder if node has no children and $root_node is set to true 2334 if( empty($tree_array[$i]["children"]) && $tree_array[$i]["requirement"]) { 2335 echo $img_tree_folder; 2336 } 2337 2338 # formatting for highlighted node 2339 $style=""; 2340 2341 if($req_id==$highlighted) { 2342 2343 $style="style='font-weight: bold; font-size: 120%;'"; 2344 } 2345 2346 # print the node name 2347 if ($tree_array[$i]["requirement"]) { 2348 2349 global $s_req_id; 2350 if((!empty($_GET['req_id']) && $_GET['req_id']==$req_id) || (!empty($s_req_id) && $req_id==$s_req_id)) 2351 echo" <a $style class='selected' name=$req_id href='requirement_detail_page.php?req_id=$req_id'>".$tree_array[$i]['name']."</a>"; 2352 else 2353 echo" <a $style name=$req_id href='requirement_detail_page.php?req_id=$req_id'>".$tree_array[$i]['name']."</a>"; 2354 } 2355 else { 2356 global $s_test_details; 2357 if((!empty($_GET['test_id']) && $_GET['test_id']==$req_id) || (!empty($s_test_details['test_id']) && $req_id==$s_test_details['test_id'])) 2358 echo" <a $style class='selected' style='color:#08398F' name=$req_id href='test_detail_page.php?test_id=$req_id'>".$tree_array[$i]['name']."</a>"; 2359 else 2360 echo" <a $style name=$req_id href='test_detail_page.php?test_id=$req_id' style='color:#08398F'>".$tree_array[$i]['name']."</a>"; 2361 } 2362 2363 echo"<br>\n"; 2364 2365 # display this nodes children 2366 if( util_array_value_search($req_id, $expanded) ) { 2367 2368 html_dynamic_tree( $session_variable, $tree_array[$i]['children'], false, $highlighted, array_merge($column_map, $column_type) ); 2369 } 2370 } 2371} 2372 2373#------------------------------------------------------------------------------------------ 2374# Prints the filter at the top of the requirements page. 2375# INPUT: 2376# all the possible values that a user can filter on 2377# OUTPUT: 2378# The requirements filter form 2379#------------------------------------------------------------------------------------------ 2380function html_print_requirements_filter( $project_id, 2381 $filter_doc_type, 2382 $filter_status, 2383 $filter_area_covered, 2384 $filter_functionality, 2385 $filter_assign_release, 2386 $filter_per_page=null, 2387 $filter_show_versions=null, 2388 $filter_search, 2389 $filter_priority, 2390 $filter_req_id=null, 2391 $filter_usecase_id=null ) { 2392 print"<table class=width100>\n"; 2393 print"<tr>\n"; 2394 print"<td>\n"; 2395 print"<table class=inner rules=none border=0>\n"; 2396 2397 # TITLES FOR HEADER DIALOG - second row 2398 print"<tr>"; 2399 2400 print"<td class=form-header-c>". lang_get('req_doc_type') ."</td>\n"; 2401 print"<td class=form-header-c>". lang_get('status') ."</td>\n"; 2402 2403 2404/* 2405 if( !is_null($filter_show_versions) ) { 2406 # SHOW VERSIONS 2407 print"<td class='left' rowspan=4>\n"; 2408 print"<input id=all_versions type='radio' name='show_versions' value='all' ".($filter_show_versions=="all"?"checked":"").">"; 2409 print"<label for=all_versions>".lang_get("all_versions")."</label><br>\n"; 2410 2411 print"<input id=latest_version type='radio' name='show_versions' value='latest' ".($filter_show_versions=="latest"?"checked":"").">"; 2412 print"<label for=latest_version>".lang_get("latest_version")."</label>\n"; 2413 print"</td>\n"; 2414 2415 //print"<td> </td>\n"; 2416 2417 } 2418*/ 2419 print"<td class=form-header-c>". lang_get('req_area') ."</td>\n"; 2420 print"<td class=form-header-c>". lang_get('functionality') ."</td>\n"; 2421 print"<td class=form-header-c>". lang_get('req_assign_release') ."</td>\n"; 2422 print"<td class=form-header-c>". lang_get('req_priority') ."</td>\n"; 2423 print"<td class=form-header-c>". lang_get('req_parent') ."</td>\n"; 2424/* 2425 if(!is_null($filter_per_page) ) { 2426 2427 print"<td class=form-header-c>". lang_get('show') ."</td>\n"; 2428 } 2429*/ 2430 print"<td class=form-header-c>". lang_get('search') ."</td>\n"; 2431 print"<td class=form-header-c></td>\n"; 2432 2433 /* 2434 if( !is_null($filter_show_versions) ) { 2435 # SHOW VERSIONS 2436 print"<td class='left' rowspan=4>\n"; 2437 print"<input id=all_versions type='radio' name='show_versions' value='all' ".($filter_show_versions=="all"?"checked":"").">"; 2438 print"<label for=all_versions>".lang_get("all_versions")."</label><br>\n"; 2439 2440 print"<input id=latest_version type='radio' name='show_versions' value='latest' ".($filter_show_versions=="latest"?"checked":"").">"; 2441 print"<label for=latest_version>".lang_get("latest_version")."</label>\n"; 2442 print"</td>\n"; 2443 2444 //print"<td> </td>\n"; 2445 2446 } 2447 */ 2448 print"</tr>"; 2449 2450 2451 # FUNCTIONALITY 2452 print"<tr>"; 2453 2454 # DOC TYPE 2455 print"<td align='center'>\n"; 2456 print"<select name='doc_type'>\n"; 2457 html_print_list_box_from_key_array( requirement_get_types($project_id, $blank=true), 2458 $selected=$filter_doc_type ); 2459 print"</select>\n"; 2460 print"</td>\n"; 2461 2462 2463 print"<td align='center'>\n"; 2464 print"<select name='status'>\n"; 2465 html_print_list_box_from_array( requirement_get_distinct_field($project_id, REQ_VERS_STATUS, $blank=true), 2466 $selected=$filter_status ); 2467 print"</select>\n"; 2468 print"</td>\n"; 2469 2470 # AREA COVERED 2471 print"<td align='center'>\n"; 2472 print"<select name='area_covered'>\n"; 2473 html_print_list_box_from_key_array( requirement_get_areas($project_id, $blank=true), 2474 $selected=$filter_area_covered ); 2475 print"</select>\n"; 2476 print"</td>\n"; 2477 2478 $functions = requirement_get_functionality($project_id); 2479 $functions[""] = ""; 2480 print"<td align='center'>\n"; 2481 print"<select name='functionality'>\n"; 2482 html_print_list_box_from_key_array( $functions, $selected=$filter_functionality ); 2483 print"</select>\n"; 2484 print"</td>\n"; 2485 2486 # ASSIGNED TO RELEASE 2487 print"<td align='center'>\n"; 2488 print"<select name='assign_release'>\n"; 2489 $rows_releases = requirement_get_all_assoc_releases($project_id, $blank=true); 2490 html_print_list_box_from_key_array( $rows_releases,$selected=$filter_assign_release ); 2491 print"</select>\n"; 2492 print"</td>\n"; 2493 2494 # PRIORITY 2495 print"<td align='center'>\n"; 2496 print"<select name='priority'>\n"; 2497 $rows_priority = requirement_get_priority(); 2498 html_print_list_box_from_array( $rows_priority, $selected=$filter_priority ); 2499 print"</select>\n"; 2500 print"</td>\n"; 2501 2502 # REQ_PARENT 2503 print"<td align='center'>\n"; 2504 print"<select name='filter_req'>\n"; 2505 if ($filter_req_id==null) $filter_req_id=0; 2506 $rows = requirement_get_relationships($filter_req_id); 2507// $rows=array_merge(array(REQ_ID => 0, REQ_FILENAME => "-"),$rows); 2508 $parent=$filter_req_id; 2509 $parent_name=''; 2510 if ($parent!=0) { 2511 $parent_name=requirement_get_name($parent); 2512 echo '<option value="'.$parent.'" selected>'.$parent_name.'</option>'; 2513 } 2514 echo '<option value="0"></option>'; 2515 foreach($rows as $row) { 2516 if (count(requirement_get_relationships($row[REQ_ID]))>0) echo '<option value="'.$row[REQ_ID].'">'.$row[REQ_FILENAME].'</option>'; 2517 } 2518 2519 print"</select>\n"; 2520 print"</td>\n"; 2521 2522/* if( !is_null($filter_per_page) ) { 2523 # PER PAGE 2524 print"<td align='center'>\n"; 2525 print"<input type='text' size='3' maxlength='3' name='per_page' value='$filter_per_page'>\n"; 2526 print"</td>\n"; 2527 } 2528*/ # SEARCH 2529 print"<td align='center'>\n"; 2530 print"<input type='text' size='15' maxlength='25' name='requirement_search' value='" . $filter_search . "'>\n"; 2531 print"</td>\n"; 2532 2533 print"<td align='center' rowspan=4><input type='submit' value='Filter'></td>\n"; 2534 2535 2536 2537 print"</tr>"; 2538 2539 2540 2541 print"</table>\n"; 2542 print"</td>\n"; 2543 print"</tr>\n"; 2544 print"</table>\n"; 2545 2546} 2547 2548#------------------------------------------------------------------------------------------ 2549# Prints the filter at the top of the test page. 2550# INPUT: 2551# all the possible values that a user can filter on 2552# OUTPUT: 2553# The test filter form 2554#------------------------------------------------------------------------------------------ 2555function html_print_tests_filter( $project_id, 2556 $filter_manual_auto, 2557 $filter_test_type, 2558 $filter_ba_owner, 2559 $filter_qa_owner, 2560 $filter_tester, 2561 $filter_area_tested, 2562 $filter_test_status=null, 2563 $filter_per_page, 2564 $filter_search,$filter_show_withreqs) { 2565 2566 2567 print"<table class=width100>\n"; 2568 print"<tr>\n"; 2569 print"<td>\n"; 2570 print"<table class=inner rules=none border=0>\n"; 2571 2572 # TITLES FOR HEADER DIALOG 2573 print"<tr class=left>\n"; 2574// print"<td class=form-header-c>". lang_get('man_auto') ."</td>\n"; 2575// print"<td class=form-header-c>". lang_get('tester') ."</td>\n"; 2576 2577 if( !is_null($filter_test_status) ) { 2578 print"<td class=form-header-c>". lang_get('test_status') ."</td>\n"; 2579 } 2580 print"<td class=form-header-c>". lang_get('show') ."</td>\n"; 2581 print"<td class=form-header-c>". lang_get('search') ."</td>\n"; 2582 2583 print"<td> </td>\n"; 2584 print"</tr>\n"; 2585 2586 print"<tr>\n"; 2587 2588 2589 print"<td class='left' rowspan=4>\n"; 2590 print"<input id=show_withreqs type='radio' style='display:inline;width:10px;height:10px;' name='test_withreqs' value='yes' ".($filter_show_withreqs=="yes"?"checked":"").">"; 2591 print"<label for=show_withreqs>".lang_get("show_withreqs")."</label><br>\n"; 2592 2593 print"<input id=show_withoutreqs type='radio' style='display:inline;width:10px;height:10px;' name='test_withreqs' value='no' ".($filter_show_withreqs=="no"?"checked":"").">"; 2594 print"<label for=show_withoutreqs>".lang_get("show_withoutreqsonly")."</label>\n"; 2595 print"</td>\n"; 2596 2597 # TEST STATUS 2598 print"<td align='center'>\n"; 2599 print"<select name='test_status'>\n"; 2600 $test_status = test_get_test_value($project_id, TEST_STATUS, $blank=true); 2601 html_print_list_box_from_array( $test_status, $filter_test_status ); 2602 print"</select>\n"; 2603 print"</td>\n"; 2604 # PER PAGE 2605 print"<td align='center'>\n"; 2606 print"<input type='text' size='3' maxlength='3' name='per_page' value='" . $filter_per_page . "'>\n"; 2607 print"</td>\n"; 2608 # SEARCH 2609 print"<td align='center'>\n"; 2610 print"<input type='text' size='15' maxlength='25' name='test_search' value='" . $filter_search . "'>\n"; 2611 print"</td>\n"; 2612 2613 print"<td align='center'><input type='submit' value='Filter'></td>\n"; 2614 print"</tr>\n"; 2615 2616 2617 print"<tr>"; 2618 2619 print"</tr>"; 2620 2621 print"<tr>"; 2622 2623 2624 print"</tr>\n"; 2625 2626 print"</table>"; 2627 print"<input type=hidden name=test_form_filter_value value=true>\n"; 2628 print"</td>\n"; 2629 print"</tr>\n"; 2630 print"</table>\n"; 2631 2632} 2633 2634#------------------------------------------------------------------------------------------ 2635# Prints the filter at the top of the bug page. 2636# INPUT: 2637# all the possible values that a user can filter on 2638# OUTPUT: 2639# The bug filter form 2640#------------------------------------------------------------------------------------------ 2641function html_print_bug_filter( $project_id, $filter_bug_status, $filter_bug_category, 2642 $filter_bug_component, $filter_reported_by, $filter_assigned_to, $filter_assigned_to_developer, $filter_found_in_rel, $filter_assigned_to_rel, $filter_per_page, $filter_view_closed, $filter_search, $filter_jump ) { 2643 2644 2645 print"<table class=width100>\n"; 2646 print"<tr>\n"; 2647 print"<td>\n"; 2648 print"<table class=inner rules=none border=0>\n"; 2649 2650 # TITLES FOR HEADER DIALOG 2651 print"<tr class=left>\n"; 2652 print"<td class=form-header-c>". lang_get('reported_by') ."</td>\n"; 2653 print"<td class=form-header-c>". lang_get('assigned_to') ."</td>\n"; 2654 print"<td class=form-header-c>". lang_get('assigned_to_developer') ."</td>\n"; 2655 print"<td class=form-header-c>". lang_get('found_in_release') ."</td>\n"; 2656 print"<td class=form-header-c>". lang_get('assigned_to_release') ."</td>\n"; 2657 print"<td class=form-header-c>". lang_get('show') ."</td>\n"; 2658 print"<td> </td>\n"; 2659 print"</tr>\n"; 2660 2661 # REPORTED BY - all users 2662 print"<td align='center'>\n"; 2663 print"<select name='reported_by'>\n"; 2664 $reported_by = user_get_usernames_by_project($project_id, $blank=true); 2665 html_print_list_box_from_array( $reported_by, $filter_reported_by ); 2666 print"</select>\n"; 2667 print"</td>\n"; 2668 2669 # ASSIGNED TO - all users?? or all users with bug_assign_status 2670 print"<td align='center'>\n"; 2671 print"<select name='assigned_to'>\n"; 2672 $assigned_to = user_get_usernames_by_project($project_id, $blank=true); 2673 html_print_list_box_from_array( $assigned_to, $filter_assigned_to ); 2674 print"</select>\n"; 2675 print"</td>\n"; 2676 2677 # ASSIGNED TO DEVELOPER 2678 print"<td align='center'>\n"; 2679 print"<select name='assigned_to_developer'>\n"; 2680 $assigned_to_developer = user_get_usernames_by_project($project_id, $blank=true); 2681 html_print_list_box_from_array( $assigned_to_developer, $filter_assigned_to_developer ); 2682 print"</select>\n"; 2683 print"</td>\n"; 2684 2685 # FOUND IN RELEASE 2686 print"<td align='center'>\n"; 2687 print"<select name='found_in_release'>\n"; 2688 $found_in_release = admin_get_all_release_names( $project_id, $blank=true ); 2689 html_print_list_box_from_array( $found_in_release, $filter_found_in_rel ); 2690 print"</select>\n"; 2691 print"</td>\n"; 2692 2693 # ASSIGNED TO RELEASE 2694 print"<td align='center'>\n"; 2695 print"<select name='assigned_to_release'>\n"; 2696 $assigned_to_release = admin_get_all_release_names( $project_id, $blank=true ); 2697 html_print_list_box_from_array( $assigned_to_release, $filter_assigned_to_rel ); 2698 print"</select>\n"; 2699 print"</td>\n"; 2700 2701 # PER PAGE 2702 print"<td align='center'>\n"; 2703 print"<input type='text' size='3' maxlength='3' name='per_page' value='" . $filter_per_page . "'>\n"; 2704 print"</td>\n"; 2705 2706 print"<td align='center' rowspan=4 valign=center><input type='submit' value='Filter'></td>\n"; 2707 print"</tr>\n"; 2708 2709 2710 # SECOND ROW OF FILTERS 2711 print"<tr class='left'>\n"; 2712 print"<td class=form-header-c>". lang_get('bug_status') ."</td>\n"; 2713 print"<td class=form-header-c>". lang_get('bug_category') ."</td>\n"; 2714 print"<td class=form-header-c>". lang_get('bug_component') ."</td>\n"; 2715 print"<td class=form-header-c>". lang_get('view_closed') ."</td>\n"; 2716 print"<td class=form-header-c>". lang_get('search') ."</td>\n"; 2717 print"<td class=form-header-c>". lang_get('jump') ."</td>\n"; 2718 print"<td> </td>\n"; 2719 print"</tr>\n"; 2720 2721 print"<tr>\n"; 2722 2723 # STATUS 2724 print"<td align='center'>\n"; 2725 print"<select name='status'>\n"; 2726 $bug_status = bug_get_status( true ); 2727 html_print_list_box_from_array( $bug_status, $filter_bug_status ); 2728 print"</select>\n"; 2729 print"</td>\n"; 2730 2731 # CATEGORY 2732 print"<td align='center'>\n"; 2733 print"<select name='category'>\n"; 2734 html_print_list_box_from_key_array( bug_get_categories( $project_id, $blank=true ), $selected=$filter_bug_category); 2735 print"</select>\n"; 2736 print"</td>\n"; 2737 2738 # COMPONENT 2739 print"<td align='center'>\n"; 2740 print"<select name='component'>\n"; 2741 html_print_list_box_from_key_array( bug_get_components( $project_id, $blank=true ), $selected=$filter_bug_component); 2742 print"</select>\n"; 2743 print"</td>\n"; 2744 2745 # VIEW CLOSED 2746 print"<td align='center'>\n"; 2747 print"<select name='view_closed'>\n"; 2748 $view_closed_options = array( lang_get('yes'), lang_get('no') ); 2749 html_print_list_box_from_array( $view_closed_options, $filter_view_closed ); 2750 print"</select>\n"; 2751 print"</td>\n"; 2752 2753 # SEARCH 2754 print"<td align='center'>\n"; 2755 print"<input type='text' size='15' maxlength='25' name='bug_search' value='" . $filter_search . "'>\n"; 2756 print"</td>\n"; 2757 2758 # JUMP 2759 print"<td align='center'>\n"; 2760 print"<input type='text' size='6' maxlength='6' name='filter_jump' value='" . $filter_jump . "'>\n"; 2761 print"</td>\n"; 2762 2763 print"</tr>\n"; 2764 2765 print"</table>\n"; 2766 print"<input type=hidden name=bug_form_filter_value value=true>\n"; 2767 print"</td>\n"; 2768 print"</tr>\n"; 2769 print"</table>\n"; 2770 2771} 2772 2773#------------------------------------------------------------------------------------------ 2774# Prints the filter at the top of the test page. 2775# INPUT: 2776# all the possible values that a user can filter on 2777# OUTPUT: 2778# The test filter form 2779#------------------------------------------------------------------------------------------ 2780function html_print_field_filter( $filter_screen, $filter_search) { 2781 2782 $s_project_properties = session_get_project_properties(); 2783 $project_id = $s_project_properties['project_id']; 2784 2785 print"<table class=width60>\n"; 2786 print"<tr>\n"; 2787 print"<td>\n"; 2788 print"<table class=inner rules=none border=0>\n"; 2789 2790 # TITLES FOR HEADER DIALOG 2791 print"<tr class=left>\n"; 2792 print"<td class=form-header-c>". lang_get('screen_name') ."</td>\n"; 2793 print"<td class=form-header-c>". lang_get('search') ."</td>\n"; 2794 print"<td> </td>\n"; 2795 print"</tr>\n"; 2796 2797 print"<tr>\n"; 2798 2799 # SCREEN_NAMES 2800 $screens = test_get_screens( $project_id, SCREEN_NAME, "ASC" ); 2801 $screen_array = array(); 2802 foreach( $screens as $screen ) { 2803 $screen_array[$screen[SCREEN_ID]] = $screen[SCREEN_NAME]; 2804 } 2805 print"<td align=center>\n"; 2806 print"<select name='filter_screen'>\n"; 2807 print"<option value=''></option>\n"; 2808 html_print_list_box_from_key_array( $screen_array, $filter_screen ); 2809 print"</select>\n"; 2810 print"</td>\n"; 2811 2812 # SEARCH 2813 print"<td align='center'>\n"; 2814 print"<input type='text' size='15' maxlength='25' name='filter_search' value='" . $filter_search . "'>\n"; 2815 print"</td>\n"; 2816 2817 # FILTER BUTTON 2818 print"<td align='center' rowspan=4 valign=center><input type='submit' value='Filter'></td>\n"; 2819 2820 print"</tr>\n"; 2821 2822 print"</table>"; 2823 print"<input type=hidden name=field_form_filter_value value=true>\n"; 2824 print"</td>\n"; 2825 print"</tr>\n"; 2826 print"</table>\n"; 2827 2828} 2829 2830#------------------------------------------------------------------------------------------ 2831# Prints the FCKeditor code if session_use_FCKeditor() returns true, 2832# otherwise prints out a normal <textarea>. 2833# INPUT: 2834# name of field 2835# width in pixels 2836# height in pixels 2837# default value of field 2838#------------------------------------------------------------------------------------------ 2839function html_FCKeditor($name, $width, $height, $value="") { 2840 2841 # Set minimum height and width of the FCKeditor 2842 if( $width < 510 ) { 2843 $width = 510; 2844 } 2845 if( $height < 120 ) { 2846 $height = 120; 2847 } 2848 2849 # if using FCKeditor 2850 if( session_use_FCKeditor() ) { 2851 2852 $FCKeditor = new FCKeditor($name); 2853 $FCKeditor->BasePath = FCK_EDITOR_BASEPATH; 2854 $FCKeditor->Config['SkinPath'] = $FCKeditor->BasePath.'editor/skins/office2003/'; 2855 $FCKeditor->ToolbarSet = "RTH"; 2856 $FCKeditor->Width = $width."px"; 2857 $FCKeditor->Height = $height."px"; 2858 $FCKeditor->Value = $value; 2859 $FCKeditor->Create(); 2860 2861 # if not using FCKeditor 2862 } else { 2863 2864 # work out number of rols and cols for the text area. 2865 # this is ~ 8 pixels per character and 20 pixels per row 2866 $cols = round($width/8); 2867 $rows = round($height/20); 2868 2869 $value = util_strip_html_tags( $value ); 2870 2871 print"<textarea rows=$rows cols=$cols name='$name'>$value</textarea>"; 2872 } 2873} 2874 2875 2876 2877 2878 2879 2880function abox_header($boxname) { 2881 ?><div class='abox'><h2><?php echo $boxname; ?></h2> 2882 <?php 2883} 2884function abox_footer() { 2885 echo '</div>'; 2886} 2887 2888function abox_list($array) { 2889 echo '<ul>'; 2890 foreach ($array as $content) { 2891 echo '<li>'.$content.'</li>'; 2892 } 2893 echo '</ul>'; 2894} 2895 2896function abox_link($title,$url) { 2897 return '<a href="'.$url.'">'.$title.'</a>'; 2898} 2899?> 2900