Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
121 hknight 1
<%
2
'=====================================================
3
' File description
4
'=====================================================
5
'                  _drawExtensionSelectBox.asp
6
'
7
' Last edited by Haydon Knight June 2008
8
'
9
' This file contains a utility subroutine 'drawExtensionSelectBox()' that is
10
' called by _form_new_version_page.asp and _wform_rename_version.asp
11
' to help draw a select box of possible extensions.
12
'
13
'=====================================================
14
' Subroutines and functions
15
'=====================================================
16
'
17
'-----------------------------------------------------------------------------------------------------------------------------
18
' Subroutine: drawExtensionSelectBox()
19
'
20
' Purpose: Writes out html options for a select box of possible package extensioms
21
'
22
' Arguments: defaultExtension - default extension to have selected (usually objPkgInfo.Item("v_ext"))
23
'            isNewVersion     - true if a new version is being created, else false
24
'
25
' Returns: none
26
'
27
' Notes: This only writes out the <option> bits of the select box - the rest of the html has to be done elsewhere
28
Sub drawExtensionSelectBox (defaultExtension, isNewVersion)
29
	Dim optionText
30
	optionText = getExtensionSelectText( defaultExtension, isNewVersion )
31
	Response.write( optionText )
32
End Sub
33
'-----------------------------------------------------------------------------------------------------------------------------
34
' Function: getExtensionSelectText()
35
'
36
' Purpose: Returns <option> text for a select box of possible package extensioms
37
'
38
' Arguments: defaultExtension - default extension to have selected (usually objPkgInfo.Item("v_ext"))
39
'            isNewVersion     - true if a new version is being created, else false
40
' Returns: text
41
'
42
' Notes: This only returns as a string the <option> bits of the select box - the rest of the html has to be done elsewhere
43
Function getExtensionSelectText (defaultExtension, isNewVersion)
44
	Dim selectedString
45
	Dim selectedFound
46
	Dim extArray
47
	Dim ext
48
	Dim dot_ext
49
 
50
	' Define the standard set of extensions that we wish everyone to use. This is the one and only place where these should be
51
	' defined. Try to keep this in alphabetical order.
153 ghuddy 52
   extArray = array("bei", "cots", "cr"  , "eng", "isr", "lvs" , "mas", "ncc", "ndl", "nzs",_
121 hknight 53
	                 "osl", "oslo", "oso" , "rm" , "rom", "sea" , "sf" , "sfo",_
54
	                 "sg" , "sls" , "ssts", "ssw", "syd", "tool", "uk" , "vtk", "wdc")
55
 
56
	getExtensionSelectText = ""
57
 
58
	selectedFound = false
59
 
60
	' Form the <option> bits of the select box, drawing upon the extArray() content one element at a time
61
	For each ext in extArray
62
 
63
		dot_ext = "." & ext
64
 
65
		selectedString = ""
66
		If dot_ext = defaultExtension Then
67
			selectedString = "selected"
68
			selectedFound = true
69
		End If
70
 
71
		getExtensionSelectText = getExtensionSelectText & "<option value=""" & dot_ext & """ " & selectedString & ">" & dot_ext & "</option>"
72
	Next
73
 
74
	' If we are reversioning a package version (isNewVersion = false), and we did not find an extension in the standard list
75
	' that matched the existing version's extension, add the existing package version extension to the list (if it is not
76
	' null or empty) and select it.
77
	If isNewVersion = false AND selectedFound = false AND NOT IsNull(defaultExtension) AND defaultExtension <> "" Then
78
		getExtensionSelectText = getExtensionSelectText & "<option value=""" & defaultExtension & """ " & "selected"  & ">" & defaultExtension & "</option>"
79
	End If
80
 
81
End Function
82
%>
83