home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 2000 March / VPR0003B.ISO / alpha / finish.inc < prev    next >
Text File  |  1999-10-14  |  14KB  |  396 lines

  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.  
  21. Function GetG()
  22.     Dim root, g
  23.     root = server.mappath(bckSlash)
  24.     root = Trim(Left(root, instrRev(root, bckSlash)))
  25.     root = root + "webpub"
  26.     g = FileSystem.GetAbsolutePathName(root)
  27.     g = g + bckSlash
  28.     GetG = g
  29. End Function
  30.  
  31. Sub remFiles(Records, NumberRecords)
  32.     Dim strFull, ChkDelstrFull, strAllLeft, strRec, strDelSQL, g, _
  33.     filespec, FileName, neg, negComment, loops, rs, posSemiRt, posSemiLt, _
  34.     i, Record, ChkDelstrFullLt, ChkDelstrFullRt, objparam, word, comma, _
  35.     posloops, negloops, isFile, NonFile
  36.     
  37.     strFull= Myinfo.strFull
  38.         
  39.     If strFull = "" Then
  40.         negComment1 = locProb + locRemProb1 + locSolu + locRemSolu1
  41.         resetVar
  42.         Exit Sub
  43.     End If
  44.         
  45.     For i = 1 to NumberRecords
  46.         'Parse Record out of Records
  47.         posSemiRt=instrRev(Records, semiColon)
  48.         posSemiLt=(instrRev(Left(Records, instrRev(Records, semiColon)-1), semiColon) + 1)
  49.         Record=Trim(mid(Records, posSemiLt, posSemiRt))
  50.         Record = Left(Record, len(Record)-1)
  51.         If instr(Record, semiColon) <> 0 Then
  52.             Record = Trim(Left(Record, instr(Record, semiColon)- 1))
  53.         End If
  54.         If instr(strFull, Record) <> 0 Then
  55.             strFull = AddAttrib(strFull, Record, "DELETE")
  56.         Else
  57.             NonFile = Trim(Left(Record, instr(Record, period) + 3))
  58.             negComment1 = locProb +  NonFile + locRemProb2 + locSolu + locRemSolu2
  59.         End If
  60.         Records = Trim(Left(Records, posSemiLt - 1))
  61.     Next
  62.         
  63.     ChkDelstrFull = strFull
  64.     ChkDelstrFull = semiColon + ChkDelstrFull
  65.     
  66.     cm.CommandText = "DELETE FROM FileList WHERE FileList.FileName = ? "
  67.     set objparam=cm.createparameter(, 200, , 255)
  68.     cm.parameters.append objparam
  69.         
  70.     Do Until instr(ChkDelstrFull, "DELETE;") = 0 
  71.         strAllLeft = Trim(Left(ChkDelstrFull, instrRev(ChkDelstrFull, "DELETE") + 5))
  72.         strRec = mid(strAllLeft, (instrRev(strAllLeft, semiColon) + 1), ((instrRev(ChkDelstrFull, "DELETE") + 5) - (instrRev(strAllLeft, semiColon) + 1)) - 5)
  73.         FileName = Left(strRec, (instr(strRec, period) + 3))
  74.         g = GetG()
  75.         filespec = g + FileName
  76.         isFile = FileSystem.FileExists(filespec)
  77.         If isFile Then
  78.             Set f = FileSystem.GetFile(filespec)
  79.             If f.attributes and 1 Then
  80.                 f.attributes = f.attributes - 1
  81.             End If
  82.             FileSystem.DeleteFile g + FileName
  83.             'Run delete sequence
  84.                 cm.parameters(0) = FileName
  85.                 set rs = cm.Execute
  86.                 posloops = posloops + 1
  87.             showNames = FileName + " " + showNames
  88.         Else
  89.             negloops = negloops + 1
  90.             If negComment1 = "" Then
  91.                 negComment1 = locProb + FileName + locRemProb3 + locSolu + locRemSolu3
  92.             Else
  93.                 negComment2 = locProb + FileName + locRemProb3 + locSolu + locRemSolu3
  94.             End If
  95.         End If
  96.                     
  97.         ChkDelstrFullLt = Trim(Left(ChkDelstrFull, instr(ChkDelstrFull, strRec) - 1))
  98.         ChkDelstrFullRt = Trim(Right(ChkDelstrFull, (len(ChkDelstrFull) - instrRev(ChkDelstrFull, strRec)) - (len(strRec) + 5)))
  99.         ChkDelstrFull = ChkDelstrFullLt + ChkDelstrFullRt
  100.         
  101.     Loop 
  102.     If posloops => 1 Then
  103.         ShowNames = locRemResult + ShowNames
  104.     End If
  105.     resetVar
  106.     posloops = 0
  107.     negloops = 0
  108. End Sub
  109.  
  110. Sub insertFiles
  111.     Dim ChkInsstrFull, strAllLeft, strRec, FileName, FilePath, FileDescription, _
  112.     g, ChkPath, objparam, posloops, negloops, rs, strFull, filespec, _
  113.     isFile, comma, word, DrivePath, DriveTest, drvType, d, PathRt
  114.     
  115.     strFull = Myinfo.strFull
  116.     
  117.     'Search strFull for INSERT attribute indicators
  118.     ChkInsstrFull = strFull
  119.     ChkInsstrFull = semiColon + ChkInsstrFull
  120.     
  121.     cm.CommandText = "INSERT INTO FileList (FileName, FileDescription, FilePath)VALUES(?, ?, ?)"
  122.     set objparam=cm.createparameter(, 200, , 255)
  123.     cm.parameters.append objparam
  124.     set objparam=cm.createparameter(, 200, , 255)
  125.     cm.parameters.append objparam
  126.     set objparam=cm.createparameter(, 200, , 255)
  127.     cm.parameters.append objparam
  128.  
  129.     Do Until instr(ChkInsstrFull, "INSERT;") = 0
  130.         strAllLeft = Left(ChkInsstrFull, instrRev(ChkInsstrFull, "INSERT") + 5)
  131.         strRec = Trim(mid(strAllLeft, (instrRev(strAllLeft, semiColon) + 1), ((instrRev(ChkInsstrFull, "INSERT") + 5) - (instrRev(strAllLeft, semiColon) + 1)) - 5))
  132.         FileName = trim(Left(strRec, (instr(strRec, period) + 3)))
  133.         If instr(strRec, bckSlash + bckSlash) <> 0 Then
  134.              FilePath = Trim(mid(strRec, (instr(strRec, bckSlash + bckSlash) - 1), (len(strRec) - (instr(strRec, colon + bckSlash) - 1)) + 2))
  135.         Else
  136.             FilePath = Trim(mid(strRec, (instr(strRec, colon + bckSlash) - 1), (len(strRec) - (instr(strRec, colon + bckSlash) - 1)) + 2))
  137.         End If
  138.         FileDescription = Trim(mid(strRec, (instr(strRec, period) + 3) + 1, (len(strRec) -len(FilePath)) - len(FileName) - 1))
  139.         ChkInsstrFull = Trim(Left(ChkInsstrFull, (len(ChkInsstrFull) - len(strRec))-8))
  140.         If instr(FilePath, bckSlash + bckSlash) <> 0 Then
  141.             PathRt =Trim(Right(FilePath, len(FilePath) - instr(FilePath, bckSlash + bckSlash) - 1))
  142.             DrivePath = bckSlash + bckSlash + Trim(Left(PathRt, instr(PathRt, bckSlash)))
  143.         Else
  144.             DrivePath = Trim(Left(FilePath, instr(FilePath, colon)))
  145.         End If
  146.         d = FileSystem.DriveExists(DrivePath) 
  147.         If d Then
  148.             Set f = FileSystem.GetDrive(DrivePath) 'is the file on a valid drive
  149.              Select Case f.DriveType
  150.                 Case 0 'Unknown
  151.                     DriveTest = locFail
  152.                     drvType = locDrvUnk
  153.                 Case 1 'Removable
  154.                     DriveTest = locFail
  155.                     drvType = locDrvRem
  156.                 Case 2 'Fixed
  157.                     DriveTest = locPass
  158.                 Case 3 'Network
  159.                     DriveTest = locFail
  160.                     drvType = locDrvNet
  161.                 Case 4 'CD-ROM
  162.                     DriveTest = locFail
  163.                     drvType = locDrvCD
  164.                 Case 5 'RAM Disk
  165.                     DriveTest = locFail
  166.                     drvType = locDrvRAM
  167.             End Select
  168.         Else
  169.             negloops = negloops + 1
  170.             If instr(DrivePath, bckSlash + bckSlash) = 0 Then
  171.                 If negComment1 = "" Then
  172.                     negComment1 = locProb + FileName + locInsProb1a + Ucase(DrivePath) + locInsProb1b + locSolu + locInsSolu1
  173.                 Else
  174.                     negComment2 = locProb + FileName + locInsProb1a + Ucase(DrivePath) + locInsProb1b + locSolu + locInsSolu1
  175.                 End If
  176.             Else
  177.                 If negComment1 = "" Then
  178.                     negComment1 = locProb + FileName + locInsProb2a + Ucase(DrivePath) + locInsProb2b + locSolu + locInsSolu2
  179.                 Else
  180.                     negComment2 = locProb + FileName + locInsProb2a + Ucase(DrivePath) + locInsProb2b + locSolu + locInsSolu2
  181.                 End If
  182.             End If
  183.         End If
  184.         If DriveTest = locPass Then
  185.             isFile = FileSystem.FileExists(FilePath) 'does new file really exist
  186.             If isFile Then
  187.                 g = GetG()
  188.                 ChkPath = g + FileName
  189.                 isFile = FileSystem.FileExists(ChkPath)
  190.                 If not isFile Then 'new file is not already in webpub
  191.                     FileSystem.CopyFile FilePath, g
  192.                     filespec = g + FileName
  193.                     Set f = FileSystem.GetFile(filespec)
  194.                     If f.attributes and 2 Then
  195.                         f.attributes = f.attributes - 2
  196.                     End If
  197.                     If f.attributes and 4 Then
  198.                         f.attributes = f.attributes - 4
  199.                     End If
  200.                     If not f.attributes and 1 Then
  201.                         f.attributes = f.attributes + 1
  202.                     End If
  203.                 'Run Insert statement
  204.                     cm.parameters(0) = FileName
  205.                     cm.parameters(1) = FileDescription
  206.                     cm.parameters(2) = FilePath
  207.                     set rs = cm.Execute
  208.                     posloops = posloops + 1
  209.                     showNames = FileName + " " + showNames
  210.                 Else 
  211.                     negloops = negloops + 1
  212.                     If negComment1 = "" Then
  213.                         negComment1 = locProb + FileName + locInsProb3 + locSolu + locInsSolu3
  214.                     Else
  215.                         negComment2 = locProb + FileName + locInsProb3 + locSolu + locInsSolu3
  216.                     End If
  217.                 End If 
  218.             Else 
  219.                 negloops = negloops + 1
  220.                 If negComment1 = "" Then
  221.                     negComment1 = locProb + FileName + locInsProb4 + locSolu + locInsSolu4
  222.                 Else
  223.                     negComment2 = locProb + FileName + locInsProb4 + locSolu + locInsSolu4
  224.                 End If
  225.             End If
  226.         End If
  227.         If DriveTest = locFail Then
  228.             negloops = negloops + 1
  229.             If negComment1 = "" Then
  230.                 negComment1 = locProb + FileName + locInsProb5a + drvType + locInsProb5b + locSolu + locInsSolu5
  231.             Else
  232.                 negComment2 = locProb + FileName + locInsProb5a + drvType + locInsProb5b + locSolu + locInsSolu5
  233.             End If
  234.         End If
  235.     Loop 
  236.     If posloops => 1 Then
  237.         ShowNames = locInsResult + ShowNames
  238.     End If
  239.     resetVar
  240.     posloops = 0
  241.     negloops = 0
  242. End Sub
  243.  
  244. Sub refreshFiles(Records, NumberRecords)
  245.     Dim rightStrRec, strRec, FileName, FilePath, FileDescription, _
  246.     g, i, filespec, objparam, strFull, Record, isTargetFile, _
  247.     isSourceFile, posSemiRt, posSemiLt, word, comma, negloops, _
  248.     posloops, NonFile
  249.     
  250.     strFull=Myinfo.strFull
  251.     
  252.     If strFull = "" Then
  253.         negComment1 = locProb + locRefProb1 + locSolu + locRefSolu1
  254.         resetVar
  255.         Exit Sub
  256.     End If
  257.     
  258.     Records = Trim(Records)
  259.     For i = 1 to NumberRecords
  260.         'Parse Record out of Records
  261.         posSemiRt=instrRev(Records, semiColon)
  262.         posSemiLt=(instrRev(Left(Records, instrRev(Records, semiColon)-1), semiColon) + 1)
  263.         Record=Trim(mid(Records, posSemiLt, posSemiRt - 1))
  264.         If instr(Record, semiColon) <> 0 Then
  265.             Record = Trim(Left(Record, instr(Record, semiColon)- 1))
  266.         End If
  267.         
  268.         If instr(strFull, Record) <> 0 Then
  269.             rightStrRec = Trim(Right(strFull, (len(strFull) - (instr(strFull, Left(Record, instr(Record, period) + 3)))) +1))
  270.             strRec = Trim(Left(rightStrRec, instr(rightStrRec, semiColon)))
  271.             FileName = trim(Left(strRec, (instr(strRec, period) + 3)))
  272.             FilePath = Trim(mid(strRec, (instr(strRec, colon + bckSlash) - 1), (len(strRec) - (instr(strRec, colon + bckSlash) - 1)) + 2))
  273.             FilePath = Trim(Left(FilePath, instr(FilePath, semiColon) - 1))
  274.             FileDescription = Trim(mid(strRec, (instr(strRec, period) + 3) + 1, (len(strRec) -len(FilePath)) - len(FileName) - 2))
  275.             g = GetG()
  276.             filespec = g + FileName
  277.             isTargetFile = FileSystem.FileExists(filespec)
  278.             isSourceFile = FileSystem.FileExists(FilePath)
  279.             If isSourceFile Then
  280.                 If isTargetFile Then
  281.                     Set f = FileSystem.GetFile(filespec)
  282.                     If f.attributes and 1 Then
  283.                         f.attributes = f.attributes - 1
  284.                     End If
  285.                     If FilePath <> filespec Then
  286.                         FileSystem.CopyFile FilePath, g
  287.                         If f.attributes and 2 Then
  288.                             f.attributes = f.attributes - 2
  289.                         End If
  290.                         If f.attributes and 4 Then
  291.                             f.attributes = f.attributes - 4
  292.                         End If
  293.                         If not f.attributes and 1 Then
  294.                             f.attributes = f.attributes + 1 'set file to read only
  295.                         End If
  296.                         posloops = posloops + 1
  297.                         showNames = FileName + " " + showNames
  298.                     Else 
  299.                         negloops = negloops + 1
  300.                         If negComment1 = "" Then
  301.                             negComment1 = locProb + FileName + locRefProb2 + locSolu + locRefSolu2
  302.                         Else
  303.                             negComment2 = locProb + FileName + locRefProb2 + locSolu + locRefSolu2
  304.                         End If
  305.                     End If 
  306.                 Else 
  307.                     negloops = negloops + 1
  308.                     If negComment1 = "" Then
  309.                         negComment1 = locProb + FileName + locRefProb3 + locSolu + locRefSolu3
  310.                     Else
  311.                         negComment2 = locProb + FileName + locRefProb3 + locSolu + locRefSolu3
  312.                     End If
  313.                 End If 
  314.             Else 
  315.                 negloops = negloops + 1
  316.                 If negComment1 = "" Then
  317.                     negComment1 = locProb + FileName + locRefProb4 + FilePath + locSolu + FileName + locRefSolu4 + FilePath
  318.                 Else
  319.                     negComment2 = locProb + FileName + locRefProb4 + FilePath + locSolu + FileName + locRefSolu4 + FilePath
  320.                 End If
  321.             End If 
  322.             Records = Left(Records, len(Records)-len(Record))
  323.         Else 
  324.             negloops = negloops + 1
  325.             NonFile = Trim(Left(Record, instr(Record, period) + 3))
  326.             negComment1 = locProb + locRefProb5 +  NonFile + locSolu + locRefSolu5
  327.             Records = Left(Records, len(Records)-len(Record))
  328.         End If 
  329.     Next
  330.     If posloops => 1 Then
  331.         ShowNames = locRefResult + ShowNames
  332.     End If
  333.     resetVar
  334.     posloops = 0
  335.     negloops = 0
  336. End Sub
  337.  
  338. Sub updFiles
  339.     Dim ChkInsstrFull, ChkInsstrFullLt, ChkInsstrFullRt, objparam, _
  340.         rs, strAllRight, newDescription, strAllLeft, strRec, _
  341.         FileName, FilePath, FileDescription, strFull, word, comma, _
  342.         negloops, posloops, g, filespec, isfile
  343.     
  344.     strFull = Myinfo.strFull
  345.     
  346.     ChkInsstrFull = strFull
  347.     ChkInsstrFull = semiColon + ChkInsstrFull
  348.         
  349.     cm.CommandText = "UPDATE FileList SET FileDescription = ? WHERE FileName = ?"
  350.     set objparam=cm.createparameter(, 200, , 255)
  351.     cm.parameters.append objparam
  352.     set objparam=cm.createparameter(, 200, , 255)
  353.     cm.parameters.append objparam    
  354.     
  355.     Do Until instr(ChkInsstrFull, "UPDATE") = 0
  356.         strAllLeft = Trim(Left(ChkInsstrFull, instrRev(ChkInsstrFull, "UPDATE") + 5))
  357.         strAllRight = Trim(Right(ChkInsstrFull, len(ChkInsstrFull) - len(strAllLeft)))
  358.         newDescription = Trim(Left(strAllRight, instr(strAllRight, semiColon) - 1))
  359.         strRec = mid(strAllLeft, (instrRev(strAllLeft, semiColon) + 1), ((instrRev(ChkInsstrFull, "UPDATE") + 5) - (instrRev(strAllLeft, semiColon) + 1)) - 5)
  360.         FileName = trim(Left(strRec, (instr(strRec, period) + 3)))
  361.                             
  362.     'Run Update statement
  363.         g = GetG()
  364.         filespec = g + FileName
  365.         isFile = FileSystem.FileExists(filespec)
  366.         If isFile Then
  367.             cm.parameters(0) = newDescription
  368.             cm.parameters(1) = FileName
  369.             cm.Execute
  370.             
  371.             posloops = posloops + 1
  372.             showNames = FileName + " " + showNames
  373.         Else
  374.             negloops = negloops + 1
  375.             If negComment1 = "" Then
  376.                 negComment1 = locProb + FileName + locUpdProb1 + locSolu + FileName + locUpdSolu1
  377.             Else
  378.                 negComment2 = locProb + FileName + locUpdProb1 + locSolu + FileName + locUpdSolu1
  379.             End If
  380.         End If
  381.         ChkInsstrFullLt = Trim(Left(ChkInsstrFull, instr(ChkInsstrFull, strRec) - 1))
  382.         ChkInsstrFullRt = Trim(Right(ChkInsstrFull, (len(ChkInsstrFull) - instrRev(ChkInsstrFull, strRec)) - (len(strRec) + 5)))
  383.         ChkInsstrFull = ChkInsstrFullLt + ChkInsstrFullRt
  384.     Loop 
  385.     If posloops => 1 Then
  386.         ShowNames = locUpdResult + ShowNames
  387.     End If
  388.     resetVar
  389.     posloops = 0
  390.     negloops = 0
  391. End Sub
  392.  
  393. If Err.number <> 0 then
  394.     negComment1 = locProb + locUnexpectProb + locSolu + locUnexpectSolu
  395. End If
  396. %>