%@ LANGUAGE="VBSCRIPT" %>
<%
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
Function WrapAround(textfield)
dim strCount, strLineSize,LineCount, LineInitial, LineTerminator, strTimes
strCount = len(textfield)
intPositionToWrap = 55
LineCount = 20
LineInitial = 1
LineTerminator = " "
strValue = ""
do while ( len(textfield) > intPositionToWrap )
CharOneHundredth = mid(textfield, intPositionToWrap, 1)
If CharOneHundredth <> " " Then
strTempText = Left(textfield, intPositionToWrap)
If InStr(strTempText, " ") <= 0 Then 'one long word
strValue = strValue & left (textfield, intPositionToWrap) & vbCrLf
intPos = intPositionToWrap
Else 'Wrap on Next " "
intPos = InStrRev(strTempText," ")
strValue = strValue & Left(textfield, intPos) & vbCrLf
End If
Else 'Wrap it right there
strValue = strValue & left (textfield, intPositionToWrap) & vbCrLf
intPos = intPositionToWrap
End If
textfield = right(textfield, len(textfield) - intPos)
loop
strValue = replace(strValue,vbCrLf," ")
WrapAround = strValue
End Function
'-- Global Variables --
'Dim gradename
strPageURL = "readrep.asp"
blnNeedRs = False ' True: Create New Recordset
blnEmptyRs = False ' True: Database Query Returned empty recordset
adMaximumShow = 25 ' 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
'strAge = FormatTextHTML(request.QueryString("Age"))
'If strAge <> "" Then
' Session("Age_aa") = strAge
'Else
' strAge = Session("Age_aa")
'End If
'strStoryDate = FormatTextHTML(request.QueryString("StoryDate"))
'If strStoryDate <> "" Then
' Session("StoryDate_aa") = strStoryDate
'Else
' strStoryDate = Session("StoryDate_aa")
'End If
If IsEmpty(Session("SortType_Sch_aa")) Then
Session("SortType_Sch_aa") = "StoryDate"
End If
strSort = FormatTextHTML(request.QueryString("Sort"))
If strSort = "" Then
strSort = Session("SortType_Sch_aa")
End If
Select Case strSort
Case "State":
strSortBy = "State, Q1, Firstname, LastInitial"
Case "Student":
strSortBy = "Firstname, LastInitial"
Case "Title":
strSortBy = "Q1, Firstname, LastInitial"
Case "StoryDate":
strSortBy = "Q2, 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("StoryDate")) <> "" Then
' blnNeedRs = True
'End If
'Always...
blnNeedRs = True
'-- Open Database Connection --
' Select if BlnNeedRs is true
If blnNeedRs Then
Set rs = Server.CreateObject("ADODB.Recordset")
'strSQL = "SELECT Age, Firstname, LastInitial, Q1, Q2, Q3, State, ReportID FROM " & table_name & " WHERE Status =" & adLive & " AND Hold = 0 AND Q2= '" & strStoryDate & "' AND WritingType='WHST' " & " ORDER BY " & strSortBy
strSQL = "SELECT Age, Firstname, LastInitial, Q1, Q2, Q3, State, ReportID FROM " & table_name & " WHERE Status =" & adLive & " AND Hold = 0 AND WritingType='WHST' " & " 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
'gradename = rs("Grade")
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
strNavBar = ""
'****** 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
strNavBar = strNavBar & "<<Previous "
End If
For intI = 1 To intTotalPages
If intI <> intPageNmr Then
strNavBar = strNavBar & " | " & intI & " "
Else
strNavBar = strNavBar & " | " & intI & " "
End If
Next
strNavBar = strNavBar & "|"
If ((intTotalPages > 1) and (intPageNmr < intTotalPages)) then
strNavBar = strNavBar & " Next>>"
End If
strNavBar = strNavBar & ""
End If
End If
%>
Amelia Earhart: Read student writing published in the the Earhart Gazette
<%
doMenu
%>
<%
'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
%>
<%=strNavBar%>
Click the red arrows to
sort by Title, Written by, or Story Date. Click the student's name
to read the selection. Read submissions from our
1997 Women's History Month contest winners!
<%
'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
'Title
Response.Write "
"
Next
Else
'No Record exist - output Message
Response.Write "
No reports available.
"
End If
%>
<%
'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
%>