home *** CD-ROM | disk | FTP | other *** search
- <%@ LANGUAGE="VBSCRIPT" %>
- <% Option Explicit %>
-
- <!-- VSS generated file data
- $Modtime: 10/23/97 12:12p $
- $Revision: 31 $
- $Workfile: filelist.asp $
- -->
-
- <%
- On Error Resume Next
-
- Dim newFileDescription, newFilePaths, insRec, delRec, showText, _
- updateRec, updRec, dropStr, spaces, remRecord, remDispRecord
-
- '----------Localization Variables-----------------
- Dim bckSlash, colon, semiColon, period
-
- bckSlash = chr(92)
- colon = chr(58)
- semiColon = chr(59)
- period = chr(46)
-
- '----------Query strings-------------------------
-
- newFileDescription = request.querystring("newDescription")
- newFilePaths = request.querystring("newFilePath")
- remRecord = request.querystring("remRecord")
- remDispRecord = request.querystring("remDispRecord")
- updateRec = request.querystring("updateRec")
- showText = Myinfo.ShowText
- dropStr = Myinfo.dropStr
-
- '------------Call Subs and Functions-----------------
-
- If remDispRecord <> "" Then 'Remove a record from the display
- removeDisplayRecords remDispRecord
- End If
-
- If updateRec <> "" Then 'Update a description
- updateRecords updateRec, newFileDescription
- End If
-
- If remRecord <> "" Then 'Remove a record
- removeRecords remRecord
- End If
-
- If newFilePaths <> "" Then 'Add records
- addRecords newFilePaths, newFileDescription
- End If
-
-
- '--------------Subs and Functions-------------------
-
- Sub removeDisplayRecords(Record)
- Dim strDisplay, strFull, n
- strFull = Myinfo.strFull
- strDisplay = Myinfo.strDisplay
- n = Myinfo.NumRecords
- strFull = ParseStr(strFull, Record)
- strDisplay = ParseStr(strDisplay, Record)
- n = n - 1
- Myinfo.NumRecords = n
- Myinfo.strFull=strFull
- Myinfo.strDisplay=strDisplay
- Myinfo.sync = 0
- End Sub
-
- Sub updateRecords(Records, Description)
- Dim strFull, strDisplay, updRec
- strFull = Myinfo.strFull
- strDisplay = Myinfo.strDisplay
- Description = " " + Description
- strFull = AddAttrib(strFull, Records, "UPDATE", Description)
- strDisplay = EditStr(strDisplay, Records, Description)
- updRec = 1
- Myinfo.sync = 0
- Myinfo.strFull = strFull
- Myinfo.strDisplay = strDisplay
- Myinfo.updRec = updRec
- Myinfo.Descrip = Description
- End Sub
-
- Sub addRecords(Records, Description)
- Dim strFull, strDisplay, n, posSemiCol, Record, FileName, FilePath, _
- strAddDisplay, insRec, addDisplay, FileDescription
-
- strFull = Myinfo.strFull
- strDisplay = Myinfo.strDisplay
- n = Myinfo.NumRecords
- If instrRev(Records, bckSlash + bckSlash ) <> 0 Then
- Records = Trim(Left(Records, len(Records) - 1))
- End If
- Do
- posSemiCol=instr(Records, semiColon)
- If posSemiCol = 0 Then Exit Do
- n = n + 1
- Record = Left(Records, posSemiCol - 1)
- FileName = Trim(Right(Record,Len(Record) - InstrRev(Record,bckSlash)))
- FilePath = Trim(Right(Record, len(Record)-(instr(Record, bckSlash) - 3)))
- Records = Trim(Right(Records, len(Records) - posSemiCol))
- If Description = "" Then
- Description = " "
- End If
- strAddDisplay = strAddDisplay + " " + FileName + " " + Description + semiColon
- strFull = strFull + " " + FileName + " " + Description + " " + FilePath + " INSERT;"
- Loop
- insRec = 1
- addDisplay = 1
- strDisplay = strDisplay + strAddDisplay
- Myinfo.sync = 0
- Myinfo.insRec = insRec
- Myinfo.NumRecords = n
- Myinfo.strFull=strFull
- Myinfo.strDisplay=strDisplay
- Myinfo.addDisplay = addDisplay
-
- End Sub
-
- Sub removeRecords(Record)
- Dim strDisplay, strFull, n, none
- strFull = Myinfo.strFull
- strDisplay = Myinfo.strDisplay
- n = Myinfo.NumRecords
- none = ""
- strFull = AddAttrib(strFull, Record, "DELETE", none)
- strDisplay = ParseStr(strDisplay, Record)
- n = n - 1
- Myinfo.NumRecords = n
- Myinfo.strFull=strFull
- Myinfo.strDisplay=strDisplay
- Myinfo.sync = 0
- End Sub
-
- Function ParseStr(BigStr, SmallStr)
- Dim leftStr, rightStr
- BigStr = Trim(BigStr)
- SmallStr = Trim(SmallStr)
- leftStr = Left(BigStr, instr(BigStr, SmallStr) -1 )
- rightStr = Right(BigStr, len(BigStr) - instr(instr(BigStr, SmallStr), BigStr, semiColon))
- ParseStr = leftStr + rightStr
- End Function
-
- Function AddAttrib(BigStr, SmallStr, Attrib, addString)
- 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 + addString + semiColon + rightStr
- End Function
-
- Function EditStr(BigStr, SmallStr, newText)
- Dim leftStr, rightStr, rightStrPart, leftStrPart
- BigStr = Trim(BigStr)
- SmallStr = Trim(SmallStr)
- newText = Trim(newText)
- rightStrPart = Right(BigStr, len(BigStr) - (instr(BigStr, Trim(SmallStr))-1))
- leftStrPart = Left(BigStr, instr(BigStr, Trim(SmallStr))-1)
- leftStr = Left(BigStr, len(leftStrPart) + (instr(rightStrPart, period) + 3))
- rightStr = Right(rightStrPart, len(rightStrPart) - (instr(RightStrPart, semiColon)))
- EditStr = leftStr + " " + newText + semiColon + rightStr
- End Function
-
- Sub setSpaces
- Dim i, boxWidth, addDisplay
-
- boxWidth = Myinfo.Width
- addDisplay = Myinfo.addDisplay
-
- If addDisplay = 1 OR boxWidth = 1 Then
- For i = 1 to 107
- spaces = spaces + "<pre> </pre>"
- Next
- Else
- For i = 1 to 120
- spaces = spaces + "<pre> </pre>"
- Next
- End If
- End Sub
- %>
- <HTML>
- <HEAD>
- <META NAME="GENERATOR" Content="Microsoft Visual InterDev 1.0">
- <META HTTP-EQUIV="Content-Type" content="text/html; charset=windows-1250">
- <TITLE>Kreator publikacji programu PWS</TITLE>
- </HEAD>
- <BODY BGCOLOR="#FFFFFF" TOPMARGIN="0" LEFTMARGIN="0">
- <SCRIPT LANGUAGE="JavaScript"><!--
- function removeItem() {
- //Find Record selected for removal from display
- Item = document.frmFILENAME.selFILENAME.selectedIndex;
- if (Item == -1 ){
- alert("Zaznacz plik do usuniΩcia");
- } else {
- //Item = document.frmFILENAME.selFILENAME.selectedIndex;
- SelectedRecord = document.frmFILENAME.selFILENAME.options[Item].text ;
- location.href="filelist.asp?remDispRecord=" + SelectedRecord;
- }
- }
- function remItem() {
- //Find Records selected for removal and send them to finish
- var SelectedRecord = "";
- var SelectedRecords = "";
- var Count = "";
- var numRecs = 0;
- for (Count = 0; Count < frmFILENAME.selFILENAME.length; Count++){
- SelectedRecord = "";
- if(frmFILENAME.selFILENAME[Count].selected){
- SelectedRecord = frmFILENAME.selFILENAME.options[Count].text ;
- }
- if(SelectedRecord != ""){
- SelectedRecords = SelectedRecords + SelectedRecord + semiColon;
- numRecs = numRecs + 1
- }
- }
- parent.location.href="welcome.asp?remRecord=" + SelectedRecords + "&nRecords=" + numRecs + "&Action=Finish";
- }
-
- function refreshItem() {
- //Find Record selected for refresh and send it to finish
- var SelectedRecord = "";
- var SelectedRecords = "";
- var Count = "";
- var numRecs = 0;
- for (Count = 0; Count < frmFILENAME.selFILENAME.length; Count++){
- SelectedRecord = "";
- if(frmFILENAME.selFILENAME[Count].selected){
- SelectedRecord = frmFILENAME.selFILENAME.options[Count].text ;
- }
- if(SelectedRecord != ""){
- SelectedRecords = SelectedRecords + SelectedRecord + semiColon;
- numRecs = numRecs + 1
- }
- }
- parent.location.href="welcome.asp?refreshRec=" + SelectedRecords + "&nRecords=" + numRecs + "&Action=Finish";
- }
-
- function updateItem(Description) {
- //Find Record selected for update and send it back
- Item = document.frmFILENAME.selFILENAME.selectedIndex;
- SelectedRecord = document.frmFILENAME.selFILENAME.options[Item].text ;
- location.href= "filelist.asp?updateRec= " + SelectedRecord + " &newDescription=" + Description;
- }
- function SelectedItem() {
- //Find Record selected and send it to text boxes
- Run = <%=Myinfo.showText%>;
- var SelectedRecord = "";
- var SelectedRecords = "";
- var Count = "";
- var numRecs = 0;
- if (Run == 1){
- for (Count = 0; Count < frmFILENAME.selFILENAME.length; Count++){
- SelectedRecord = "";
- if(frmFILENAME.selFILENAME[Count].selected){
- SelectedRecord = frmFILENAME.selFILENAME.options[Count].text ;
- }
- if(SelectedRecord != ""){
- SelectedRecords = SelectedRecords + SelectedRecord + semiColon;
- numRecs = numRecs + 1
- }
- }
- if (numRecs == 1){
- pos= SelectedRecords.lastIndexOf(semiColon);
- if(pos == SelectedRecords.length - 1)
- SelectedRecords = SelectedRecords.substring(0, SelectedRecords.length - 1);
- }
- ShowText(SelectedRecords, numRecs);
- }
- else{
- Run = 0 ;
- }
- }
- //-->
- </SCRIPT>
-
- <SCRIPT LANGUAGE="VBScript">
- Dim updateOn, period, semiColon
- semiColon = chr(59)
- period = chr(46)
- updateOn = 0
- Sub goNext()
- strFull="<%=Myinfo.strFull%>"
- parent.location.href="welcome.asp?strFull=" & strFull & "&action=finish"
- End Sub
- Sub changeValue()
- updateOn = 1
- End Sub
- Sub ShowText(Record, nRecords)
- Record=Trim(Record)
- If nRecords = 1 Then
- FileName=Trim(Left(Record, instr(Record, period) + 3))
- FileDescription=Trim(Right(Record, len(Record) - len(FileName)))
- parent.frmFILENAME.FILENAME.value = FileName
- parent.frmDESCRIPTION.DESCRIPTION.value = FileDescription
- If updateOn = 0 Then
- parent.frmNext.goNextBTN.disabled = "False"
- End If
- Else
- For i = 1 to nRecords
- posSemiRt=instrRev(Record, semiColon)
- posSemiLt=instrRev(Left(Record, instrRev(Record, semiColon)-1), semiColon) + 1
- FileRecord=Trim(mid(Record, posSemiLt, posSemiRt))
- FileName=Trim(Left(FileRecord, instr(FileRecord, period) + 3)) + semiColon
- FileDescription = Trim(mid(FileRecord, len(FileName) + 1,(instr(FileRecord, semiColon)-1)))
- Record = Left(Record, len(Record)-len(FileRecord))
- FileNames = FileNames + FileName
- FileDescriptions = FileDescriptions + FileDescription
- Next
- parent.frmFILENAME.FILENAME.value = FileNames
- parent.frmDESCRIPTION.DESCRIPTION.value = FileDescriptions
- If updateOn = 0 Then
- parent.frmNext.goNextBTN.disabled = "False"
- End If
- End If
- End Sub
- </SCRIPT>
- <FORM NAME=frmFILENAME>
- <FONT FACE="Arial" SIZE=1>
- <SELECT NAME=selFILENAME SIZE=6 WIDTH=300 onClick="JavaScript:SelectedItem();">
- <%
- setSpaces
- displayRecords
-
- Sub displayRecords
- Dim i, n, addDisplay, FileRecord, strDisplay
-
- addDisplay = Myinfo.addDisplay
- strDisplay = Myinfo.strDisplay
- n = Myinfo.NumRecords
-
- If addDisplay = 0 Then
- For i = 1 to n
- strDisplay = Trim(strDisplay)
- FileRecord = Left(strDisplay,Instr(strDisplay,semiColon)-1) 'All chars left of next semi colon
- strDisplay = Right(strDisplay, Len(strDisplay) - Instr(strDisplay,semiColon)) 'Redefine whole string as all chars right of next semi colon
- %>
- <OPTION><%=FileRecord%>
- <% Next
- End If
- If addDisplay = 1 Then
- If strDisplay <> "" Then
- For i = 1 to n
- strDisplay = Trim(strDisplay)
- FileRecord = Left(strDisplay,Instr(strDisplay,semiColon)-1) 'All chars left of next semi colon
- strDisplay = Right(strDisplay, Len(strDisplay) - Instr(strDisplay,semiColon)) 'Redefine whole string as all chars right of next semi colon
- %>
- <OPTION><%=FileRecord%>
- <% Next
- End IF
- End If
- %>
- <OPTION><%=spaces%>
- <% End Sub %>
- </SELECT>
- </FONT>
- </FORM>
- </BODY>
- </HTML>