Subversion Repositories DevTools

Rev

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

Rev Author Line No. Line
5357 dpurdie 1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
3
Option explicit
4
Response.Expires = 0   ' always load the page, dont store
5
%>
6
<%
7
'=====================================================
8
'               Change Owner
9
'=====================================================
10
%>
11
<!--#include file="common/conf.asp"-->
12
<!--#include file="common/globals.asp"-->
13
<!--#include file="common/qstr.asp"-->
14
<!--#include file="common/common_subs.asp"-->
15
<!--#include file="common/common_dbedit.asp"-->
16
<!--#include file="common/_popup_window_common.asp"-->
17
<%
18
'------------ ACCESS CONTROL ------------------
19
%>
20
<!--#include file="_access_control_login.asp"-->
21
<!--#include file="_access_control_general.asp"-->
22
<!--#include file="_access_control_project.asp"-->
23
<%
24
'------------ Variable Definition -------------
25
Dim parPv_id
26
'------------ Constants Declaration -----------
27
'------------ Variable Init -------------------
28
Set pkgInfoHash = CreateObject("Scripting.Dictionary")
29
parPv_id = QStrPar("pv_id")
30
'----------------------------------------------
31
%>
32
<%
33
Sub Get_Pkg_Info_With_Owner ( NNpv_id )
34
   Dim rsTemp, Query_String
35
 
36
   Query_String = _
37
   " SELECT pkg.pkg_name, pv.pkg_version, pv.owner_id"&_
38
   "   FROM packages pkg, package_versions pv"&_
39
   "  WHERE pkg.pkg_id = pv.pkg_id"&_
40
   "    AND pv.pv_id = "& NNpv_id
41
 
42
   Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
43
 
44
   If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) Then
45
      pkgInfoHash.Add "pkg_name", (rsTemp.Fields("pkg_name"))
46
      pkgInfoHash.Add "pkg_version", (rsTemp.Fields("pkg_version"))
47
      pkgInfoHash.Add "owner_id", (rsTemp.Fields("owner_id"))
48
   End If
49
 
50
   rsTemp.Close
51
   Set rsTemp = nothing
52
End Sub
53
 
54
 
55
Function Users_List ( )
56
   Users_List = _
57
   " SELECT usr.user_id, usr.full_name"&_
58
    "   FROM users usr"&_
59
   "  WHERE usr.IS_DISABLED IS NULL"&_
60
   "  ORDER BY UPPER(usr.full_name)"
61
End Function
62
 
63
Sub Update_Owner ( NNpv_id, NNown_id )
64
   Dim rsTemp, Query_String, sComments, previousOwner, isOfficial
65
   Dim objWSH, sPackage
66
 
67
 
68
   '-- Get package details
69
   Query_String = _
70
   " SELECT pv.owner_id, pv.dlocked, pkg.pkg_name, pv.pkg_version"&_
71
   " FROM package_versions pv, packages pkg"&_
72
   " WHERE pv.pv_id = "& NNpv_id &_
73
   "   AND pv.pkg_id = pkg.pkg_id"
74
 
75
   Set rsTemp = OraDatabase.CreateDynaset( Query_String, cint(0))
76
   previousOwner = rsTemp.Fields("owner_id").Value
77
 
78
   isOfficial = rsTemp("dlocked")
79
   sPackage = rsTemp("pkg_name") &" "& rsTemp("pkg_version")
80
 
81
   rsTemp.Close
82
   Set rsTemp = nothing
83
 
84
   '-- Update database to change the owner
85
   objEH.TryORA ( OraSession )
86
   On Error Resume Next
87
 
88
   OraDatabase.ExecuteSQL _
89
      " UPDATE PACKAGE_VERSIONS pv SET "&_
90
      " pv.owner_id = "& NNown_id &_
91
      " WHERE pv.pv_id = "& NNpv_id
92
 
93
   objEH.CatchORA ( OraSession )
94
 
95
   '-- Make dpkg_archive folder writable by all if Unofficial
96
   If objEH.LastOraFailed = FALSE Then
97
      '-- Notify new owner
