| 119 |
ghuddy |
1 |
<%
|
|
|
2 |
'=====================================================
|
|
|
3 |
' FORMATING
|
|
|
4 |
'=====================================================
|
|
|
5 |
%>
|
|
|
6 |
<%
|
|
|
7 |
'-----------------------------------------------------------------------------------------------------------------------------
|
| 5684 |
dpurdie |
8 |
' Don't use - retained for legacy bits
|
| 119 |
ghuddy |
9 |
Function EuroDate ( dDate )
|
|
|
10 |
' Ensures Euro Date format DD/MM/YYYY
|
|
|
11 |
If IsNull(dDate) Then Exit Function
|
|
|
12 |
EuroDate = Day(dDate) &"/"& Month(dDate) &"/"& Year(dDate)
|
|
|
13 |
End Function
|
|
|
14 |
'-----------------------------------------------------------------------------------------------------------------------------
|
| 5632 |
dpurdie |
15 |
Function DayName (intDay)
|
|
|
16 |
'------------------------------------------
|
|
|
17 |
' Returns Abbreviated Day of Week
|
|
|
18 |
'------------------------------------------
|
|
|
19 |
select case intDay
|
|
|
20 |
case 1
|
|
|
21 |
DayName = "Sun"
|
|
|
22 |
case 2
|
|
|
23 |
DayName = "Mon"
|
|
|
24 |
case 3
|
|
|
25 |
DayName = "Tue"
|
|
|
26 |
case 4
|
|
|
27 |
DayName = "Wed"
|
|
|
28 |
case 5
|
|
|
29 |
DayName = "Thu"
|
|
|
30 |
case 6
|
|
|
31 |
DayName = "Fri"
|
|
|
32 |
case 7
|
|
|
33 |
DayName = "Sat"
|
|
|
34 |
end select
|
|
|
35 |
end function
|
|
|
36 |
|
|
|
37 |
function MonthToName(intMonth)
|
|
|
38 |
'-----------------------------------------
|
|
|
39 |
' Returns Abbreviated Month Name
|
|
|
40 |
'-----------------------------------------
|
|
|
41 |
select case intMonth
|
|
|
42 |
case 1
|
|
|
43 |
MonthToName = "Jan"
|
|
|
44 |
case 2
|
|
|
45 |
MonthToName = "Feb"
|
|
|
46 |
case 3
|
|
|
47 |
MonthToName = "Mar"
|
|
|
48 |
case 4
|
|
|
49 |
MonthToName = "Apr"
|
|
|
50 |
case 5
|
|
|
51 |
MonthToName = "May"
|
|
|
52 |
case 6
|
|
|
53 |
MonthToName = "Jun"
|
|
|
54 |
case 7
|
|
|
55 |
MonthToName = "Jul"
|
|
|
56 |
case 8
|
|
|
57 |
MonthToName = "Aug"
|
|
|
58 |
case 9
|
|
|
59 |
MonthToName = "Sep"
|
|
|
60 |
case 10
|
|
|
61 |
MonthToName = "Oct"
|
|
|
62 |
case 11
|
|
|
63 |
MonthToName = "Nov"
|
|
|
64 |
case 12
|
|
|
65 |
MonthToName = "Dec"
|
|
|
66 |
end select
|
|
|
67 |
end function
|
|
|
68 |
|
|
|
69 |
Function DisplayShortDate ( dDate )
|
|
|
70 |
' Ensures Nice Date format DD-Mon-YYYY
|
|
|
71 |
If IsNull(dDate) Then Exit Function
|
|
|
72 |
DisplayShortDate = Day(dDate) & "-" & MonthToName( Month(dDate)) & "-" & Year(dDate)
|
|
|
73 |
End Function
|
|
|
74 |
|
|
|
75 |
Function DisplayDate ( dDate )
|
|
|
76 |
' Ensures Nice Date format Day DD-Mon-YYYY
|
|
|
77 |
If IsNull(dDate) Then Exit Function
|
|
|
78 |
DisplayDate = DayName (WeekDay(dDate)) & " " & Day(dDate) & "-" & MonthToName( Month(dDate)) & "-" & Year(dDate)
|
|
|
79 |
End Function
|
|
|
80 |
|
|
|
81 |
Function DisplayShortDateTime ( dDate )
|
|
|
82 |
' Ensures Nice Date format DD-Mon-YYYY HH:MM
|
|
|
83 |
If IsNull(dDate) Then Exit Function
|
|
|
84 |
DisplayShortDateTime = DisplayShortDate ( dDate ) &" "& FormatDateTime( dDate, 4 )
|
|
|
85 |
End Function
|
|
|
86 |
|
|
|
87 |
Function DisplayDateTime ( dDate )
|
|
|
88 |
' Ensures Nice Date format Day DD-Mon-YYYY HH:MM
|
|
|
89 |
If IsNull(dDate) Then Exit Function
|
|
|
90 |
DisplayDateTime = DisplayDate ( dDate ) &" "& FormatDateTime( dDate, 4 )
|
|
|
91 |
End Function
|
|
|
92 |
|
|
|
93 |
Function DisplayDateTimeSecs ( dDate )
|
| 5670 |
dpurdie |
94 |
' Ensures Nice Date format Day DD-Mon-YYYY HH:MM:SS
|
| 5632 |
dpurdie |
95 |
If IsNull(dDate) Then Exit Function
|
|
|
96 |
DisplayDateTimeSecs = DisplayDate ( dDate ) &" "& Right("0" & Hour(dDate), 2) & ":" & Right("0" & Minute(dDate), 2) & ":" & Right("0" & Second(dDate), 2)
|
|
|
97 |
End Function
|
|
|
98 |
|
| 5670 |
dpurdie |
99 |
Function DisplayShortDateTimeSecs ( dDate )
|
|
|
100 |
' Ensures Nice Date format DD-Mon-YYYY HH:MM:SS
|
|
|
101 |
If IsNull(dDate) Then Exit Function
|
|
|
102 |
DisplayShortDateTimeSecs = DisplayShortDate ( dDate ) &" "& Right("0" & Hour(dDate), 2) & ":" & Right("0" & Minute(dDate), 2) & ":" & Right("0" & Second(dDate), 2)
|
|
|
103 |
End Function
|
|
|
104 |
|
| 119 |
ghuddy |
105 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
106 |
Function ToLongDate ( dDate )
|
|
|
107 |
' DD/MM/YYYY -> Saturday, June 26, 1943
|
|
|
108 |
If IsNull(dDate) Then Exit Function
|
|
|
109 |
ToLongDate = FormatDateTime(dDate, 1)
|
|
|
110 |
End Function
|
|
|
111 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
112 |
Function TO_ORADATE ( SSdate )
|
|
|
113 |
'DD/MM/YYYY -> ORADATE
|
|
|
114 |
TO_ORADATE = "TO_DATE( '"& SSdate &"','DD/MM/YYYY' )"
|
|
|
115 |
End Function
|
|
|
116 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
117 |
Function ORA_SYSDATE ()
|
|
|
118 |
ORA_SYSDATE = "TO_DATE( TO_CHAR( SYSDATE,'DD-MON-YYYY' ),'DD-MON-YYYY' )"
|
|
|
119 |
End Function
|
|
|
120 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
121 |
Function ORA_SYSDATETIME ()
|
|
|
122 |
ORA_SYSDATETIME = "TO_DATE( TO_CHAR( SYSDATE,'DD-MON-YYYY HH24:MI:SS' ),'DD-MON-YYYY HH24:MI:SS' )"
|
|
|
123 |
End Function
|
|
|
124 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
125 |
Function Quotes( SSstr )
|
|
|
126 |
If InStr(SSstr, "$") > 0 Then
|
|
|
127 |
' PERL variable
|
|
|
128 |
Quotes = """"& SSstr & """"
|
|
|
129 |
Else
|
|
|
130 |
' Not PERL variable
|
|
|
131 |
Quotes = "'"& SSstr & "'"
|
|
|
132 |
End If
|
|
|
133 |
End Function
|
|
|
134 |
'-----------------------------------------------------------------------------------------------------------------------------
|
| 159 |
ghuddy |
135 |
Function DoubleQuotes( SSstr )
|
|
|
136 |
DoubleQuotes = """"& SSstr & """"
|
|
|
137 |
End Function
|
|
|
138 |
'-----------------------------------------------------------------------------------------------------------------------------
|
| 119 |
ghuddy |
139 |
Function To_JATS ( SSbt, SSpkg, SSver )
|
|
|
140 |
If SSbt = "B" Then
|
|
|
141 |
SSbt = "BuildPkgArchive"
|
|
|
142 |
ElseIf SSbt = "L" Then
|
|
|
143 |
SSbt = "LinkPkgArchive"
|
|
|
144 |
End If
|
|
|
145 |
To_JATS = SSbt &" ( "& Quotes( SSpkg ) &", "& Quotes( SSver ) &" );"
|
|
|
146 |
End Function
|
|
|
147 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
148 |
Function To_ANT ( SSpkg, SSver )
|
|
|
149 |
To_ANT = "<property name="""& SSpkg &""" value="""& SSver &"""/>"
|
|
|
150 |
End Function
|
|
|
151 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
152 |
Function To_ClearCase ( SSpkgLabel )
|
|
|
153 |
To_ClearCase = "element * "& SSpkgLabel
|
|
|
154 |
End Function
|
|
|
155 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
156 |
Function To_HTML ( sStr )
|
| 147 |
ghuddy |
157 |
If NOT IsNull(sStr) Then To_HTML = Server.HTMLEncode( sStr )
|
| 119 |
ghuddy |
158 |
End Function
|
|
|
159 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
160 |
Function SQLstring ( SSstr )
|
|
|
161 |
If IsNull(SSstr) OR (SSstr = "") Then Exit Function
|
|
|
162 |
SQLstring = Replace( Trim(SSstr), "'", "''")
|
|
|
163 |
End Function
|
|
|
164 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
165 |
Function Format4Java ( SSstr )
|
|
|
166 |
Dim tempSTR
|
|
|
167 |
tempSTR = SSstr
|
|
|
168 |
tempSTR = Replace( tempSTR, "'", "\'" )
|
|
|
169 |
tempSTR = Replace( tempSTR, "<", "\<" )
|
|
|
170 |
tempSTR = Replace( tempSTR, ">", "\>" )
|
|
|
171 |
tempSTR = Replace( tempSTR, ";", "\;" )
|
|
|
172 |
tempSTR = Replace( tempSTR, VBNEWLine, "\n" )
|
|
|
173 |
Format4Java = tempSTR
|
|
|
174 |
End Function
|
|
|
175 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
176 |
Function Format4HTML ( SSstr )
|
|
|
177 |
If IsNull(SSstr) Then Exit Function
|
|
|
178 |
Dim tempSTR
|
|
|
179 |
tempSTR = SSstr
|
|
|
180 |
tempSTR = Replace( tempSTR, "&", "&" )
|
|
|
181 |
Format4HTML = tempSTR
|
|
|
182 |
End Function
|
|
|
183 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
184 |
Function Pipes2Commas ( SSstr )
|
|
|
185 |
' replaces |1||2||3| to 1,2,3
|
|
|
186 |
Pipes2Commas = Replace( SSstr, "||", "," )
|
|
|
187 |
Pipes2Commas = Replace( Pipes2Commas, "|", "" )
|
|
|
188 |
End Function
|
|
|
189 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
190 |
Function QuoteCSV ( SSstr )
|
|
|
191 |
Dim tempStr
|
|
|
192 |
tempStr = SSstr
|
| 147 |
ghuddy |
193 |
If tempStr = "" Then
|
| 119 |
ghuddy |
194 |
QuoteCSV = ""
|
|
|
195 |
Exit Function
|
|
|
196 |
End If
|
| 147 |
ghuddy |
197 |
|
| 119 |
ghuddy |
198 |
tempStr = Replace(tempStr, " ", "") ' remove any spaces
|
|
|
199 |
QuoteCSV = "'"& Replace( UCase(tempStr), ",", "','") &"'"
|
|
|
200 |
End Function
|
|
|
201 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
202 |
Function QuoteCSVwithLIKE ( SSstr )
|
|
|
203 |
Dim tempStr
|
|
|
204 |
tempStr = SSstr
|
| 147 |
ghuddy |
205 |
If tempStr = "" Then
|
| 119 |
ghuddy |
206 |
QuoteCSVwithLIKE = ""
|
|
|
207 |
Exit Function
|
|
|
208 |
End If
|
| 147 |
ghuddy |
209 |
|
| 119 |
ghuddy |
210 |
tempStr = Replace(tempStr, " ", "") ' remove any spaces
|
|
|
211 |
QuoteCSVwithLIKE = "'%"& Replace( UCase(tempStr), ",", "','") &"'"
|
|
|
212 |
End Function
|
|
|
213 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
214 |
Function SplitPipes ( SSstr )
|
| 147 |
ghuddy |
215 |
' split |val1||val2||val3| to array
|
| 119 |
ghuddy |
216 |
SplitPipes = Split( Replace( Replace(SSstr,"||","%"), "|","") , "%" )
|
|
|
217 |
End Function
|
|
|
218 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
219 |
Function SplitAmpasans ( SSstr )
|
| 147 |
ghuddy |
220 |
' split &val1&&val2&&val3& to array
|
| 119 |
ghuddy |
221 |
SSstr = Left (SSstr, Len(SSstr)-1) 'remove last &
|
|
|
222 |
SSstr = Right (SSstr, Len(SSstr)-1) 'remove first &
|
|
|
223 |
SplitAmpasans = Split( SSstr , "&&" )
|
|
|
224 |
End Function
|
|
|
225 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
226 |
Function URLEncode ( SSstr )
|
|
|
227 |
Dim tmpStr
|
|
|
228 |
tmpStr = SSstr
|
|
|
229 |
tmpStr = Replace(tmpStr, "'", "%27") ' Encode '
|
|
|
230 |
tmpStr = Replace(tmpStr, """", "%22") ' Encode "
|
|
|
231 |
tmpStr = Replace(tmpStr, ",", "%2C") ' Encode ,
|
|
|
232 |
tmpStr = Replace(tmpStr, ";", "%3B") ' Encode ;
|
|
|
233 |
tmpStr = Replace(tmpStr, VBNewLine, "%0D%0A") ' Encode new line
|
|
|
234 |
URLEncode = tmpStr
|
|
|
235 |
End Function
|
|
|
236 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
237 |
Function URLDecode ( SSstr )
|
|
|
238 |
Dim tmpStr
|
|
|
239 |
tmpStr = SSstr
|
|
|
240 |
tmpStr = Replace(tmpStr, "%27", "'") ' Decode '
|
|
|
241 |
tmpStr = Replace(tmpStr, "%22", """") ' Decode "
|
|
|
242 |
tmpStr = Replace(tmpStr, "%2C", ",") ' Decode ,
|
|
|
243 |
tmpStr = Replace(tmpStr, "%3B", ";") ' Decode ;
|
|
|
244 |
tmpStr = Replace(tmpStr, "%0D%0A", VBNewLine) ' Decode new line
|
|
|
245 |
URLDecode = tmpStr
|
|
|
246 |
End Function
|
|
|
247 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
248 |
Function WURLEncode ( sText )
|
|
|
249 |
If (NOT IsNull(sText)) AND ( sText <> "" ) Then
|
|
|
250 |
WURLEncode = Server.URLEncode( sText )
|
|
|
251 |
Else
|
|
|
252 |
WURLEncode = sText
|
|
|
253 |
End If
|
|
|
254 |
End Function
|
|
|
255 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
256 |
Function HTMLEncode ( sText )
|
|
|
257 |
If (NOT IsNull(sText)) AND ( sText <> "" ) Then
|
|
|
258 |
HTMLEncode = Server.HTMLEncode( sText)
|
|
|
259 |
Else
|
|
|
260 |
HTMLEncode = sText
|
|
|
261 |
End If
|
|
|
262 |
End Function
|
|
|
263 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
264 |
Function Highlight_Substring ( SSstr, SSsubstr )
|
|
|
265 |
Dim leftSTR, startPos
|
|
|
266 |
startPos = InStr( 1, SSstr, SSsubstr, 1 )
|
| 147 |
ghuddy |
267 |
|
| 119 |
ghuddy |
268 |
If startPos > 0 Then
|
|
|
269 |
leftSTR = Left ( SSstr, startPos - 1 )
|
|
|
270 |
Highlight_Substring = leftSTR &"<SPAN style='background:#ffff99;'>"& Mid( SSstr, startPos, Len(SSsubstr) ) &"</SPAN>"& Right ( SSstr, Len(SSstr) - Len(leftSTR) - Len(SSsubstr) )
|
|
|
271 |
Else
|
|
|
272 |
' Subtring not found
|
|
|
273 |
Highlight_Substring = SSstr
|
|
|
274 |
End If
|
| 147 |
ghuddy |
275 |
|
| 119 |
ghuddy |
276 |
End Function
|
|
|
277 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
278 |
Function NewLine_To_BR (SSstr)
|
| 147 |
ghuddy |
279 |
If SSstr = "" OR IsNull(SSstr) Then
|
| 119 |
ghuddy |
280 |
Exit Function
|
|
|
281 |
Else
|
|
|
282 |
NewLine_To_BR = Replace ( SSstr, VBNewLine, "<br>")
|
|
|
283 |
End If
|
|
|
284 |
End Function
|
|
|
285 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
286 |
Function IsTicked ( ByVal nParId, ByVal sParList )
|
|
|
287 |
' Used only with check boxes as they send comma-separated list
|
|
|
288 |
nParId = ","& Replace(nParId, " ", "") &","
|
|
|
289 |
sParList = ","& Replace(sParList, " ", "") &","
|
| 147 |
ghuddy |
290 |
|
| 119 |
ghuddy |
291 |
If InStr( sParList, nParId ) > 0 Then
|
|
|
292 |
IsTicked = TRUE
|
|
|
293 |
Else
|
|
|
294 |
IsTicked = FALSE
|
|
|
295 |
End If
|
|
|
296 |
End Function
|
|
|
297 |
'------------------------------------------------------------------------------------------------------------------
|
|
|
298 |
Function FormatVersion ( ByVal nVersion )
|
|
|
299 |
Dim arrVersion, MajorVersion, MinorVersion
|
|
|
300 |
If IsNull( nVersion ) Then Exit Function
|
| 147 |
ghuddy |
301 |
If NOT IsNumeric(nVersion) Then
|
| 119 |
ghuddy |
302 |
FormatVersion = nVersion
|
|
|
303 |
Exit Function
|
|
|
304 |
End If
|
| 147 |
ghuddy |
305 |
|
| 119 |
ghuddy |
306 |
nVersion = FormatNumber( nVersion, 3 )
|
| 147 |
ghuddy |
307 |
|
| 119 |
ghuddy |
308 |
arrVersion = Split( CStr( nVersion ), ".")
|
|
|
309 |
MajorVersion = arrVersion(0)
|
|
|
310 |
MinorVersion = CInt(arrVersion(1))
|
|
|
311 |
FormatVersion = MajorVersion &"."& MinorVersion
|
| 147 |
ghuddy |
312 |
|
| 119 |
ghuddy |
313 |
End Function
|
|
|
314 |
'-----------------------------------------------------------------------------------------------------------------------------
|
| 147 |
ghuddy |
315 |
%>
|