home *** CD-ROM | disk | FTP | other *** search
/ Chip 1999 September / CHIPCD_9_99.iso / software / uaktualnienia / OptionPackPL / iis4_02.cab / welcome.inc < prev    next >
Encoding:
Text File  |  1998-04-27  |  6.6 KB  |  222 lines

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