Subversion Repositories DevTools

Rev

Details | 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
4230 dpurdie 10
' called by _form_new_version_page.asp to help draw a select box of possible extensions.
177 brianf 11
'
12
'=====================================================
13
' Subroutines and functions
14
'=====================================================
15
'
16
'-----------------------------------------------------------------------------------------------------------------------------
17
' Subroutine: drawExtensionSelectBox()
18
'
19
' Purpose: Writes out html options for a select box of possible package extensioms
20
'
21
' Arguments: defaultExtension - default extension to have selected (usually objPkgInfo.Item("v_ext"))
22
'            isNewVersion     - true if a new version is being created, else false
23
'
24
' Returns: none
25
'
26
' Notes: This only writes out the <option> bits of the select box - the rest of the html has to be done elsewhere
27
Sub drawExtensionSelectBox (defaultExtension, isNewVersion)
28
	Dim optionText
29
	optionText = getExtensionSelectText( defaultExtension, isNewVersion )
30
	Response.write( optionText )
31
End Sub
32
'-----------------------------------------------------------------------------------------------------------------------------
33
' Function: getExtensionSelectText()
34
'
35
' Purpose: Returns <option> text for a select box of possible package extensioms
36
'
37
' Arguments: defaultExtension - default extension to have selected (usually objPkgInfo.Item("v_ext"))
38
'            isNewVersion     - true if a new version is being created, else false
39
' Returns: text
40
'
41
' Notes: This only returns as a string the <option> bits of the select box - the rest of the html has to be done elsewhere
42
Function getExtensionSelectText (defaultExtension, isNewVersion)
43
	Dim selectedString
44
	Dim selectedFound
3959 dpurdie 45
	Dim cmt
177 brianf 46
	Dim dot_ext
3959 dpurdie 47
    Dim rsQry
48
    Dim attrCots
49
    Dim isCots
177 brianf 50
 
51
	getExtensionSelectText = ""
52
	selectedFound = false
2735 dpurdie 53
    If defaultExtension = "" Then
54
        defaultExtension = ".cr"
55
    End If
177 brianf 56
 
57
 
3959 dpurdie 58
	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 )
59
	While (NOT rsQry.BOF) AND (NOT rsQry.EOF)
177 brianf 60
 
3959 dpurdie 61
	' Form the <option> bits of the select box, drawing upon the PROJECT_EXTENTIONS contents one element at a time
62
        dot_ext =  rsQry("EXT_NAME")
63
 
64
        ' Append comment with a nice separator
65
        cmt =  rsQry("UCOMMENT")
66
        if cmt <> "" Then
67
            cmt = " - " & cmt
68
        end if
69
 
177 brianf 70
		selectedString = ""
71
		If dot_ext = defaultExtension Then
72
			selectedString = "selected"
73
			selectedFound = true
74
		End If
75
 
3959 dpurdie 76
        ' Store IsCots information in a custom attribute
77
        attrCots = ""
78
        isCots =  rsQry("IS_COTS")
79
        if isCots = "Y" Then
80
            attrCots = " isCOTS=""Y"""
81
        end if
177 brianf 82
 
3959 dpurdie 83
		getExtensionSelectText = getExtensionSelectText & "<option value=""" & dot_ext & """ " & selectedString & attrCots & ">" & dot_ext & cmt & "</option>"
84
	    rsQry.MoveNext()
85
	Wend
86
	rsQry.Close()
87
	Set rsQry = nothing
88
 
177 brianf 89
	' If we are reversioning a package version (isNewVersion = false), and we did not find an extension in the standard list
90
	' that matched the existing version's extension, add the existing package version extension to the list (if it is not
91
	' null or empty) and select it.
92
	If isNewVersion = false AND selectedFound = false AND NOT IsNull(defaultExtension) AND defaultExtension <> "" Then
93
		getExtensionSelectText = getExtensionSelectText & "<option value=""" & defaultExtension & """ " & "selected"  & ">" & defaultExtension & "</option>"
94
	End If
95
 
96
End Function
97
%>
98