Rev 5670 | Rev 6683 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<%'=====================================================' FORMATING'=====================================================%><%'-----------------------------------------------------------------------------------------------------------------------------' Don't use - retained for legacy bitsFunction EuroDate ( dDate )' Ensures Euro Date format DD/MM/YYYYIf IsNull(dDate) Then Exit FunctionEuroDate = Day(dDate) &"/"& Month(dDate) &"/"& Year(dDate)End Function'-----------------------------------------------------------------------------------------------------------------------------Function DayName (intDay)'------------------------------------------' Returns Abbreviated Day of Week'------------------------------------------select case intDaycase 1DayName = "Sun"case 2DayName = "Mon"case 3DayName = "Tue"case 4DayName = "Wed"case 5DayName = "Thu"case 6DayName = "Fri"case 7DayName = "Sat"end selectend functionfunction MonthToName(intMonth)'-----------------------------------------' Returns Abbreviated Month Name'-----------------------------------------select case intMonthcase 1MonthToName = "Jan"case 2MonthToName = "Feb"case 3MonthToName = "Mar"case 4MonthToName = "Apr"case 5MonthToName = "May"case 6MonthToName = "Jun"case 7MonthToName = "Jul"case 8MonthToName = "Aug"case 9MonthToName = "Sep"case 10MonthToName = "Oct"case 11MonthToName = "Nov"case 12MonthToName = "Dec"end selectend functionFunction DisplayShortDate ( dDate )' Ensures Nice Date format DD-Mon-YYYYIf IsNull(dDate) Then Exit FunctionDisplayShortDate = Day(dDate) & "-" & MonthToName( Month(dDate)) & "-" & Year(dDate)End FunctionFunction DisplayDate ( dDate )' Ensures Nice Date format Day DD-Mon-YYYYIf IsNull(dDate) Then Exit FunctionDisplayDate = DayName (WeekDay(dDate)) & " " & Day(dDate) & "-" & MonthToName( Month(dDate)) & "-" & Year(dDate)End FunctionFunction DisplayShortDateTime ( dDate )' Ensures Nice Date format DD-Mon-YYYY HH:MMIf IsNull(dDate) Then Exit FunctionDisplayShortDateTime = DisplayShortDate ( dDate ) &" "& FormatDateTime( dDate, 4 )End FunctionFunction DisplayDateTime ( dDate )' Ensures Nice Date format Day DD-Mon-YYYY HH:MMIf IsNull(dDate) Then Exit FunctionDisplayDateTime = DisplayDate ( dDate ) &" "& FormatDateTime( dDate, 4 )End FunctionFunction DisplayDateTimeSecs ( dDate )' Ensures Nice Date format Day DD-Mon-YYYY HH:MM:SSIf IsNull(dDate) Then Exit FunctionDisplayDateTimeSecs = DisplayDate ( dDate ) &" "& Right("0" & Hour(dDate), 2) & ":" & Right("0" & Minute(dDate), 2) & ":" & Right("0" & Second(dDate), 2)End FunctionFunction DisplayShortDateTimeSecs ( dDate )' Ensures Nice Date format DD-Mon-YYYY HH:MM:SSIf IsNull(dDate) Then Exit FunctionDisplayShortDateTimeSecs = 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, 1943If IsNull(dDate) Then Exit FunctionToLongDate = FormatDateTime(dDate, 1)End Function'-----------------------------------------------------------------------------------------------------------------------------Function TO_ORADATE ( SSdate )'DD/MM/YYYY -> ORADATETO_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 variableQuotes = """"& SSstr & """"Else' Not PERL variableQuotes = "'"& SSstr & "'"End IfEnd Function'-----------------------------------------------------------------------------------------------------------------------------Function DoubleQuotes( SSstr )DoubleQuotes = """"& SSstr & """"End Function'-----------------------------------------------------------------------------------------------------------------------------Function To_JATS ( SSbt, SSpkg, SSver )If SSbt = "B" ThenSSbt = "BuildPkgArchive"ElseIf SSbt = "L" ThenSSbt = "LinkPkgArchive"End IfTo_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 * "& SSpkgLabelEnd 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 FunctionSQLstring = Replace( Trim(SSstr), "'", "''")End Function'-----------------------------------------------------------------------------------------------------------------------------Function Format4Java ( SSstr )Dim tempSTRtempSTR = SSstrtempSTR = Replace( tempSTR, "'", "\'" )tempSTR = Replace( tempSTR, "<", "\<" )tempSTR = Replace( tempSTR, ">", "\>" )tempSTR = Replace( tempSTR, ";", "\;" )tempSTR = Replace( tempSTR, VBNEWLine, "\n" )Format4Java = tempSTREnd Function'-----------------------------------------------------------------------------------------------------------------------------Function Format4HTML ( SSstr )If IsNull(SSstr) Then Exit FunctionDim tempSTRtempSTR = SSstrtempSTR = Replace( tempSTR, "&", "&" )Format4HTML = tempSTREnd Function'-----------------------------------------------------------------------------------------------------------------------------Function Pipes2Commas ( SSstr )' replaces |1||2||3| to 1,2,3Pipes2Commas = Replace( SSstr, "||", "," )Pipes2Commas = Replace( Pipes2Commas, "|", "" )End Function'-----------------------------------------------------------------------------------------------------------------------------Function QuoteCSV ( SSstr )Dim tempStrtempStr = SSstrIf tempStr = "" ThenQuoteCSV = ""Exit FunctionEnd IftempStr = Replace(tempStr, " ", "") ' remove any spacesQuoteCSV = "'"& Replace( UCase(tempStr), ",", "','") &"'"End Function'-----------------------------------------------------------------------------------------------------------------------------Function QuoteCSVwithLIKE ( SSstr )Dim tempStrtempStr = SSstrIf tempStr = "" ThenQuoteCSVwithLIKE = ""Exit FunctionEnd IftempStr = Replace(tempStr, " ", "") ' remove any spacesQuoteCSVwithLIKE = "'%"& Replace( UCase(tempStr), ",", "','") &"'"End Function'-----------------------------------------------------------------------------------------------------------------------------Function SplitPipes ( SSstr )' split |val1||val2||val3| to arraySplitPipes = Split( Replace( Replace(SSstr,"||","%"), "|","") , "%" )End Function'-----------------------------------------------------------------------------------------------------------------------------Function SplitAmpasans ( SSstr )' split &val1&&val2&&val3& to arraySSstr = Left (SSstr, Len(SSstr)-1) 'remove last &SSstr = Right (SSstr, Len(SSstr)-1) 'remove first &SplitAmpasans = Split( SSstr , "&&" )End Function'-----------------------------------------------------------------------------------------------------------------------------Function URLEncode ( SSstr )Dim tmpStrtmpStr = SSstrtmpStr = 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 lineURLEncode = tmpStrEnd Function'-----------------------------------------------------------------------------------------------------------------------------Function URLDecode ( SSstr )Dim tmpStrtmpStr = SSstrtmpStr = 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 lineURLDecode = tmpStrEnd Function'-----------------------------------------------------------------------------------------------------------------------------Function WURLEncode ( sText )If (NOT IsNull(sText)) AND ( sText <> "" ) ThenWURLEncode = Server.URLEncode( sText )ElseWURLEncode = sTextEnd IfEnd Function'-----------------------------------------------------------------------------------------------------------------------------Function HTMLEncode ( sText )If (NOT IsNull(sText)) AND ( sText <> "" ) ThenHTMLEncode = Server.HTMLEncode( sText)ElseHTMLEncode = sTextEnd IfEnd Function'-----------------------------------------------------------------------------------------------------------------------------Function Highlight_Substring ( SSstr, SSsubstr )Dim leftSTR, startPosstartPos = InStr( 1, SSstr, SSsubstr, 1 )If startPos > 0 ThenleftSTR = Left ( SSstr, startPos - 1 )Highlight_Substring = leftSTR &"<SPAN style='background:#ffff99;'>"& Mid( SSstr, startPos, Len(SSsubstr) ) &"</SPAN>"& Right ( SSstr, Len(SSstr) - Len(leftSTR) - Len(SSsubstr) )Else' Subtring not foundHighlight_Substring = SSstrEnd IfEnd Function'-----------------------------------------------------------------------------------------------------------------------------Function NewLine_To_BR (SSstr)If SSstr = "" OR IsNull(SSstr) ThenExit FunctionElseNewLine_To_BR = Replace ( SSstr, VBNewLine, "<br>")End IfEnd Function'-----------------------------------------------------------------------------------------------------------------------------Function IsTicked ( ByVal nParId, ByVal sParList )' Used only with check boxes as they send comma-separated listnParId = ","& Replace(nParId, " ", "") &","sParList = ","& Replace(sParList, " ", "") &","If InStr( sParList, nParId ) > 0 ThenIsTicked = TRUEElseIsTicked = FALSEEnd IfEnd Function'------------------------------------------------------------------------------------------------------------------Function FormatVersion ( ByVal nVersion )Dim arrVersion, MajorVersion, MinorVersionIf IsNull( nVersion ) Then Exit FunctionIf NOT IsNumeric(nVersion) ThenFormatVersion = nVersionExit FunctionEnd IfnVersion = FormatNumber( nVersion, 3 )arrVersion = Split( CStr( nVersion ), ".")MajorVersion = arrVersion(0)MinorVersion = CInt(arrVersion(1))FormatVersion = MajorVersion &"."& MinorVersionEnd Function'-----------------------------------------------------------------------------------------------------------------------------%>