home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 1999 July / APC47-1.ISO / workshop / win95 / pws / iis4_02.cab / sub.inc < prev    next >
Encoding:
Text File  |  1997-10-21  |  9.4 KB  |  268 lines

  1. <%
  2. '    $Date: 10/20/97 6:35p $
  3. '    $ModTime: $
  4. '    $Revision: 26 $
  5. '    $Workfile: sub.inc $
  6.  
  7. '    ***    Style Sheet selection
  8.  Sub styleSheet
  9.     If myinfo.Theme <> "" Then
  10.         response.write"<LINK REL=StyleSheet HREF='/iissamples/homepage/themes/" & myinfo.Theme & "/layout.css' TYPE='text/css' MEDIA=screen>"
  11.     End If
  12.  End Sub
  13. '                *********************    DATE/TIME/MESSAGING/LINKS
  14.  
  15. '                *******        Date/Time
  16.  Sub page_datetime
  17.     response.write "<h4>Welcome!</h4>"_
  18.      & "<H5>Today is " & Date & ".<BR>"_
  19.      & "The local time is " & Time & ".</H5><BR>"
  20.  End Sub
  21.  
  22. '                *******        Guestbook and Messaging
  23.  Sub page_messaging
  24.     If myinfo.Guestbook <> "" or myinfo.Messages <> "" or myinfo.Email <> "" Then
  25.         If myinfo.Guestbook = "-1" or myinfo.Messages = "-1" or myinfo.checkEmail ="-1" Then
  26.             response.write "<h4>While you are here...</h4>"
  27.         End If
  28.         response.write "<FONT style='font-family:verdana;font-size:10pt'>"
  29.         If myinfo.Guestbook = "-1" THEN
  30.             response.write "<P><a href='/iissamples/homepage/guestbk.asp'>Read my guest book</A><BR>"
  31.         End If
  32.         If myinfo.Messages = "-1" THEN
  33.             response.write "<P><a href='/iissamples/homepage/signbook.asp?private=-1'>Leave a private message</a><BR>"
  34.         End If
  35.         response.write "</FONT>"
  36.     End If
  37.  End Sub
  38.  
  39.  Sub file_check
  40.     '***This routine checks for files in the webpub directory and creates a link to view the file list when files do exist.
  41.     DIM FileSystem, fl, g, f, sc, fc, isFiles
  42.         isfiles = 0
  43.         Set FileSystem=CreateObject("Scripting.FileSystemObject")
  44.     'Set File System Object.
  45.         g = Server.MapPath("\webpub")
  46.         g = g + "\"
  47.         Set f=FileSystem.GetFolder(g)
  48.         Set sc = f.SubFolders
  49.     'Check for files in folder.
  50.         Set fc = f.Files
  51.         For Each fl in fc
  52.             isfiles= isfiles + 1
  53.         Next
  54.     'If files exist, create link.
  55.         If isfiles > 0 Then
  56.             response.write "<FONT style='font-family:verdana;font-size:10pt'>"_
  57.             & "<A Href='/iissamples/homepage/myfiles.asp'>View my published documents.</A>"_
  58.             & "</FONT><BR>"
  59.         End If
  60.  End Sub
  61.     ' ***This subroutine creates an array of your weblinks.
  62.  Sub page_links
  63.     If myinfo.intUrl <> "" Then
  64.         response.write "<BR><FONT style='font-family:verdana;font-size:10pt'>"
  65.         call urlArray
  66.         response.write "</FONT>"
  67.     End If
  68.  End Sub
  69.  
  70.     '***Favorite links array
  71.  Sub urlArray
  72.     Dim urlList(), urlWordsList()
  73.     intID = 0
  74.     For i = 0 to myinfo.intUrl
  75.         If  myinfo("urlWords" & i) = "null" or myinfo("urlWords" & i) = "endoffile" or myinfo("url" & i) = "http://" or myinfo("url" & i) = ""  THEN
  76.             myinfo("url" & i) = "null"
  77.             myinfo("urlWords" & i) = "null"
  78.         Else
  79.             Redim Preserve urlList(intID), urlWordsList(intID)
  80.             urlList(intID) = Myinfo("url" & i)
  81.             urlWordsList(intID) = Myinfo("urlWords" & i)
  82.             response.write "<A href='" & urlList(intID) &"'>" & urlWordsList(intID) & "</A><BR>"
  83.             intID = intID + 1
  84.             myinfo.favoriteLinks = -1
  85.         End If
  86.     Next
  87.  End Sub
  88.  
  89.     '***Title
  90.  Sub Title
  91.     If myinfo.Title <> "" Then
  92.         response.write myinfo.Title
  93.     ElseIf myinfo.Name <> "" Then
  94.         response.write myinfo.Name & "'" 
  95.             If right(myInfo.Name, 1) <> "s" then
  96.             response.write "s"
  97.             End If
  98.         response.write " Home Page"
  99.     Else
  100.         response.write "My Home Page"
  101.     End If
  102.  End sub
  103.  
  104.     '*** main page contents
  105.  Sub layout_Email
  106.     If myinfo.Email <> "" Then
  107.         response.write "<FONT style='font-family:verdana;font-size:10pt'>"_
  108.         & "<P><BR>Email:<BR>"_
  109.         & "<A HREF=""" & "mailto:" & myinfo.Email & """>" & myinfo.Email & "</A></Font>"
  110.     End If
  111.  End Sub
  112.  
  113.  Sub Phone
  114.     If myinfo.Phone <> "" Then
  115.         response.write "<FONT style='font-family:verdana;font-size:10pt'>"_
  116.         & "<P><BR>Phone number:<BR>"_
  117.         & myinfo.Phone & "</Font>"
  118.     End If
  119.  End Sub
  120.  
  121.  Sub faxPhone
  122.     If myinfo.faxPhone <> ""Then
  123.         response.write "<FONT style='font-family:verdana;font-size:10pt'>"_
  124.         & "<P><BR>Fax number:<BR>"_
  125.         & myinfo.faxPhone &"</FONT><BR>"
  126.     End If
  127.  End Sub
  128.  
  129.  Sub Address
  130.     If myinfo.Name <> "" Then
  131.         response.write "<P><BR>" & myinfo.Name & "<br>"
  132.     End If
  133.     If myinfo.Department <> "" Then 
  134.         response.write "<FONT style='font-family:verdana;font-size:10pt'><P><BR>"_
  135.         & myinfo.Department & "</Font><BR>"
  136.     End If
  137.     DIM number
  138.     number = 1
  139.     For number = 1 to 4
  140.         If myinfo("Address" & number) <> "" Then
  141.             response.write "<FONT style='font-family:verdana;font-size:10pt'><P><BR>"_
  142.             & myinfo("Address" & number) & "</Font>"
  143.         End If
  144.     Next
  145.  End Sub
  146.  
  147.     '*** Headings & paragraphs
  148.  Function Heading(num)
  149.     Dim strHeading
  150.     strHeading = "<P><BR><FONT face='Verdana'><B>"
  151.     If myinfo("Heading" & num) <> "" Then
  152.         strHeading = strHeading & myinfo("Heading" & num) & "<BR>"
  153.     End If
  154.     strHeading = strHeading & "</B></FONT><FONT face='Verdana' size='-1'>"
  155.     If myinfo("Words" & num) <> "" Then
  156.         strHeading = strHeading & myinfo("Words" & num)
  157.     End If
  158.     strHeading = strHeading & "</FONT>"
  159.     Heading = strHeading
  160.  End Function
  161.     '*** IE LOGO
  162.  Sub ie_logo
  163.     response.write "<CENTER><BR><a href='http://www.microsoft.com/ie'>"_
  164.     & "<img src='/IISSamples/Default/IE.GIF' alt='Download Internet Explorer!' width='88' height='31' border=0></a>"_
  165.     & "</CENTER>"
  166.  End Sub
  167.  
  168.     '*** Navigation buttons for Guestbook and Administration pages.
  169.  Sub navigationButtons
  170.     If intMessageID <> "" Then
  171.          response.write "<TR><TD ALIGN='center' colspan='6'>"
  172.         rst.MovePrevious
  173.         If not rst.BOF Then
  174.             response.write FormSubmit("SUBMIT", "prev", "<<")
  175.         End If
  176.         rst.MoveNext
  177.             If page_Admin = "True" Then            ' Add delete button to admin page.
  178.                 response.write FormSubmit("SUBMIT", "delete", "Delete message")
  179.             Else
  180.                 response.write "   "
  181.             End If
  182.         rst.MoveNext
  183.         If not rst.EOF Then
  184.             response.write FormSubmit("SUBMIT", "next", ">>")
  185.         End If
  186.         rst.MovePrevious
  187.         response.write FormSubmit("HIDDEN", "MessageID", rst("MessageID"))
  188.         response.write "</TD></TR><TR><TD Colspan=6><B>"
  189.         If MessagePrivate ="True" Then
  190.             response.write "<A HREF='admin.asp?private=True'>Return to the " & L_Dropbox & "</A><BR>"
  191.         Else
  192.             response.write "<A HREF='admin.asp?private=False&strQuery=" & strQuery & "'>Return to the " & L_Guestbook & "</A><BR>"_
  193.         End If
  194.     Else
  195.         response.write "<TR><TD Colspan=3><B>"
  196.         If MessagePrivate <> "True" Then
  197.             response.write "<A HREF='qbe.asp'>New Query</A><BR>"
  198.         End If
  199.     End If
  200.         response.write "<A HREF='default.asp'>Web Site</A></B></TD></TR>"
  201.  End Sub
  202.     '*** Guestbook and Administration pages:  Table of messages.
  203.  Sub buildTable
  204.      Set rst = Session("rst")
  205.      If rst.EOF Then
  206.          If intMessageID <> "" Then
  207.             response.Write "<TR><TD Colspan='3'>There are no more messages.</TD></TR>"
  208.         ElseIf request.QueryString("MessageDateLimit") <> "" Then
  209.             response.Write "<TR><TD Colspan='3'>There are no messages that meet your criteria.</TD></TR>"
  210.         Else
  211.             response.Write "<TR><TD BGColor='#FFFFFF' Colspan='3'>There are no entries in your "
  212.             If MessagePrivate = "False" Then
  213.                 response.write L_Guestbook
  214.             Else
  215.                 response.write L_Dropbox
  216.             End If
  217.             response.write ".</TD></TR>"
  218.         End If
  219.      ElseIf intMessageID <> "" Then
  220.          Dim col1Cell
  221.         Dim col5Cell
  222.         Dim colFont
  223.         col5Cell = "<TD  BGColor='#FFFFFF' ALIGN=left VALIGN=TOP COLSPAN=5><FONT style='font-family:verdana;font-size:8pt'>"
  224.         col1Cell = "<TD  BGColor='#FFFFFF' ALIGN=right VALIGN=TOP COLSPAN=1><FONT style='font-family:verdana;font-size:10pt'>"
  225.         Response.Write "<TR>"_
  226.         & col1Cell & "<B>Date:</B></FONT></TD>"_
  227.         & col5Cell & rst("MessageDate") & "</TD></TR>"_
  228.         & "<TR>" & col1Cell & "<B>Name:</B></FONT></TD>"_
  229.         & col5Cell & rst("MessageFrom") & "</FONT></TD></TR>"_
  230.         & "<TR>" & col1Cell & "<B>Email:</B></FONT></TD>"_
  231.         & col5Cell & "<A HREF='mailto:" & rst("Email") & "'>" & rst("Email") & "</A></FONT></TD></TR>"_
  232.         & "<TR>" & col1Cell & "<B>Home page:</B></FONT></TD>"_
  233.         & col5Cell  & "<A HREF='" & rst("URL") & "'>" & rst("URL") & "</A></FONT></TD></TR>"_
  234.         & "<TR>" & col1Cell & "<B>Subject:</B></FONT></TD>"_
  235.         & col5Cell  & rst("MessageSubject") & "</FONT></TD></TR>"_
  236.         & "<TR>" & col1Cell & "<B>Message:</B></FONT></TD>"_
  237.         & col5Cell & "<FONT SIZE='-1' FACE='arial','helvetica'>" & rst("MessageBody") & "</FONT></TD>"_
  238.         & "</TR><TR><TD HEIGHT=5 Colspan=6>" & FormSubmit( "HIDDEN", "private", MessagePrivate ) & "</TD></TR>"
  239.     Else
  240.         tableCell = "<TD ALIGN=LEFT VALIGN=TOP BGColor='#FFFFFF'><FONT style='font-family:verdana;font-size:10pt'>"
  241.         Response.Write "<TR><TD BGColor='#cccccc' WIDTH=125>"_
  242.         & FormSubmit( "SUBMIT", "sort", "sort by date" )_
  243.         & "</TD><TD BGColor='#cccccc'>"_
  244.         & FormSubmit( "SUBMIT", "sort", "sort by author" )_
  245.         & "</TD><TD BGColor='#cccccc'>"_
  246.         & FormSubmit( "SUBMIT", "sort", "sort by subject" )_
  247.         & FormSubmit( "HIDDEN", "private", MessagePrivate )_
  248.         & "</TD></TR><TR><TD HEIGHT=1 Colspan=3 BGColor='#FFFFFF'></TD></TR>"
  249.         count = 1
  250.         Do UNTIL rst.EOF
  251.             Response.Write "<TR>" & tableCell & rst("MessageDate") & "</A></FONT></TD>"_
  252.             & tableCell & "<A HREF=""" & "admin.asp?message=" & rst("MessageID") & "&count=" & count & "&private=" & rst("MessagePrivate") & """>" & rst("MessageFrom") & "</A></FONT></TD>"_
  253.             & tableCell & "<A HREF=""" & "admin.asp?message=" & rst("MessageID") & "&count=" & count & "&private=" & rst("MessagePrivate") & """>" & rst("MessageSubject") & "</A></FONT></TD>"
  254.             rst.MoveNext
  255.             Response.Write "</TR><TR><TD HEIGHT=1 Colspan=3></TD></TR>"
  256.             count = count + 1
  257.         Loop
  258.     End If
  259.  End Sub
  260.  
  261. '    ***    Creates input buttons.
  262.  Function FormSubmit( t, name, value )
  263.     Dim btnSubmit
  264.     btnSubmit = "<INPUT TYPE=""" & t & """ NAME=""" & name & """ VALUE=""" & value & """>"
  265.     FormSubmit = btnSubmit
  266.  End Function
  267. %>
  268.