%@ LANGUAGE="VBSCRIPT" %>
<%
'-- Global Variables --
'Dim gradename
blnNeedRs = False ' True: Create New Recordset
blnEmptyRs = False ' True: Database Query Returned empty recordset
adMaximumShow = 30 ' Maximum show on page
strFilename = Request.ServerVariables("PATH_INFO")
strnameParts = Split(strFilename,"/")
strFilename = strnameParts(UBound(strnameParts))
' -- Retrieve Page Parameters
'Response.Write "BlnNeedRs is :" & BlnNeedRs
' determine the current page number
strPageNmr = FormatTextHTML(request.QueryString("Page"))
If strPageNmr = "" Then
If IsEmpty(Session("PageNmr_Sch_aa")) Then
intPageNmr = 1
Else
'intPageNmr = Session("PageNmr_Sch_aa")
End If
Else
intPageNmr = CInt(strPageNmr)
Session("PageNmr_Sch_aa") = intPageNmr
End If
'Comment started Sanjay
If IsEmpty(Session("Schoolname_aa")) Then
Session("Schoolname_aa") = " "
End If
strState = FormatTextHTML(request.QueryString("State"))
If strState <> "" Then
Session("State_aa") = strState
Else
strState = Session("State_aa")
End If
If IsEmpty(Session("SortType_Sch_aa")) Then
Session("SortType_Sch_aa") = "Student"
End If
strSort = FormatTextHTML(request.QueryString("Sort"))
If strSort = "" Then
strSort = Session("SortType_Sch_aa")
End If
Select Case strSort
Case "Age":
strSortBy = "Age, Q1, Firstname, LastInitial"
Case "Student":
strSortBy = "Firstname, LastInitial"
Case "Title":
strSortBy = "Q1, Firstname, LastInitial"
End Select
If IsEmpty(Session("avar_Reports_Sch_aa")) Then
blnNeedRs = True
ElseIf Session("SortType_Sch_aa") <> strSort Then
blnNeedRs = True
'ElseIf FormatTextHTML(request.QueryString("School")) <> "" Then '---->Sanjay
ElseIf FormatTextHTML(request.QueryString("State")) <> "" Then
blnNeedRs = True
End If
'-- Open Database Connection --
' Select if BlnNeedRs is true
If blnNeedRs Then
Set rs = Server.CreateObject("ADODB.Recordset")
'strSQL = "SELECT Age, Firstname, LastInitial, Q1, Q2, Schoolname, State, ReportID FROM CB_HowFeel WHERE Status =" & adLive & " AND Hold = 0 AND Schoolname = '" & strSchoolname & "' ORDER BY " & strSortBy
strSQL = "SELECT Age, Firstname, LastInitial, Q1, Q2, 'DUMMYCOLUMN', State, ReportID FROM " & table_name & " WHERE Status =" & adLive & " AND Hold = 0 AND State = '" & strState & "' ORDER BY " & strSortBy
'rs.Open strSQL, Application("DBConn"), 3, 3
rs.Open strSQL, CONNECTION_STRING, 3, 3
If NOT (rs.EOF AND rs.BOF) Then
'Agename = rs("Age")
avarReports = rs.GetRows()
Else
blnEmptyRs = True
End If
Session("avar_Reports_Sch_aa") = avarReports
Session("SortType_Sch_aa") = strSort
Else
avarReports = Session("avar_Reports_Sch_aa")
End If
On Error Resume Next
'Calculate # of pages
If NOT blnEmptyRs Then
intTotalPages = Fix((UBound(avarReports,2) + 1) /adMaximumShow)
If UBound(avarReports,2) + 1 mod adMaximumShow <> 0 Then
intTotalPages = intTotalPages + 1
End If
End If
Function WrapIt(textfield)
dim strCount, strLineSize,LineCount, LineInitial, LineTerminator, strTimes
strCount = len(textfield)
LineCount = 20
LineInitial = 1
LineTerminator = " "
textfield = replace(textfield,chr(13)&chr(10)," ")
strTimes= strCount/LineCount
For i=0 to Cint(strTimes)
strValue = strValue & mid(textfield, LineInitial, LineCount) & LineTerminator
LineInitial = LineInitial + LineCount
next
WrapIt = strValue
End Function
%>
News Writing With Scholastic Editors
<%
doMenu
%>
Read Student Writing
<%=strState%>
<%
'Display Current page of total pages
If FormatTextHTML(request("Page")) <> "" then ' Is there Page # passed?
Page = FormatTextHTML(request("Page")) ' Yes, there is
If IsNumeric(Page) then Page = Int(Page)
Else
If intTotalPages > 1 Then intPageNmr = 1
End If
PageURL = "readsch.asp"
'strPageTitle = "Administration Page"
If FormatTextHTML(request("rand"))= NULL or FormatTextHTML(request("rand")) = "" then
rndnum = rnd
else
rndnum = FormatTextHTML(request("rand"))+ 1
end if
If intTotalPages > 1 Then
Response.Write "Page: " & intPageNmr & " of " & intTotalPages
End If
%>
<%
'****** Generate page(s) link (30 records per each page) ***********
If NOT blnEmptyRs Then
' -- JUMP TO PAGE linkS --
If intTotalPages > 1 Then 'Generate pages only if find more than 30 records
If (intPageNmr > 1) then
Response.Write "<<Previous "
End If
For intI = 1 To intTotalPages
If intI <> intPageNmr Then
Response.Write " | " & intI & " "
Else
Response.Write " | " & intI & " "
End If
Next
Response.Write "|"
If ((intTotalPages > 1) and (intPageNmr < intTotalPages)) then
Response.Write " Next>>"
End If
End If
End If
%>
Click a column heading to sort by student name, Age, or title.
Click a student's name to read the selection.
<%
'Generate List of records in selected page. Default is first page.
If NOT blnEmptyRs Then
'There is some record exist on the selection
If (intPageNmr <> intTotalPages) and (intTotalPages > 1) Then
intRepShow = adMaximumShow
Elseif (intPageNmr > 0) and (intTotalPages > 1) Then
intRepShow = UBound(avarReports,2) - ((intPageNmr-1) * adMaximumShow) + 1
Else
intPageNmr = 1
intRepShow = UBound(avarReports,2) + 1
End If
intShift = (intPageNmr - 1) * adMaximumShow
For intLoop = intShift To intRepShow + intShift - 1
Response.Write "