%@ CodePage=65001 %> <% Const EW_PAGE_ID = "view" Const EW_TABLE_NAME = "Top_Navigation" %> <% Session.Timeout = 100 %> <% Response.Expires = 0 Response.ExpiresAbsolute = Now() - 1 Response.AddHeader "pragma", "no-cache" Response.AddHeader "cache-control", "private, no-cache, no-store, must-revalidate" %> <% ' Open connection to the database Dim conn Set conn = Server.CreateObject("ADODB.Connection") conn.Open EW_DB_CONNECTION_STRING %> <% Dim Security Set Security = New cAdvancedSecurity %> <% If Not Security.IsLoggedIn() Then Call Security.AutoLogin() If Not Security.IsLoggedIn() Then Call Security.SaveLastUrl() Call Page_Terminate("login.asp") End If %> <% ' Common page loading event (in userfn60.asp) Call Page_Loading() %> <% ' Page load event, used in current page Call Page_Load() %> <% Response.Buffer = True If Request.QueryString("id").Count > 0 Then Top_Navigation.id.QueryStringValue = Request.QueryString("id") Else Call Page_Terminate("Top_Navigationlist.asp") ' Return to list page End If ' Get action If Request.Form("a_view").Count > 0 Then Top_Navigation.CurrentAction = Request.Form("a_view") Else Top_Navigation.CurrentAction = "I" ' Display form End If Select Case Top_Navigation.CurrentAction Case "I" ' Get a record to display If Not LoadRow() Then ' Load record based on key Session(EW_SESSION_MESSAGE) = "No records found" ' Set no record message Call Page_Terminate("Top_Navigationlist.asp") ' Return to list End If End Select ' Set return url Top_Navigation.ReturnUrl = "Top_Navigationview.asp" ' Render row Top_Navigation.RowType = EW_ROWTYPE_VIEW Call RenderRow() %>
View TABLE: Top Navigation
Back to List
<% If Security.IsLoggedIn() Then %>
Add
<% End If %>
<% If Security.IsLoggedIn() Then %>
Edit
<% End If %>
<% If Security.IsLoggedIn() Then %>
Copy
<% End If %>
<% If Security.IsLoggedIn() Then %>
Delete
<% End If %>
<%= Session(EW_SESSION_MESSAGE) %>
<% Session(EW_SESSION_MESSAGE) = "" ' Clear message End If %>
<%
' If control is passed here, simply terminate the page without redirect
Call Page_Terminate("")
' -----------------------------------------------------------------
' Subroutine Page_Terminate
' - called when exit page
' - clean up ADO connection and objects
' - if url specified, redirect to url, otherwise end response
'
Sub Page_Terminate(url)
' Page unload event, used in current page
Call Page_Unload()
' Global page unloaded event (in userfn60.asp)
Call Page_Unloaded()
conn.Close ' Close Connection
Set conn = Nothing
Set Security = Nothing
Set Top_Navigation = Nothing
' Go to url if specified
If url <> "" Then
Response.Clear
Response.Redirect url
End If
' Terminate response
Response.End
End Sub
'
' Subroutine Page_Terminate (End)
' ----------------------------------------
%>
<%
' Load row based on key values
Function LoadRow()
Dim rs, sSql, sFilter
sFilter = Top_Navigation.SqlKeyFilter
If Not IsNumeric(Top_Navigation.id.CurrentValue) Then
LoadRow = False ' Invalid key, exit
Exit Function
End If
sFilter = Replace(sFilter, "@id@", ew_AdjustSql(Top_Navigation.id.CurrentValue)) ' Replace key value
' Call Row Selecting event
Call Top_Navigation.Row_Selecting(sFilter)
' Load sql based on filter
Top_Navigation.CurrentFilter = sFilter
sSql = Top_Navigation.SQL
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sSql, conn
If rs.Eof Then
LoadRow = False
Else
LoadRow = True
rs.MoveFirst
Call LoadRowValues(rs) ' Load row values
' Call Row Selected event
Call Top_Navigation.Row_Selected(rs)
End If
rs.Close
Set rs = Nothing
End Function
' Load row values from recordset
Sub LoadRowValues(rs)
Top_Navigation.id.DbValue = rs("id")
Top_Navigation.Navigation_Name.DbValue = rs("Navigation_Name")
Top_Navigation.language_id.DbValue = rs("language_id")
Top_Navigation.Page_Type.DbValue = rs("Page_Type")
Top_Navigation.Player_Position.DbValue = rs("Player_Position")
Top_Navigation.Content.DbValue = rs("Content")
Top_Navigation.View_Order.DbValue = rs("View_Order")
Top_Navigation.Show_Center_Images.DbValue = ew_IIf(rs("Show_Center_Images"), "1", "0")
Top_Navigation.Show_Rotating_Images.DbValue = ew_IIf(rs("Show_Rotating_Images"), "1", "0")
Top_Navigation.Show_Wallpaper.DbValue = ew_IIf(rs("Show_Wallpaper"), "1", "0")
Top_Navigation.Hide.DbValue = ew_IIf(rs("Hide"), "1", "0")
Top_Navigation.Thumb_Image.Upload.DbValue = rs("Thumb_Image")
Top_Navigation.Image.Upload.DbValue = rs("Image")
Top_Navigation.isHomePage.DbValue = ew_IIf(rs("isHomePage"), "1", "0")
End Sub
%>
<%
' Render row values based on field settings
Sub RenderRow()
' Call Row Rendering event
Call Top_Navigation.Row_Rendering()
' Common render codes for all row types
' id
Top_Navigation.id.CellCssStyle = ""
Top_Navigation.id.CellCssClass = ""
' Navigation_Name
Top_Navigation.Navigation_Name.CellCssStyle = ""
Top_Navigation.Navigation_Name.CellCssClass = ""
' language_id
Top_Navigation.language_id.CellCssStyle = ""
Top_Navigation.language_id.CellCssClass = ""
' Page_Type
Top_Navigation.Page_Type.CellCssStyle = ""
Top_Navigation.Page_Type.CellCssClass = ""
' Player_Position
Top_Navigation.Player_Position.CellCssStyle = ""
Top_Navigation.Player_Position.CellCssClass = ""
' Content
Top_Navigation.Content.CellCssStyle = ""
Top_Navigation.Content.CellCssClass = ""
' View_Order
Top_Navigation.View_Order.CellCssStyle = ""
Top_Navigation.View_Order.CellCssClass = ""
' Show_Center_Images
Top_Navigation.Show_Center_Images.CellCssStyle = ""
Top_Navigation.Show_Center_Images.CellCssClass = ""
' Show_Rotating_Images
Top_Navigation.Show_Rotating_Images.CellCssStyle = ""
Top_Navigation.Show_Rotating_Images.CellCssClass = ""
' Show_Wallpaper
Top_Navigation.Show_Wallpaper.CellCssStyle = ""
Top_Navigation.Show_Wallpaper.CellCssClass = ""
' Hide
Top_Navigation.Hide.CellCssStyle = ""
Top_Navigation.Hide.CellCssClass = ""
' Thumb_Image
Top_Navigation.Thumb_Image.CellCssStyle = ""
Top_Navigation.Thumb_Image.CellCssClass = ""
' Image
Top_Navigation.Image.CellCssStyle = ""
Top_Navigation.Image.CellCssClass = ""
' isHomePage
Top_Navigation.isHomePage.CellCssStyle = ""
Top_Navigation.isHomePage.CellCssClass = ""
If Top_Navigation.RowType = EW_ROWTYPE_VIEW Then ' View row
' id
Top_Navigation.id.ViewValue = Top_Navigation.id.CurrentValue
Top_Navigation.id.CssStyle = ""
Top_Navigation.id.CssClass = ""
Top_Navigation.id.ViewCustomAttributes = ""
' Navigation_Name
Top_Navigation.Navigation_Name.ViewValue = Top_Navigation.Navigation_Name.CurrentValue
Top_Navigation.Navigation_Name.CssStyle = ""
Top_Navigation.Navigation_Name.CssClass = ""
Top_Navigation.Navigation_Name.ViewCustomAttributes = ""
' language_id
If Not IsNull(Top_Navigation.language_id.CurrentValue) And Top_Navigation.language_id.CurrentValue <> "" Then
sSqlWrk = "SELECT [Language_Name] FROM [Languages] WHERE [id] = " & ew_AdjustSql(Top_Navigation.language_id.CurrentValue) & ""
sSqlWrk = sSqlWrk & " ORDER BY [Language_Name] Asc"
Set rswrk = conn.Execute(sSqlWrk)
If Not rswrk.Eof Then
Top_Navigation.language_id.ViewValue = rswrk("Language_Name")
Else
Top_Navigation.language_id.ViewValue = Top_Navigation.language_id.CurrentValue
End If
rswrk.Close
Set rswrk = Nothing
Else
Top_Navigation.language_id.ViewValue = Null
End If
Top_Navigation.language_id.CssStyle = ""
Top_Navigation.language_id.CssClass = ""
Top_Navigation.language_id.ViewCustomAttributes = ""
' Page_Type
If Not IsNull(Top_Navigation.Page_Type.CurrentValue) Then
Select Case Top_Navigation.Page_Type.CurrentValue
Case "1"
Top_Navigation.Page_Type.ViewValue = "General"
Case "2"
Top_Navigation.Page_Type.ViewValue = "Players"
Case "3"
Top_Navigation.Page_Type.ViewValue = "Coaches"
Case Else
Top_Navigation.Page_Type.ViewValue = Top_Navigation.Page_Type.CurrentValue
End Select
Else
Top_Navigation.Page_Type.ViewValue = Null
End If
Top_Navigation.Page_Type.CssStyle = ""
Top_Navigation.Page_Type.CssClass = ""
Top_Navigation.Page_Type.ViewCustomAttributes = ""
' Player_Position
If Not IsNull(Top_Navigation.Player_Position.CurrentValue) And Top_Navigation.Player_Position.CurrentValue <> "" Then
sSqlWrk = "SELECT [Position] FROM [positions] WHERE [ID] = " & ew_AdjustSql(Top_Navigation.Player_Position.CurrentValue) & ""
sSqlWrk = sSqlWrk & " ORDER BY [Position] Asc"
Set rswrk = conn.Execute(sSqlWrk)
If Not rswrk.Eof Then
Top_Navigation.Player_Position.ViewValue = rswrk("Position")
Else
Top_Navigation.Player_Position.ViewValue = Top_Navigation.Player_Position.CurrentValue
End If
rswrk.Close
Set rswrk = Nothing
Else
Top_Navigation.Player_Position.ViewValue = Null
End If
Top_Navigation.Player_Position.CssStyle = ""
Top_Navigation.Player_Position.CssClass = ""
Top_Navigation.Player_Position.ViewCustomAttributes = ""
' Content
Top_Navigation.Content.ViewValue = Top_Navigation.Content.CurrentValue
If Not IsNull(Top_Navigation.Content.ViewValue) Then
Top_Navigation.Content.ViewValue = Replace(Top_Navigation.Content.ViewValue, vbLf, "
")
End If
Top_Navigation.Content.CssStyle = ""
Top_Navigation.Content.CssClass = ""
Top_Navigation.Content.ViewCustomAttributes = ""
' View_Order
Top_Navigation.View_Order.ViewValue = Top_Navigation.View_Order.CurrentValue
Top_Navigation.View_Order.CssStyle = ""
Top_Navigation.View_Order.CssClass = ""
Top_Navigation.View_Order.ViewCustomAttributes = ""
' Show_Center_Images
If Top_Navigation.Show_Center_Images.CurrentValue = "1" Then
Top_Navigation.Show_Center_Images.ViewValue = "Yes"
Else
Top_Navigation.Show_Center_Images.ViewValue = "No"
End If
Top_Navigation.Show_Center_Images.CssStyle = ""
Top_Navigation.Show_Center_Images.CssClass = ""
Top_Navigation.Show_Center_Images.ViewCustomAttributes = ""
' Show_Rotating_Images
If Top_Navigation.Show_Rotating_Images.CurrentValue = "1" Then
Top_Navigation.Show_Rotating_Images.ViewValue = "Yes"
Else
Top_Navigation.Show_Rotating_Images.ViewValue = "No"
End If
Top_Navigation.Show_Rotating_Images.CssStyle = ""
Top_Navigation.Show_Rotating_Images.CssClass = ""
Top_Navigation.Show_Rotating_Images.ViewCustomAttributes = ""
' Show_Wallpaper
If Top_Navigation.Show_Wallpaper.CurrentValue = "1" Then
Top_Navigation.Show_Wallpaper.ViewValue = "Yes"
Else
Top_Navigation.Show_Wallpaper.ViewValue = "No"
End If
Top_Navigation.Show_Wallpaper.CssStyle = ""
Top_Navigation.Show_Wallpaper.CssClass = ""
Top_Navigation.Show_Wallpaper.ViewCustomAttributes = ""
' Hide
If Top_Navigation.Hide.CurrentValue = "1" Then
Top_Navigation.Hide.ViewValue = "Yes"
Else
Top_Navigation.Hide.ViewValue = "No"
End If
Top_Navigation.Hide.CssStyle = ""
Top_Navigation.Hide.CssClass = ""
Top_Navigation.Hide.ViewCustomAttributes = ""
' Thumb_Image
If Not IsNull(Top_Navigation.Thumb_Image.Upload.DbValue) Then
Top_Navigation.Thumb_Image.ViewValue = Top_Navigation.Thumb_Image.Upload.DbValue
Top_Navigation.Thumb_Image.ImageAlt = ""
Else
Top_Navigation.Thumb_Image.ViewValue = ""
End If
Top_Navigation.Thumb_Image.CssStyle = ""
Top_Navigation.Thumb_Image.CssClass = ""
Top_Navigation.Thumb_Image.ViewCustomAttributes = ""
' Image
If Not IsNull(Top_Navigation.Image.Upload.DbValue) Then
Top_Navigation.Image.ViewValue = Top_Navigation.Image.Upload.DbValue
Top_Navigation.Image.ImageAlt = ""
Else
Top_Navigation.Image.ViewValue = ""
End If
Top_Navigation.Image.CssStyle = ""
Top_Navigation.Image.CssClass = ""
Top_Navigation.Image.ViewCustomAttributes = ""
' isHomePage
If Top_Navigation.isHomePage.CurrentValue = "1" Then
Top_Navigation.isHomePage.ViewValue = "Yes"
Else
Top_Navigation.isHomePage.ViewValue = "No"
End If
Top_Navigation.isHomePage.CssStyle = ""
Top_Navigation.isHomePage.CssClass = ""
Top_Navigation.isHomePage.ViewCustomAttributes = ""
' id
' *** view refer script
Top_Navigation.id.HrefValue = ""
' Navigation_Name
' *** view refer script
Top_Navigation.Navigation_Name.HrefValue = ""
' language_id
' *** view refer script
Top_Navigation.language_id.HrefValue = ""
' Page_Type
' *** view refer script
Top_Navigation.Page_Type.HrefValue = ""
' Player_Position
' *** view refer script
Top_Navigation.Player_Position.HrefValue = ""
' Content
' *** view refer script
Top_Navigation.Content.HrefValue = ""
' View_Order
' *** view refer script
Top_Navigation.View_Order.HrefValue = ""
' Show_Center_Images
' *** view refer script
Top_Navigation.Show_Center_Images.HrefValue = ""
' Show_Rotating_Images
' *** view refer script
Top_Navigation.Show_Rotating_Images.HrefValue = ""
' Show_Wallpaper
' *** view refer script
Top_Navigation.Show_Wallpaper.HrefValue = ""
' Hide
' *** view refer script
Top_Navigation.Hide.HrefValue = ""
' Thumb_Image
' *** view refer script
Top_Navigation.Thumb_Image.HrefValue = ""
' Image
' *** view refer script
Top_Navigation.Image.HrefValue = ""
' isHomePage
' *** view refer script
Top_Navigation.isHomePage.HrefValue = ""
ElseIf Top_Navigation.RowType = EW_ROWTYPE_ADD Then ' Add row
ElseIf Top_Navigation.RowType = EW_ROWTYPE_EDIT Then ' Edit row
ElseIf Top_Navigation.RowType = EW_ROWTYPE_SEARCH Then ' Search row
End If
' Call Row Rendered event
Call Top_Navigation.Row_Rendered()
End Sub
%>
<%
' Set up Starting Record parameters based on Pager Navigation
Sub SetUpStartRec()
Dim nPageNo
' Exit if nDisplayRecs = 0
If nDisplayRecs = 0 Then Exit Sub
' Check for a START parameter
If Request.QueryString(EW_TABLE_START_REC).Count > 0 Then
nStartRec = Request.QueryString(EW_TABLE_START_REC)
Top_Navigation.StartRecordNumber = nStartRec
ElseIf Request.QueryString(EW_TABLE_PAGE_NO).Count > 0 Then
nPageNo = Request.QueryString(EW_TABLE_PAGE_NO)
If IsNumeric(nPageNo) Then
nStartRec = (nPageNo-1)*nDisplayRecs+1
If nStartRec <= 0 Then
nStartRec = 1
ElseIf nStartRec >= ((nTotalRecs-1)\nDisplayRecs)*nDisplayRecs+1 Then
nStartRec = ((nTotalRecs-1)\nDisplayRecs)*nDisplayRecs+1
End If
Top_Navigation.StartRecordNumber = nStartRec
Else
nStartRec = Top_Navigation.StartRecordNumber
End If
Else
nStartRec = Top_Navigation.StartRecordNumber
End If
' Check if correct start record counter
If Not IsNumeric(nStartRec) Or nStartRec = "" Then ' Avoid invalid start record counter
nStartRec = 1 ' Reset start record counter
Top_Navigation.StartRecordNumber = nStartRec
ElseIf CLng(nStartRec) > CLng(nTotalRecs) Then ' Avoid starting record > total records
nStartRec = ((nTotalRecs-1)\nDisplayRecs)*nDisplayRecs+1 ' Point to last page first record
Top_Navigation.StartRecordNumber = nStartRec
ElseIf (nStartRec-1) Mod nDisplayRecs <> 0 Then
nStartRec = ((nStartRec-1)\nDisplayRecs)*nDisplayRecs+1 ' Point to page boundary
Top_Navigation.StartRecordNumber = nStartRec
End If
End Sub
%>
<%
' Page Load event
Sub Page_Load()
'***Response.Write "Page Load"
End Sub
' Page Unload event
Sub Page_Unload()
'***Response.Write "Page Unload"
End Sub
%>