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