if ($row_requirement[REQ_REC_FILE] == "R") {
    # DETAIL
    $detail = session_validate_form_get_field('req_detail_required', $req_detail, session_use_FCKeditor());
    print "<tr>" . NEWLINE;
    print "<td class=form-lbl-r nowrap>" . lang_get('req_detail') . " <span class='required'>*</span></td>" . NEWLINE;
    print "<td class=form-data-l>{$detail}</td>" . NEWLINE;
    /*
    print"<td class=form-data-l>";
    html_FCKeditor("req_detail_required", 360, 100, $detail);
    print"</td>". NEWLINE;
    */
    print "<input type='hidden' name='req_detail_required' value='{$detail}'>";
    print "</tr>" . NEWLINE;
}
# REASON FOR CHANGE
$reason_for_change = session_validate_form_get_field('req_reason_change', $req_reason_for_change, session_use_FCKeditor());
print "<tr>" . NEWLINE;
print "<td class=form-lbl-r nowrap>" . lang_get('req_reason_change') . "</td>" . NEWLINE;
print "<td class=form-data-l>";
html_FCKeditor("req_reason_change", 360, 100, $reason_for_change);
print "</td>" . NEWLINE;
print "</tr>" . NEWLINE;
# STATUS
print "<tr>" . NEWLINE;
print "<td class=form-lbl-r nowrap>" . lang_get('req_status') . "</td>" . NEWLINE;
print "<td class=form-data-l>" . NEWLINE;
print "<select name=req_status size=1>" . NEWLINE;
$list_box = requirement_get_statuses();
html_print_list_box_from_array($list_box, session_validate_form_get_field('req_status', $req_version_status));
print "</select>" . NEWLINE;
print "</td>" . NEWLINE;
 print "<td class='form-lbl-r'>" . lang_get('step_action') . " <span class='required'>*</span></td>" . NEWLINE;
 print "<td align=left>";
 html_FCKeditor("step_action_required", 600, 200, $action);
 print "</td>" . NEWLINE;
 print "</tr>";
 # TEST INPUTS
 $test_inputs = session_validate_form_get_field("step_test_inputs", "", session_use_FCKeditor());
 print "<tr>";
 print "<td class='form-lbl-r'>" . lang_get('test_inputs');
 //<span class='required'>*</span></td>". NEWLINE;
 print "<td align=left>";
 html_FCKeditor("step_test_inputs", 600, 200, $action);
 print "</td>" . NEWLINE;
 print "</tr>" . NEWLINE;
 # EXPTECTED RESULT
 $expected_result = session_validate_form_get_field("step_expected_required", "", session_use_FCKeditor());
 print "<tr>";
 print "<td class='form-lbl-r'>" . lang_get('step_expected') . " <span class='required'>*</span></td>" . NEWLINE;
 print "<td align=left>";
 html_FCKeditor("step_expected_required", 600, 200, $expected_result);
 print "</td>" . NEWLINE;
 print "</tr>" . NEWLINE;
 print "<tr>" . NEWLINE;
 print "<td><input type='hidden' name='test_id' value='{$test_id}'></td>" . NEWLINE;
 print "</tr>" . NEWLINE;
 util_add_spacer();
 # SUBMIT BUTTON
 print "<tr>" . NEWLINE;
 print "<td colspan='3' class=center><input type='submit' value='" . lang_get('add_step') . "'></td>" . NEWLINE;
 print "</tr>" . NEWLINE;
 util_add_spacer();
