<TD><B>Submitted By:</B><BR>' . user_getname(db_result($result, 0, 'submitted_by')) . '</TD>
		<TD><B>Group:</B><BR>' . group_getname($group_id) . '</TD>
	</TR>

	<TR>
		<TD><B>Date Submitted:</B><BR>
		' . date($sys_datefmt, db_result($result, 0, 'open_date')) . '
		</TD>
		<TD><FONT SIZE="-1">
		<INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="Submit Changes">
		</TD>
	</TR>

	<TR>
		<TD><B>Category:</B><BR>';
    echo patch_category_box($group_id, 'patch_category_id', db_result($result, 0, 'patch_category_id'));
    echo '
		</TD>
		<TD><B>Assigned To:</B><BR>';
    echo patch_technician_box($group_id, 'assigned_to', db_result($result, 0, 'assigned_to'));
    ?>
	</TD></TR>

	<TR><TD COLSPAN="2">
		<B>Status:</B><BR>
		<?php 
    echo patch_status_box('patch_status_id', db_result($result, 0, 'patch_status_id'));
    ?>
	</TD></TR>

	<TR><TD COLSPAN="2"><B>Summary:</B><BR>
function show_patchlist($result, $offset, $set = 'open')
{
    global $sys_datefmt, $group_id;
    /*
    	Accepts a result set from the patch table. Should include all columns from
    	the table, and it should be joined to USER to get the user_name.
    */
    $IS_PATCH_ADMIN = user_ismember($group_id, 'C2');
    echo '
	<FORM ACTION="' . $PHP_SELF . '" METHOD="POST">
		<INPUT TYPE="HIDDEN" NAME="group_id" VALUE="' . $group_id . '">
		<INPUT TYPE="HIDDEN" NAME="func" VALUE="massupdate">';
    $rows = db_numrows($result);
    $url = "/patch/?group_id={$group_id}&set={$set}&order=";
    $title_arr = array();
    $title_arr[] = 'Patch ID';
    $title_arr[] = 'Summary';
    $title_arr[] = 'Date';
    $title_arr[] = 'Assigned To';
    $title_arr[] = 'Submitted By';
    $links_arr = array();
    $links_arr[] = $url . 'patch_id';
    $links_arr[] = $url . 'summary';
    $links_arr[] = $url . 'date';
    $links_arr[] = $url . 'assigned_to_user';
    $links_arr[] = $url . 'submitted_by';
    echo html_build_list_table_top($title_arr, $links_arr);
    for ($i = 0; $i < $rows; $i++) {
        echo '
			<TR BGCOLOR="' . html_get_alt_row_color($i) . '">' . '<TD NOWRAP>' . ($IS_PATCH_ADMIN ? '<INPUT TYPE="CHECKBOX" NAME="patch_id[]" VALUE="' . db_result($result, $i, 'patch_id') . '"> ' : '') . sprintf("%06d", db_result($result, $i, 'patch_id')) . '</TD>' . '<TD><A HREF="' . $PHP_SELF . '?func=detailpatch&patch_id=' . db_result($result, $i, 'patch_id') . '&group_id=' . db_result($result, $i, 'group_id') . '">' . db_result($result, $i, 'summary') . '</TD>' . '<TD>' . date($sys_datefmt, db_result($result, $i, 'date')) . '</TD>' . '<TD>' . db_result($result, $i, 'assigned_to_user') . '</TD>' . '<TD>' . db_result($result, $i, 'submitted_by') . '</TD></TR>';
    }
    /*
    	Show extra rows for <-- Prev / Next -->
    */
    echo '
		<TR><TD COLSPAN="2">';
    if ($offset > 0) {
        echo '<A HREF="' . $PHP_SELF . '?func=browse&group_id=' . $group_id . '&set=' . $set . '&offset=' . ($offset - 50) . '"><B><-- Previous 50</B></A>';
    } else {
        echo '&nbsp;';
    }
    echo '</TD><TD>&nbsp;</TD><TD COLSPAN="2">';
    if ($rows == 50) {
        echo '<A HREF="' . $PHP_SELF . '?func=browse&group_id=' . $group_id . '&set=' . $set . '&offset=' . ($offset + 50) . '"><B>Next 50 --></B></A>';
    } else {
        echo '&nbsp;';
    }
    echo '</TD></TR>';
    /*
    	Mass Update Code
    */
    if ($IS_PATCH_ADMIN) {
        echo '<TR><TD COLSPAN="5">
		<FONT COLOR="#FF0000"><B>Patch Admin:</B></FONT>  If you wish to apply changes to all patches selected above, use these controls to change their properties and click once on "Mass Update".
		<TABLE WIDTH="100%" BORDER="0">

		<TR><TD><B>Assigned To:</B><BR>' . patch_technician_box($group_id, 'assigned_to', $group_id, 'No Change') . '</TD>
		<TD><B>Status:</B><BR>' . patch_status_box('patch_status_id', 'xyz', 'No Change') . '</TD>
		<TD><B>Category:</B><BR>' . patch_category_box($group_id, 'patch_category_id', 'xyz', 'No Change') . '</TD></TR>
		<TR><TD COLSPAN="3" ALIGN="MIDDLE"><INPUT TYPE="SUBMIT" name="submit" VALUE="Mass Update"></TD></TR>

		</TABLE>
	    </TD></TR>';
    }
    echo '</TABLE>';
}
// $Id: add_patch.php,v 1.2 2003/11/13 11:29:25 helix Exp $
patch_header(array('title' => 'Submit a Patch'));
echo '
		<P>
		<H2>Submit A Patch</H2>
		<P>
		<B>Fill out the form below.</B> You can either paste your patch into the window 
		below or check the box and upload your patch.
		<P>
		<FORM ACTION="' . $PHP_SELF . '" METHOD="POST" enctype="multipart/form-data">
		<INPUT TYPE="HIDDEN" NAME="func" VALUE="postaddpatch">
		<INPUT TYPE="HIDDEN" NAME="group_id" VALUE="' . $group_id . '">
		<TABLE>
		<TR><TD VALIGN="TOP" COLSPAN="2"><B>Group:</B><BR>' . group_getname($group_id) . '</TD></TR>
		<TR><TD VALIGN="TOP" COLSPAN="2"><B>Category:</B><BR>';
