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.

274 lines
7.3 KiB

  1. <!-- VSS generated file data
  2. $Modtime: 10/22/97 4:35p $
  3. $Revision: 29 $
  4. $Workfile: finish.inc $
  5. -->
  6. <%
  7. '--------------------------------------------------------------------
  8. ' Functions and Subs to complete Publisher Wizard actions on publish.mdb
  9. ' and \\Inetpub\webpub
  10. '--------------------------------------------------------------------
  11. Function AddAttrib(BigStr, SmallStr, Attrib)
  12. Dim leftStr, rightStr
  13. BigStr = Trim(BigStr)
  14. SmallStr = Trim(SmallStr)
  15. Attrib = Trim(Attrib)
  16. leftStr = Left(BigStr, instr(instr(BigStr, SmallStr), BigStr, semiColon) -1)
  17. rightStr = Right(BigStr, len(BigStr) - instr(instr(BigStr, SmallStr), BigStr, semiColon))
  18. AddAttrib = leftStr + " " + Attrib + semiColon + rightStr
  19. End Function
  20. Function GetG()
  21. Dim root, g
  22. root = server.mappath(bckSlash)
  23. root = Trim(Left(root, instrRev(root, bckSlash)))
  24. root = root + "webpub"
  25. g = FileSystem.GetAbsolutePathName(root)
  26. g = g + bckSlash
  27. GetG = g
  28. End Function
  29. Sub remFiles(sFilesToDelete)
  30. Dim strRec, strDelSQL, g, rs, i, objparam, word, comma
  31. if 0 then
  32. resetVar
  33. end if
  34. 'lara's vars
  35. Dim aFilesToDelete, item, aFileItem, success, thisErr
  36. Dim FileName, FileDesc, FilePath, PublishedFilePath, oPublishedFile
  37. success = False
  38. aFilesToDelete = split(sFilesToDelete,";")
  39. For Each FileName in aFilesToDelete
  40. if FileName <> "" then
  41. g = GetG()
  42. PublishedFilePath = g + FileName
  43. thisErr = PathOK(PublishedFilePath,False)
  44. if thisErr = "" then
  45. cm.CommandText = "DELETE FROM FileList WHERE FileList.FileName = ? "
  46. set objparam=cm.createparameter(, 200, , 255)
  47. cm.parameters.append objparam
  48. Set oPublishedFile = FileSystem.GetFile(PublishedFilePath)
  49. If oPublishedFile.attributes and 1 Then
  50. oPublishedFile.attributes = oPublishedFile.attributes - 1
  51. End If
  52. FileSystem.DeleteFile PublishedFilePath
  53. 'Run delete sequence
  54. cm.parameters(0) = FileName
  55. set rs = cm.Execute
  56. success = True
  57. showNames = FileName + " " + showNames
  58. end if
  59. end if
  60. Next
  61. If success Then
  62. ShowNames = locRemResult + ShowNames
  63. End If
  64. resetVar
  65. End Sub
  66. Sub insertFiles
  67. Dim FileName, FilePath, FileDesc, g, objparam
  68. Dim rs, strFull, filespec, isFile
  69. dim aFullStr, item, thisErr, aFileItem, success
  70. strFull = Myinfo.strFull
  71. success = False
  72. if strFull <> "" then
  73. cm.CommandText = "INSERT INTO FileList (FileName, FileDescription, FilePath)VALUES(?, ?, ?)"
  74. set objparam=cm.createparameter(, 200, , 255)
  75. cm.parameters.append objparam
  76. set objparam=cm.createparameter(, 200, , 255)
  77. cm.parameters.append objparam
  78. set objparam=cm.createparameter(, 200, , 255)
  79. cm.parameters.append objparam
  80. aFullStr = split(strFull,";")
  81. for each item in aFullStr
  82. if instr(item,"INSERT") then
  83. aFileItem = split(item,"|")
  84. FileName = aFileItem(0)
  85. FileDesc = aFileItem(1)
  86. FilePath = aFileItem(2)
  87. thisErr = PathOK(FilePath,True)
  88. if thisErr = "" then
  89. g = GetG()
  90. FileSystem.CopyFile FilePath, g
  91. filespec = g & FileName
  92. Set f = FileSystem.GetFile(filespec)
  93. If f.attributes and 2 Then
  94. f.attributes = f.attributes - 2
  95. End If
  96. If f.attributes and 4 Then
  97. f.attributes = f.attributes - 4
  98. End If
  99. If not f.attributes and 1 Then
  100. f.attributes = f.attributes + 1
  101. End If
  102. 'Run Insert statement
  103. cm.parameters(0) = FileName
  104. cm.parameters(1) = FileDesc
  105. cm.parameters(2) = FilePath
  106. set rs = cm.Execute
  107. success = True
  108. showNames = showNames & " " & FileName
  109. else
  110. negComment1 = negComment1 & thisErr
  111. end if
  112. end if
  113. next
  114. end if
  115. If success then
  116. showNames = locInsResult & showNames
  117. End If
  118. resetVar
  119. End Sub
  120. Function GetDriveType(FilePath)
  121. Dim driveName,oDrive, drvType
  122. drvType = ""
  123. if FileSystem.DriveExists(FilePath) then
  124. driveName = FileSystem.GetDriveName(FilePath)
  125. Set oDrive = FileSystem.GetDrive(driveName)
  126. Select Case oDrive.DriveType
  127. Case 0 'Unknown
  128. drvType = locDrvUnk
  129. Case 1 'Removable
  130. drvType = locDrvRem
  131. Case 3 'Network
  132. drvType = locDrvNet
  133. Case 4 'CD-ROM
  134. drvType = locDrvCD
  135. Case 5 'RAM Disk
  136. drvType = locDrvRAM
  137. Case 2 'Fixed
  138. End Select
  139. else
  140. drvType = locDrvUnk
  141. end if
  142. GetDriveType = drvType
  143. End Function
  144. Function pathOK(FilePath,ChkWebPub)
  145. Dim drvType,isFile,g, FileName,ChkPath, errstr
  146. errstr = ""
  147. drvType = GetDriveType(FilePath)
  148. if drvType <> "" then
  149. isFile = FileSystem.FileExists(FilePath) 'does new file really exist
  150. If isFile Then
  151. if ChkWebPub then
  152. g = GetG()
  153. FileName = FileSystem.GetFileName(FilePath)
  154. ChkPath = g + FileName
  155. isFile = FileSystem.FileExists(ChkPath)
  156. If isFile Then 'new file is not already in webpub
  157. errStr = locProb + FileName + locFileIsPublished
  158. end if
  159. end if
  160. else
  161. errStr = locProb + FileName + locFileDoesNotExist
  162. end if
  163. else
  164. errStr = locProb + FileName + locInsProb5a + drvType + locInsProb5b + locSolu + locInsSolu5
  165. end if
  166. pathOK = errStr
  167. End Function
  168. Sub refreshFiles(sFilesToRefresh)
  169. Dim strFull, astrFull, item
  170. Dim aFileItem, FileName, FilePath
  171. Dim success, thisErr, g, PublishedFilePath, PublishedFile
  172. success = False
  173. strFull = Myinfo.strFull
  174. astrFull = split(Myinfo.strFull,";")
  175. for each item in astrFull
  176. if item <> "" then
  177. aFileItem = split(item,"|")
  178. FileName = aFileItem(0)
  179. FilePath = aFileItem(2)
  180. if InStr(sFilesToRefresh,FileName) <> 0 then
  181. thisErr = PathOK(FilePath,False)
  182. if thisErr = "" then
  183. g = GetG()
  184. PublishedFilePath = g + FileName
  185. if FileSystem.FileExists(PublishedFilePath) then
  186. Set PublishedFile = FileSystem.GetFile(PublishedFilePath)
  187. If PublishedFile.attributes and 1 Then
  188. PublishedFile.attributes = PublishedFile.attributes - 1
  189. End If
  190. end if
  191. FileSystem.CopyFile FilePath, g
  192. If PublishedFile.attributes and 2 Then
  193. PublishedFile.attributes = PublishedFile.attributes - 2
  194. End If
  195. If PublishedFile.attributes and 4 Then
  196. PublishedFile.attributes = PublishedFile.attributes - 4
  197. End If
  198. If not PublishedFile.attributes and 1 Then
  199. 'set file to read only
  200. PublishedFile.attributes = PublishedFile.attributes + 1
  201. End If
  202. success = True
  203. showNames = FileName + " " + showNames
  204. end if
  205. end if
  206. end if
  207. next
  208. If success then
  209. ShowNames = locRefResult + ShowNames
  210. End If
  211. resetVar
  212. End Sub
  213. Sub updFiles
  214. Dim objparam
  215. Dim strFull, astrFull, item, aFileInfo, FileName, FileDesc, FilePath
  216. Dim thiserr, success
  217. success = False
  218. strFull = Myinfo.strFull
  219. astrFull = split(strFull,";")
  220. cm.CommandText = "UPDATE FileList SET FileDescription = ? WHERE FileName = ?"
  221. set objparam=cm.createparameter(, 200, , 255)
  222. cm.parameters.append objparam
  223. set objparam=cm.createparameter(, 200, , 255)
  224. cm.parameters.append objparam
  225. For each item in astrFull
  226. if inStr(item,"UPDATE") then
  227. aFileInfo = split(item,"|")
  228. FileName = aFileInfo(0)
  229. FileDesc = aFileInfo(1)
  230. FilePath = aFileInfo(2)
  231. thiserr = pathOK(FilePath, False)
  232. if thiserr = "" then
  233. cm.parameters(0) = FileDesc
  234. cm.parameters(1) = FileName
  235. cm.Execute
  236. success = True
  237. ShowNames = ShowNames & FileName
  238. end if
  239. end if
  240. next
  241. if success then
  242. ShowNames = locUpdResult & ShowNames
  243. End If
  244. resetVar
  245. End Sub
  246. If Err.number <> 0 then
  247. negComment1 = locProb + locUnexpectProb + locSolu + locUnexpectSolu
  248. End If
  249. %>