Back to
the Source Listing
<!--#include
file="includes/FacConn.inc"-->
<%
'Developer: Angela Johnston
'Date: March 5, 2002
'
'editCourse.asp - This page
contains allows the user to either update a course already listed on
' their page, add new course to
the list of courses, or select a course from a
' list of courses. The
information entered in this form is sent to addCourse.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)
' Remove - sends the user to
addCourse.asp with the QueryString Action equal to Remove
' and the QueryString ID equal to
the current fldCourseID.
' Add - means that a new course
will be added to the faculty page. The ID QueryString
' is not necessary.
' Edit - means that this page
will edit a current course defined by the ID QueryString
'
'Recordsets (name - value)
' rsUser - (FacConn.inc) contains
the current user logged on to the intranet (tblUser)
' rsCourse - contains the
information for the current course being edited
'
'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
' bNew - boolean value, contains
True if the user selected to add a course and False if the user selected
' to edit a course.
'Forms
' frmCourse - contains the
following Form Fields
'
'Form Fields
' cboCourse - a combo box that
allows the user to select a course to be added to the current page
' Number - (Required) the number
for the new course to be added. It should have the text 'Agron' followed
' by three numbers. (example
Agron 450).
' Name - (Required) the full name
of the course.
' DescURL - The URL location of
the description for the course. This location is on the Agronomy site.
' WebPageURL - The URL location
for the course web site.
'
'***************************************************************************************************************
%>
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.0 Transitional//EN">
<html lang="EN">
<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
Form - Edit Course</title>
<script>
<!--
function verifyData()
{
//if (isEmpty(document.frmCourse.Number.value))
//{
//alert("Your Course Number
field is empty - please reenter");
//return false;
//}
//if (isEmpty(document.frmCourse.Name.value))
//{
// alert("Your Course Name
field is empty - please reenter");
//return false;
//}
return 1;
}
// Check whether string s is
empty.
function isEmpty(s)
{ return ((s == null) || (s.length
== 0) || (s == "Agron"))
}
//-->
</script>
<link rel="stylesheet"
type="text/css"
href="includes/formStyle.css">
</head>
<body background="../newhierarchy/images/backgroundtile.gif">
<div class="center">
<table
cellspacing="0"
cellpadding="0"
width="600">
<tr>
<td colspan="5">
<h1 class="center">Faculty
Web Application - Courses</h1>
</td>
</tr>
<tr>
<td class="center">[<a
href="editPage.asp">Main
Form</a>]</td>
<%If Not
Session("strUserLogon")="tfaculty" Then %>
<td class="center">[<a
href="http://intranet.oznet.ksu.edu/agronomy/uploadImage.asp">Edit
Picture</a>]</td>
<% End If %>
<td class="center">[<a
href="editGeneral.asp">Edit
General Info</a>]</td>
<td class="center">[<a
href="editProfessional.asp">Edit
Professional Info</a>]</td>
<td class="center">[<a
href="editMiscCategory.asp">Edit
Miscellaneous Info</a>]</td>
</tr>
<tr>
<td colspan="5">
<hr>
<%
Dim rsCourse
Dim bNew
'If the user selected to remove
the course and go to addCourse.asp
'*****************************************************************
If Request("Remove")
<> "" Then
'Remove the current Course
Response.Redirect "addCourse.asp?Action=Remove&ID="
& Request("ID")
End If
'Open a recordset containing the
courses
Set rsCourse =
Server.CreateObject("ADODB.Recordset")
strSQL = "Select * FROM
tblCourses ORDER BY tblCourses.fldNumber;"
rsCourse.Open strSQL, fp_conn,
adOpenDynamic, adLockOptimistic, adCmdText
'Check the QueryString to see
whether the user selected to add a new course
'or edit a current course. The
user must either select a button called Add
'or Edit or slect a link with the
querystring Add or Edit.
'**************************************************************************
If Request("Add")
<> "" Then
'Add a new Course
bNew = True
Else
If Request("Edit")
<> "" Then
'Edit the current Course
rsCourse.Filter = "fldCourseID
= " & Request("ID")
bNew = False
Else
'Return to the main form
Response.Redirect "editPage.asp"
End If
End If
If Not bNew Then
%>
<h2 class="center">Edit
your Course Information for the web</h2>
<form
action="addCourse.asp"
method="Post"
onsubmit="return verifyData()"
name="frmCourse">
<input
type="Hidden"
alt=" "
name="CourseID"
value="<%=
rsCourse("fldCourseID") %>">
<% Else %>
<div class="center">
<h2>Pick
a Course from the list</h2>
<form
action="addCourse.asp"
method="post"
onSubmit="return verifyData()"
name="frmCourse">
<input
type="Hidden"
alt=" "
name="CourseID"
value><select name="cboCourse">
<option
value selected><---Select a Course
---></option>
<%'Create a combo box
with all of the courses listed in the faculty database
'*************************************************************************
While Not rsCourse.EOF %>
<option
value="<%=
rsCourse("fldCourseID")%>"><%=
rsCourse("fldNumber")%></option>
<% rsCourse.MoveNext
Wend
rsCourse.Close
%>
</select><input
alt="Add Course"
type="Submit"
value="Add Course">
</div>
<h2 class="center">or </h2>
<h2 class="center">Enter
Course Information for a new Course</h2>
<% End If %>
<table
width="600"
cellspacing="0"
cellpadding="10">
<tr>
<td>
<div class="center">
<table
width="600">
<tr>
<td colspan="2"><label>Course
Number:</label>*
(Agron ###)</td>
</tr>
<tr>
<td colspan="2"><input
alt="Number"
type="text"
name="Number"
size="9"
value="<%If
Not bNew Then Response.Write rsCourse("fldNumber") Else Response.Write
"Agron" End If%>"></td>
</tr>
<tr>
<td></td>
<td width="478"></td>
</tr>
<tr>
<td colspan="2"><label>Name:*</label></td>
</tr>
<tr>
<td colspan="2"><input
alt="Name"
type="text"
name="Name"
size="92"
value="<%If
Not bNew Then Response.Write rsCourse("fldName") End If%>"></td>
</tr>
<tr>
<td colspan="2"></td>
</tr>
<tr>
<td colspan="2"><label>Course
Description URL:(optional)</label></td>
</tr>
<tr>
<td colspan="2"><input
alt="Description URL"
type="text"
name="DescURL"
size="92"
value="<%If
Not bNew Then Response.Write rsCourse("fldDescURL") End If%>"></td>
</tr>
<tr>
<td colspan="2"></td>
</tr>
<tr>
<td colspan="2"><label>Course
Web Page URL:(optional)</label></td>
</tr>
<tr>
<td colspan="2"><input
alt="Web Page URL"
type="text"
name="WebPageURL"
size="92"
value="<%If
Not bNew Then Response.Write rsCourse("fldWebPageURL") End If%>"></td>
</tr>
<tr>
<td colspan="2"> <input
alt="Submit"
type="Submit"
value="<%If
bNew Then %>Add Course<%
Else %>Update Course<%End
If%>">
<input
alt="Reset to Original Information"
type="reset"
value="Reset to Original Information"
name="Reset"></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</form>
<!--webbot bot="Include"
u-include="includes/footer.asp" tag="BODY" -->
</td>
</tr>
</table>
</div>
</body>
</html>