Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

221 lines
6.4 KiB

  1. <!-- VSS generated file data
  2. $Modtime: 10/24/97 12:56p $
  3. $Revision: 26 $
  4. $Workfile: welcome.inc $
  5. -->
  6. <%
  7. '--------------------------------------------------------------------
  8. ' Functions and Subs to syncronize Publisher Wizard with publish.mdb
  9. ' and \Inetpub\Webpub directory
  10. '--------------------------------------------------------------------
  11. Sub setConnObj
  12. Dim strProvider, conn
  13. strProvider="DRIVER=Microsoft Access Driver (*.mdb); DBQ=" & Server.MapPath("\iisadmin") & "\publish\publish.mdb;"
  14. Set conn = Server.CreateObject("ADODB.Connection")
  15. conn.open strProvider,"",""
  16. Set cm = Server.CreateObject("ADODB.Command")
  17. cm.ActiveConnection = conn
  18. cm.CommandType = 1
  19. End Sub
  20. Sub ChkRunWiz
  21. If runWiz = "-1" Then
  22. noCache = ""
  23. wizWarning = ""
  24. wizButton = ""
  25. wizFormPic = "<INPUT TYPE=IMAGE SRC='../website/merlin.gif'>"
  26. wizPic = ""
  27. noCache = ""
  28. Response.Clear
  29. Else
  30. noCache = "<META HTTP-EQUIV='Expires' CONTENT='0'>"
  31. wizWarning = "<FONT COLOR=RED FACE='VERDANA, ARIAL, HELVETICA' SIZE='-1'><STRONG>" + _
  32. locWarning + "</STRONG></FONT>"
  33. wizButton = "<FONT FACE='VERDANA, ARIAL, HELVETICA' SIZE='-2'><STRONG>" + _
  34. "<FORM METHOD=POST ACTION='.." + bckSlash + "website" + bckSlash + "default.asp'>" + _
  35. "<INPUT TYPE=SUBMIT VALUE='Home Page Wizard' >" + _
  36. "</FORM></STRONG></FONT>"
  37. wizFormPic = ""
  38. wizPic = "<IMG SRC='../website/merlin.gif'>"
  39. locWelcomeInstr2 = ""
  40. End If
  41. End Sub
  42. Sub readPublish 'Read all files in publish.mdb
  43. Dim rs, i, r
  44. cm.CommandText = "SELECT FileList.FileName, FileList.FileDescription, FileList.FilePath FROM FileList ORDER BY FileList.FileName"
  45. Set rs = cm.Execute
  46. If Not rs.EOF Then
  47. rs.MoveFirst
  48. End If
  49. Do While Not rs.EOF
  50. r = r + 1
  51. rs.movenext
  52. Loop
  53. If Not rs.BOF Then
  54. rs.movefirst
  55. End If
  56. For i = 1 to r
  57. If not rs.EOF Then
  58. pubMdbList1 = pubMdbList1 + rs.Fields("FileName").Value + semiColon
  59. rs.movenext
  60. End If
  61. Next
  62. End Sub
  63. Sub setSystemObj 'Set File System Object
  64. Dim root, g, sc
  65. root = server.mappath(bckSlash)
  66. root = Trim(Left(root, instrRev(root, bckSlash)))
  67. root = root + "webpub"
  68. Set FileSystem=CreateObject("Scripting.FileSystemObject")
  69. g = FileSystem.GetAbsolutePathName(root)
  70. g = g + bckSlash
  71. Set f=FileSystem.GetFolder(g)
  72. End Sub
  73. Sub readWebPub 'Read all file names in WebPub
  74. Dim fc, fl
  75. Set fc = f.Files
  76. For Each fl in fc
  77. isFiles= isFiles + 1
  78. webDirList1 = webDirList1 + fl.name + semiColon
  79. Next
  80. End Sub
  81. Sub addNewFiles 'Add new files in webpub to publish.mdb
  82. Dim i, rs, posFile, filespec, webFileName, webDirList, pubMdbList, _
  83. objparam, g, root
  84. webDirList = webDirList1
  85. pubMdbList = PubMdbList1
  86. root = server.mappath(bckSlash)
  87. root = Trim(Left(root, instrRev(root, bckSlash)))
  88. root = root + "webpub"
  89. Set FileSystem=CreateObject("Scripting.FileSystemObject")
  90. g = FileSystem.GetAbsolutePathName(root)
  91. g = g + bckSlash
  92. For i = 1 to isFiles
  93. If webDirList <> "" Then
  94. webFileName = Trim(Mid(webDirList, 1 , instr(webDirList, semiColon)))
  95. webFileName = Left(webFileName, instr(webFileName, semiColon)-1)
  96. End If
  97. If pubMdbList = "" Then
  98. cm.CommandText = "INSERT INTO FileList (FileName, FileDescription, FilePath)VALUES(?, ?, ?)"
  99. set objparam=cm.createparameter(, 200, , 255, webFileName)
  100. cm.parameters.append objparam
  101. set objparam=cm.createparameter(, 200, , 255, "")
  102. cm.parameters.append objparam
  103. set objparam=cm.createparameter(, 200, , 255, g + webFileName)
  104. cm.parameters.append objparam
  105. Set rs = cm.Execute
  106. End If
  107. If pubMdbList <> "" Then
  108. posFile=instr(Ucase(pubMdbList), Ucase(webFileName))
  109. If posFile = 0 Then
  110. cm.CommandText = "INSERT INTO FileList (FileName, FileDescription, FilePath)VALUES(?, ?, ?)"
  111. set objparam=cm.createparameter(, 200, , 255, webFileName)
  112. cm.parameters.append objparam
  113. set objparam=cm.createparameter(, 200, , 255, "")
  114. cm.parameters.append objparam
  115. set objparam=cm.createparameter(, 200, , 255, g + webFileName)
  116. cm.parameters.append objparam
  117. Set rs = cm.Execute
  118. filespec = g + webFileName
  119. Set f = FileSystem.GetFile(filespec)
  120. If f.attributes and 2 Then
  121. f.attributes = f.attributes - 2
  122. End If
  123. If f.attributes and 4 Then
  124. f.attributes = f.attributes - 4
  125. End If
  126. If not f.attributes and 1 Then
  127. f.attributes = f.attributes + 1 'set file to read only
  128. End If
  129. End If
  130. End If
  131. If webDirList <> "" Then
  132. webDirList = Trim(Right(webDirList, len(webDirList) - len(webFileName)-1))
  133. End If
  134. Next
  135. End Sub
  136. Sub removeFiles 'Remove files not in webpub from publish.mdb
  137. Dim i, webDirList, pubMdbList, pubFileName, posFile, rs, r
  138. webDirList = webDirList1
  139. pubMdbList = PubMdbList1
  140. cm.CommandText = "SELECT FileList.FileName, FileList.FileDescription, FileList.FilePath FROM FileList ORDER BY FileList.FileName"
  141. cm.CommandType = 1
  142. Set rs = cm.Execute
  143. If Not rs.EOF Then
  144. rs.MoveFirst
  145. End If
  146. Do While Not rs.EOF
  147. r = r + 1
  148. rs.movenext
  149. Loop
  150. For i = 0 to r
  151. If pubMdbList <>"" Then
  152. pubFileName = Trim(Mid(pubMdbList, 1 , instr(pubMdbList, semiColon)))
  153. pubFileName = Left(pubFileName, instr(pubFileName, semiColon)-1)
  154. posFile=instr(Ucase(webDirList), Ucase(pubFileName))
  155. If posFile = 0 Then
  156. cm.CommandText = "DELETE FROM FileList WHERE FileList.FileName = " + "'" + pubFileName + "'"
  157. Set rs = cm.Execute
  158. End If
  159. pubMdbList = Trim(Right(pubMdbList, len(pubMdbList) - len(pubFileName)-1))
  160. End If
  161. Next
  162. End Sub
  163. Sub updateStrings 'Create updated content strings
  164. Dim rs, r, i
  165. cm.CommandText = "SELECT FileList.FileName, FileList.FileDescription, FileList.FilePath FROM FileList ORDER BY FileList.FileName"
  166. cm.CommandType = 1
  167. Set rs = cm.Execute
  168. If Not rs.EOF Then
  169. rs.MoveFirst
  170. End If
  171. Do While Not rs.EOF
  172. r = r + 1
  173. rs.movenext
  174. Loop
  175. If Not rs.BOF Then
  176. rs.MoveFirst
  177. End If
  178. For i = 1 to r
  179. If not rs.EOF Then
  180. strDisplay1 = strDisplay1 + rs.Fields("FileName").Value + " " + rs.Fields("FileDescription").Value + semiColon
  181. strFull1 = strFull1 & rs.Fields("FileName").Value & "|" & rs.Fields("FileDescription").Value & "|" & rs.Fields("FilePath").Value & "|" & semiColon
  182. rs.movenext
  183. End If
  184. Next
  185. Myinfo.strDisplay = strDisplay1
  186. Myinfo.strFull = strFull1
  187. Myinfo.NumRecords = r
  188. End Sub
  189. Sub sendUser 'Send user to page contingent on webpub content
  190. If dropStr = "" Then
  191. If isFiles = 0 then 'no files in webpub
  192. action="Add"
  193. Myinfo.publish = 0
  194. End If
  195. If isFiles => 1 then 'files in webpub
  196. action="Choose"
  197. Myinfo.publish = -1
  198. End If
  199. End If
  200. End Sub
  201. %>