From f47a9d9db3d06927380bb79b04bb6d4721a92d2b Mon Sep 17 00:00:00 2001 From: Jens-Heiner Rechtien Date: Mon, 18 Sep 2000 16:07:07 +0000 Subject: initial import --- sd/res/webview/common.inc | 110 +++++++++++++++++++++++++++++++++++++++++++++ sd/res/webview/edit.asp | 9 ++++ sd/res/webview/editpic.asp | 58 ++++++++++++++++++++++++ sd/res/webview/poll.asp | 36 +++++++++++++++ sd/res/webview/savepic.asp | 39 ++++++++++++++++ sd/res/webview/show.asp | 42 +++++++++++++++++ sd/res/webview/webview.asp | 28 ++++++++++++ 7 files changed, 322 insertions(+) create mode 100644 sd/res/webview/common.inc create mode 100644 sd/res/webview/edit.asp create mode 100644 sd/res/webview/editpic.asp create mode 100644 sd/res/webview/poll.asp create mode 100644 sd/res/webview/savepic.asp create mode 100644 sd/res/webview/show.asp create mode 100644 sd/res/webview/webview.asp (limited to 'sd/res') diff --git a/sd/res/webview/common.inc b/sd/res/webview/common.inc new file mode 100644 index 000000000000..f0dd463821d2 --- /dev/null +++ b/sd/res/webview/common.inc @@ -0,0 +1,110 @@ +<% + +public const cnRefreshTime = 5 ' refresh time in seconds + +' filename for file with all pictures and file containing the name of the current picture +public const csFilePicture= "picture.txt" +public const csFileCurrent= "currpic.txt" + +' constants for file-access +const ForReading = 1 +const ForWriting = 2 + +' new-line delimiter +Dim FILE_LINE_DELIMITER +FILE_LINE_DELIMITER = vbCRLF + +'/** +' * Get data from file using a given separator. +' */ +function File_getDataVirtual( sFilename, sServerPath, sSeperator ) + call Err.Clear() + + Dim aFSObject, sServerFileName + + Set aFSObject = CreateObject("Scripting.FileSystemObject") + sServerFileName = aFSObject.BuildPath( Server.MapPath( sServerPath ), sFileName ) + + File_getDataVirtual = "" + if Err.Number = 0 then + File_getDataVirtual = File_read( sServerFileName ) + If Not IsNull(File_getDataVirtual) Then + File_getDataVirtual = Replace( File_getDataVirtual, FILE_LINE_DELIMITER, sSeperator) + File_getDataVirtual = Split( File_getDataVirtual, sSeperator) + End If + end if +end function + +'/** +' * Get data from a file +' */ +function File_read( sFilename ) + call Err.Clear() + + Dim aFSObject, aStream + + Set aFSObject = CreateObject( "Scripting.FileSystemObject" ) + Set aStream = aFSObject.OpenTextFile( sFilename, ForReading ) + + while not aStream.AtEndOfStream + File_read = File_read + aStream.ReadLine + FILE_LINE_DELIMITER + wend + + aStream.Close +end function + +'/** +' * Get data from a file given by filename and virtual pathname +' */ +Function File_readVirtual(sFileName, sServerPath) + call Err.Clear() + + Dim aFSObject, sServerFileName + + Set aFSObject = CreateObject("Scripting.FileSystemObject") + sServerFileName = aFSObject.BuildPath( Server.MapPath( sServerPath ), sFileName ) + + File_readVirtual = "" + if Err.Number = 0 then + File_readVirtual = File_read( sServerFileName ) + end if +End Function + +'/** +' * Write data to a file +' */ +function File_write( sFileName, sText ) + call Err.Clear() + + Dim aFSObject, aFile + + Set aFSObject = CreateObject( "Scripting.FileSystemObject" ) + if Err.Number = 0 then + Set aFile = aFSObject.CreateTextFile( sFileName, TRUE ) + if Err.Number = 0 then + aFile.Write( sText ) + aFile.Close + end if + end if + + File_write = ( Err.Number = 0 ) +end function + +'/** +' * Write data to a file given by filename and virtual pathname +' */ +function File_writeVirtual( sFileName, sServerPath, sText ) + call Err.Clear() + + Dim aFSObject, aServerFile + + Set aFSObject = CreateObject( "Scripting.FileSystemObject" ) + aServerFile = aFSObject.BuildPath( Server.MapPath( sServerPath ), sFileName ) + + If Err.Number = 0 Then + File_writeVirtual = File_write( aServerFile, sText ) + else + File_writeVirtual = false + End If +end function +%> \ No newline at end of file diff --git a/sd/res/webview/edit.asp b/sd/res/webview/edit.asp new file mode 100644 index 000000000000..654a441fe357 --- /dev/null +++ b/sd/res/webview/edit.asp @@ -0,0 +1,9 @@ + + + $$1 + + + + + + \ No newline at end of file diff --git a/sd/res/webview/editpic.asp b/sd/res/webview/editpic.asp new file mode 100644 index 000000000000..34a4a51e4473 --- /dev/null +++ b/sd/res/webview/editpic.asp @@ -0,0 +1,58 @@ +<% + Option Explicit + Response.Expires = 0 + Response.Buffer = True +%> + + + + +<% + Dim aPictureArray, nPic, nUpper + + aPictureArray = File_getDataVirtual( csFilePicture, ".", ";" ) + nPic = File_readVirtual( "currpic.txt", "." ) + nUpper = CInt( (UBound(aPictureArray) - 1 ) / 2) +%> + + + + + +
+ <% + if isNumeric(nPic) then + if (CInt( nPic ) >= CInt( (UBound(aPictureArray ) - 1 ) / 2 )) then + nPic = nUpper + end if + else + nPic = nUpper + end if + + + if CInt( nPic ) > 1 then + %> + + <% + else + %> + + <% + end if + %> + + <% + if CInt( nPic ) < CInt( nUpper ) then + %> + + <% + else + %> + + <% + end if + %> + +
+ + diff --git a/sd/res/webview/poll.asp b/sd/res/webview/poll.asp new file mode 100644 index 000000000000..dd1a9bfe0022 --- /dev/null +++ b/sd/res/webview/poll.asp @@ -0,0 +1,36 @@ +<% + Option Explicit + Response.Expires = 0 +%> + + + + + + + + + +<% + ' get current picture id + Dim nGIFID + + nGifID = File_getDataVirtual( csFileCurrent, ".", ";" )( 0 ) + + ' a new picture was chosen ? + if nGIFID <> Session( "GIFID" ) then + ' then store the id of the new picture and show it + Session( "GIFID" ) = nGIFID + %> + + <% + else + %> + + <% + end if +%> + + + + \ No newline at end of file diff --git a/sd/res/webview/savepic.asp b/sd/res/webview/savepic.asp new file mode 100644 index 000000000000..71adefc4f391 --- /dev/null +++ b/sd/res/webview/savepic.asp @@ -0,0 +1,39 @@ +<% + Option Explicit + Response.Expires = 0 + Response.Buffer = True +%> + + + +<% + ' get new picture + Dim sCurrPic,aPictureArray, nUpper, nCurrPic + + aPictureArray = File_getDataVirtual( csFilePicture, ".", ";" ) + nUpper = CInt( (UBound(aPictureArray) - 1 ) / 2) + + sCurrPic = Request( "CurrPic" ) + + ' check if + or - was pressed + select case Request( "Auswahl" ) + case "+" + if isNumeric( sCurrPic ) then + sCurrPic = CStr( CLng( sCurrPic ) + 1 ) + end if + case "-" + if isNumeric( sCurrPic ) then + sCurrPic = CStr( CLng( sCurrPic ) - 1 ) + end if + end select + + ' save picture name + if isNumeric( sCurrPic ) then + if (CInt( sCurrPic ) > 0) and ( CInt( sCurrPic ) <= nUpper ) then + call File_writeVirtual( "currpic.txt", ".", sCurrPic ) + end if + end if + + ' return to edit page + Response.Redirect( "./editpic.asp" ) +%> diff --git a/sd/res/webview/show.asp b/sd/res/webview/show.asp new file mode 100644 index 000000000000..b66103cc6edf --- /dev/null +++ b/sd/res/webview/show.asp @@ -0,0 +1,42 @@ +<% + Option Explicit + Response.Expires = 0 +%> + + + +<% + Dim sGifName1, sGifName2, nGifID, aPictureArray + + nGifID = Session( "GIFID" ) + + ' get current and next picture + aPictureArray = File_getDataVirtual( csFilePicture, ".", ";" ) + + ' not last picture or wrong input ? + If CInt( nGifID ) < UBound( aPictureArray ) / 2 Then + sGifName1 = aPictureArray( ( nGifID - 1 ) * 2 + 1 ) + sGifName2 = aPictureArray( ( nGifID ) * 2 + 1 ) + Else + nGifID = CInt( UBound( aPictureArray ) / 2 ) + sGifName1 = aPictureArray( ( nGifID - 1 ) * 2 + 1 ) + sGifName2 = sGifName1 + End If +%> + + + + + $$1 + + + + + +
+ +
+
+ + + \ No newline at end of file diff --git a/sd/res/webview/webview.asp b/sd/res/webview/webview.asp new file mode 100644 index 000000000000..f3c3af760eda --- /dev/null +++ b/sd/res/webview/webview.asp @@ -0,0 +1,28 @@ +<% + Option Explicit + Response.Expires = 0 +%> + + + +<% + Session( "GIFID" ) = File_getDataVirtual( csFileCurrent, ".", ";" )( 0 ) +%> + + + + + + + + + + + + + +<BODY BGCOLOR="white"> + <META HTTP-EQUIV="-REFRESH" CONTENT="1;URL=./show.asp"> +</BODY> + +</HTML> \ No newline at end of file -- cgit