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

  1. <%@ LANGUAGE="VBSCRIPT" %>
  2. <% Option Explicit %>
  3.  
  4. <!-- VSS generated file data
  5. $Modtime: 10/23/97 12:12p $
  6. $Revision: 31 $
  7. $Workfile: filelist.asp $
  8. -->
  9.  
  10. <%
  11. On Error Resume Next
  12.  
  13. Dim newFileDescription, newFilePaths, insRec, delRec, showText, _
  14. updateRec, updRec, dropStr, spaces, remRecord, remDispRecord
  15.  
  16. '----------Localization Variables-----------------
  17.     Dim bckSlash, colon, semiColon, period
  18.     
  19.     bckSlash = chr(92)
  20.     colon = chr(58)
  21.     semiColon = chr(59)
  22.     period = chr(46)
  23.  
  24. '----------Query strings-------------------------
  25.  
  26. newFileDescription = request.querystring("newDescription")
  27. newFilePaths = request.querystring("newFilePath")
  28. remRecord = request.querystring("remRecord")
  29. remDispRecord = request.querystring("remDispRecord")
  30. updateRec = request.querystring("updateRec")
  31. showText = Myinfo.ShowText
  32. dropStr = Myinfo.dropStr
  33.  
  34. '------------Call Subs and Functions-----------------
  35.  
  36. If remDispRecord <> "" Then 'Remove a record from the display
  37.     removeDisplayRecords remDispRecord
  38. End If
  39.  
  40. If updateRec <> "" Then 'Update a description
  41.     updateRecords updateRec, newFileDescription
  42. End If
  43.  
  44. If remRecord <> "" Then 'Remove a record
  45.     removeRecords remRecord
  46. End If
  47.  
  48. If newFilePaths <> "" Then 'Add records
  49.     addRecords newFilePaths, newFileDescription
  50. End If
  51.  
  52.  
  53. '--------------Subs and Functions-------------------
  54.  
  55. Sub removeDisplayRecords(Record)
  56.     Dim strDisplay, strFull, n
  57.     strFull = Myinfo.strFull
  58.     strDisplay = Myinfo.strDisplay
  59.     n = Myinfo.NumRecords
  60.     strFull = ParseStr(strFull, Record)
  61.     strDisplay = ParseStr(strDisplay, Record)
  62.     n = n - 1
  63.     Myinfo.NumRecords = n
  64.     Myinfo.strFull=strFull
  65.     Myinfo.strDisplay=strDisplay
  66.     Myinfo.sync = 0
  67. End Sub
  68.  
  69. Sub updateRecords(Records, Description)
  70.     Dim strFull, strDisplay, updRec
  71.     strFull = Myinfo.strFull
  72.     strDisplay = Myinfo.strDisplay
  73.     Description = " " + Description
  74.     strFull = AddAttrib(strFull, Records, "UPDATE", Description)
  75.     strDisplay = EditStr(strDisplay, Records, Description)
  76.     updRec = 1
  77.     Myinfo.sync = 0
  78.     Myinfo.strFull = strFull
  79.     Myinfo.strDisplay = strDisplay
  80.     Myinfo.updRec = updRec
  81.     Myinfo.Descrip = Description
  82. End Sub
  83.  
  84. Sub addRecords(Records, Description)
  85.     Dim strFull, strDisplay, n, posSemiCol, Record, FileName, FilePath, _
  86.     strAddDisplay, insRec, addDisplay, FileDescription
  87.  
  88.     strFull = Myinfo.strFull
  89.     strDisplay = Myinfo.strDisplay
  90.     n = Myinfo.NumRecords
  91.     If instrRev(Records, bckSlash + bckSlash ) <> 0 Then
  92.             Records = Trim(Left(Records, len(Records) - 1))
  93.     End If
  94.     Do 
  95.         posSemiCol=instr(Records, semiColon)
  96.         If posSemiCol = 0 Then Exit Do
  97.         n = n + 1
  98.         Record = Left(Records, posSemiCol - 1)
  99.         FileName = Trim(Right(Record,Len(Record) - InstrRev(Record,bckSlash)))
  100.         FilePath = Trim(Right(Record, len(Record)-(instr(Record, bckSlash) - 3)))
  101.         Records = Trim(Right(Records, len(Records) - posSemiCol))
  102.         If Description = "" Then
  103.             Description = "    "
  104.         End If
  105.         strAddDisplay = strAddDisplay + " " + FileName  + " " + Description + semiColon
  106.         strFull = strFull + " " + FileName + " " + Description + " " + FilePath + " INSERT;"
  107.     Loop 
  108.     insRec = 1
  109.     addDisplay = 1
  110.     strDisplay = strDisplay + strAddDisplay
  111.     Myinfo.sync = 0
  112.     Myinfo.insRec = insRec
  113.     Myinfo.NumRecords = n
  114.     Myinfo.strFull=strFull
  115.     Myinfo.strDisplay=strDisplay
  116.     Myinfo.addDisplay = addDisplay
  117.     
  118. End Sub
  119.  
  120. Sub removeRecords(Record)
  121.     Dim strDisplay, strFull, n, none
  122.     strFull = Myinfo.strFull
  123.     strDisplay = Myinfo.strDisplay
  124.     n = Myinfo.NumRecords
  125.     none = ""
  126.     strFull = AddAttrib(strFull, Record, "DELETE", none)
  127.     strDisplay = ParseStr(strDisplay, Record)
  128.     n = n - 1
  129.     Myinfo.NumRecords = n
  130.     Myinfo.strFull=strFull
  131.     Myinfo.strDisplay=strDisplay
  132.     Myinfo.sync = 0
  133. End Sub
  134.  
  135. Function ParseStr(BigStr, SmallStr)
  136.     Dim leftStr, rightStr
  137.     BigStr = Trim(BigStr)
  138.     SmallStr = Trim(SmallStr) 
  139.     leftStr = Left(BigStr, instr(BigStr, SmallStr) -1 )
  140.     rightStr = Right(BigStr, len(BigStr) - instr(instr(BigStr, SmallStr), BigStr, semiColon))
  141.     ParseStr = leftStr + rightStr
  142. End Function
  143.  
  144. Function AddAttrib(BigStr, SmallStr, Attrib, addString)
  145.     Dim leftStr, rightStr
  146.     BigStr = Trim(BigStr)
  147.     SmallStr = Trim(SmallStr)
  148.     Attrib = Trim(Attrib)
  149.     leftStr = Left(BigStr, instr(instr(BigStr, SmallStr), BigStr, semiColon) -1)
  150.     rightStr = Right(BigStr, len(BigStr) - instr(instr(BigStr, SmallStr), BigStr, semiColon))
  151.     AddAttrib = leftStr + " " + Attrib + addString + semiColon + rightStr
  152. End Function
  153.  
  154. Function EditStr(BigStr, SmallStr, newText)
  155.     Dim leftStr, rightStr, rightStrPart, leftStrPart
  156.     BigStr = Trim(BigStr)
  157.     SmallStr = Trim(SmallStr)
  158.     newText = Trim(newText)
  159.     rightStrPart = Right(BigStr, len(BigStr) - (instr(BigStr, Trim(SmallStr))-1))
  160.     leftStrPart = Left(BigStr, instr(BigStr, Trim(SmallStr))-1)
  161.     leftStr = Left(BigStr, len(leftStrPart) + (instr(rightStrPart, period) + 3))
  162.     rightStr = Right(rightStrPart, len(rightStrPart) - (instr(RightStrPart, semiColon)))
  163.     EditStr = leftStr + " " + newText + semiColon + rightStr
  164. End Function
  165.  
  166. Sub setSpaces
  167.     Dim i, boxWidth, addDisplay
  168.     
  169.     boxWidth = Myinfo.Width
  170.     addDisplay = Myinfo.addDisplay
  171.     
  172.     If addDisplay = 1  OR boxWidth = 1 Then
  173.         For i = 1 to 107
  174.             spaces = spaces + "<pre> </pre>"
  175.         Next
  176.     Else
  177.         For i = 1 to 120
  178.             spaces = spaces + "<pre> </pre>"
  179.         Next
  180.     End If
  181. End Sub
  182. %>
  183. <HTML>
  184. <HEAD>
  185. <META NAME="GENERATOR" Content="Microsoft Visual InterDev 1.0">
  186. <META HTTP-EQUIV="Content-Type" content="text/html; charset=windows-1250">
  187. <TITLE>Kreator publikacji programu PWS</TITLE>
  188. </HEAD>
  189. <BODY BGCOLOR="#FFFFFF" TOPMARGIN="0" LEFTMARGIN="0">
  190. <SCRIPT LANGUAGE="JavaScript"><!--
  191.     function removeItem() {
  192.         //Find Record selected for removal from display
  193.             Item = document.frmFILENAME.selFILENAME.selectedIndex;
  194.         if (Item == -1 ){
  195.             alert("Zaznacz plik do usuniΩcia");
  196.         } else {
  197.             //Item = document.frmFILENAME.selFILENAME.selectedIndex;
  198.             SelectedRecord = document.frmFILENAME.selFILENAME.options[Item].text ;
  199.             location.href="filelist.asp?remDispRecord=" + SelectedRecord;
  200.         }
  201.     }
  202.     function remItem() {
  203.         //Find Records selected for removal and send them to finish
  204.         var SelectedRecord = "";
  205.         var SelectedRecords = "";
  206.         var Count = "";
  207.         var numRecs = 0;
  208.         for (Count = 0; Count < frmFILENAME.selFILENAME.length; Count++){
  209.                 SelectedRecord = "";
  210.                 if(frmFILENAME.selFILENAME[Count].selected){
  211.                     SelectedRecord = frmFILENAME.selFILENAME.options[Count].text ;
  212.                 }
  213.                 if(SelectedRecord != ""){
  214.                     SelectedRecords = SelectedRecords + SelectedRecord + semiColon;
  215.                     numRecs = numRecs + 1
  216.                 }
  217.         }
  218.         parent.location.href="welcome.asp?remRecord=" + SelectedRecords + "&nRecords=" + numRecs + "&Action=Finish";
  219.     }
  220.     
  221.     function refreshItem() {
  222.         //Find Record selected for refresh and send it to finish
  223.         var SelectedRecord = "";
  224.         var SelectedRecords = "";
  225.         var Count = "";
  226.         var numRecs = 0;
  227.         for (Count = 0; Count < frmFILENAME.selFILENAME.length; Count++){
  228.                 SelectedRecord = "";
  229.                 if(frmFILENAME.selFILENAME[Count].selected){
  230.                     SelectedRecord = frmFILENAME.selFILENAME.options[Count].text ;
  231.                 }
  232.                 if(SelectedRecord != ""){
  233.                     SelectedRecords = SelectedRecords + SelectedRecord + semiColon;
  234.                     numRecs = numRecs + 1
  235.                 }
  236.         }
  237.         parent.location.href="welcome.asp?refreshRec=" + SelectedRecords + "&nRecords=" + numRecs + "&Action=Finish";
  238.     }
  239.     
  240.     function updateItem(Description) {
  241.         //Find Record selected for update and send it back
  242.         Item = document.frmFILENAME.selFILENAME.selectedIndex;
  243.         SelectedRecord = document.frmFILENAME.selFILENAME.options[Item].text ;
  244.         location.href= "filelist.asp?updateRec= " + SelectedRecord + " &newDescription=" + Description;
  245.     }
  246.     function SelectedItem() {
  247.         //Find Record selected and send it to text boxes        
  248.         Run = <%=Myinfo.showText%>;
  249.         var SelectedRecord = "";
  250.         var SelectedRecords = "";
  251.         var Count = "";
  252.         var numRecs = 0;
  253.         if (Run == 1){
  254.             for (Count = 0; Count < frmFILENAME.selFILENAME.length; Count++){
  255.                 SelectedRecord = "";
  256.                 if(frmFILENAME.selFILENAME[Count].selected){
  257.                     SelectedRecord = frmFILENAME.selFILENAME.options[Count].text ;
  258.                 }
  259.                 if(SelectedRecord != ""){
  260.                     SelectedRecords = SelectedRecords + SelectedRecord + semiColon;
  261.                     numRecs = numRecs + 1
  262.                 }
  263.             }
  264.             if (numRecs == 1){
  265.                 pos= SelectedRecords.lastIndexOf(semiColon);
  266.                 if(pos == SelectedRecords.length - 1)
  267.                     SelectedRecords = SelectedRecords.substring(0, SelectedRecords.length - 1);
  268.             }
  269.             ShowText(SelectedRecords, numRecs);
  270.         }
  271.         else{
  272.             Run = 0 ;
  273.         }
  274.     }
  275. //-->
  276. </SCRIPT>
  277.  
  278. <SCRIPT LANGUAGE="VBScript">
  279.     Dim updateOn, period, semiColon
  280.     semiColon = chr(59)
  281.     period = chr(46)
  282.     updateOn = 0
  283.     Sub goNext()
  284.         strFull="<%=Myinfo.strFull%>"
  285.         parent.location.href="welcome.asp?strFull=" & strFull & "&action=finish"
  286.     End Sub
  287.     Sub changeValue()
  288.         updateOn = 1
  289.     End Sub
  290.     Sub ShowText(Record, nRecords)
  291.             Record=Trim(Record)
  292.         If nRecords = 1 Then
  293.             FileName=Trim(Left(Record, instr(Record, period) + 3))
  294.             FileDescription=Trim(Right(Record, len(Record) - len(FileName)))
  295.             parent.frmFILENAME.FILENAME.value = FileName
  296.             parent.frmDESCRIPTION.DESCRIPTION.value = FileDescription
  297.             If updateOn = 0 Then
  298.                 parent.frmNext.goNextBTN.disabled = "False"
  299.             End If
  300.         Else
  301.             For i = 1 to nRecords
  302.                 posSemiRt=instrRev(Record, semiColon)
  303.                 posSemiLt=instrRev(Left(Record, instrRev(Record, semiColon)-1), semiColon) + 1
  304.                 FileRecord=Trim(mid(Record, posSemiLt, posSemiRt))
  305.                 FileName=Trim(Left(FileRecord, instr(FileRecord, period) + 3)) + semiColon
  306.                 FileDescription = Trim(mid(FileRecord, len(FileName) + 1,(instr(FileRecord, semiColon)-1)))
  307.                 Record = Left(Record, len(Record)-len(FileRecord))
  308.                 FileNames = FileNames + FileName
  309.                 FileDescriptions = FileDescriptions + FileDescription
  310.             Next
  311.             parent.frmFILENAME.FILENAME.value = FileNames
  312.             parent.frmDESCRIPTION.DESCRIPTION.value = FileDescriptions
  313.             If updateOn = 0 Then
  314.                 parent.frmNext.goNextBTN.disabled = "False"
  315.             End If
  316.         End If
  317.     End Sub
  318. </SCRIPT>
  319. <FORM NAME=frmFILENAME>
  320. <FONT FACE="Arial" SIZE=1>
  321. <SELECT NAME=selFILENAME SIZE=6 WIDTH=300 onClick="JavaScript:SelectedItem();">
  322. <%  
  323.     setSpaces
  324.     displayRecords
  325.     
  326. Sub displayRecords
  327.     Dim i, n, addDisplay, FileRecord, strDisplay
  328.  
  329.     addDisplay = Myinfo.addDisplay
  330.     strDisplay = Myinfo.strDisplay
  331.     n = Myinfo.NumRecords
  332.     
  333.     If addDisplay = 0 Then
  334.         For i = 1 to n
  335.             strDisplay = Trim(strDisplay)
  336.             FileRecord = Left(strDisplay,Instr(strDisplay,semiColon)-1)  'All chars left of next semi colon
  337.             strDisplay = Right(strDisplay, Len(strDisplay) - Instr(strDisplay,semiColon)) 'Redefine whole string as all chars right of next semi colon
  338.     %>
  339.     <OPTION><%=FileRecord%>
  340.     <%    Next
  341.     End If
  342.     If addDisplay = 1 Then
  343.         If strDisplay <> "" Then
  344.             For i = 1 to n
  345.                 strDisplay = Trim(strDisplay)
  346.                 FileRecord = Left(strDisplay,Instr(strDisplay,semiColon)-1)  'All chars left of next semi colon
  347.                 strDisplay = Right(strDisplay, Len(strDisplay) - Instr(strDisplay,semiColon)) 'Redefine whole string as all chars right of next semi colon
  348.     %>
  349.     <OPTION><%=FileRecord%>
  350.     <%        Next
  351.         End IF
  352.     End If
  353.     %>
  354. <OPTION><%=spaces%>
  355. <% End Sub %>
  356. </SELECT>
  357. </FONT>
  358. </FORM>
  359. </BODY>
  360. </HTML>