Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
119 ghuddy 1
<%
2
'=====================================================
3
'					 FORMATING
4
'=====================================================
5
%>
6
<%
7
'-----------------------------------------------------------------------------------------------------------------------------
8
Function EuroDate ( dDate )
9
	' Ensures Euro Date format DD/MM/YYYY
10
	If IsNull(dDate) Then Exit Function
11
	EuroDate = Day(dDate) &"/"& Month(dDate) &"/"& Year(dDate)
12
End Function
13
'-----------------------------------------------------------------------------------------------------------------------------
14
Function EuroDateTime ( dDate )
15
	' Ensures Euro DateTime format DD/MM/YYYY H24:MIN:SS
16
	If IsNull(dDate) Then Exit Function
17
	EuroDateTime = Day(dDate) &"/"& Month(dDate) &"/"& Year(dDate) &" "& FormatDateTime( dDate, 4 )
18
End Function
19
'-----------------------------------------------------------------------------------------------------------------------------
20
Function ToLongDate ( dDate )
21
	' DD/MM/YYYY  -> Saturday, June 26, 1943
22
	If IsNull(dDate) Then Exit Function
23
	ToLongDate = FormatDateTime(dDate, 1)
24
End Function
25
'-----------------------------------------------------------------------------------------------------------------------------
26
Function TO_ORADATE ( SSdate )
27
	'DD/MM/YYYY -> ORADATE
28
	TO_ORADATE = "TO_DATE( '"& SSdate &"','DD/MM/YYYY' )"
29
End Function
30
'-----------------------------------------------------------------------------------------------------------------------------
31
Function ORA_SYSDATE ()
32
	ORA_SYSDATE = "TO_DATE( TO_CHAR( SYSDATE,'DD-MON-YYYY' ),'DD-MON-YYYY' )"
33
End Function
34
'-----------------------------------------------------------------------------------------------------------------------------
35
Function ORA_SYSDATETIME ()
36
	ORA_SYSDATETIME = "TO_DATE( TO_CHAR( SYSDATE,'DD-MON-YYYY HH24:MI:SS' ),'DD-MON-YYYY HH24:MI:SS' )"
37
End Function
38
'-----------------------------------------------------------------------------------------------------------------------------
39
Function Quotes( SSstr )
40
	If InStr(SSstr, "$") > 0 Then
41
		' PERL variable
42
		Quotes = """"& SSstr & """"
43
	Else
44
		' Not PERL variable
45
		Quotes = "'"& SSstr & "'"
46
	End If
47
End Function
48
'-----------------------------------------------------------------------------------------------------------------------------
49
Function To_JATS ( SSbt, SSpkg, SSver )
50
	If SSbt = "B" Then
51
		SSbt = "BuildPkgArchive"
52
	ElseIf SSbt = "L" Then
53
		SSbt = "LinkPkgArchive"
54
	End If
55
	To_JATS = SSbt &" ( "& Quotes( SSpkg ) &", "& Quotes( SSver ) &" );"
