print "</tr>" . NEWLINE;
 print "</table>" . NEWLINE;
 print "</form>" . NEWLINE;
 if ($rows_test_doc_types) {
     print "<table class='width70' rules=cols>" . NEWLINE;
     print "<tr>" . NEWLINE;
     html_tbl_print_header(lang_get('test_doc_type'), MAN_DOC_TYPE_NAME, $order_by, $order_dir, "{$page}?page_number={$page_number}", $page_number);
     if ($project_manager) {
         html_tbl_print_header(lang_get('edit'));
         html_tbl_print_header(lang_get('delete'));
     }
     print "\n</tr>" . NEWLINE;
     foreach ($rows_test_doc_types as $row_test_doc_type) {
         $id = $row_test_doc_type[MAN_DOC_TYPE_ID];
         $name = $row_test_doc_type[MAN_DOC_TYPE_NAME];
         $row_style = html_tbl_alternate_bgcolor($row_style);
         print "<tr class='{$row_style}'>" . NEWLINE;
         print "<td>{$name}</td>" . NEWLINE;
         if ($project_manager) {
             print "<td><a href='project_edit_testdoctype_page.php?test_doc_type_id={$id}'>" . lang_get("edit") . "</a></td>" . NEWLINE;
             print "<td>" . NEWLINE;
             print "<form name='delete_release' method=post action='{$delete_page}'>" . NEWLINE;
             print "<input type='submit' name='remove_man_doc_type_from_project' value='" . lang_get('delete') . "' class='page-numbers'>" . NEWLINE;
             print "<input type='hidden' name='r_page' value='{$redirect_url}#test_doc_type'>" . NEWLINE;
             print "<input type='hidden' name='f' value='remove_man_doc_type_from_project'>" . NEWLINE;
             print "<input type='hidden' name='id' value='{$id}'>" . NEWLINE;
             print "<input type='hidden' name='project_id' value='{$selected_project_id}'>" . NEWLINE;
             print "<input type='hidden' name='msg' value='" . DEL_TEST_DOC_TYPE_FROM_PROJECT . "'>" . NEWLINE;
             print "</form>" . NEWLINE;
             print "</td>" . NEWLINE;
         }
function bug_display_related_items($bug_id, $user_tempest_admin, $user_project_manager)
{
    # Get all records where the bug_id is in the src column and display the dest bugs
    $delete_page = 'delete_page.php';
    $redirect_url = "bug_detail_page.php?bug_id={$bug_id}";
    $relations = bug_get_relations($bug_id);
    $row_style = '';
    foreach ($relations as $rel) {
        $assoc_id = $rel[BUG_ASSOC_ID];
        $src_id = $rel[BUG_ASSOC_SRC_ID];
        $dest_id = $rel[BUG_ASSOC_DEST_ID];
        $rel_type = $rel[BUG_ASSOC_REL_TYPE];
        if ($bug_id == $src_id) {
            # viewing bug from the src side
            $dest_bug_detail = bug_get_detail($dest_id);
            $relationship = bug_get_relationship_type_for_src($rel_type);
            $project_name = project_get_name($dest_bug_detail[BUG_PROJECT_ID]);
            $related_bug_id = $dest_id;
            $padded_bug_id = util_pad_id($dest_id);
            $bug_status = $dest_bug_detail[BUG_STATUS];
            $assigned_to_dev = $dest_bug_detail[BUG_ASSIGNED_TO_DEVELOPER];
            $bug_summary = $dest_bug_detail[BUG_SUMMARY];
        } else {
            # viewing bug from dest side
            $src_bug_detail = bug_get_detail($src_id);
            $relationship = bug_get_relationship_type_for_dest($rel_type);
            $project_name = project_get_name($src_bug_detail[BUG_PROJECT_ID]);
            $related_bug_id = $src_id;
            $padded_bug_id = util_pad_id($src_id);
            $bug_status = $src_bug_detail[BUG_STATUS];
            $assigned_to_dev = $src_bug_detail[BUG_ASSIGNED_TO_DEVELOPER];
            $bug_summary = $src_bug_detail[BUG_SUMMARY];
        }
        $row_style = html_tbl_alternate_bgcolor($row_style);
        print "<tr class='{$row_style}'>" . NEWLINE;
        print "<td class='tbl-r' width='10%'>{$relationship}</td>" . NEWLINE;
        print "<td class='tbl-c' width='10%'><a href='bug_detail_page.php?bug_id={$related_bug_id}'>{$padded_bug_id}</a></td>" . NEWLINE;
        print "<td class='tbl-c' width='10%'>{$project_name}</td>" . NEWLINE;
        print "<td class='tbl-c' width='10%'>{$bug_status}</td>" . NEWLINE;
        #print"<td class='tbl-c' width='10%'>$bug_assigned_to</td>". NEWLINE;
        print "<td class='tbl-c' width='10%'>{$assigned_to_dev}</td>" . NEWLINE;
        print "<td class='tbl-l' width='35%'>{$bug_summary}</td>" . NEWLINE;
        # DELETE LINK
        print "<td class='tbl-c' width='5%'>" . NEWLINE;
        if ($user_tempest_admin) {
            # nesting forms breaks html, if the delete button is pressed, the delete page will be included at the top of the bug_detail_page
            //print"<form method=post action='$delete_page'>". NEWLINE;
            print "<input type='submit' name='delete' value='[" . lang_get('delete') . "]' class='page-numbers'>";
            print "<input type='hidden' name='r_page' value={$redirect_url}>" . NEWLINE;
            print "<input type='hidden' name='f' value='delete_bug_assoc'>" . NEWLINE;
            print "<input type='hidden' name='id' value={$assoc_id}>" . NEWLINE;
            print "<input type='hidden' name='msg' value='270'>" . NEWLINE;
            //print"</form>";
        }
        print "</td>" . NEWLINE;
        print "</tr>" . NEWLINE;
    }
}