Subversion Repositories DevTools

Rev

Rev 3865 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<%
'=====================================================
' File description
'=====================================================
'                  _drawExtensionSelectBox.asp
'
' Last edited by Haydon Knight June 2008
'
' This file contains a utility subroutine 'drawExtensionSelectBox()' that is
' called by _form_new_version_page.asp and _wform_rename_version.asp
' to help draw a select box of possible extensions.
'
'=====================================================
' Subroutines and functions
'=====================================================
'
'-----------------------------------------------------------------------------------------------------------------------------
' Subroutine: drawExtensionSelectBox()
'
' Purpose: Writes out html options for a select box of possible package extensioms
'
' Arguments: defaultExtension - default extension to have selected (usually objPkgInfo.Item("v_ext"))
'            isNewVersion     - true if a new version is being created, else false
'
' Returns: none
'
' Notes: This only writes out the <option> bits of the select box - the rest of the html has to be done elsewhere
Sub drawExtensionSelectBox (defaultExtension, isNewVersion)
        Dim optionText
        optionText = getExtensionSelectText( defaultExtension, isNewVersion )
        Response.write( optionText )
End Sub
'-----------------------------------------------------------------------------------------------------------------------------
' Function: getExtensionSelectText()
'
' Purpose: Returns <option> text for a select box of possible package extensioms
'
' Arguments: defaultExtension - default extension to have selected (usually objPkgInfo.Item("v_ext"))
'            isNewVersion     - true if a new version is being created, else false
' Returns: text
'
' Notes: This only returns as a string the <option> bits of the select box - the rest of the html has to be done elsewhere
Function getExtensionSelectText (defaultExtension, isNewVersion)
        Dim selectedString
        Dim selectedFound
        Dim cmt
        Dim dot_ext
    Dim rsQry
    Dim attrCots
    Dim isCots

        getExtensionSelectText = ""
        selectedFound = false
    If defaultExtension = "" Then
        defaultExtension = ".cr"
    End If


        Set rsQry = OraDatabase.DbCreateDynaset( "SELECT EXT_NAME,UCOMMENT,IS_COTS FROM PROJECT_EXTENTIONS pe WHERE pe.IS_VISIBLE='Y' ORDER BY pe.EXT_NAME", ORADYN_DEFAULT )
        While (NOT rsQry.BOF) AND (NOT rsQry.EOF)

        ' Form the <option> bits of the select box, drawing upon the PROJECT_EXTENTIONS contents one element at a time
        dot_ext =  rsQry("EXT_NAME")

        ' Append comment with a nice separator
        cmt =  rsQry("UCOMMENT")
        if cmt <> "" Then
            cmt = " - " & cmt
        end if
        
                selectedString = ""
                If dot_ext = defaultExtension Then
                        selectedString = "selected"
                        selectedFound = true
                End If

        ' Store IsCots information in a custom attribute
        attrCots = ""
        isCots =  rsQry("IS_COTS")
        if isCots = "Y" Then
            attrCots = " isCOTS=""Y"""
        end if

                getExtensionSelectText = getExtensionSelectText & "<option value=""" & dot_ext & """ " & selectedString & attrCots & ">" & dot_ext & cmt & "</option>"
            rsQry.MoveNext()
        Wend
        rsQry.Close()
        Set rsQry = nothing

        ' If we are reversioning a package version (isNewVersion = false), and we did not find an extension in the standard list
        ' that matched the existing version's extension, add the existing package version extension to the list (if it is not
        ' null or empty) and select it.
        If isNewVersion = false AND selectedFound = false AND NOT IsNull(defaultExtension) AND defaultExtension <> "" Then
                getExtensionSelectText = getExtensionSelectText & "<option value=""" & defaultExtension & """ " & "selected"  & ">" & defaultExtension & "</option>"
        End If

End Function
%>