| 13 |
rsolanki |
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 = "<sandbox name="""& SSpkg &""" version="""& SSver &"""/>"
|
|
|
60 |
End Function
|
|
|
61 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
62 |
Function To_ClearCase ( SSpkgLabel )
|
|
|
63 |
To_ClearCase = "element * "& SSpkgLabel
|
|
|
64 |
End Function
|
|
|
65 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
66 |
Function To_HTML ( sStr )
|
|
|
67 |
If NOT IsNull(sStr) Then To_HTML = Server.HTMLEncode( sStr )
|
|
|
68 |
End Function
|
|
|
69 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
70 |
Function SQLstring ( SSstr )
|
|
|
71 |
If IsNull(SSstr) OR (SSstr = "") Then Exit Function
|
|
|
72 |
SQLstring = Replace( Trim(SSstr), "'", "''")
|
|
|
73 |
End Function
|
|
|
74 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
75 |
Function Format4Java ( SSstr )
|
|
|
76 |
Dim tempSTR
|
|
|
77 |
tempSTR = SSstr
|
|
|
78 |
tempSTR = Replace( tempSTR, "'", "\'" )
|
|
|
79 |
tempSTR = Replace( tempSTR, "<", "\<" )
|
|
|
80 |
tempSTR = Replace( tempSTR, ">", "\>" )
|
|
|
81 |
tempSTR = Replace( tempSTR, ";", "\;" )
|
|
|
82 |
tempSTR = Replace( tempSTR, VBNEWLine, "\n" )
|
|
|
83 |
Format4Java = tempSTR
|
|
|
84 |
End Function
|
|
|
85 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
86 |
Function Format4HTML ( SSstr )
|
|
|
87 |
If IsNull(SSstr) Then Exit Function
|
|
|
88 |
Dim tempSTR
|
|
|
89 |
tempSTR = SSstr
|
|
|
90 |
tempSTR = Replace( tempSTR, "&", "&" )
|
|
|
91 |
Format4HTML = tempSTR
|
|
|
92 |
End Function
|
|
|
93 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
94 |
Function Pipes2Commas ( SSstr )
|
|
|
95 |
' replaces |1||2||3| to 1,2,3
|
|
|
96 |
Pipes2Commas = Replace( SSstr, "||", "," )
|
|
|
97 |
Pipes2Commas = Replace( Pipes2Commas, "|", "" )
|
|
|
98 |
End Function
|
|
|
99 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
100 |
Function QuoteCSV ( SSstr )
|
|
|
101 |
Dim tempStr
|
|
|
102 |
tempStr = SSstr
|
|
|
103 |
If tempStr = "" Then
|
|
|
104 |
QuoteCSV = ""
|
|
|
105 |
Exit Function
|
|
|
106 |
End If
|
|
|
107 |
|
|
|
108 |
tempStr = Replace(tempStr, " ", "") ' remove any spaces
|
|
|
109 |
QuoteCSV = "'"& Replace( UCase(tempStr), ",", "','") &"'"
|
|
|
110 |
End Function
|
|
|
111 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
112 |
Function QuoteCSVwithLIKE ( SSstr )
|
|
|
113 |
Dim tempStr
|
|
|
114 |
tempStr = SSstr
|
|
|
115 |
If tempStr = "" Then
|
|
|
116 |
QuoteCSVwithLIKE = ""
|
|
|
117 |
Exit Function
|
|
|
118 |
End If
|
|
|
119 |
|
|
|
120 |
tempStr = Replace(tempStr, " ", "") ' remove any spaces
|
|
|
121 |
QuoteCSVwithLIKE = "'%"& Replace( UCase(tempStr), ",", "','") &"'"
|
|
|
122 |
End Function
|
|
|
123 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
124 |
Function SplitPipes ( SSstr )
|
|
|
125 |
' split |val1||val2||val3| to array
|
|
|
126 |
SplitPipes = Split( Replace( Replace(SSstr,"||","%"), "|","") , "%" )
|
|
|
127 |
End Function
|
|
|
128 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
129 |
Function SplitAmpasans ( SSstr )
|
|
|
130 |
' split &val1&&val2&&val3& to array
|
|
|
131 |
SSstr = Left (SSstr, Len(SSstr)-1) 'remove last &
|
|
|
132 |
SSstr = Right (SSstr, Len(SSstr)-1) 'remove first &
|
|
|
133 |
SplitAmpasans = Split( SSstr , "&&" )
|
|
|
134 |
End Function
|
|
|
135 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
136 |
Function URLEncode ( SSstr )
|
|
|
137 |
Dim tmpStr
|
|
|
138 |
tmpStr = SSstr
|
|
|
139 |
tmpStr = Replace(tmpStr, "'", "%27") ' Encode '
|
|
|
140 |
tmpStr = Replace(tmpStr, """", "%22") ' Encode "
|
|
|
141 |
tmpStr = Replace(tmpStr, ",", "%2C") ' Encode ,
|
|
|
142 |
tmpStr = Replace(tmpStr, ";", "%3B") ' Encode ;
|
|
|
143 |
tmpStr = Replace(tmpStr, VBNewLine, "%0D%0A") ' Encode new line
|
|
|
144 |
URLEncode = tmpStr
|
|
|
145 |
End Function
|
|
|
146 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
147 |
Function URLDecode ( SSstr )
|
|
|
148 |
Dim tmpStr
|
|
|
149 |
tmpStr = SSstr
|
|
|
150 |
tmpStr = Replace(tmpStr, "%27", "'") ' Decode '
|
|
|
151 |
tmpStr = Replace(tmpStr, "%22", """") ' Decode "
|
|
|
152 |
tmpStr = Replace(tmpStr, "%2C", ",") ' Decode ,
|
|
|
153 |
tmpStr = Replace(tmpStr, "%3B", ";") ' Decode ;
|
|
|
154 |
tmpStr = Replace(tmpStr, "%0D%0A", VBNewLine) ' Decode new line
|
|
|
155 |
URLDecode = tmpStr
|
|
|
156 |
End Function
|
|
|
157 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
158 |
Function WURLEncode ( sText )
|
|
|
159 |
If (NOT IsNull(sText)) AND ( sText <> "" ) Then
|
|
|
160 |
WURLEncode = Server.URLEncode( sText )
|
|
|
161 |
Else
|
|
|
162 |
WURLEncode = sText
|
|
|
163 |
End If
|
|
|
164 |
End Function
|
|
|
165 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
166 |
Function HTMLEncode ( sText )
|
|
|
167 |
If (NOT IsNull(sText)) AND ( sText <> "" ) Then
|
|
|
168 |
HTMLEncode = Server.HTMLEncode( sText)
|
|
|
169 |
Else
|
|
|
170 |
HTMLEncode = sText
|
|
|
171 |
End If
|
|
|
172 |
End Function
|
|
|
173 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
174 |
Function Highlight_Substring ( SSstr, SSsubstr )
|
|
|
175 |
Dim leftSTR, startPos
|
|
|
176 |
startPos = InStr( 1, SSstr, SSsubstr, 1 )
|
|
|
177 |
|
|
|
178 |
If startPos > 0 Then
|
|
|
179 |
leftSTR = Left ( SSstr, startPos - 1 )
|
|
|
180 |
Highlight_Substring = leftSTR &"<SPAN style='background:#ffff99;'>"& Mid( SSstr, startPos, Len(SSsubstr) ) &"</SPAN>"& Right ( SSstr, Len(SSstr) - Len(leftSTR) - Len(SSsubstr) )
|
|
|
181 |
Else
|
|
|
182 |
' Subtring not found
|
|
|
183 |
Highlight_Substring = SSstr
|
|
|
184 |
End If
|
|
|
185 |
|
|
|
186 |
End Function
|
|
|
187 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
188 |
Function NewLine_To_BR (SSstr)
|
|
|
189 |
If SSstr = "" OR IsNull(SSstr) Then
|
|
|
190 |
Exit Function
|
|
|
191 |
Else
|
|
|
192 |
NewLine_To_BR = Replace ( SSstr, VBNewLine, "<br>")
|
|
|
193 |
End If
|
|
|
194 |
End Function
|
|
|
195 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
196 |
Function IsTicked ( ByVal nParId, ByVal sParList )
|
|
|
197 |
' Used only with check boxes as they send comma-separated list
|
|
|
198 |
nParId = ","& Replace(nParId, " ", "") &","
|
|
|
199 |
sParList = ","& Replace(sParList, " ", "") &","
|
|
|
200 |
|
|
|
201 |
If InStr( sParList, nParId ) > 0 Then
|
|
|
202 |
IsTicked = TRUE
|
|
|
203 |
Else
|
|
|
204 |
IsTicked = FALSE
|
|
|
205 |
End If
|
|
|
206 |
End Function
|
|
|
207 |
'------------------------------------------------------------------------------------------------------------------
|
|
|
208 |
Function FormatVersion ( ByVal nVersion )
|
|
|
209 |
Dim arrVersion, MajorVersion, MinorVersion
|
|
|
210 |
If IsNull( nVersion ) Then Exit Function
|
|
|
211 |
If NOT IsNumeric(nVersion) Then
|
|
|
212 |
FormatVersion = nVersion
|
|
|
213 |
Exit Function
|
|
|
214 |
End If
|
|
|
215 |
|
|
|
216 |
nVersion = FormatNumber( nVersion, 3 )
|
|
|
217 |
|
|
|
218 |
arrVersion = Split( CStr( nVersion ), ".")
|
|
|
219 |
MajorVersion = arrVersion(0)
|
|
|
220 |
MinorVersion = CInt(arrVersion(1))
|
|
|
221 |
FormatVersion = MajorVersion &"."& MinorVersion
|
|
|
222 |
|
|
|
223 |
End Function
|
|
|
224 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
225 |
Function GetBuildTypeString( enumBuildType )
|
|
|
226 |
|
|
|
227 |
If (NOT IsNull(enumBuildType)) OR (NOT enumBuildType = "") Then
|
|
|
228 |
|
|
|
229 |
Select Case CInt(enumBuildType)
|
|
|
230 |
Case enumDB_BUILD_TYPE_NONE
|
|
|
231 |
GetBuildTypeString = "Build type not applicable"
|
|
|
232 |
|
|
|
233 |
Case enumDB_BUILD_TYPE_DEBUG
|
|
|
234 |
GetBuildTypeString = "Debug"
|
|
|
235 |
|
|
|
236 |
Case enumDB_BUILD_TYPE_PROD
|
|
|
237 |
GetBuildTypeString = "Production"
|
|
|
238 |
|
|
|
239 |
Case enumDB_BUILD_TYPE_PROD_AND_DEBUG
|
|
|
240 |
GetBuildTypeString = "Production and Debug"
|
|
|
241 |
|
|
|
242 |
Case enumDB_BUILD_TYPE_JAVA_1_4
|
|
|
243 |
GetBuildTypeString = "Java 1.4"
|
|
|
244 |
|
|
|
245 |
Case enumDB_BUILD_TYPE_JAVA_1_5
|
|
|
246 |
GetBuildTypeString = "Java 1.5"
|
|
|
247 |
|
|
|
248 |
End Select
|
|
|
249 |
|
|
|
250 |
Else
|
|
|
251 |
GetBuildTypeString = "Build type not defined"
|
|
|
252 |
End If
|
|
|
253 |
|
|
|
254 |
|
|
|
255 |
End Function
|
|
|
256 |
'-----------------------------------------------------------------------------------------------------------------------------
|
|
|
257 |
%>
|