Subversion Repositories DevTools

Rev

Rev 5474 | Rev 5632 | Go to most recent revision | Details | Compare with Previous | 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_ClearCase ( SSpkgLabel )
73
	To_ClearCase = "element * "& SSpkgLabel
74
End Function
75
'-----------------------------------------------------------------------------------------------------------------------------
76
Function To_HTML ( sStr )
147 ghuddy 77
	If NOT IsNull(sStr) Then To_HTML = Server.HTMLEncode( sStr )
119 ghuddy 78
End Function
79
'-----------------------------------------------------------------------------------------------------------------------------
80
Function SQLstring ( SSstr )
81
	If IsNull(SSstr) OR (SSstr = "") Then Exit Function
82
	SQLstring = Replace( Trim(SSstr), "'", "''")
83
End Function
84
'-----------------------------------------------------------------------------------------------------------------------------
85
Function Format4Java ( SSstr )
86
	Dim tempSTR
87
	tempSTR = SSstr
88
	tempSTR = Replace( tempSTR, "'", "\'" )
89
	tempSTR = Replace( tempSTR, "&lt;", "\<" )
90
	tempSTR = Replace( tempSTR, "&gt;", "\>" )
91
	tempSTR = Replace( tempSTR, ";", "\;" )
92
	tempSTR = Replace( tempSTR, VBNEWLine, "\n" )
93
	Format4Java = tempSTR
94
End Function
95
'-----------------------------------------------------------------------------------------------------------------------------
96
Function Format4HTML ( SSstr )
97
	If IsNull(SSstr) Then Exit Function
98
	Dim tempSTR
99
	tempSTR = SSstr
100
	tempSTR = Replace( tempSTR, "&", "&amp;" )
101
	Format4HTML = tempSTR
102
End Function
103
'-----------------------------------------------------------------------------------------------------------------------------
104
Function Pipes2Commas ( SSstr )
105
	' replaces |1||2||3| to 1,2,3
106
	Pipes2Commas = Replace( SSstr, "||", "," )
107
	Pipes2Commas = Replace( Pipes2Commas, "|", "" )
108
End Function
109
'-----------------------------------------------------------------------------------------------------------------------------
110
Function QuoteCSV ( SSstr )
111
	Dim tempStr
112
	tempStr = SSstr
147 ghuddy 113
	If tempStr = "" Then
119 ghuddy 114
		QuoteCSV = ""
115
		Exit Function
116
	End If
147 ghuddy 117
 
119 ghuddy 118
	tempStr = Replace(tempStr, " ", "")		' remove any spaces
119
	QuoteCSV = "'"& Replace( UCase(tempStr), ",", "','") &"'"
120
End Function
121
'-----------------------------------------------------------------------------------------------------------------------------
122
Function QuoteCSVwithLIKE ( SSstr )
123
	Dim tempStr
124
	tempStr = SSstr
147 ghuddy 125
	If tempStr = "" Then
119 ghuddy 126
		QuoteCSVwithLIKE = ""
127
		Exit Function
128
	End If
147 ghuddy 129
 
119 ghuddy 130
	tempStr = Replace(tempStr, " ", "")		' remove any spaces
131
	QuoteCSVwithLIKE = "'%"& Replace( UCase(tempStr), ",", "','") &"'"
132
End Function
133
'-----------------------------------------------------------------------------------------------------------------------------
134
Function SplitPipes ( SSstr )
147 ghuddy 135
	' split |val1||val2||val3| to array
119 ghuddy 136
	SplitPipes = Split( Replace( Replace(SSstr,"||","%"), "|","") , "%" )
137
End Function
138
'-----------------------------------------------------------------------------------------------------------------------------
139
Function SplitAmpasans ( SSstr )
147 ghuddy 140
	' split &val1&&val2&&val3& to array
119 ghuddy 141
	SSstr = Left (SSstr, Len(SSstr)-1)	'remove last &
142
	SSstr = Right (SSstr, Len(SSstr)-1)	'remove first &
143
	SplitAmpasans = Split( SSstr , "&&" )
144
End Function
145
'-----------------------------------------------------------------------------------------------------------------------------
146
Function URLEncode ( SSstr )
147
	Dim tmpStr
148
	tmpStr = SSstr
149
	tmpStr = Replace(tmpStr, "'", "%27")	' Encode '