56
End Function
57
'-----------------------------------------------------------------------------------------------------------------------------
58
Function To_ANT ( SSpkg, SSver )
59
	To_ANT = "&lt;property name="""& SSpkg &""" value="""& SSver &"""/&gt;"
60
End Function
61
'-----------------------------------------------------------------------------------------------------------------------------
62
Function To_JANT ( SSpkg, SSver )
63
	To_JANT = "&lt;sandbox name="""& SSpkg &""" version="""& SSver &"""/&gt;"
64
End Function
65
'-----------------------------------------------------------------------------------------------------------------------------
66
Function To_ClearCase ( SSpkgLabel )
67
	To_ClearCase = "element * "& SSpkgLabel
68
End Function
69
'-----------------------------------------------------------------------------------------------------------------------------
70
Function To_HTML ( sStr )
71
	If NOT IsNull(sStr) Then To_HTML = Server.HTMLEncode( sStr ) 
72
End Function
73
'-----------------------------------------------------------------------------------------------------------------------------
74
Function SQLstring ( SSstr )
75
	If IsNull(SSstr) OR (SSstr = "") Then Exit Function
76
	SQLstring = Replace( Trim(SSstr), "'", "''")
77
End Function
78
'-----------------------------------------------------------------------------------------------------------------------------
79
Function Format4Java ( SSstr )
80
	Dim tempSTR
81
	tempSTR = SSstr
82
	tempSTR = Replace( tempSTR, "'", "\'" )
83
	tempSTR = Replace( tempSTR, "&lt;", "\<" )
84
	tempSTR = Replace( tempSTR, "&gt;", "\>" )
85
	tempSTR = Replace( tempSTR, ";", "\;" )
86
	tempSTR = Replace( tempSTR, VBNEWLine, "\n" )
87
	Format4Java = tempSTR
88
End Function
89
'-----------------------------------------------------------------------------------------------------------------------------
90
Function Format4HTML ( SSstr )
91
	If IsNull(SSstr) Then Exit Function
92
	Dim tempSTR
93
	tempSTR = SSstr
94
	tempSTR = Replace( tempSTR, "&", "&amp;" )
95
	Format4HTML = tempSTR
96
End Function
97
'-----------------------------------------------------------------------------------------------------------------------------
98
Function Pipes2Commas ( SSstr )
99
	' replaces |1||2||3| to 1,2,3
100
	Pipes2Commas = Replace( SSstr, "||", "," )
101
	Pipes2Commas = Replace( Pipes2Commas, "|", "" )
102
End Function
103
'-----------------------------------------------------------------------------------------------------------------------------
104
Function QuoteCSV ( SSstr )
105
	Dim tempStr
106
	tempStr = SSstr
107
	If tempStr = "" Then 
108
		QuoteCSV = ""
109
		Exit Function
110
	End If
111
 
112
	tempStr = Replace(tempStr, " ", "")		' remove any spaces
113
	QuoteCSV = "'"& Replace( UCase(tempStr), ",", "','") &"'"
114
End Function
115
'-----------------------------------------------------------------------------------------------------------------------------
116
Function QuoteCSVwithLIKE ( SSstr )
117
	Dim tempStr
118
	tempStr = SSstr
119
	If tempStr = "" Then 
120
		QuoteCSVwithLIKE = ""
121
		Exit Function
122
	End If
123
 
124
	tempStr = Replace(tempStr, " ", "")		' remove any spaces
125
	QuoteCSVwithLIKE = "'%"& Replace( UCase(tempStr), ",", "','") &"'"
126
End Function
127
'-----------------------------------------------------------------------------------------------------------------------------
128
Function SplitPipes ( SSstr )
129
	' split |val1||val2||val3| to array 
130
	SplitPipes = Split( Replace( Replace(SSstr,"||","%"), "|","") , "%" )
131
End Function
132
'-----------------------------------------------------------------------------------------------------------------------------
133
Function SplitAmpasans ( SSstr )
134
	' split &val1&&val2&&val3& to array 
135
	SSstr = Left (SSstr, Len(SSstr)-1)	'remove last &
136
	SSstr = Right (SSstr, Len(SSstr)-1)	'remove first &
137
	SplitAmpasans = Split( SSstr , "&&" )
138
End Function
139
'-----------------------------------------------------------------------------------------------------------------------------
140
Function URLEncode ( SSstr )
141
	Dim tmpStr
142
	tmpStr = SSstr
143
	tmpStr = Replace(tmpStr, "'", "%27")	' Encode '
144
	tmpStr = Replace(tmpStr, """", "%22")	' Encode "
145
	tmpStr = Replace(tmpStr, ",", "%2C")	' Encode ,
146
	tmpStr = Replace(tmpStr, ";", "%3B")	' Encode ;
147
	tmpStr = Replace(tmpStr, VBNewLine, "%0D%0A")	' Encode new line
148
	URLEncode = tmpStr
149
End Function
150
'-----------------------------------------------------------------------------------------------------------------------------
151
Function URLDecode ( SSstr )
152
	Dim tmpStr
153
	tmpStr = SSstr
154
	tmpStr = Replace(tmpStr, "%27", "'")	' Decode '
