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

	#----------------------------------------------------------------------
	# $Id: addfilter.php3,v 1.7 2000/12/14 19:13:43 shevett Exp $
	#----------------------------------------------------------------------
	
?>


<?
	$a_uid = $curruser ;
	if ($f_func=='modfilter') {
		$fquery = db_query("select * from filters where _rowid=$f_filter");
		$fdata = db_fetch_array($fquery);
		$fdata[fselect]=stripslashes($fdata[fselect]);
	}
?>

	<form method="post" action="nbrowse.php3">
	<input type=hidden name="f_process" value="postfilter">
	<input type=hidden name="f_flag" value="<? echo $f_func ?>">
	<input type=hidden name="a_uid" value="<? echo $curruser ?>">
	<tr bgcolor=#BBBBCB>
	<td width=100% bgcolor=#202020>
	<table width=100% bgcolor=#bbbbbb cellspacing=2>
	<tr>
		<td align=center colspan=2>
			<?
				if ($f_func=='addfilter') {
					echo "Add a new filter";
				} else {
					echo "Modify filter # $f_filter";
					echo "<input type=hidden name=a_rowid value=$fdata[_rowid]>";
				}
			?>
		</td>
	</tr>
	<tr bgcolor=#bbbbbb valign=top>
		<td bgcolor=#808080>
			<i>To be applied to table...</i><br>
			<select name="a_ftable">
			<option value="resources"	<? if ($fdata[ftable]=="resources") {echo " selected";} ?>>Resources
			<option value="contacts"	<? if ($fdata[ftable]=="contacts") 	{echo " selected";} ?>>Contacts
			<option value="slips"			<? if ($fdata[ftable]=="slips") 		{echo " selected";} ?>>Slips
			</select>
		</td>
		<td bgcolor=#808080 valign=center>
			<i>Is this filter public?</i><br>
			<input type="radio" name="a_fpublic" value="1" <? if ($fdata[fpublic] == 1) {echo " checked";} ?>> Public <br>
			<input type="radio" name="a_fpublic" value="0" <? if ($fdata[fpublic] == 0) {echo " checked";} ?>> Private
			<center>
		</td>
	</tr>
	<tr bgcolor=#bbbbbb valign=top>
		<td colspan=2 bgcolor=#808080>
			<i>Description of this filter</i><br>
			<!-- FIXME: needs maxsize based on database query -->
			<input type=text size=40 name="a_fdesc" value="<? echo $fdata[fdesc] ?>">
			<br>&nbsp;
		</td>
	</tr>
	<tr bgcolor=#bbbbbb valign=top>
		<td colspan=2 bgcolor=#808080>
			<i>Select statement (note the word USERNAME will be replaced with the currently logged in user)</i><br>
			<!-- FIXME: needs maxsize based on database query -->
			<input type=text size=80 name="a_fselect" value="<? echo $fdata[fselect] ?>">
			<br>&nbsp;
		</td>
	</tr>
	<tr bgcolor=#bbbbbb valign=center>
		<td colspan=2>
		<table width=100%>
		<tr>
		<td width=33%>&nbsp;</td>
		<td width=33% align=center>
			<input type="submit" value="Post Filter">
		</td>
		<td width=33%>&nbsp;</td>
		</tr>
		</table></td></tr>
	
	</table>
	</td>
	</tr>
	
	</form>
