home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 2000 March
/
VPR0003B.ISO
/
alpha
/
finish.inc
< prev
next >
Wrap
Text File
|
1999-10-14
|
14KB
|
396 lines
<!-- VSS generated file data
$Modtime: 10/22/97 4:35p $
$Revision: 29 $
$Workfile: finish.inc $
-->
<%
'--------------------------------------------------------------------
' Functions and Subs to complete Publisher Wizard actions on publish.mdb
' and \\Inetpub\webpub
'--------------------------------------------------------------------
Function AddAttrib(BigStr, SmallStr, Attrib)
Dim leftStr, rightStr
BigStr = Trim(BigStr)
SmallStr = Trim(SmallStr)
Attrib = Trim(Attrib)
leftStr = Left(BigStr, instr(instr(BigStr, SmallStr), BigStr, semiColon) -1)
rightStr = Right(BigStr, len(BigStr) - instr(instr(BigStr, SmallStr), BigStr, semiColon))
AddAttrib = leftStr + " " + Attrib + semiColon + rightStr
End Function
Function GetG()
Dim root, g
root = server.mappath(bckSlash)
root = Trim(Left(root, instrRev(root, bckSlash)))
root = root + "webpub"
g = FileSystem.GetAbsolutePathName(root)
g = g + bckSlash
GetG = g
End Function
Sub remFiles(Records, NumberRecords)
Dim strFull, ChkDelstrFull, strAllLeft, strRec, strDelSQL, g, _
filespec, FileName, neg, negComment, loops, rs, posSemiRt, posSemiLt, _
i, Record, ChkDelstrFullLt, ChkDelstrFullRt, objparam, word, comma, _
posloops, negloops, isFile, NonFile
strFull= Myinfo.strFull
If strFull = "" Then
negComment1 = locProb + locRemProb1 + locSolu + locRemSolu1
resetVar
Exit Sub
End If
For i = 1 to NumberRecords
'Parse Record out of Records
posSemiRt=instrRev(Records, semiColon)
posSemiLt=(instrRev(Left(Records, instrRev(Records, semiColon)-1), semiColon) + 1)
Record=Trim(mid(Records, posSemiLt, posSemiRt))
Record = Left(Record, len(Record)-1)
If instr(Record, semiColon) <> 0 Then
Record = Trim(Left(Record, instr(Record, semiColon)- 1))
End If
If instr(strFull, Record) <> 0 Then
strFull = AddAttrib(strFull, Record, "DELETE")
Else
NonFile = Trim(Left(Record, instr(Record, period) + 3))
negComment1 = locProb + NonFile + locRemProb2 + locSolu + locRemSolu2
End If
Records = Trim(Left(Records, posSemiLt - 1))
Next
ChkDelstrFull = strFull
ChkDelstrFull = semiColon + ChkDelstrFull
cm.CommandText = "DELETE FROM FileList WHERE FileList.FileName = ? "
set objparam=cm.createparameter(, 200, , 255)
cm.parameters.append objparam
Do Until instr(ChkDelstrFull, "DELETE;") = 0
strAllLeft = Trim(Left(ChkDelstrFull, instrRev(ChkDelstrFull, "DELETE") + 5))
strRec = mid(strAllLeft, (instrRev(strAllLeft, semiColon) + 1), ((instrRev(ChkDelstrFull, "DELETE") + 5) - (instrRev(strAllLeft, semiColon) + 1)) - 5)
FileName = Left(strRec, (instr(strRec, period) + 3))
g = GetG()
filespec = g + FileName
isFile = FileSystem.FileExists(filespec)
If isFile Then
Set f = FileSystem.GetFile(filespec)
If f.attributes and 1 Then
f.attributes = f.attributes - 1
End If
FileSystem.DeleteFile g + FileName
'Run delete sequence
cm.parameters(0) = FileName
set rs = cm.Execute
posloops = posloops + 1
showNames = FileName + " " + showNames
Else
negloops = negloops + 1
If negComment1 = "" Then
negComment1 = locProb + FileName + locRemProb3 + locSolu + locRemSolu3
Else
negComment2 = locProb + FileName + locRemProb3 + locSolu + locRemSolu3
End If
End If
ChkDelstrFullLt = Trim(Left(ChkDelstrFull, instr(ChkDelstrFull, strRec) - 1))
ChkDelstrFullRt = Trim(Right(ChkDelstrFull, (len(ChkDelstrFull) - instrRev(ChkDelstrFull, strRec)) - (len(strRec) + 5)))
ChkDelstrFull = ChkDelstrFullLt + ChkDelstrFullRt
Loop
If posloops => 1 Then
ShowNames = locRemResult + ShowNames
End If
resetVar
posloops = 0
negloops = 0
End Sub
Sub insertFiles
Dim ChkInsstrFull, strAllLeft, strRec, FileName, FilePath, FileDescription, _
g, ChkPath, objparam, posloops, negloops, rs, strFull, filespec, _
isFile, comma, word, DrivePath, DriveTest, drvType, d, PathRt
strFull = Myinfo.strFull
'Search strFull for INSERT attribute indicators
ChkInsstrFull = strFull
ChkInsstrFull = semiColon + ChkInsstrFull
cm.CommandText = "INSERT INTO FileList (FileName, FileDescription, FilePath)VALUES(?, ?, ?)"
set objparam=cm.createparameter(, 200, , 255)
cm.parameters.append objparam
set objparam=cm.createparameter(, 200, , 255)
cm.parameters.append objparam
set objparam=cm.createparameter(, 200, , 255)
cm.parameters.append objparam
Do Until instr(ChkInsstrFull, "INSERT;") = 0
strAllLeft = Left(ChkInsstrFull, instrRev(ChkInsstrFull, "INSERT") + 5)
strRec = Trim(mid(strAllLeft, (instrRev(strAllLeft, semiColon) + 1), ((instrRev(ChkInsstrFull, "INSERT") + 5) - (instrRev(strAllLeft, semiColon) + 1)) - 5))
FileName = trim(Left(strRec, (instr(strRec, period) + 3)))
If instr(strRec, bckSlash + bckSlash) <> 0 Then
FilePath = Trim(mid(strRec, (instr(strRec, bckSlash + bckSlash) - 1), (len(strRec) - (instr(strRec, colon + bckSlash) - 1)) + 2))
Else
FilePath = Trim(mid(strRec, (instr(strRec, colon + bckSlash) - 1), (len(strRec) - (instr(strRec, colon + bckSlash) - 1)) + 2))
End If
FileDescription = Trim(mid(strRec, (instr(strRec, period) + 3) + 1, (len(strRec) -len(FilePath)) - len(FileName) - 1))
ChkInsstrFull = Trim(Left(ChkInsstrFull, (len(ChkInsstrFull) - len(strRec))-8))
If instr(FilePath, bckSlash + bckSlash) <> 0 Then
PathRt =Trim(Right(FilePath, len(FilePath) - instr(FilePath, bckSlash + bckSlash) - 1))
DrivePath = bckSlash + bckSlash + Trim(Left(PathRt, instr(PathRt, bckSlash)))
Else
DrivePath = Trim(Left(FilePath, instr(FilePath, colon)))
End If
d = FileSystem.DriveExists(DrivePath)
If d Then
Set f = FileSystem.GetDrive(DrivePath) 'is the file on a valid drive
Select Case f.DriveType
Case 0 'Unknown
DriveTest = locFail
drvType = locDrvUnk
Case 1 'Removable
DriveTest = locFail
drvType = locDrvRem
Case 2 'Fixed
DriveTest = locPass
Case 3 'Network
DriveTest = locFail
drvType = locDrvNet
Case 4 'CD-ROM
DriveTest = locFail
drvType = locDrvCD
Case 5 'RAM Disk
DriveTest = locFail
drvType = locDrvRAM
End Select
Else
negloops = negloops + 1
If instr(DrivePath, bckSlash + bckSlash) = 0 Then
If negComment1 = "" Then
negComment1 = locProb + FileName + locInsProb1a + Ucase(DrivePath) + locInsProb1b + locSolu + locInsSolu1
Else
negComment2 = locProb + FileName + locInsProb1a + Ucase(DrivePath) + locInsProb1b + locSolu + locInsSolu1
End If
Else
If negComment1 = "" Then
negComment1 = locProb + FileName + locInsProb2a + Ucase(DrivePath) + locInsProb2b + locSolu + locInsSolu2
Else
negComment2 = locProb + FileName + locInsProb2a + Ucase(DrivePath) + locInsProb2b + locSolu + locInsSolu2
End If
End If
End If
If DriveTest = locPass Then
isFile = FileSystem.FileExists(FilePath) 'does new file really exist
If isFile Then
g = GetG()
ChkPath = g + FileName
isFile = FileSystem.FileExists(ChkPath)
If not isFile Then 'new file is not already in webpub
FileSystem.CopyFile FilePath, g
filespec = g + FileName
Set f = FileSystem.GetFile(filespec)
If f.attributes and 2 Then
f.attributes = f.attributes - 2
End If
If f.attributes and 4 Then
f.attributes = f.attributes - 4
End If
If not f.attributes and 1 Then
f.attributes = f.attributes + 1
End If
'Run Insert statement
cm.parameters(0) = FileName
cm.parameters(1) = FileDescription
cm.parameters(2) = FilePath
set rs = cm.Execute
posloops = posloops + 1
showNames = FileName + " " + showNames
Else
negloops = negloops + 1
If negComment1 = "" Then
negComment1 = locProb + FileName + locInsProb3 + locSolu + locInsSolu3
Else
negComment2 = locProb + FileName + locInsProb3 + locSolu + locInsSolu3
End If
End If
Else
negloops = negloops + 1
If negComment1 = "" Then
negComment1 = locProb + FileName + locInsProb4 + locSolu + locInsSolu4
Else
negComment2 = locProb + FileName + locInsProb4 + locSolu + locInsSolu4
End If
End If
End If
If DriveTest = locFail Then
negloops = negloops + 1
If negComment1 = "" Then
negComment1 = locProb + FileName + locInsProb5a + drvType + locInsProb5b + locSolu + locInsSolu5
Else
negComment2 = locProb + FileName + locInsProb5a + drvType + locInsProb5b + locSolu + locInsSolu5
End If
End If
Loop
If posloops => 1 Then
ShowNames = locInsResult + ShowNames
End If
resetVar
posloops = 0
negloops = 0
End Sub
Sub refreshFiles(Records, NumberRecords)
Dim rightStrRec, strRec, FileName, FilePath, FileDescription, _
g, i, filespec, objparam, strFull, Record, isTargetFile, _
isSourceFile, posSemiRt, posSemiLt, word, comma, negloops, _
posloops, NonFile
strFull=Myinfo.strFull
If strFull = "" Then
negComment1 = locProb + locRefProb1 + locSolu + locRefSolu1
resetVar
Exit Sub
End If
Records = Trim(Records)
For i = 1 to NumberRecords
'Parse Record out of Records
posSemiRt=instrRev(Records, semiColon)
posSemiLt=(instrRev(Left(Records, instrRev(Records, semiColon)-1), semiColon) + 1)
Record=Trim(mid(Records, posSemiLt, posSemiRt - 1))
If instr(Record, semiColon) <> 0 Then
Record = Trim(Left(Record, instr(Record, semiColon)- 1))
End If
If instr(strFull, Record) <> 0 Then
rightStrRec = Trim(Right(strFull, (len(strFull) - (instr(strFull, Left(Record, instr(Record, period) + 3)))) +1))
strRec = Trim(Left(rightStrRec, instr(rightStrRec, semiColon)))
FileName = trim(Left(strRec, (instr(strRec, period) + 3)))
FilePath = Trim(mid(strRec, (instr(strRec, colon + bckSlash) - 1), (len(strRec) - (instr(strRec, colon + bckSlash) - 1)) + 2))
FilePath = Trim(Left(FilePath, instr(FilePath, semiColon) - 1))
FileDescription = Trim(mid(strRec, (instr(strRec, period) + 3) + 1, (len(strRec) -len(FilePath)) - len(FileName) - 2))
g = GetG()
filespec = g + FileName
isTargetFile = FileSystem.FileExists(filespec)
isSourceFile = FileSystem.FileExists(FilePath)
If isSourceFile Then
If isTargetFile Then
Set f = FileSystem.GetFile(filespec)
If f.attributes and 1 Then
f.attributes = f.attributes - 1
End If
If FilePath <> filespec Then
FileSystem.CopyFile FilePath, g
If f.attributes and 2 Then
f.attributes = f.attributes - 2
End If
If f.attributes and 4 Then
f.attributes = f.attributes - 4
End If
If not f.attributes and 1 Then
f.attributes = f.attributes + 1 'set file to read only
End If
posloops = posloops + 1
showNames = FileName + " " + showNames
Else
negloops = negloops + 1
If negComment1 = "" Then
negComment1 = locProb + FileName + locRefProb2 + locSolu + locRefSolu2
Else
negComment2 = locProb + FileName + locRefProb2 + locSolu + locRefSolu2
End If
End If
Else
negloops = negloops + 1
If negComment1 = "" Then
negComment1 = locProb + FileName + locRefProb3 + locSolu + locRefSolu3
Else
negComment2 = locProb + FileName + locRefProb3 + locSolu + locRefSolu3
End If
End If
Else
negloops = negloops + 1
If negComment1 = "" Then
negComment1 = locProb + FileName + locRefProb4 + FilePath + locSolu + FileName + locRefSolu4 + FilePath
Else
negComment2 = locProb + FileName + locRefProb4 + FilePath + locSolu + FileName + locRefSolu4 + FilePath
End If
End If
Records = Left(Records, len(Records)-len(Record))
Else
negloops = negloops + 1
NonFile = Trim(Left(Record, instr(Record, period) + 3))
negComment1 = locProb + locRefProb5 + NonFile + locSolu + locRefSolu5
Records = Left(Records, len(Records)-len(Record))
End If
Next
If posloops => 1 Then
ShowNames = locRefResult + ShowNames
End If
resetVar
posloops = 0
negloops = 0
End Sub
Sub updFiles
Dim ChkInsstrFull, ChkInsstrFullLt, ChkInsstrFullRt, objparam, _
rs, strAllRight, newDescription, strAllLeft, strRec, _
FileName, FilePath, FileDescription, strFull, word, comma, _
negloops, posloops, g, filespec, isfile
strFull = Myinfo.strFull
ChkInsstrFull = strFull
ChkInsstrFull = semiColon + ChkInsstrFull
cm.CommandText = "UPDATE FileList SET FileDescription = ? WHERE FileName = ?"
set objparam=cm.createparameter(, 200, , 255)
cm.parameters.append objparam
set objparam=cm.createparameter(, 200, , 255)
cm.parameters.append objparam
Do Until instr(ChkInsstrFull, "UPDATE") = 0
strAllLeft = Trim(Left(ChkInsstrFull, instrRev(ChkInsstrFull, "UPDATE") + 5))
strAllRight = Trim(Right(ChkInsstrFull, len(ChkInsstrFull) - len(strAllLeft)))
newDescription = Trim(Left(strAllRight, instr(strAllRight, semiColon) - 1))
strRec = mid(strAllLeft, (instrRev(strAllLeft, semiColon) + 1), ((instrRev(ChkInsstrFull, "UPDATE") + 5) - (instrRev(strAllLeft, semiColon) + 1)) - 5)
FileName = trim(Left(strRec, (instr(strRec, period) + 3)))
'Run Update statement
g = GetG()
filespec = g + FileName
isFile = FileSystem.FileExists(filespec)
If isFile Then
cm.parameters(0) = newDescription
cm.parameters(1) = FileName
cm.Execute
posloops = posloops + 1
showNames = FileName + " " + showNames
Else
negloops = negloops + 1
If negComment1 = "" Then
negComment1 = locProb + FileName + locUpdProb1 + locSolu + FileName + locUpdSolu1
Else
negComment2 = locProb + FileName + locUpdProb1 + locSolu + FileName + locUpdSolu1
End If
End If
ChkInsstrFullLt = Trim(Left(ChkInsstrFull, instr(ChkInsstrFull, strRec) - 1))
ChkInsstrFullRt = Trim(Right(ChkInsstrFull, (len(ChkInsstrFull) - instrRev(ChkInsstrFull, strRec)) - (len(strRec) + 5)))
ChkInsstrFull = ChkInsstrFullLt + ChkInsstrFullRt
Loop
If posloops => 1 Then
ShowNames = locUpdResult + ShowNames
End If
resetVar
posloops = 0
negloops = 0
End Sub
If Err.number <> 0 then
negComment1 = locProb + locUnexpectProb + locSolu + locUnexpectSolu
End If
%>