Subversion Repositories DevTools

Rev

Rev 2735 | Blame | 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 extArray
        Dim ext
        Dim dot_ext

        ' Define the standard set of extensions that we wish everyone to use. This is the one and only place where these should be
        ' defined. Try to keep this in alphabetical order.
  extArray = array("bei", "bes" , "bkk" , "coct", "cots", "cr"  , "dev" , "ebr", "eng", "isr", "lvs", "mas", "mbu", "mlc",_
                   "ncc", "ndl" , "nzs" , "osl" , "oslo", "oso" , "pmb", "rm" , "rom", "sea", "sf" , "sfo",_
                   "sg" , "sls" , "ssts", "ssw" , "syd" , "tool", "uk" , "uta", "vps", "vss", "vtk", "wdc")

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

        ' Form the <option> bits of the select box, drawing upon the extArray() content one element at a time
        For each ext in extArray

                dot_ext = "." & ext

                selectedString = ""
                If dot_ext = defaultExtension Then
                        selectedString = "selected"
                        selectedFound = true
                End If

                getExtensionSelectText = getExtensionSelectText & "<option value=""" & dot_ext & """ " & selectedString & ">" & dot_ext & "</option>"
        Next

        ' 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
%>