| 5980 |
dpurdie |
1 |
<%@LANGUAGE="VBSCRIPT"%>
|
|
|
2 |
<%
|
|
|
3 |
Option explicit
|
|
|
4 |
Response.Expires = 0 ' always load the page, dont store
|
|
|
5 |
%>
|
|
|
6 |
<%
|
|
|
7 |
'=====================================================
|
|
|
8 |
' _wform_change_licence.asp
|
|
|
9 |
'
|
|
|
10 |
' This form is designed to work within an iframe pop up
|
|
|
11 |
'=====================================================
|
|
|
12 |
%>
|
|
|
13 |
<!--#include file="common/conf.asp"-->
|
|
|
14 |
<!--#include file="common/globals.asp"-->
|
|
|
15 |
<!--#include file="common/qstr.asp"-->
|
|
|
16 |
<!--#include file="common/common_subs.asp"-->
|
|
|
17 |
<!--#include file="common/common_dbedit.asp"-->
|
|
|
18 |
<!--#include file="common/_popup_window_common.asp"-->
|
|
|
19 |
<%
|
|
|
20 |
'------------ ACCESS CONTROL ------------------
|
|
|
21 |
%>
|
|
|
22 |
<!--#include file="_access_control_login.asp"-->
|
|
|
23 |
<!--#include file="_access_control_general.asp"-->
|
|
|
24 |
<!--#include file="_access_control_project.asp"-->
|
|
|
25 |
<%
|
|
|
26 |
'------------ Variable Definition -------------
|
|
|
27 |
Dim parPv_id
|
|
|
28 |
Dim sMessage, sMessageType
|
|
|
29 |
'------------ Constants Declaration -----------
|
|
|
30 |
'------------ Variable Init -------------------
|
|
|
31 |
Set pkgInfoHash = CreateObject("Scripting.Dictionary")
|
|
|
32 |
parPv_id = QStrPar("pv_id")
|
|
|
33 |
sMessage = NULL
|
|
|
34 |
sMessageType = 3
|
|
|
35 |
'----------------------------------------------
|
|
|
36 |
%>
|
|
|
37 |
<%
|
|
|
38 |
'------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
39 |
'
|
|
|
40 |
' Add a line of text to the System Message
|
|
|
41 |
' eLevel - 1 == Critical, 2==Warning, 3==Note
|
|
|
42 |
Sub sMessageAdd(eLevel, text)
|
|
|
43 |
If NOT isNull(sMessage) Then
|
|
|
44 |
sMessage = sMessage & "<br>"
|
|
|
45 |
End If
|
|
|
46 |
sMessage = sMessage & text
|
|
|
47 |
|
|
|
48 |
If eLevel < sMessageType Then
|
|
|
49 |
sMessageType = eLevel
|
|
|
50 |
End If
|
|
|
51 |
End Sub
|
|
|
52 |
|
|
|
53 |
Sub Get_Pkg_Info_With_Licence ( NNpv_id )
|
|
|
54 |
Dim rsTemp, Query_String
|
|
|
55 |
|
|
|
56 |
Query_String = _
|
|
|
57 |
" SELECT pkg.pkg_name, pv.pkg_version, NVL(ld.licence, -2) as licence_id"&_
|
|
|
58 |
" FROM packages pkg, package_versions pv, licencing ld"&_
|
|
|
59 |
" WHERE pkg.pkg_id = pv.pkg_id"&_
|
|
|
60 |
" AND pv.pv_id = " & NNpv_id &_
|
|
|
61 |
" AND ld.pv_id(+) = pv.pv_id"
|
|
|
62 |
|
|
|
63 |
Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
|
|
|
64 |
|
|
|
65 |
If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) Then
|
|
|
66 |
pkgInfoHash.Add "pkg_name", (rsTemp.Fields("pkg_name"))
|
|
|
67 |
pkgInfoHash.Add "pkg_version", (rsTemp.Fields("pkg_version"))
|
|
|
68 |
pkgInfoHash.Add "licence_id", (rsTemp.Fields("licence_id"))
|
|
|
69 |
End If
|
|
|
70 |
|
|
|
71 |
rsTemp.Close
|
|
|
72 |
Set rsTemp = nothing
|
|
|
73 |
End Sub
|
|
|
74 |
|
|
|
75 |
Function Licence_List ( )
|
|
|
76 |
Licence_List = _
|
|
|
77 |
" SELECT l.licence as licence_id, l.name"&_
|
|
|
78 |
" FROM licences l "&_
|
|
|
79 |
" ORDER BY UPPER(l.name)"
|
|
|
80 |
End Function
|
|
|
81 |
|
|
|
82 |
Function Update_Licence ( NNpv_id, NNlicence_id )
|
|
|
83 |
Dim rsTemp, Query_String, sComments
|
|
|
84 |
Dim licenceText
|
|
|
85 |
|
|
|
86 |
Update_Licence = FALSE
|
|
|
87 |
|
|
|
88 |
If CInt(NNlicence_id) < 0 Then
|
|
|
89 |
Update_Licence = TRUE
|
|
|
90 |
Exit Function
|
|
|
91 |
End If
|
|
|
92 |
|
|
|
93 |
|
|
|
94 |
' Check for a chnage
|
|
|
95 |
If CInt(NNlicence_id) = CInt(pkgInfoHash.Item("licence_id")) Then
|
|
|
96 |
Update_Licence = TRUE
|
|
|
97 |
Exit Function
|
|
|
98 |
End If
|
|
|
99 |
|
|
|
100 |
'-- Get licence details. Next text name for logging
|
|
|
101 |
Query_String = _
|
|
|
102 |
" SELECT licence, name"&_
|
|
|
103 |
" FROM licences"&_
|
|
|
104 |
" WHERE licence = "& NNlicence_id
|
|
|
105 |
|
|
|
106 |
Set rsTemp = OraDatabase.CreateDynaset( Query_String, cint(0))
|
|
|
107 |
licenceText = rsTemp.Fields("name").Value
|
|
|
108 |
If isNUll(licenceText) OR licenceText = "" Then
|
|
|
109 |
sMessageAdd 1, "Licence text cannot be found"
|
|
|
110 |
Exit Function
|
|
|
111 |
End If
|
|
|
112 |
|
|
|
113 |
rsTemp.Close
|
|
|
114 |
Set rsTemp = nothing
|
|
|
115 |
|
|
|
116 |
Query_String = _
|
|
|
117 |
"MERGE INTO LICENCING ld" &_
|
|
|
118 |
" USING (SELECT "& NNpv_id & " pv_id, "& NNlicence_id & " licence from dual) s" &_
|
|
|
119 |
" ON (ld.pv_id = s.pv_id)" &_
|
|
|
120 |
" WHEN MATCHED THEN UPDATE SET ld.licence = s.licence" &_
|
|
|
121 |
" WHEN NOT MATCHED THEN INSERT (pv_id, licence) VALUES (s.pv_id, s.licence)"
|
|
|
122 |
|
|
|
123 |
sComments = "Set: " & licenceText
|
|
|
124 |
|
|
|
125 |
'-- Update database to change the owner
|
|
|
126 |
objEH.ErrorRedirect = FALSE
|
|
|
127 |
objEH.TryORA ( OraSession )
|
|
|
128 |
On Error Resume Next
|
|
|
129 |
|
|
|
130 |
' Update the licence
|
|
|
131 |
OraDatabase.ExecuteSQL Query_String
|
|
|
132 |
objEH.CatchORA ( OraSession )
|
|
|
133 |
|
|
|
134 |
If objEH.LastOraFailed = FALSE Then
|
|
|
135 |
'-- Log the change
|
|
|
136 |
Call Log_Action ( NNpv_id, "software_licence", sComments )
|
|
|
137 |
Update_Licence = TRUE
|
|
|
138 |
End If
|
|
|
139 |
End Function
|
|
|
140 |
|
|
|
141 |
Function Delete_Licence ( NNpv_id )
|
|
|
142 |
Dim rsTemp, Query_String, sComments
|
|
|
143 |
Delete_Licence = FALSE
|
|
|
144 |
|
|
|
145 |
' Delete any exsiting licence
|
|
|
146 |
' Check for a change
|
|
|
147 |
If CInt(pkgInfoHash.Item("licence_id")) < 0 Then
|
|
|
148 |
Delete_Licence = TRUE
|
|
|
149 |
Exit Function
|
|
|
150 |
End If
|
|
|
151 |
|
|
|
152 |
'-- Update database to change the owner
|
|
|
153 |
objEH.ErrorRedirect = FALSE
|
|
|
154 |
objEH.TryORA ( OraSession )
|
|
|
155 |
On Error Resume Next
|
|
|
156 |
|
|
|
157 |
' Update the licence
|
|
|
158 |
OraDatabase.ExecuteSQL _
|
|
|
159 |
" DELETE from LICENCING ld "&_
|
|
|
160 |
" WHERE ld.pv_id = "& NNpv_id
|
|
|
161 |
|
|
|
162 |
objEH.CatchORA ( OraSession )
|
|
|
163 |
|
|
|
164 |
If objEH.LastOraFailed = FALSE Then
|
|
|
165 |
'-- Log the change
|
|
|
166 |
Call Log_Action ( NNpv_id, "software_licence", "Deleted Licence" )
|
|
|
167 |
Delete_Licence = TRUE
|
|
|
168 |
End If
|
|
|
169 |
End Function
|
|
|
170 |
|
|
|
171 |
%>
|
|
|
172 |
<%
|
|
|
173 |
Call Get_Pkg_Info_With_Licence ( parPv_id )
|
|
|
174 |
|
|
|
175 |
'Process submition
|
|
|
176 |
If CBool(QStrPar("action")) AND objAccessControl.UserLogedIn Then
|
|
|
177 |
If Request("btn") = "Delete" Then
|
|
|
178 |
If Delete_Licence (parPv_id) Then
|
|
|
179 |
Call ReloadParentWindow
|
|
|
180 |
Call CloseWindow
|
|
|
181 |
End If
|
|
|
182 |
Else
|
|
|
183 |
If Update_Licence ( parPv_id, Request("licence_id") ) Then
|
|
|
184 |
Call ReloadParentWindow
|
|
|
185 |
Call CloseWindow
|
|
|
186 |
End If
|
|
|
187 |
End If
|
|
|
188 |
End If
|
|
|
189 |
%>
|
|
|
190 |
<%
|
|
|
191 |
If objAccessControl.UserId = "" Then
|
|
|
192 |
sMessageAdd 1, "No longer logged in"
|
|
|
193 |
End If
|
|
|
194 |
%>
|
|
|
195 |
<html>
|
|
|
196 |
<head>
|
|
|
197 |
<title>Release Manager</title>
|
|
|
198 |
<link rel="shortcut icon" href="<%=FavIcon%>"/>
|
|
|
199 |
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
|
|
|
200 |
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
| 6579 |
dpurdie |
201 |
<link rel="stylesheet" href="images/release_manager_style.css?ver=<%=VixVerNum%>" type="text/css">
|
|
|
202 |
<link rel="stylesheet" href="images/navigation.css?ver=<%=VixVerNum%>" type="text/css">
|
|
|
203 |
<script language="JavaScript" src="images/tipster.js?ver=<%=VixVerNum%>"></script>
|
|
|
204 |
<script language="JavaScript" src="images/_help_tips.js?ver=<%=VixVerNum%>"></script>
|
|
|
205 |
<script language="JavaScript" src="images/common.js?ver=<%=VixVerNum%>"></script>
|
| 5980 |
dpurdie |
206 |
</head>
|
|
|
207 |
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" onload="self.focus();">
|
|
|
208 |
<form name="chowner" method="post" action="<%=scriptName%>" class="form_tight">
|
|
|
209 |
<table border="0" cellspacing="0" cellpadding="2" width="100%">
|
|
|
210 |
<tr>
|
|
|
211 |
<td valign="top" nowrap colspan="3" class="wform_ttl" background="images/bg_form_lightgray.gif">
|
|
|
212 |
<!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
|
213 |
<%Call Messenger ( sMessage , sMessageType, "100%" )%>
|
|
|
214 |
<!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
|
|
|
215 |
<!--#include file="messages/_msg_inline.asp"-->
|
|
|
216 |
<table width="100%" border="0" cellspacing="1" cellpadding="2">
|
|
|
217 |
<tr>
|
|
|
218 |
<!-- Package Name and Version -->
|
|
|
219 |
<td width="1%" nowrap class="form_field" background="images/bg_form_lightbluedark.gif">Package</td>
|
|
|
220 |
<td nowrap width="100%" background="images/bg_form_lightbluedark.gif" class="form_txt">
|
|
|
221 |
<%=pkgInfoHash.Item ("pkg_name") &" "& pkgInfoHash.Item ("pkg_version")%></td>
|
|
|
222 |
</tr>
|
|
|
223 |
<tr>
|
|
|
224 |
<!-- Usage in other versions -->
|
|
|
225 |
<%
|
|
|
226 |
Dim otherUse
|
|
|
227 |
Set otherUse = OraDatabase.DbCreateDynaset( _
|
|
|
228 |
"SELECT ld.NAME, count(*) as count" &_
|
|
|
229 |
" FROM licencing l," &_
|
|
|
230 |
" LICENCES ld" &_
|
|
|
231 |
" WHERE l.pv_id IN" &_
|
|
|
232 |
" (SELECT pv_id FROM package_versions WHERE pkg_id IN (SELECT pkg_id FROM package_versions WHERE pv_id="&parPv_id&" )" &_
|
|
|
233 |
" )" &_
|
|
|
234 |
" AND l.LICENCE = ld.LICENCE" &_
|
|
|
235 |
" group by ld.NAME" &_
|
|
|
236 |
" ORDER BY UPPER(ld.NAME)" _
|
|
|
237 |
, cint(0))
|
|
|
238 |
%>
|
|
|
239 |
<td width="1%" nowrap class="form_field" background="images/bg_form_lightbluedark.gif">Usage</td>
|
|
|
240 |
<td nowrap width="100%" background="images/bg_form_lightbluedark.gif" class="form_txt">
|
|
|
241 |
<%If otherUse.RecordCount > 0 Then%>
|
|
|
242 |
<table width="100%" border="0" cellspacing="1" cellpadding="2" >
|
|
|
243 |
<tr class="form_field">
|
|
|
244 |
<td>Licence</td>
|
|
|
245 |
<td>Count</td>
|
|
|
246 |
</tr>
|
|
|
247 |
<%
|
|
|
248 |
While ((NOT otherUse.BOF) AND (NOT otherUse.EOF))
|
|
|
249 |
%><tr class="form_item">
|
|
|
250 |
<td><%=otherUse("name")%></td>
|
|
|
251 |
<td><%=otherUse("count")%></td>
|
|
|
252 |
</tr><%
|
|
|
253 |
otherUse.MoveNext
|
|
|
254 |
WEnd
|
|
|
255 |
otherUse.Close
|
|
|
256 |
set otherUse = nothing
|
|
|
257 |
%>
|
|
|
258 |
</table>
|
|
|
259 |
<%End If%>
|
|
|
260 |
</td>
|
|
|
261 |
</tr>
|
|
|
262 |
<tr>
|
|
|
263 |
<!-- Package Licence -->
|
|
|
264 |
<td width="1%" nowrap class="form_field" background="images/bg_form_lightbluedark.gif">Licence</td>
|
|
|
265 |
<td nowrap width="100%" background="images/bg_form_lightbluedark.gif">
|
|
|
266 |
<select name="licence_id" class="form_item">
|
|
|
267 |
<option value=-2>None Selected</option>
|
|
|
268 |
<%
|
|
|
269 |
Dim rsLicences
|
|
|
270 |
Set rsLicences = OraDatabase.DbCreateDynaset( Licence_List( ), cint(0))
|
|
|
271 |
While ((NOT rsLicences.BOF) AND (NOT rsLicences.EOF))%>
|
|
|
272 |
<option <%If CInt(rsLicences("licence_id")) = CInt(pkgInfoHash.Item("licence_id")) Then%>selected<%End If%> value="<%=rsLicences.Fields("licence_id")%>"><%=rsLicences.Fields("name")%></option>
|
|
|
273 |
<% rsLicences.MoveNext
|
|
|
274 |
WEnd
|
|
|
275 |
rsLicences.Close
|
|
|
276 |
set rsLicences = nothing
|
|
|
277 |
%>
|
|
|
278 |
</select>
|
|
|
279 |
<input type="hidden" name="pv_id" value="<%=parPv_id%>">
|
|
|
280 |
<input type="hidden" name="rtag_id" value="<%=parRtag_id%>">
|
|
|
281 |
<input type="hidden" name="action" value="true">
|
|
|
282 |
</td>
|
|
|
283 |
</tr>
|
|
|
284 |
</table>
|
|
|
285 |
</td>
|
|
|
286 |
</tr>
|
|
|
287 |
<tr>
|
|
|
288 |
<td align="right">
|
|
|
289 |
<input type="submit" name="btn" value="Update" class="form_btn_comp">
|
|
|
290 |
<input type="submit" name="btn" value="Delete" class="form_btn_comp">
|
|
|
291 |
<input type="reset" name="btn" value="Cancel" class="form_btn_comp" onclick="parent.closeIFrame();">
|
|
|
292 |
</td>
|
|
|
293 |
</tr>
|
|
|
294 |
</table>
|
|
|
295 |
</form>
|
|
|
296 |
</body>
|
|
|
297 |
</html>
|
|
|
298 |
<!-- DESTRUCTOR ------->
|
|
|
299 |
<!--#include file="common/destructor.asp"-->
|