Back to the Source Listing 

<!--#include file="includes/FacConn.inc"-->
<%
'Developer: Angela Johnston
'Date: February 21, 2002
'
'editMiscCategory.asp - This page allows the user to create and update a miscellaneous category.
' The information on this page is sent to addMiscCategory.asp.
'
'***************************************************************************************************************
'Included pages
' FacConn.inc - Checks whether the user has application priviledges
' formStyle.css - The style sheet for the Faculty Application
' adovbs.inc - A page usually included with ASP to make openning tables and running queries easier.
' It assigns names to numbers, so that you don't have to remember what each number means.
' footer.asp - Contains the menu that should be located at the bottom of the page
'
'QueryStrings (name - value)
' None
'
'Recordsets (name - value)
' rsUser - (FacConn.inc) contains the current user logged on to the intranet (tblUser)
' rsMisc - contains all the miscellaneous categories for the current faculty member (tblMiscCategory)
' rsItems - contains all the miscellaneous data items for the current miscellaneous category (tblMiscData)
'
'Variables
' strSQL - (FacConn.inc) use to store the sql string for a query
' bAdmin - (FacConn.inc) boolean value, "True" if user is an Administrator, "False" if the user is not
' lngUserID - (FacConn.inc) the ID number for the current user
' strUserLogon - (FacConn.inc) the Logon Name for the current user
' intCounter - keeps track of the number for the current data item. This allows each text box for each data
' item to have a different name. (Example. Location1)
'
'Forms
' frmMiscCat - contains the following form fields
'
'Form Fields
' Title - A text box that contains the title of the Category
' Information - A text box that allows the user to enter a new item under the current category
' Location - A text box that allows the user to enter a URL location for the item in the
' Information text box.
' Information1 - The first item under the current category
' Location1 - The URL location for the first item
' ...
' Information# - The last item under the current category
' Location# - The URL location for the last item under the current category
' Count - A hidden text box that contains the number of items already in the current category
'
'***************************************************************************************************************
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="EN" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Faculty Application - Miscellaneous Category</title>
<link rel="stylesheet" type="text/css" href="includes/formStyle.css">
</head>
<body background="../newhierarchy/images/backgroundtile.gif">
<div class="center">
<table summary=" " cellspacing="0" cellpadding="3" width="700">
<tr>
<td colspan="5">
<h1 align="center">Faculty Web Application - Miscellaneous</h1>
</td>
</tr>
<tr>
<td align="center">[<a href="editPage.asp">Main Form</a>]</td>
<%If Not Session("strUserLogon")="tfaculty" Then %>
<td align="center">[<a href="http://intranet.oznet.ksu.edu/agronomy/uploadImage.asp">Edit
Picture</a>]</td>
<%End If%>
<td align="center">[<a href="editGeneral.asp">Edit General Info</a>]</td>
<td align="center">[<a href="editProfessional.asp">Edit Professional Info</a>]</td>
<td align="center">[<a href="editCourse.asp?Add=yes">Add Course</a>]</td>
</tr>
<tr>
<td colspan="5">
<hr>
<%
Dim rsMisc, rsItems, intCounter
 

'Open a recordset containing the courses
Set rsMisc = Server.CreateObject("ADODB.Recordset")
strSQL = "Select * FROM tblMiscCategory ORDER BY tblMiscCategory.fldMiscTitle;"
rsMisc.Open strSQL, fp_conn, adOpenDynamic, adLockOptimistic, adCmdText
 

'If the user requested to edit a category
If Request("fldMiscCatID") <> "" Then
'Filter for appropriate Miscellaneous Category to edit
rsMisc.Filter = "fldMiscCatID = " & Request("fldMiscCatID")
 

'If there is no category then return to the main page
If rsMisc.EOF Then
Response.Redirect "editPage.asp"
End If
bNew = False
%>
<h1 align="center">Miscellaneous Category</h1>
<h2 align="center">Edit your Miscellaneous Category Information for the
web</h2>
<form action="addMiscCategory.asp" method="Post" name="frmMiscCat">
<input type="Hidden" alt=" " name="MiscCatID" value="<%= rsMisc("fldMiscCatID") %>">
<% Else
'Create new Category
bNew = True
%>
 
<form action="addMiscCategory.asp" method="Post" name="frmMiscCat">
<input type="Hidden" alt=" " name="MiscCatID" value>
<h1 align="center">Micellaneous Category</h1>
<h2 align="center">Enter Information for a new Category</h2>
<% End If %>
<table summary=" " width="600">
<tr>
<td><label>Category Title</label></td>
</tr>
<tr>
<td><input alt="Title" type="text" name="Title" size="50" value="<% If Not bNew Then Response.Write rsMisc("fldMiscTitle") End If%>"></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td>
<hr>
</tr>
<tr>
<td width="100%"><label>&nbsp;</label></td>
</tr>
<tr>
<td width="100%"><label>Information:</label></td>
</tr>
<tr>
<td width="100%"><textarea name="Information" cols="50" rows="1"></textarea></td>
</tr>
<tr>
<td width="100%"><label>Location URL: (optional)</label></td>
</tr>
<tr>
<td width="100%"><input alt="Location" type="text" name="Location" size="50"></td>
</tr>
<tr>
<td><input alt="Add Item" type="submit" value="Add Item" name="Add">
</tr>
<%
If not bNew Then
 

'Close tblMiscCat
rsMisc.Close
 

'Open tblMiscData
Set rsItems = Server.CreateObject("ADODB.Recordset")
strSql = "SELECT * FROM tblMiscData WHERE (((tblMiscData.fldMiscCatID)=" & Request("fldMiscCatID") & "));"
rsItems.Open strSql, fp_conn, adOpenDynamic, adLockOptimistic, adCmdText
 

'List all of the items under the current category
'************************************************
%>
<tr>
<td>
<hr>
Listing of current items</td>
</tr>
<% intCounter = 0
While Not rsItems.EOF
'increment the intCounter by 1
'this is necessary so that we can edit an infinite number of items in each category
'**********************************************************************************
intCounter = intCounter + 1
%>
<tr>
<td></td>
</tr>
<tr>
<td><input alt=" " type="Hidden" name="MiscDataID" value="<%= rsItems("fldMiscDataID") %>"><label>Information:</label>
<textarea name="Information<%= intCounter%>" cols="50" rows="1"><%= rsItems("fldInformation") %></textarea></td>
</tr>
<tr>
<td><label>Location URL:</label> <input alt="Location" type="text" name="Location<%= intCounter%>" size="50" value="<%= rsItems("fldLocation") %>"><br>
&nbsp;</td>
</tr>
 
 
<%
rsItems.MoveNext
Wend
%>
 
<tr>
<td>
<hr>
<tr>
<td>
<% rsItems.Close
End If %>
</table>
<input alt=" " type="hidden" value="<%= intCounter%>" name="Count"><input alt="Submit" type="Submit" value="<%If bNew Then %>Add Category<% Else %>Update Category<%End If%>">
&nbsp;&nbsp;<input alt="Reset to Original Information" type="reset" value="Reset to Original Information" name="Reset">
<%If Not bNew Then %><input alt="Remove All" type="Submit" value="Remove Category" name="RemoveAll"><%End If%>
</form>
<!--webbot bot="Include" u-include="includes/footer.asp" tag="BODY" -->
</td>
</tr>
</table>
</div>
</body>
</html>