150
	tmpStr = Replace(tmpStr, """", "%22")	' Encode "
151
	tmpStr = Replace(tmpStr, ",", "%2C")	' Encode ,
152
	tmpStr = Replace(tmpStr, ";", "%3B")	' Encode ;
153
	tmpStr = Replace(tmpStr, VBNewLine, "%0D%0A")	' Encode new line
154
	URLEncode = tmpStr
155
End Function
156
'-----------------------------------------------------------------------------------------------------------------------------
157
Function URLDecode ( SSstr )
158
	Dim tmpStr
159
	tmpStr = SSstr
160
	tmpStr = Replace(tmpStr, "%27", "'")	' Decode '
161
	tmpStr = Replace(tmpStr, "%22", """")	' Decode "
162
	tmpStr = Replace(tmpStr, "%2C", ",")	' Decode ,
163
	tmpStr = Replace(tmpStr, "%3B", ";")	' Decode ;
164
	tmpStr = Replace(tmpStr, "%0D%0A", VBNewLine)	' Decode new line
165
	URLDecode = tmpStr
166
End Function
167
'-----------------------------------------------------------------------------------------------------------------------------
168
Function WURLEncode ( sText )
169
	If (NOT IsNull(sText)) AND ( sText <> "" ) Then
170
		WURLEncode = Server.URLEncode( sText )
171
	Else
172
		WURLEncode = sText
173
	End If
174
End Function
175
'-----------------------------------------------------------------------------------------------------------------------------
176
Function HTMLEncode ( sText )
177
	If (NOT IsNull(sText)) AND ( sText <> "" ) Then
178
		HTMLEncode = Server.HTMLEncode( sText)
179
	Else
180
		HTMLEncode = sText
181
	End If
182
End Function
183
'-----------------------------------------------------------------------------------------------------------------------------
184
Function Highlight_Substring ( SSstr, SSsubstr )
185
	Dim leftSTR, startPos
186
	startPos = InStr( 1, SSstr, SSsubstr, 1 )
147 ghuddy 187
 
119 ghuddy 188
	If startPos > 0 Then
189
		leftSTR = Left ( SSstr, startPos - 1 )
190
		Highlight_Substring = leftSTR &"<SPAN style='background:#ffff99;'>"& Mid( SSstr, startPos, Len(SSsubstr) ) &"</SPAN>"&  Right ( SSstr, Len(SSstr) - Len(leftSTR) - Len(SSsubstr)  )
191
	Else
192
		' Subtring not found
193
		Highlight_Substring = SSstr
194
	End If
147 ghuddy 195
 
119 ghuddy 196
End Function
197
'-----------------------------------------------------------------------------------------------------------------------------
198
Function NewLine_To_BR (SSstr)
147 ghuddy 199
	If SSstr = "" OR IsNull(SSstr) Then
119 ghuddy 200
		Exit Function
201
	Else
202
		NewLine_To_BR = Replace ( SSstr, VBNewLine, "<br>")
203
	End If
204
End Function
205
'-----------------------------------------------------------------------------------------------------------------------------
206
Function IsTicked ( ByVal nParId, ByVal sParList )
207
	' Used only with check boxes as they send comma-separated list
208
	nParId 	 = ","&  Replace(nParId, " ", "") &","
209
	sParList = ","&  Replace(sParList, " ", "") &","
147 ghuddy 210
 
119 ghuddy 211
	If InStr( sParList, nParId ) > 0 Then
212
		IsTicked = TRUE
213
	Else
214
		IsTicked = FALSE
215
	End If
216
End Function
217
'------------------------------------------------------------------------------------------------------------------
218
Function FormatVersion ( ByVal nVersion )
219
	Dim arrVersion, MajorVersion, MinorVersion
220
	If IsNull( nVersion ) Then Exit Function
147 ghuddy 221
	If NOT IsNumeric(nVersion) Then
119 ghuddy 222
		FormatVersion = nVersion
223
		Exit Function
224
	End If
147 ghuddy 225
 
119 ghuddy 226
	nVersion = FormatNumber( nVersion, 3 )
147 ghuddy 227
 
119 ghuddy 228
	arrVersion = Split( CStr( nVersion ), ".")
229
	MajorVersion = arrVersion(0)
230
	MinorVersion = CInt(arrVersion(1))
231
	FormatVersion = MajorVersion &"."& MinorVersion
147 ghuddy 232
 
119 ghuddy 233
End Function
234
'-----------------------------------------------------------------------------------------------------------------------------
147 ghuddy 235
%>