Subversion Repositories DevTools

Rev

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