155
	tmpStr = Replace(tmpStr, "%22", """")	' Decode "
156
	tmpStr = Replace(tmpStr, "%2C", ",")	' Decode ,
157
	tmpStr = Replace(tmpStr, "%3B", ";")	' Decode ;
158
	tmpStr = Replace(tmpStr, "%0D%0A", VBNewLine)	' Decode new line
159
	URLDecode = tmpStr
160
End Function
161
'-----------------------------------------------------------------------------------------------------------------------------
162
Function WURLEncode ( sText )
163
	If (NOT IsNull(sText)) AND ( sText <> "" ) Then
164
		WURLEncode = Server.URLEncode( sText )
165
	Else
166
		WURLEncode = sText
167
	End If
168
End Function
169
'-----------------------------------------------------------------------------------------------------------------------------
170
Function HTMLEncode ( sText )
171
	If (NOT IsNull(sText)) AND ( sText <> "" ) Then
172
		HTMLEncode = Server.HTMLEncode( sText)
173
	Else
174
		HTMLEncode = sText
175
	End If
176
End Function
177
'-----------------------------------------------------------------------------------------------------------------------------
178
Function Highlight_Substring ( SSstr, SSsubstr )
179
	Dim leftSTR, startPos
180
	startPos = InStr( 1, SSstr, SSsubstr, 1 )
181
 
182
	If startPos > 0 Then
183
		leftSTR = Left ( SSstr, startPos - 1 )
184
		Highlight_Substring = leftSTR &"<SPAN style='background:#ffff99;'>"& Mid( SSstr, startPos, Len(SSsubstr) ) &"</SPAN>"&  Right ( SSstr, Len(SSstr) - Len(leftSTR) - Len(SSsubstr)  )
185
	Else
186
		' Subtring not found
187
		Highlight_Substring = SSstr
188
	End If
189
 
190
End Function
191
'-----------------------------------------------------------------------------------------------------------------------------
192
Function NewLine_To_BR (SSstr)
193
	If SSstr = "" OR IsNull(SSstr) Then 
194
		Exit Function
195
	Else
196
		NewLine_To_BR = Replace ( SSstr, VBNewLine, "<br>")
197
	End If
198
End Function
199
'-----------------------------------------------------------------------------------------------------------------------------
200
Function IsTicked ( ByVal nParId, ByVal sParList )
201
	' Used only with check boxes as they send comma-separated list
202
	nParId 	 = ","&  Replace(nParId, " ", "") &","
203
	sParList = ","&  Replace(sParList, " ", "") &","
204
 
205
	If InStr( sParList, nParId ) > 0 Then
206
		IsTicked = TRUE
207
	Else
208
		IsTicked = FALSE
209
	End If
210
End Function
211
'------------------------------------------------------------------------------------------------------------------
212
Function FormatVersion ( ByVal nVersion )
213
	Dim arrVersion, MajorVersion, MinorVersion
214
	If IsNull( nVersion ) Then Exit Function
215
	If NOT IsNumeric(nVersion) Then 
216
		FormatVersion = nVersion
217
		Exit Function
218
	End If
219
 
220
	nVersion = FormatNumber( nVersion, 3 )
221
 
222
	arrVersion = Split( CStr( nVersion ), ".")
223
	MajorVersion = arrVersion(0)
224
	MinorVersion = CInt(arrVersion(1))
225
	FormatVersion = MajorVersion &"."& MinorVersion
226
 
227
End Function
228
'-----------------------------------------------------------------------------------------------------------------------------
229
Function GetBuildTypeString( enumBuildType )
230
 
231
	If (NOT IsNull(enumBuildType)) OR (NOT enumBuildType = "") Then
232
 
233
		Select Case CInt(enumBuildType)
234
			Case enumDB_BUILD_TYPE_NONE
235
				GetBuildTypeString = "Build type not specified"
236
 
237
			Case enumDB_BUILD_TYPE_DEBUG
238
				GetBuildTypeString = "Debug"
239
 
240
			Case enumDB_BUILD_TYPE_PROD
241
				GetBuildTypeString = "Production"
242
 
243
			Case enumDB_BUILD_TYPE_PROD_AND_DEBUG
244
				GetBuildTypeString = "Production and Debug"
245
 
246
			Case enumDB_BUILD_TYPE_JAVA_1_4
247
				GetBuildTypeString = "Java 1.4"
248
 
249
			Case enumDB_BUILD_TYPE_JAVA_1_5
250
				GetBuildTypeString = "Java 1.5"
251
 
252
			Case enumDB_BUILD_TYPE_JAVA_1_6
253
				GetBuildTypeString = "Java 1.6"				
254
 
255
		End Select
256
 
257
	Else
258
		GetBuildTypeString = "Build type not defined"
259
	End If
260
 
261
 
262
End Function
263
'-----------------------------------------------------------------------------------------------------------------------------
264
%>