Subversion Repositories DevTools

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

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