Rev 64 | Blame | Compare with Previous | Last modification | View Log | RSS feed
<%'============================================================='//'// PersistanceModule'//'// version: 2.0'// last modified: 24-Aug-2004 10:16 by Sasha Vukovic'=============================================================%><%Class PersistanceModulePrivate mobjURLPrivate mbReCompose ' Used in Compose() to increase performance.' When mbReCompose = FALSE, msCompose will already contain composed URLPrivate msCompose'-----------------------------------------------------------------------------------------------------------------Public Sub PersistInQryString ( ParNames )Dim paramIf IsArray( ParNames ) ThenFor Each param In ParNamesCall SinglePersistInQryString ( param )NextElseCall SinglePersistInQryString ( ParNames )End IfmbReCompose = TRUEEnd Sub'-----------------------------------------------------------------------------------------------------------------Public Sub PersistInQryStringWithValue ( sParName, sVal )mobjURL.Item ( CStr(sParName) ) = sValmbReCompose = TRUEEnd Sub'-----------------------------------------------------------------------------------------------------------------Private Sub SinglePersistInQryString ( sParName )If mobjURL.Exists ( CStr(sParName) ) ThenmobjURL.Item ( CStr(sParName) ) = Request( sParName )ElsemobjURL.Add ( CStr(sParName) ), Request( sParName )End IfEnd Sub'-----------------------------------------------------------------------------------------------------------------Public Sub PersistInCookie ( sParName )If Request( sParName ) <> "" ThenResponse.Cookies( enumCOOKIE_NAME )( sParName ) = Request( sParName )End IfEnd Sub'-----------------------------------------------------------------------------------------------------------------Public Sub StoreParameter ( sParName, sParVal )If mobjURL.Exists ( CStr(sParName) ) ThenmobjURL.Item ( CStr(sParName) ) = sParValElsemobjURL.Add ( CStr(sParName) ), sParValEnd IfmbReCompose = TRUEEnd Sub'-----------------------------------------------------------------------------------------------------------------Public Function ComposeURL ()Dim arrParNames, ParName, tempSTRIf mbReCompose ThenarrParNames = mobjURL.KeysFor Each ParName In arrParNamesIf mobjURL.Item( ParName ) <> "" ThentempSTR = tempSTR & ParName &"="& mobjURL.Item( ParName ) &"&"End IfNextIf Right( tempSTR, 1 ) = "&" Then tempSTR = Left ( tempSTR, Len( tempSTR ) - 1 ) ' Remove last &msCompose = tempSTRComposeURL = tempSTRmbReCompose = FALSEElseComposeURL = msComposeEnd IfEnd Function'-----------------------------------------------------------------------------------------------------------------Public Function ComposeHiddenTags ()Dim arrParNames, ParName, tempSTRarrParNames = mobjURL.KeysFor Each ParName In arrParNamesIf mobjURL.Item( ParName ) <> "" ThentempSTR = tempSTR & "<input type='hidden' name='"& ParName &"' value='"& mobjURL.Item( ParName ) &"'>" & VBNewLineEnd IfNextComposeHiddenTags = tempSTREnd Function'-----------------------------------------------------------------------------------------------------------------Public Function ComposeHiddenTagsWithout ( sWithout )Dim arrParNames, ParName, tempSTR, objWithout, tempArr, fieldnameSet objWithout = CreateObject("Scripting.Dictionary")tempArr = Split( sWithout, "," )For Each fieldname In tempArrobjWithout.Item (fieldname) = fieldnameNextarrParNames = mobjURL.KeysFor Each ParName In arrParNamesIf (mobjURL.Item( ParName ) <> "") AND ( NOT objWithout.Exists ( ParName ) ) ThentempSTR = tempSTR & "<input type='hidden' name='"& ParName &"' value='"& mobjURL.Item( ParName ) &"'>" & VBNewLineEnd IfNextComposeHiddenTagsWithout = tempSTRSet objWithout = NothingEnd Function'-----------------------------------------------------------------------------------------------------------------Public Function ComposeURLWith ( sParamList )Dim arrParNames, ParName, tempSTRarrParNames = Split( sParamList, "," )For Each ParName In arrParNamesIf mobjURL.Item( ParName ) <> "" ThentempSTR = tempSTR & ParName &"="& mobjURL.Item( ParName ) &"&"End IfNextIf Right( tempSTR, 1 ) = "&" Then tempSTR = Left ( tempSTR, Len( tempSTR ) - 1 ) ' Remove last &ComposeURLWith = tempSTREnd Function'-----------------------------------------------------------------------------------------------------------------Public Function ComposeURLWithout ( ByVal sParamList )Dim arrParNames, ParName, tempSTRsParamList = ","& sParamList &","arrParNames = mobjURL.KeysFor Each ParName In arrParNamesIf mobjURL.Item( ParName ) <> "" AND ( InStr( sParamList, ","& ParName &"," ) < 1 ) ThentempSTR = tempSTR &"&"& ParName &"="& mobjURL.Item( ParName )End IfNext'If Left( tempSTR, 1 ) = "&" Then tempSTR = Right ( tempSTR, Len( tempSTR ) - 1 ) ' Remove first &ComposeURLWithout = tempSTREnd Function'-----------------------------------------------------------------------------------------------------------------Private Sub Class_Initialize()Set mobjURL = CreateObject("Scripting.Dictionary")mbReCompose = TRUEEnd Sub'-----------------------------------------------------------------------------------------------------------------Private Sub Class_Terminate()Set mobjURL = NothingEnd Sub'-----------------------------------------------------------------------------------------------------------------End Class%>