Subversion Repositories DevTools

Rev

Rev 3610 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
177 brianf 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
3865 dpurdie 46
	Dim cmt
177 brianf 47
	Dim dot_ext
3865 dpurdie 48
    Dim rsQry
177 brianf 49
 
50
	getExtensionSelectText = ""
51
	selectedFound = false
2547 dpurdie 52
    If defaultExtension = "" Then
53
        defaultExtension = ".cr"
54
    End If
177 brianf 55
 
56
 
3865 dpurdie 57
	Set rsQry = OraDatabase.DbCreateDynaset( "SELECT EXT_NAME,UCOMMENT FROM PROJECT_EXTENTIONS pe WHERE pe.IS_VISIBLE='Y' ORDER BY pe.EXT_NAME", ORADYN_DEFAULT )
58
	While (NOT rsQry.BOF) AND (NOT rsQry.EOF)
177 brianf 59
 
3865 dpurdie 60
	' Form the <option> bits of the select box, drawing upon the PROJECT_EXTENTIONS contents one element at a time
61
        dot_ext =  rsQry("EXT_NAME")
62
 
63
        ' Append comment with a nice separator
64
        cmt =  rsQry("UCOMMENT")
65
        if cmt <> "" Then
66
            cmt = " - " & cmt
67
        end if
68
 
177 brianf 69
		selectedString = ""
70
		If dot_ext = defaultExtension Then
71
			selectedString = "selected"
72
			selectedFound = true
73
		End If
74
 
3865 dpurdie 75
		getExtensionSelectText = getExtensionSelectText & "<option value=""" & dot_ext & """ " & selectedString & ">" & dot_ext & cmt & "</option>"
76
	    rsQry.MoveNext()
77
	Wend
78
	rsQry.Close()
79
	Set rsQry = nothing
177 brianf 80
 
81
	' If we are reversioning a package version (isNewVersion = false), and we did not find an extension in the standard list
82
	' that matched the existing version's extension, add the existing package version extension to the list (if it is not
83
	' null or empty) and select it.
84
	If isNewVersion = false AND selectedFound = false AND NOT IsNull(defaultExtension) AND defaultExtension <> "" Then
85
		getExtensionSelectText = getExtensionSelectText & "<option value=""" & defaultExtension & """ " & "selected"  & ">" & defaultExtension & "</option>"
86
	End If
87
 
88
End Function
89
%>
90