echo patch_category_box($group_id, 'patch_category_id');
?>
	</TD></TR>

	<TR><TD COLSPAN="2"><B>Summary:</B><BR>
		<INPUT TYPE="TEXT" NAME="summary" SIZE="45" MAXLENGTH="60">
	</TD></TR>

	<TR><TD COLSPAN="2">
		<INPUT TYPE="CHECKBOX" NAME="upload_instead" VALUE="1"> <B>Upload Patch</B>
		<P>
		<input type="file" name="uploaded_data"  size="30">
		<P>
		<B>OR Paste the patch here, instead of uploading it:</B>
		<P>
		<TEXTAREA NAME="code" ROWS="30" COLS="85" WRAP="SOFT"></TEXTAREA>
$res_tech = patch_data_get_technicians($group_id);
$tech_id_arr = util_result_column_to_array($res_tech, 0);
$tech_id_arr[] = '0';
//this will be the 'any' row
$tech_name_arr = util_result_column_to_array($res_tech, 1);
$tech_name_arr[] = 'Any';
$tech_box = html_build_select_box_from_arrays($tech_id_arr, $tech_name_arr, '_assigned_to', $_assigned_to, true, 'Unassigned');
/*
	Show the new pop-up boxes to select assigned to and/or status
*/
echo '<H2>Browse Patches by</H2>
	<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="6"><FORM ACTION="' . $PHP_SELF . '" METHOD="GET">
	<INPUT TYPE="HIDDEN" NAME="group_id" VALUE="' . $group_id . '">
	<INPUT TYPE="HIDDEN" NAME="set" VALUE="custom">
	<TR><TD><b>Assigned User:</b></TD><TD><b>Status:</b></TD><TD><b>Category:</b></TD></TR>
	<TR><TD><FONT SIZE="-1">' . $tech_box . '</TD><TD><FONT SIZE="-1">' . patch_status_box('_status', $_status, 'Any') . '</TD>' . '<TD><FONT SIZE="-1">' . patch_category_box($group_id, '_category', $_category, 'Any') . '</TD>' . '<TD><FONT SIZE="-1"><INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="Browse"></TD></TR></FORM></TABLE>';
if ($result && db_numrows($result) > 0) {
    //create a new $set string to be used for next/prev button
    if ($set == 'custom') {
        $set .= '&_assigned_to=' . $_assigned_to . '&_status=' . $_status;
    }
    echo '
		<P>
		<h2>' . $statement . '</H2>
		<P>
		<B>You can use the Patch Manager to control/faciliate code contributions from the user community</B>
		<P>';
    show_patchlist($result, $offset, $set);
} else {
    echo '
		<P>