#Region " Imports " Imports System.Text Imports Statistics.PkiMethods #End Region Public Class PageTemplate #Region " Instance Fields " Dim _bannerUrl As String = "[Not Set]" Dim _bannerUrlLogged As String = "[Not Set]" Dim _bannerImage As String = "[Not Set]" Dim _displayTitle As String = "[Not Set]" Dim _privateUrl As String = "http://www.example.com" Dim _privateJoinUrl As String = "http://www.another.com" Dim _privatePortalUrl As String = "http://www.yetanother.com" Dim _publicJoinUrl As String = "http://www.stillanother.com" Dim _publicPortalUrl As String = "http://www.lestweforget.com" Dim _publicUrl As String = "http://www.theend.com" #End Region #Region " Enumerations " Enum WebsiteType As Integer PublicWebsite PrivateWebsite End Enum #End Region #Region " Properties " Public Property bannerImage() As String Get Return _bannerImage End Get Set(ByVal value As String) _bannerImage = value End Set End Property Public Property bannerUrl() As String Get Return _bannerUrl End Get Set(ByVal value As String) _bannerUrl = value End Set End Property Public Property bannerUrlLogged() As String Get Return _bannerUrlLogged End Get Set(ByVal value As String) _bannerUrlLogged = value End Set End Property Public Property displayTitle() As String Get Return _displayTitle End Get Set(ByVal value As String) _displayTitle = value End Set End Property #End Region #Region " Methods " Public Function AccessDenied() As String Dim s As New StringBuilder s.Append("") s.Append("") s.Append("
") s.Append("") s.Append("") s.Append("
") s.Append("Access Denied

") s.Append("

") s.Append("You do not have permission ") s.Append("to access this tool") s.Append("
") s.Append("
") Return s.ToString End Function Public Function Banner(ByVal type As WebsiteType) As String Dim _failed As Boolean = False Dim _logged As Boolean = False Dim _renderUrl As String = _bannerUrl If Not HttpContext.Current.Session("username") Is Nothing Then If Not HttpContext.Current.Session("username") = String.Empty Then _logged = True End If End If If _bannerImage = "[Not Set]" Then HttpContext.Current.Response.Write("

ERROR: Banner Image Not Set

") _failed = True End If If _displayTitle = "[Not Set]" Then HttpContext.Current.Response.Write("

ERROR: Banner Title Not Set

") _failed = True End If If _bannerUrl = "[Not Set]" Then HttpContext.Current.Response.Write("

ERROR: Banner URL Not Set

") _failed = True End If If _bannerUrlLogged = "[Not Set]" Then HttpContext.Current.Response.Write("

ERROR: Banner URL Logged Not Set

") _failed = True End If If _failed Then HttpContext.Current.Response.End() Return "

ERROR: Unable to create page banner.

" Else If _logged Then _renderUrl = _bannerUrlLogged Dim s As New StringBuilder s.Append("") s.Append("") s.Append("") s.Append("") s.Append("") s.Append("") s.Append("") Return s.ToString End If End Function Public Sub Breadcrumb(ByVal id As Label, ByVal title As String, ByVal pagename As String) If Len(id.Text) > 0 Then id.Text = id.Text & " " & ">" & " " id.Text = id.Text & "" & title & "" End Sub Public Sub Breadcrumb(ByVal id As Label, ByVal title As String) If Len(id.Text) > 0 Then id.Text = id.Text & " " & ">" & " " id.Text = id.Text & "" & title & "" End Sub Public Sub Breadcrumb(ByVal id As Label) id.Text = String.Empty End Sub Public Function Footer(ByVal type As WebsiteType) As String Dim Pki As New PkiMethods Dim _failed As Boolean = False If _displayTitle = "[Not Set]" Then HttpContext.Current.Response.Write("

ERROR: Banner Title Not Set

") _failed = True End If If _failed Then HttpContext.Current.Response.End() Return "

ERROR: Unable to create page footer.

" Else Dim s As New StringBuilder s.Append("") s.Append("") s.Append("") s.Append("") s.Append("
") Return s.ToString End If End Function Public Function Menubar(ByVal type As WebsiteType) As String Dim Pki As New PkiMethods Dim _joinLink As String = String.Empty Dim _joinText As String = String.Empty Dim _portalLink As String = String.Empty Select Case type Case WebsiteType.PrivateWebsite _joinLink = _privateJoinUrl _joinText = " Reserve    " _portalLink = _privatePortalUrl Case WebsiteType.PublicWebsite _joinLink = _publicJoinUrl _joinText = "    " _portalLink = _publicPortalUrl End Select Dim s As New StringBuilder s.Append("") s.Append("") s.Append("") s.Append("") s.Append("") s.Append("
") s.Append("") s.Append("") If Pki.IsLoggedOn Then s.Append("LOGOFF    ") Else s.Append("Join the Air Force" & _joinText & "") End If s.Append("
") Return s.ToString End Function Public Function SessionExpired() As String Dim s As New StringBuilder s.Append("") s.Append("") s.Append("
") s.Append("") s.Append("") s.Append("
") s.Append("Session Expired

") s.Append("

") s.Append("You will have log back on ") s.Append("to continue using this tool") s.Append("

") s.Append("
") s.Append("
") Return s.ToString End Function #End Region End Class