Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
119 ghuddy 1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
3
Option explicit
129 ghuddy 4
Response.Expires = 0   ' always load the page, dont store
119 ghuddy 5
%>
6
<%
7
'=====================================================
129 ghuddy 8
'               Change Owner
119 ghuddy 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 )
129 ghuddy 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
119 ghuddy 52
End Sub
53
 
54
 
55
Function Users_List ( )
129 ghuddy 56
   Users_List = _
57
   " SELECT usr.user_id, usr.full_name"&_
119 ghuddy 58
    "   FROM users usr"&_
129 ghuddy 59
   "  WHERE usr.IS_DISABLED IS NULL"&_
60
   "  ORDER BY UPPER(usr.full_name)"
119 ghuddy 61
End Function
62
 
63
Sub Update_Owner ( NNpv_id, NNown_id )
129 ghuddy 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
      If UCase(isOfficial) = "N" Then
98
 
99
         Set objWSH = Server.CreateObject("WScript.Shell")
100
 
101
         objWSH.Run  "cmd.exe /c cscript.exe //B //NoLogo "& rootPath & SCRIPTS_FOLDER &"\Admin_Tools.wsf //job:onMakeUnofficial "&_
102
                     "/pv_id:"& NNpv_id , _
103
                     0, FALSE
104
 
105
      End If
106
 
107
      '-- Notify new owner
108
      Call Send_Email ( "Release Manager Notification", adminEmail, GetUserEmail( NNown_id ), "You are now the owner of """& sPackage &"""", Empty, NULL )
109
 
110
      '-- Log the change
111
      sComments = "Changed from "& GetUsername(previousOwner) &" to "& GetUsername(NNown_id)
112
      call Log_Action ( NNpv_id, "owner_change", sComments )
113
   End If
119 ghuddy 114
End Sub
115
%>
116
<%
117
'Process submition
118
If CBool(QStrPar("action")) AND  objAccessControl.UserLogedIn Then
129 ghuddy 119
   Call Update_Owner ( parPv_id, Request("own_id") )
120
 
121
   Call OpenInParentWindow ( "dependencies.asp?pv_id="& parPv_id &"&rtag_id="& parRtag_id )
122
   Call CloseWindow
123
 
119 ghuddy 124
End If
125
%>
126
<%
127
Call Get_Pkg_Info_With_Owner ( parPv_id )
128
%>
129
<html>
130
<head>
131
<title>Release Manager</title>
132
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
133
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
134
<link rel="stylesheet" href="images/release_manager_style.css" type="text/css">
135
<link rel="stylesheet" href="images/navigation.css" type="text/css">
136
<script language="JavaScript" src="images/tipster.js"></script>
137
<script language="JavaScript" src="images/_help_tips.js"></script>
138
<script language="JavaScript" src="images/common.js"></script>
139
</head>
140
 
141
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" onload="self.focus();">
142
<form name="chowner" method="post" action="<%=scriptName%>">
143
  <table width="100%" border="0" cellspacing="0" cellpadding="2" height="100%">
129 ghuddy 144
    <tr>
119 ghuddy 145
      <td background="images/lbox_bg_orange.gif" width="1%" height="1%"><img src="images/i_owner.gif" width="20" height="29" hspace="5"></td>
146
      <td background="images/lbox_bg_blue.gif" nowrap width="50%" class="wform_ttl">&nbsp;Change Owner</td>
129 ghuddy 147
      <td background="images/lbox_bg_blue.gif" align="right" width="50%">
119 ghuddy 148
        <input type="submit" name="btn" value="Update" class="form_btn_comp">
149
        <input type="reset" name="btn" value="Cancel" class="form_btn_comp" onclick="self.close()">
150
      </td>
129 ghuddy 151
      <td background="images/lbox_bg_blue.gif" align="right" width="1%%" nowrap>
119 ghuddy 152
        <img src="images/h_trsp_dot.gif" width="5" height="22"> </td>
153
    </tr>
129 ghuddy 154
    <tr>
119 ghuddy 155
      <td height="100%" width="1%">&nbsp;</td>
129 ghuddy 156
      <td valign="top" nowrap colspan="3" class="wform_ttl" background="images/bg_form_lightgray.gif">
119 ghuddy 157
        <table width="100%" border="0" cellspacing="1" cellpadding="2">
129 ghuddy 158
          <tr>
119 ghuddy 159
            <td width="1%"><img src="images/h_trsp_dot.gif" width="10" height="30"></td>
160
            <td width="1%" nowrap class="form_group" valign="bottom"></td>
161
            <td nowrap width="100%">&nbsp; </td>
162
          </tr>
129 ghuddy 163
          <tr>
119 ghuddy 164
            <td width="1%">&nbsp;</td>
165
            <td width="1%" nowrap class="form_field" background="images/bg_form_lightbluedark.gif">Package</td>
129 ghuddy 166
            <td nowrap width="100%" background="images/bg_form_lightbluedark.gif" class="form_txt">
119 ghuddy 167
              <%=pkgInfoHash.Item ("pkg_name") &" "& pkgInfoHash.Item ("pkg_version")%></td>
168
          </tr>
129 ghuddy 169
          <tr>
119 ghuddy 170
            <td width="1%">&nbsp;</td>
171
            <td width="1%" nowrap class="form_field" background="images/bg_form_lightbluedark.gif">Owner</td>
172
            <td nowrap width="100%" background="images/bg_form_lightbluedark.gif">
129 ghuddy 173
         <select name="own_id" class="form_item">
119 ghuddy 174
<%
129 ghuddy 175
         Dim rsUsers
176
         Set rsUsers = OraDatabase.DbCreateDynaset( Users_List( ), cint(0))
177
         While ((NOT rsUsers.BOF) AND (NOT rsUsers.EOF))%>
119 ghuddy 178
                <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>
129 ghuddy 179
<%            rsUsers.MoveNext
180
         WEnd
181
         rsUsers.Close
182
         set rsUsers = nothing
183
         %>
184
         </select>
119 ghuddy 185
            <input type="hidden" name="pv_id" value="<%=parPv_id%>">
129 ghuddy 186
         <input type="hidden" name="rtag_id" value="<%=parRtag_id%>">
187
         <input type="hidden" name="action" value="true">
119 ghuddy 188
            </td>
189
          </tr>
129 ghuddy 190
          <tr>
119 ghuddy 191
            <td width="1%">&nbsp;</td>
192
            <td width="1%" nowrap class="form_field"><img src="images/h_trsp_dot.gif" width="100" height="10"></td>
129 ghuddy 193
            <td nowrap width="100%">
119 ghuddy 194
              <p>&nbsp;</p>
195
            </td>
196
          </tr>
197
        </table>
198
      </td>
199
    </tr>
200
    <tr>
201
      <td height="1%" width="1%"><img src="images/h_trsp_dot.gif" width="5" height="5"></td>
202
      <td valign="top" nowrap colspan="3" class="wform_ttl" background="images/lbox_bg_blue.gif"></td>
203
    </tr>
204
  </table>
205
</form>
206
<!-- TIPS LAYERS -------------------------------------->
207
<div id="formTipsLayer" style="position: absolute; z-index: 1000; visibility: hidden; left:0; top: 0; width: 10">&nbsp;</div>
208
<!----------------------------------------------------->
209
</body>
210
</html>
211
 
212
 
213
<!-- DESTRUCTOR ------->
129 ghuddy 214
<!--#include file="common/destructor.asp"-->