function html_FCKeditor($name, $width, $height, $value = "")
{
    # Set minimum height and width of the FCKeditor
    if ($width < 510) {
        $width = 510;
    }
    if ($height < 120) {
        $height = 120;
    }
    # if using FCKeditor
    if (session_use_FCKeditor()) {
        $FCKeditor = new FCKeditor($name);
        $FCKeditor->BasePath = FCK_EDITOR_BASEPATH;
        $FCKeditor->Config['SkinPath'] = $FCKeditor->BasePath . 'editor/skins/office2003/';
        $FCKeditor->ToolbarSet = "RTH";
        $FCKeditor->Width = $width . "px";
        $FCKeditor->Height = $height . "px";
        $FCKeditor->Value = $value;
        $FCKeditor->Create();
        # if not using FCKeditor
    } else {
        # work out number of rols and cols for the text area.
        # this is ~ 8 pixels per character and 20 pixels per row
        $cols = round($width / 8);
        $rows = round($height / 20);
        $value = util_strip_html_tags($value);
        print "<textarea rows={$rows} cols={$cols} name='{$name}'>{$value}</textarea>";
    }
}
# ------------------------------------
# $RCSfile: bug_add_action.php,v $  $Revision: 1.2 $
# ------------------------------------
include "./api/include_api.php";
auth_authenticate_user();
# TO DO
# check for test_run_id
# check for req_version_id
# add bug relationships
# create bug history
$project_properties = session_get_project_properties();
$project_id = $project_properties['project_id'];
$page = basename(__FILE__);
$redirect_on_error = 'bug_add_page.php';
session_validate_form_set($_POST, $redirect_on_error);
$bug_id = bug_add($project_id, session_validate_form_get_field('bug_category'), session_validate_form_get_field('bug_component'), session_validate_form_get_field('discovery_period'), session_validate_form_get_field('bug_priority'), session_validate_form_get_field('bug_severity'), session_validate_form_get_field('found_in_release'), session_validate_form_get_field('assign_to_release'), session_validate_form_get_field('assigned_to'), session_validate_form_get_field('assigned_to_developer'), session_validate_form_get_field('summary_required'), session_validate_form_get_field('description_required', "", session_use_FCKeditor()), session_validate_form_get_field('req_version_id'), session_validate_form_get_field('verify_id'));
session_validate_form_reset();
# REDIRECT THE USER BACK TO THE TEST RUN PAGE IF THAT'S WHERE THEY CAME FROM
if (!empty($_POST['test_run_id'])) {
    $test_run_id = $_POST['test_run_id'];
    $redirect_on_success = "results_view_verifications_page.php?test_run_id={$test_run_id}";
} else {
    $redirect_on_success = "bug_detail_page.php?bug_id={$bug_id}";
}
html_print_operation_successful('add_bug_page', $redirect_on_success);
# ------------------------------------
# $Log: bug_add_action.php,v $
# Revision 1.2  2006/02/27 17:51:34  gth2
# added bug email functionality - gth
#
# Revision 1.1.1.1  2005/11/30 23:00:56  gth2
include "./api/include_api.php";
auth_authenticate_user();
$test_id = $_POST['test_id'];
$test_step_id = $_POST['test_step_id'];
//$test_version_id	= $_POST['test_version_id'];
$project_id = session_get_project_id();
$page = 'test_step_edit_page.php';
$error_page = 'test_step_edit_page.php?test_step_id=' . $test_step_id . '&test_id=' . $test_id;
$redirect_page = 'test_detail_page.php?test_id=' . $test_id . '&project_id=' . $project_id;
session_validate_form_set($_POST, $error_page);
$info_step = "N";
if (isset($_POST['info_step'])) {
    $info_step = "Y";
}
#added to every session_validate... mysql_real_escape_string(), because it doesnt work for session_validate...(fck-textfield)
test_update_test_step($test_id, $test_step_id, session_validate_form_get_field('location'), mysql_real_escape_string(session_validate_form_get_field('step_action_required', "", session_use_FCKeditor())), mysql_real_escape_string(session_validate_form_get_field('step_input', "", session_use_FCKeditor())), mysql_real_escape_string(session_validate_form_get_field('step_expected_required', "", session_use_FCKeditor())), $info_step);
session_validate_form_reset();
html_print_operation_successful("edit_test_step_page", $redirect_page);
# ---------------------------------------------------------------------
# $Log: test_step_edit_action.php,v $
# Revision 1.6  2009/03/26 08:04:05  sca_gs
# fixed problem with wrong caption
#
# Revision 1.5  2008/07/21 07:42:34  peter_thal
# small bug fixes for test_detail_page linking parameter
#
# Revision 1.4  2008/07/03 09:30:27  peter_thal
# enabled writing and saving backslashes in all fields
#
# Revision 1.3  2007/03/14 17:23:44  gth2
# removing Test Input as a required field so that it's consistent witth the
# rth is a requirement, test, and bugtracking system
# Copyright (C) 2005 George Holbrook - rth@lists.sourceforge.net
# This program is distributed under the terms and conditions of the GPL
# See the README and LICENSE files for details
#----------------------------------------------------------------------
# ------------------------------------
# Bug Detail Update Action Page
#
# $RCSfile: bug_detail_update_action.php,v $  $Revision   $
# ------------------------------------
include "./api/include_api.php";
auth_authenticate_user();
$s_bug_details = session_get_properties("bug");
$bug_id = $s_bug_details['bug_id'];
$redirect_on_success = 'bug_detail_page.php';
$redirect_on_error = 'bug_detail_update_page.php';
$redirect_on_closed = 'bug_close_page.php';
session_validate_form_set($_POST, $redirect_on_error);
$value = session_validate_form_get_field('bug_status');
bug_update($bug_id, session_validate_form_get_field('bug_status'), session_validate_form_get_field('bug_category'), session_validate_form_get_field('discovery_period'), session_validate_form_get_field('bug_component'), session_validate_form_get_field('bug_priority'), session_validate_form_get_field('bug_severity'), session_validate_form_get_field('found_in_release'), session_validate_form_get_field('assign_to_release'), session_validate_form_get_field('implemented_in_release'), session_validate_form_get_field('assigned_to'), session_validate_form_get_field('assigned_to_developer'), session_validate_form_get_field('summary_required'), session_validate_form_get_field('bug_description_required', "", session_use_FCKeditor()));
if ($value == 'Closed') {
    html_redirect($redirect_on_closed . "?bug_id={$bug_id}");
}
session_validate_form_reset();
html_print_operation_successful('update_bug_page', $redirect_on_success);
# ------------------------------------
# $Log: bug_detail_update_action.php,v $
# Revision 1.1.1.1  2005/11/30 23:00:56  gth2
# importing initial version - gth
#
# ------------------------------------
$selected_value = session_validate_form_get_field('assigned_to_developer');
print "<select name='assigned_to_developer' size=1>" . NEWLINE;
$assigned_to = user_get_usernames_by_project($project_id, $blank = true);
html_print_list_box_from_array($assigned_to, $selected_value);
print "</select>" . NEWLINE;
print "</td>" . NEWLINE;
print "</tr>" . NEWLINE;
# SUMMARY
print "<tr>" . NEWLINE;
print "<td class=form-lbl-r>" . lang_get('bug_summary') . "<span class='required'>*</span></td>";
print "<td class=form-data-l>" . NEWLINE;
print "<input type=text size='100' maxlength='128' name=summary_required value='" . session_validate_form_get_field('summary_required') . "'>";
print "</td>" . NEWLINE;
print "</tr>" . NEWLINE;
# DESCRIPTION
$description = session_validate_form_get_field('description_required', "", session_use_FCKeditor());
print "<tr>" . NEWLINE;
print "<td class=form-lbl-r>" . lang_get('bug_description') . "<span class='required'>*</span></td>" . NEWLINE;
print "<td class=form-data-l>" . NEWLINE;
html_FCKeditor("description_required", 640, 240, $description);
print "</td>" . NEWLINE;
print "</tr>" . NEWLINE;
util_add_spacer();
print "<tr><td class=center colspan=2><input type=submit name='save' value='Save'><br><br></td>" . NEWLINE;
print "</table>" . NEWLINE;
print "</td>" . NEWLINE;
print "</tr>" . NEWLINE;
print "</table>" . NEWLINE;
print "</form>" . NEWLINE;
print "</div>" . NEWLINE;
html_print_footer();
auth_authenticate_user();
# if $parent_req==0, then the requirement is not a child of any other requirement
if (isset($_POST["parent_req"])) {
    $parent_req = $_POST["parent_req"];
} else {
    $parent_req = 0;
}
$add_req_page = "requirement_add_page.php?type=" . $_POST['req_record_or_file'] . "&parent_req={$parent_req}";
session_validate_form_set($_POST, $add_req_page);
# if requirement is a file
if ($_POST['req_record_or_file'] == "F") {
    $uploaded_filename = file_add_requirement($add_req_page);
    $detail = "";
} else {
    $uploaded_filename = "";
    $detail = session_validate_form_get_field('req_detail_required', "", session_use_FCKeditor());
}
$req_reason_for_change = session_validate_form_get_field("req_reason_change");
$project_id = $_POST['project_id'];
$req_name = session_validate_form_get_field('req_name_required');
$req_area = session_validate_form_get_field('req_area_covered');
$req_type = session_validate_form_get_field('req_type');
$req_rec_or_file = $_POST['req_record_or_file'];
$req_version = session_validate_form_get_field('req_version');
$req_status = session_validate_form_get_field('req_status');
$req_priority = session_validate_form_get_field('req_priority');
$req_assigned_to = session_validate_form_get_field('req_assigned_to');
$req_assign_release = session_validate_form_get_field('req_assign_release');
$req_author = session_validate_form_get_field('req_author');
$req_functionality = session_validate_form_get_field('req_functionality');
//$req_untestable			= session_validate_form_get_field('chk_untestable');
 print "<input type=hidden name='req_id' value='{$s_req_id}'>" . NEWLINE;
 print "<input type=hidden name='status' value='OPEN'>" . NEWLINE;
 print "<input type=hidden name='author' value='{$s_username}'>" . NEWLINE;
 print "<input type=hidden name='assign_to' value=''>" . NEWLINE;
 print "<table class='inner'>" . NEWLINE;
 # FORM TITLE
 print "<tr>" . NEWLINE;
 print "<td colspan='2'><h4>" . lang_get('add_discussion') . "</h4></td>" . NEWLINE;
 print "</tr>" . NEWLINE;
 # SUBJECT
 print "<tr>" . NEWLINE;
 print "<td class='form-lbl-r'>" . lang_get('subject') . " <span class='required'>*</span></td>" . NEWLINE;
 print "<td class='form-data-l'><input type='text' maxlength='255' name='subject_required' size=60 value='" . session_validate_form_get_field("subject_required") . "'></td>" . NEWLINE;
 print "</tr>" . NEWLINE;
 # DESCRIPTION
 $add_discussion = session_validate_form_get_field("discussion", "", session_use_FCKeditor());
 print "<tr>" . NEWLINE;
 print "<td class='form-lbl-r'>" . lang_get('discussion') . "</td>" . NEWLINE;
 print "<td class='form-data-l'>";
 html_FCKeditor("discussion", 360, 200, $add_discussion);
 print "</td>";
 print "</tr>" . NEWLINE;
 # SUBMIT BUTTON
 print "<tr>" . NEWLINE;
 print "<td colspan='2' class='form-data-c'><input type='submit' name=submit_add_discussion value='" . lang_get('add') . "'></td>" . NEWLINE;
 print "</tr>" . NEWLINE;
 print "</table>" . NEWLINE;
 print "</form>" . NEWLINE;
 print "</td>" . NEWLINE;
 print "</tr>" . NEWLINE;
 print "</table>" . NEWLINE;
