Subversion Repositories DevTools

Rev

Rev 3892 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3892 Rev 3896
Line 18... Line 18...
18
<!--#include file="common/formating.asp"-->
18
<!--#include file="common/formating.asp"-->
19
<!--#include file="common/qstr.asp"-->
19
<!--#include file="common/qstr.asp"-->
20
<!--#include file="common/common_subs.asp"-->
20
<!--#include file="common/common_subs.asp"-->
21
<!--#include file="common/common_dbedit.asp"-->
21
<!--#include file="common/common_dbedit.asp"-->
22
<!--#include file="class/classaspJSON.asp" -->
22
<!--#include file="class/classaspJSON.asp" -->
-
 
23
<!--#include file="class/classSortHelper.asp"-->
23
<%
24
<%
24
'------------ ACCESS CONTROL ------------------
25
'------------ ACCESS CONTROL ------------------
25
%>
26
%>
26
<!--#include file="_access_control_login.asp"-->
27
<!--#include file="_access_control_login.asp"-->
27
<!--#include file="_access_control_general.asp"-->
28
<!--#include file="_access_control_general.asp"-->
Line 36... Line 37...
36
 
37
 
37
parOpr = QStrPar("Opr")
38
parOpr = QStrPar("Opr")
38
parPkgName = Trim(QStrPar("packageName"))
39
parPkgName = Trim(QStrPar("packageName"))
39
result = -1
40
result = -1
40
 
41
 
-
 
42
' Init the output JSON class
-
 
43
'   Operations can add data
-
 
44
'   Default data will be added at the end
-
 
45
Dim oJSON
-
 
46
Set oJSON = New aspJSON
-
 
47
Dim newitem
-
 
48
 
41
If (parOpr = "checkName") Then
49
If (parOpr = "checkName") Then
42
 
50
 
43
    ' Test existance of a package name
51
    ' Test existance of a package name
44
    ' Returns the PKG_ID of the package or 0
52
    ' Returns the PKG_ID of the package or 0
45
    '
53
    '
Line 89... Line 97...
89
        End If
97
        End If
90
    End IF
98
    End IF
91
 
99
 
92
    rsQry.Close
100
    rsQry.Close
93
    Set rsQry = Nothing
101
    Set rsQry = Nothing
94
End If
-
 
95
 
102
 
-
 
103
ElseIf (parOpr = "getVerList") Then
-
 
104
    Dim parPkgId
-
 
105
    parPkgId = QStrPar("pkg_id")
-
 
106
 
-
 
107
    result = 0
-
 
108
    SqlQry = "select pv_id, pkg_version, dlocked" &_
-
 
109
         "  FROM package_versions pv" &_
-
 
110
         " WHERE pv.pkg_id = "& parPkgId
-
 
111
 
-
 
112
    On Error Resume Next
-
 
113
    objEH.ErrorRedirect = FALSE
-
 
114
    objEH.TryORA ( OraSession )
-
 
115
    Set rsQry = OraDatabase.DbCreateDynaset( SqlQry, ORADYN_DEFAULT )
-
 
116
    objEH.CatchORA ( OraSession )
-
 
117
 
-
 
118
    If objEH.Finally Then
-
 
119
 
-
 
120
        oJSON.data("VersionRef") = QStrPar("Ref")
-
 
121
        Set oJSON.data("Versions") = oJSON.Collection()
-
 
122
 
-
 
123
        Dim aVersions
-
 
124
        Dim objSortHelper
-
 
125
        Dim lastRow, i
-
 
126
 
-
 
127
	    If rsQry.RecordCount > 0 Then
-
 
128
 
-
 
129
		    aVersions = rsQry.GetRows()
-
 
130
		    lastRow = UBound( aVersions, 2 )
-
 
131
 
-
 
132
		    Set objSortHelper = New SortHelper
-
 
133
 
-
 
134
		    ' Sort versions
-
 
135
		    Call objSortHelper.VersionSort( aVersions, 0, lastRow, rsQry.FieldIndex("pkg_version") )
-
 
136
 
-
 
137
		    ' Descending order
-
 
138
		    For i = lastRow To 0 Step -1
-
 
139
 
-
 
140
                Dim vname : vname = aVersions( rsQry.FieldIndex("pkg_version"), i )
-
 
141
                Dim pvid : pvid = aVersions( rsQry.FieldIndex("pv_id"), i )
-
 
142
                Dim lck : lck = aVersions( rsQry.FieldIndex("dlocked"), i )
-
 
143
 
-
 
144
                result = result + 1
-
 
145
 
-
 
146
                Set newitem = oJSON.AddToCollection(oJSON.data("Versions"))
-
 
147
                newitem.add "vname", vname
-
 
148
                newitem.add "pv_id", pvid
-
 
149
                newitem.add "dlocked", lck
-
 
150
		    Next
-
 
151
		    Set objSortHelper = nothing
-
 
152
	    End If
-
 
153
    End IF
-
 
154
 
-
 
155
    rsQry.Close
-
 
156
    Set rsQry = Nothing
-
 
157
 
-
 
158
End If
96
 
159
 
97
Dim oJSON
-
 
98
Set oJSON = New aspJSON
-
 
99
Dim newitem
-
 
100
 
160
 
101
'
161
'
102
'   Create JSON data for the user
162
'   Create JSON data for the user
103
'   Important fields
163
'   Important fields
104
'       result
164
'       result