<?
	#---------------------------------------------------------------------#
	# This source code is (c)2000 White Pajamas, Inc                      #
	# see http://www.stonekeep.com/license.html for licensing information #
	#---------------------------------------------------------------------#

	#--------------------------------------------------------------------
	# $Id: memedit.php3,v 1.6 2000/12/20 18:19:35 nclemons Exp $
	#--------------------------------------------------------------------
	
?>

<?	if ($sys_groupstatus && $m_group=="quickslips") {
			$wclause = "where status='$sys_groupstatus'";
			$mextra = ",status";
	} else {
			$wclause = "";
			$mextra = "";
	}
	if ($f_func=="memedit") { ?>

	<form method="post" action="nbrowse.php3">
	<input type=hidden name="f_process" value="postmem">
	<input type=hidden name="m_group" value="<? echo $m_group ?>">
	<input type=hidden name="m_table" value="<? echo $m_table ?>">
	<input type=hidden name="m_column" value="<? echo $m_column ?>">
	<input type=hidden name="m_definition" value="<? echo $m_definition ?>">	
	<tr>
		<td width=100% bgcolor=#BBBBBB align=center>
			<h3>Edit group '<? echo $m_group ?>' 
		</td>
	</tr>
	<tr><td bgcolor=#000000>&nbsp;</td></tr>
	<tr bgcolor=#000000 valign=top>
		<td align=center>
		<?
			$gq = db_query("select $m_column,$m_definition$mextra from $m_table $wclause order by $m_definition");
			$nr = db_numrows($gq);
		?>
		<select name="data[]" multiple size=<? echo $nr ?>>
		<?
			while ($rinfo = db_fetch_array($gq)) {
				$val = $rinfo[$m_column];
				$check = db_query("select id from members where id='$m_group' and element='$val'");
				$sel = (db_numrows($check) > 0) ? "selected" : "";
				echo "<option value=$rinfo[$m_column] $sel > $rinfo[$m_column] - $rinfo[$m_definition]\n";
			}
		?>
		</select>
		</td>
	</tr>
	<tr><td>&nbsp;</td></tr>
	<tr bgcolor=#000000 valign=top>
		<td bgcolor=#000000 valign=top align=center>
			<input type="submit" value="Post Listing">
		</td>
	</tr>
	</form>
	
<? } else {

	$gq = db_query("delete from members where id='$m_group'");
	for ($i=0;$i<SizeOf($data);$i++) {
		$iq = db_query("insert into members values ('$m_group','$data[$i]')");
	}

}
?>