98
      Call Send_Email ( "Release Manager Notification", ADMIN_EMAIL, GetUserEmail( NNown_id ), "You are now the owner of """& sPackage &"""", Empty, NULL )
99
 
100
      '-- Log the change
101
      sComments = "Changed from "& GetUsername(previousOwner) &" to "& GetUsername(NNown_id)
102
      call Log_Action ( NNpv_id, "owner_change", sComments )
103
   End If
104
End Sub
105
%>
106
<%
107
'Process submition
108
If CBool(QStrPar("action")) AND  objAccessControl.UserLogedIn Then
109
   Call Update_Owner ( parPv_id, Request("own_id") )
5590 dpurdie 110
   Call ReloadParentWindow
5357 dpurdie 111
   Call CloseWindow
112
End If
113
%>
114
<%
115
Call Get_Pkg_Info_With_Owner ( parPv_id )
116
%>
117
<html>
118
<head>
119
<title>Release Manager</title>
120
<link rel="shortcut icon" href="<%=FavIcon%>"/>
121
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
122
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
123
<link rel="stylesheet" href="images/release_manager_style.css" type="text/css">
124
<link rel="stylesheet" href="images/navigation.css" type="text/css">
125
<script language="JavaScript" src="images/tipster.js"></script>
126
<script language="JavaScript" src="images/_help_tips.js"></script>
127
<script language="JavaScript" src="images/common.js"></script>
128
</head>
129
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" onload="self.focus();">
5590 dpurdie 130
<form name="chowner" method="post" action="<%=scriptName%>" class="form_tight">
131
  <table border="0" cellspacing="0" cellpadding="2" width="100%">
5357 dpurdie 132
    <tr>
133
      <td valign="top" nowrap colspan="3" class="wform_ttl" background="images/bg_form_lightgray.gif">
134
        <table width="100%" border="0" cellspacing="1" cellpadding="2">
135
          <tr>
136
            <td width="1%" nowrap class="form_field" background="images/bg_form_lightbluedark.gif">Package</td>
137
            <td nowrap width="100%" background="images/bg_form_lightbluedark.gif" class="form_txt">
138
              <%=pkgInfoHash.Item ("pkg_name") &" "& pkgInfoHash.Item ("pkg_version")%></td>
139
          </tr>
140
          <tr>
141
            <td width="1%" nowrap class="form_field" background="images/bg_form_lightbluedark.gif">Owner</td>
142
            <td nowrap width="100%" background="images/bg_form_lightbluedark.gif">
143
         <select name="own_id" class="form_item">
144
<%
145
         Dim rsUsers
146
         Set rsUsers = OraDatabase.DbCreateDynaset( Users_List( ), cint(0))
147
         While ((NOT rsUsers.BOF) AND (NOT rsUsers.EOF))%>
148
                <option <%If CInt(rsUsers("user_id")) = CInt(pkgInfoHash.Item("owner_id")) Then%>selected<%End If%> value="<%=rsUsers.Fields("user_id")%>"><%=rsUsers.Fields("full_name")%></option>
149
<%            rsUsers.MoveNext
150
         WEnd
151
         rsUsers.Close
152
         set rsUsers = nothing
153
         %>
154
         </select>
155
            <input type="hidden" name="pv_id" value="<%=parPv_id%>">
156
         <input type="hidden" name="rtag_id" value="<%=parRtag_id%>">
157
         <input type="hidden" name="action" value="true">
158
            </td>
159
          </tr>
160
        </table>
161
      </td>
162
    </tr>
163
    <tr>
5590 dpurdie 164
      <td align="right">
165
        <input type="submit" name="btn" value="Update" class="form_btn_comp">
166
        <input type="reset" name="btn" value="Cancel" class="form_btn_comp" onclick="parent.closeIFrame();">
167
      </td>
5357 dpurdie 168
    </tr>
169
  </table>
170
</form>
171
<!-- TIPS LAYERS -------------------------------------->
172
<div id="formTipsLayer" style="position: absolute; z-index: 1000; visibility: hidden; left:0; top: 0; width: 10">&nbsp;</div>
173
<!----------------------------------------------------->
174
</body>
175
</html>
176
<!-- DESTRUCTOR ------->
177
<!--#include file="common/destructor.asp"-->