Subversion Repositories DevTools

Rev

Rev 119 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
119 ghuddy 1
<%
2
'=============================================================
3
'//
4
'//					PersistanceModule
5
'//
6
'// version: 		2.0
7
'//	last modified: 	29-Apr-2004 14:19 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
	Private Sub SinglePersistInQryString ( sParName )
37
		If Request( sParName ) <> "" Then
38
			mobjURL.Item ( CStr(sParName) ) = Request( sParName )
39
		End If
40
 
41
	End Sub
42
	'-----------------------------------------------------------------------------------------------------------------
43
	Public Sub PersistInCookie ( sParName )
44
		If Request( sParName ) <> "" Then
45
			Response.Cookies( COOKIE_NAME )( sParName ) = Request( sParName )
46
		End If
47
 
48
	End Sub
49
	'-----------------------------------------------------------------------------------------------------------------
50
	Public Sub StoreParameter ( sParName, sParVal )
51
		mobjURL.Item ( CStr(sParName) ) = sParVal
52
 
53
		mbReCompose = TRUE
54
	End Sub
55
	'-----------------------------------------------------------------------------------------------------------------
56
	Public Function GetParamValue ( sParName )
57
		GetParamValue = mobjURL.Item ( CStr(sParName) )
58
	End Function
59
	'-----------------------------------------------------------------------------------------------------------------
60
	Public Function ComposeURL ()
61
		Dim arrParNames, ParName, tempSTR
62
 
63
		If mbReCompose Then
64
			arrParNames = mobjURL.Keys
65
 
66
			For Each ParName In arrParNames
67
				If mobjURL.Item( ParName ) <> "" Then
68
					tempSTR = tempSTR & ParName &"="& mobjURL.Item( ParName ) &"&"
69
				End If
70
			Next
71
			If Right( tempSTR, 1 ) = "&" Then tempSTR = Left ( tempSTR, Len( tempSTR ) - 1 ) 		' Remove last &
72
 
73
			msCompose = tempSTR
74
			ComposeURL = tempSTR
75
 
76
			mbReCompose = FALSE
77
		Else
78
			ComposeURL = msCompose
79
 
80
		End If
81
 
82
	End Function
83
	'-----------------------------------------------------------------------------------------------------------------
84
	Public Function ComposeHiddenTags ()
85
		Dim arrParNames, ParName, tempSTR
86
 
87
		arrParNames = mobjURL.Keys
88
 
89
		For Each ParName In arrParNames
90
			If mobjURL.Item( ParName ) <> "" Then
91
				tempSTR = tempSTR & "<input type='hidden' name='"& ParName &"' value='"& mobjURL.Item( ParName ) &"'>" & VBNewLine
92
			End If
93
		Next
94
 
95
		ComposeHiddenTags = tempSTR
96
 
97
	End Function
98
	'-----------------------------------------------------------------------------------------------------------------
99
	Public Function ComposeHiddenTagsWithout ( sWithout )
100
		Dim arrParNames, ParName, tempSTR, objWithout, tempArr, fieldname
101
		Set objWithout = CreateObject("Scripting.Dictionary")
102
 
103
		tempArr = Split( sWithout, "," )
104
 
105
		For Each fieldname In tempArr
106
			objWithout.Item (fieldname) = fieldname
107
		Next
108
 
109
		arrParNames = mobjURL.Keys
110
 
111
		For Each ParName In arrParNames
112
			If (mobjURL.Item( ParName ) <> "") AND ( NOT objWithout.Exists ( ParName ) ) Then
113
				tempSTR = tempSTR & "<input type='hidden' name='"& ParName &"' value='"& mobjURL.Item( ParName ) &"'>" & VBNewLine
114
			End If
115
		Next
116
 
117
		ComposeHiddenTagsWithout = tempSTR
118
 
119
		Set objWithout = Nothing
120
	End Function
121
	'-----------------------------------------------------------------------------------------------------------------
122
	Public Function ComposeURLWith ( sParamList )
123
		Dim arrParNames, ParName, tempSTR
124
 
125
		arrParNames = Split( sParamList, "," )
126
 
127
		For Each ParName In arrParNames
128
			If mobjURL.Item( ParName ) <> "" Then
129
 
130
				tempSTR = tempSTR & ParName &"="& mobjURL.Item( ParName ) &"&"
131
			End If
132
		Next
133
		If Right( tempSTR, 1 ) = "&" Then tempSTR = Left ( tempSTR, Len( tempSTR ) - 1 ) 		' Remove last &
134
 
135
		ComposeURLWith = tempSTR
136
 
137
	End Function
138
	'-----------------------------------------------------------------------------------------------------------------
139
	Public Function ComposeURLWithout ( ByVal sParamList )
140
		Dim arrParNames, ParName, tempSTR
141
		sParamList = ","& sParamList &","
142
		arrParNames = mobjURL.Keys
143
 
144
		For Each ParName In arrParNames
145
			If mobjURL.Item( ParName ) <> "" AND ( InStr( sParamList, ","& ParName &"," ) < 1 ) Then
146
 
147
				tempSTR =  tempSTR &"&"& ParName &"="& mobjURL.Item( ParName )
148
			End If
149
		Next
150
		'If Left( tempSTR, 1 ) = "&" Then tempSTR = Right ( tempSTR, Len( tempSTR ) - 1 ) 		' Remove first &
151
 
152
		ComposeURLWithout = tempSTR
153
 
154
	End Function
155
	'-----------------------------------------------------------------------------------------------------------------
156
	Private Sub Class_Initialize()
157
		Set mobjURL = CreateObject("Scripting.Dictionary")
158
		mbReCompose = TRUE
159
	End Sub
160
	'-----------------------------------------------------------------------------------------------------------------
161
	Private Sub Class_Terminate()
162
		Set mobjURL = Nothing
163
	End Sub
164
	'-----------------------------------------------------------------------------------------------------------------
165
End Class
166
%>