Rev 143 | 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 elsewhereSub drawExtensionSelectBox (defaultExtension, isNewVersion)Dim optionTextoptionText = 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 elsewhereFunction getExtensionSelectText (defaultExtension, isNewVersion)Dim selectedStringDim selectedFoundDim extArrayDim extDim 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", "cots", "cr" , "eng", "isr", "lvs" , "mas", "ncc", "ndl", "nzs",_"osl", "oslo", "oso" , "rm" , "rom", "sea" , "sf" , "sfo",_"sg" , "sls" , "ssts", "ssw", "syd", "tool", "uk" , "vtk", "wdc")getExtensionSelectText = ""selectedFound = false' Form the <option> bits of the select box, drawing upon the extArray() content one element at a timeFor each ext in extArraydot_ext = "." & extselectedString = ""If dot_ext = defaultExtension ThenselectedString = "selected"selectedFound = trueEnd IfgetExtensionSelectText = 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 <> "" ThengetExtensionSelectText = getExtensionSelectText & "<option value=""" & defaultExtension & """ " & "selected" & ">" & defaultExtension & "</option>"End IfEnd Function%>