Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
64 jtweddle 1
<%
2
'=============================================================
3
'//
4
'//					PersistanceModule
5
'//
6
'// version: 		2.0
7
'//	last modified: 	24-Aug-2004 10:16 by Sasha Vukovic
8
'=============================================================
9
%>
10
<%
11
Class PersistanceModule
12
 
13
	Private mobjURL
14
	Private mbReCompose			' Used in Compose() to increase performance.
15
								' When mbReCompose = FALSE, msCompose will already contain composed URL
16
	Private msCompose
17
 
18
 
19
	'-----------------------------------------------------------------------------------------------------------------
20
	Public Sub PersistInQryString ( ParNames )
21
		Dim param
22
 
23
		If IsArray( ParNames ) Then
24
			For Each param In ParNames
25
				Call SinglePersistInQryString ( param )
26
			Next
27
 
28
		Else
29
			Call SinglePersistInQryString ( ParNames )
30
 
31
		End If
32
 
33
		mbReCompose = TRUE
34
	End Sub
35
	'-----------------------------------------------------------------------------------------------------------------
36
	Public Sub PersistInQryStringWithValue ( sParName, sVal )
37
		mobjURL.Item ( CStr(sParName) ) = sVal
38
 
39
		mbReCompose = TRUE
40
	End Sub
41
	'-----------------------------------------------------------------------------------------------------------------
42
	Private Sub SinglePersistInQryString ( sParName )
43
		If mobjURL.Exists ( CStr(sParName) ) Then
44
			mobjURL.Item ( CStr(sParName) ) = Request( sParName )
45
 
46
		Else
47
			mobjURL.Add ( CStr(sParName) ), Request( sParName )
48
 
49
		End If
50
	End Sub
51
	'-----------------------------------------------------------------------------------------------------------------
52
	Public Sub PersistInCookie ( sParName )
53
		If Request( sParName ) <> "" Then
54
			Response.Cookies( enumCOOKIE_NAME )( sParName ) = Request( sParName )
55
		End If
56
 
57
	End Sub
58
	'-----------------------------------------------------------------------------------------------------------------
59
	Public Sub StoreParameter ( sParName, sParVal )
60
		If mobjURL.Exists ( CStr(sParName) ) Then
61
			mobjURL.Item ( CStr(sParName) ) = sParVal
62
 
63
		Else
64
			mobjURL.Add ( CStr(sParName) ), sParVal
65
 
66
		End If
67
 
68
		mbReCompose = TRUE
69
	End Sub
70
	'-----------------------------------------------------------------------------------------------------------------
71
	Public Function ComposeURL ()
72
		Dim arrParNames, ParName, tempSTR
73
 
74
		If mbReCompose Then
75
			arrParNames = mobjURL.Keys
76
 
77
			For Each ParName In arrParNames
78
				If mobjURL.Item( ParName ) <> "" Then
79
					tempSTR = tempSTR & ParName &"="& mobjURL.Item( ParName ) &"&"
80
				End If
81
			Next
82
			If Right( tempSTR, 1 ) = "&" Then tempSTR = Left ( tempSTR, Len( tempSTR ) - 1 ) 		' Remove last &
83
 
84
			msCompose = tempSTR
85
			ComposeURL = tempSTR
86
 
87
			mbReCompose = FALSE
88
		Else
89
			ComposeURL = msCompose
90
 
91
		End If
92
 
93
	End Function
94
	'-----------------------------------------------------------------------------------------------------------------
95
	Public Function ComposeHiddenTags ()
96
		Dim arrParNames, ParName, tempSTR
97
 
98
		arrParNames = mobjURL.Keys
99
 
100
		For Each ParName In arrParNames
101
			If mobjURL.Item( ParName ) <> "" Then
102
				tempSTR = tempSTR & "<input type='hidden' name='"& ParName &"' value='"& mobjURL.Item( ParName ) &"'>" & VBNewLine
103
			End If
104
		Next
105
 
106
		ComposeHiddenTags = tempSTR
107
 
108
	End Function
109
	'-----------------------------------------------------------------------------------------------------------------
110
	Public Function ComposeHiddenTagsWithout ( sWithout )
111
		Dim arrParNames, ParName, tempSTR, objWithout, tempArr, fieldname
112
		Set objWithout = CreateObject("Scripting.Dictionary")
113
 
114
		tempArr = Split( sWithout, "," )
115
 
116
		For Each fieldname In tempArr
117
			objWithout.Item (fieldname) = fieldname
118
		Next
119
 
120
		arrParNames = mobjURL.Keys
121
 
122
		For Each ParName In arrParNames
123
			If (mobjURL.Item( ParName ) <> "") AND ( NOT objWithout.Exists ( ParName ) ) Then
124
				tempSTR = tempSTR & "<input type='hidden' name='"& ParName &"' value='"& mobjURL.Item( ParName ) &"'>" & VBNewLine
125
			End If
126
		Next
127
 
128
		ComposeHiddenTagsWithout = tempSTR
129
 
130
		Set objWithout = Nothing
131
	End Function
132
	'-----------------------------------------------------------------------------------------------------------------
133
	Public Function ComposeURLWith ( sParamList )
134
		Dim arrParNames, ParName, tempSTR
135
 
136
		arrParNames = Split( sParamList, "," )
137
 
138
		For Each ParName In arrParNames
139
			If mobjURL.Item( ParName ) <> "" Then
140
 
141
				tempSTR = tempSTR & ParName &"="& mobjURL.Item( ParName ) &"&"
142
			End If
143
		Next
144
		If Right( tempSTR, 1 ) = "&" Then tempSTR = Left ( tempSTR, Len( tempSTR ) - 1 ) 		' Remove last &
145
 
146
		ComposeURLWith = tempSTR
147
 
148
	End Function
149
	'-----------------------------------------------------------------------------------------------------------------
150
	Public Function ComposeURLWithout ( ByVal sParamList )
151
		Dim arrParNames, ParName, tempSTR
152
		sParamList = ","& sParamList &","
153
		arrParNames = mobjURL.Keys
154
 
155
		For Each ParName In arrParNames
156
			If mobjURL.Item( ParName ) <> "" AND ( InStr( sParamList, ","& ParName &"," ) < 1 ) Then
157
 
158
				tempSTR =  tempSTR &"&"& ParName &"="& mobjURL.Item( ParName ) 
159
			End If
160
		Next
161
		'If Left( tempSTR, 1 ) = "&" Then tempSTR = Right ( tempSTR, Len( tempSTR ) - 1 ) 		' Remove first &
162
 
163
		ComposeURLWithout = tempSTR
164
 
165
	End Function
166
	'-----------------------------------------------------------------------------------------------------------------
167
	Private Sub Class_Initialize()
168
		Set mobjURL = CreateObject("Scripting.Dictionary")
169
		mbReCompose = TRUE
170
	End Sub
171
	'-----------------------------------------------------------------------------------------------------------------
172
	Private Sub Class_Terminate()
173
		Set mobjURL = Nothing
174
	End Sub
175
	'-----------------------------------------------------------------------------------------------------------------
176
End Class
177
%>