#
# $RCSfile: requirement_edit_action.php,v $  $Revision: 1.6 $
# ---------------------------------------------------------------------
include "./api/include_api.php";
auth_authenticate_user();
session_validate_form_set($_POST, "requirement_edit_page.php");
if ($_POST['record_or_file'] == "R") {
    $detail = session_validate_form_get_field('req_detail_required', "", session_use_FCKeditor());
} else {
    $detail = "";
}
$redirect_on_error = "requirement_edit_page.php?failed=true&error=280";
$project_id = $_POST["project_id"];
$req_id = $_POST["req_id"];
$req_version_id = $_POST["req_ver_id"];
$reason_for_change = session_validate_form_get_field("req_reason_change", "", session_use_FCKeditor());
$req_name = session_validate_form_get_field('req_name_required');
$req_area = session_validate_form_get_field('req_area');
$req_type = session_validate_form_get_field('req_type');
$req_status = session_validate_form_get_field('req_status');
$req_functionality = session_validate_form_get_field("req_functionality");
$req_priority = session_validate_form_get_field("req_priority");
$req_release = session_validate_form_get_field("assigned_release");
$req_defect_id = session_validate_form_get_field("defect_id");
if ($req_defect_id == '') {
    $req_defect_id = 0;
}
# return the user to the previous page if the new_bug_id doesn't exist in the bug table
if (!bug_exists($req_defect_id) && $req_defect_id != 0) {
    html_redirect($redirect_on_error);
}