<% '===================================================== ' FORMATING '===================================================== %> <% '----------------------------------------------------------------------------------------------------------------------------- ' Don't use - retained for legacy bits Function EuroDate ( dDate ) ' Ensures Euro Date format DD/MM/YYYY If IsNull(dDate) Then Exit Function EuroDate = Day(dDate) &"/"& Month(dDate) &"/"& Year(dDate) End Function '----------------------------------------------------------------------------------------------------------------------------- Function DayName (intDay) '------------------------------------------ ' Returns Abbreviated Day of Week '------------------------------------------ select case intDay case 1 DayName = "Sun" case 2 DayName = "Mon" case 3 DayName = "Tue" case 4 DayName = "Wed" case 5 DayName = "Thu" case 6 DayName = "Fri" case 7 DayName = "Sat" end select end function function MonthToName(intMonth) '----------------------------------------- ' Returns Abbreviated Month Name '----------------------------------------- select case intMonth case 1 MonthToName = "Jan" case 2 MonthToName = "Feb" case 3 MonthToName = "Mar" case 4 MonthToName = "Apr" case 5 MonthToName = "May" case 6 MonthToName = "Jun" case 7 MonthToName = "Jul" case 8 MonthToName = "Aug" case 9 MonthToName = "Sep" case 10 MonthToName = "Oct" case 11 MonthToName = "Nov" case 12 MonthToName = "Dec" end select end function Function DisplayShortDate ( dDate ) ' Ensures Nice Date format DD-Mon-YYYY If IsNull(dDate) Then Exit Function DisplayShortDate = Day(dDate) & "-" & MonthToName( Month(dDate)) & "-" & Year(dDate) End Function Function DisplayDate ( dDate ) ' Ensures Nice Date format Day DD-Mon-YYYY If IsNull(dDate) Then Exit Function DisplayDate = DayName (WeekDay(dDate)) & " " & Day(dDate) & "-" & MonthToName( Month(dDate)) & "-" & Year(dDate) End Function Function DisplayShortDateTime ( dDate ) ' Ensures Nice Date format DD-Mon-YYYY HH:MM If IsNull(dDate) Then Exit Function DisplayShortDateTime = DisplayShortDate ( dDate ) &" "& FormatDateTime( dDate, 4 ) End Function Function DisplayDateTime ( dDate ) ' Ensures Nice Date format Day DD-Mon-YYYY HH:MM If IsNull(dDate) Then Exit Function DisplayDateTime = DisplayDate ( dDate ) &" "& FormatDateTime( dDate, 4 ) End Function Function DisplayDateTimeSecs ( dDate ) ' Ensures Nice Date format Day DD-Mon-YYYY HH:MM:SS If IsNull(dDate) Then Exit Function DisplayDateTimeSecs = DisplayDate ( dDate ) &" "& Right("0" & Hour(dDate), 2) & ":" & Right("0" & Minute(dDate), 2) & ":" & Right("0" & Second(dDate), 2) End Function Function DisplayShortDateTimeSecs ( dDate ) ' Ensures Nice Date format DD-Mon-YYYY HH:MM:SS If IsNull(dDate) Then Exit Function DisplayShortDateTimeSecs = DisplayShortDate ( dDate ) &" "& Right("0" & Hour(dDate), 2) & ":" & Right("0" & Minute(dDate), 2) & ":" & Right("0" & Second(dDate), 2) End Function '----------------------------------------------------------------------------------------------------------------------------- Function ToLongDate ( dDate ) ' DD/MM/YYYY -> Saturday, June 26, 1943 If IsNull(dDate) Then Exit Function ToLongDate = FormatDateTime(dDate, 1) End Function '----------------------------------------------------------------------------------------------------------------------------- Function TO_ORADATE ( SSdate ) 'DD/MM/YYYY -> ORADATE TO_ORADATE = "TO_DATE( '"& SSdate &"','DD/MM/YYYY' )" End Function '----------------------------------------------------------------------------------------------------------------------------- Function ORA_SYSDATE () ORA_SYSDATE = "TO_DATE( TO_CHAR( SYSDATE,'DD-MON-YYYY' ),'DD-MON-YYYY' )" End Function '----------------------------------------------------------------------------------------------------------------------------- Function ORA_SYSDATETIME () ORA_SYSDATETIME = "TO_DATE( TO_CHAR( SYSDATE,'DD-MON-YYYY HH24:MI:SS' ),'DD-MON-YYYY HH24:MI:SS' )" End Function '----------------------------------------------------------------------------------------------------------------------------- Function Quotes( SSstr ) If InStr(SSstr, "$") > 0 Then ' PERL variable Quotes = """"& SSstr & """" Else ' Not PERL variable Quotes = "'"& SSstr & "'" End If End Function '----------------------------------------------------------------------------------------------------------------------------- Function DoubleQuotes( SSstr ) DoubleQuotes = """"& SSstr & """" End Function '----------------------------------------------------------------------------------------------------------------------------- Function To_JATS ( SSbt, SSpkg, SSver ) If SSbt = "B" Then SSbt = "BuildPkgArchive" ElseIf SSbt = "L" Then SSbt = "LinkPkgArchive" End If To_JATS = SSbt &" ( "& Quotes( SSpkg ) &", "& Quotes( SSver ) &" );" End Function '----------------------------------------------------------------------------------------------------------------------------- Function To_ANT ( SSpkg, SSver ) To_ANT = "<property name="""& SSpkg &""" value="""& SSver &"""/>" End Function '----------------------------------------------------------------------------------------------------------------------------- Function To_ClearCase ( SSpkgLabel ) To_ClearCase = "element * "& SSpkgLabel End Function '----------------------------------------------------------------------------------------------------------------------------- Function To_Simple ( SSpkg, SSver ) To_Simple = SSpkg & ", "& SSver End Function '----------------------------------------------------------------------------------------------------------------------------- Function To_HTML ( sStr ) If NOT IsNull(sStr) Then To_HTML = Server.HTMLEncode( sStr ) End Function '----------------------------------------------------------------------------------------------------------------------------- Function SQLstring ( SSstr ) If IsNull(SSstr) OR (SSstr = "") Then Exit Function SQLstring = Replace( Trim(SSstr), "'", "''") End Function '----------------------------------------------------------------------------------------------------------------------------- Function Format4Java ( SSstr ) Dim tempSTR tempSTR = SSstr tempSTR = Replace( tempSTR, "'", "\'" ) tempSTR = Replace( tempSTR, "<", "\<" ) tempSTR = Replace( tempSTR, ">", "\>" ) tempSTR = Replace( tempSTR, ";", "\;" ) tempSTR = Replace( tempSTR, VBNEWLine, "\n" ) Format4Java = tempSTR End Function '----------------------------------------------------------------------------------------------------------------------------- Function JSEncode ( SSstr ) Dim tempSTR tempSTR = SSstr If SSstr <> "" Then tempSTR = Replace( tempSTR, "'", "'" ) tempSTR = Replace( tempSTR, """", """ ) End If JSEncode = tempSTR End Function '----------------------------------------------------------------------------------------------------------------------------- Function Format4HTML ( SSstr ) If IsNull(SSstr) Then Exit Function Dim tempSTR tempSTR = SSstr tempSTR = Replace( tempSTR, "&", "&" ) Format4HTML = tempSTR End Function '----------------------------------------------------------------------------------------------------------------------------- Function Pipes2Commas ( SSstr ) ' replaces |1||2||3| to 1,2,3 Pipes2Commas = Replace( SSstr, "||", "," ) Pipes2Commas = Replace( Pipes2Commas, "|", "" ) End Function '----------------------------------------------------------------------------------------------------------------------------- Function QuoteCSV ( SSstr ) Dim tempStr tempStr = SSstr If tempStr = "" Then QuoteCSV = "" Exit Function End If tempStr = Replace(tempStr, " ", "") ' remove any spaces QuoteCSV = "'"& Replace( UCase(tempStr), ",", "','") &"'" End Function '----------------------------------------------------------------------------------------------------------------------------- Function QuoteCSVwithLIKE ( SSstr ) Dim tempStr tempStr = SSstr If tempStr = "" Then QuoteCSVwithLIKE = "" Exit Function End If tempStr = Replace(tempStr, " ", "") ' remove any spaces QuoteCSVwithLIKE = "'%"& Replace( UCase(tempStr), ",", "','") &"'" End Function '----------------------------------------------------------------------------------------------------------------------------- Function SplitPipes ( SSstr ) ' split |val1||val2||val3| to array SplitPipes = Split( Replace( Replace(SSstr,"||","%"), "|","") , "%" ) End Function '----------------------------------------------------------------------------------------------------------------------------- Function SplitAmpasans ( SSstr ) ' split &val1&&val2&&val3& to array SSstr = Left (SSstr, Len(SSstr)-1) 'remove last & SSstr = Right (SSstr, Len(SSstr)-1) 'remove first & SplitAmpasans = Split( SSstr , "&&" ) End Function '----------------------------------------------------------------------------------------------------------------------------- Function URLEncode ( SSstr ) Dim tmpStr tmpStr = SSstr tmpStr = Replace(tmpStr, "'", "%27") ' Encode ' tmpStr = Replace(tmpStr, """", "%22") ' Encode " tmpStr = Replace(tmpStr, ",", "%2C") ' Encode , tmpStr = Replace(tmpStr, ";", "%3B") ' Encode ; tmpStr = Replace(tmpStr, VBNewLine, "%0D%0A") ' Encode new line URLEncode = tmpStr End Function '----------------------------------------------------------------------------------------------------------------------------- Function URLDecode ( SSstr ) Dim tmpStr tmpStr = SSstr tmpStr = Replace(tmpStr, "%27", "'") ' Decode ' tmpStr = Replace(tmpStr, "%22", """") ' Decode " tmpStr = Replace(tmpStr, "%2C", ",") ' Decode , tmpStr = Replace(tmpStr, "%3B", ";") ' Decode ; tmpStr = Replace(tmpStr, "%0D%0A", VBNewLine) ' Decode new line URLDecode = tmpStr End Function '----------------------------------------------------------------------------------------------------------------------------- Function WURLEncode ( sText ) If (NOT IsNull(sText)) AND ( sText <> "" ) Then WURLEncode = Server.URLEncode( sText ) Else WURLEncode = sText End If End Function '----------------------------------------------------------------------------------------------------------------------------- Function HTMLEncode ( sText ) If (NOT IsNull(sText)) AND ( sText <> "" ) Then HTMLEncode = Server.HTMLEncode( sText) Else HTMLEncode = sText End If End Function '----------------------------------------------------------------------------------------------------------------------------- Function Highlight_Substring ( SSstr, SSsubstr ) Dim leftSTR, startPos startPos = InStr( 1, SSstr, SSsubstr, 1 ) If startPos > 0 Then leftSTR = Left ( SSstr, startPos - 1 ) Highlight_Substring = leftSTR &""& Mid( SSstr, startPos, Len(SSsubstr) ) &""& Right ( SSstr, Len(SSstr) - Len(leftSTR) - Len(SSsubstr) ) Else ' Subtring not found Highlight_Substring = SSstr End If End Function '----------------------------------------------------------------------------------------------------------------------------- Function NewLine_To_BR (SSstr) If SSstr = "" OR IsNull(SSstr) Then Exit Function Else ' Remove trailing new lines and spaces While Asc(Right(SSstr, 1)) = 10 Or Asc(Right(SSstr, 1)) = 13 SSstr = Left(SSstr, Len(SSstr) - 1) If Len(SSstr) = 0 Then SSstr = " " End If Wend SSstr = Trim(SSstr) NewLine_To_BR = Replace ( SSstr, VBNewLine, "
") End If End Function '----------------------------------------------------------------------------------------------------------------------------- Function IsTicked ( ByVal nParId, ByVal sParList ) ' Used only with check boxes as they send comma-separated list nParId = ","& Replace(nParId, " ", "") &"," sParList = ","& Replace(sParList, " ", "") &"," If InStr( sParList, nParId ) > 0 Then IsTicked = TRUE Else IsTicked = FALSE End If End Function '------------------------------------------------------------------------------------------------------------------ Function FormatVersion ( ByVal nVersion ) Dim arrVersion, MajorVersion, MinorVersion If IsNull( nVersion ) Then Exit Function If NOT IsNumeric(nVersion) Then FormatVersion = nVersion Exit Function End If nVersion = FormatNumber( nVersion, 3 ) arrVersion = Split( CStr( nVersion ), ".") MajorVersion = arrVersion(0) MinorVersion = CInt(arrVersion(1)) FormatVersion = MajorVersion &"."& MinorVersion End Function '----------------------------------------------------------------------------------------------------------------------------- %>