Subversion Repositories DevTools

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
6624 dpurdie 1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
3
Option explicit
4
Response.Expires = 0   ' always load the page, dont store
5
%>
6
<%
7
'=====================================================
8
'   _wform_change_owner_bulk.asp
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 parPvidList
26
Dim pvidArray
27
'------------ Constants Declaration -----------
28
'------------ Variable Init -------------------
29
Set pkgInfoHash = CreateObject("Scripting.Dictionary")
30
parPvidList = QStrPar("pvidList")
31
pvidArray = Split(parPvidList,",")
32
'----------------------------------------------
33
%>
34
<%
35
Function Users_List ( )
36
   Users_List = _
37
   " SELECT usr.user_id, usr.full_name"&_
38
    "   FROM users usr"&_
39
   "  WHERE usr.IS_DISABLED IS NULL"&_
40
   "  ORDER BY UPPER(usr.full_name)"
41
End Function
42
 
43
'
44
'   Update the owner field on all packages in the pvidArray list
45
'        
46
Sub Update_Owner (NNown_id )
47
    Dim rsTemp, Query_String, sComments, previousOwner
48
    Dim pkgList
49
    Dim index
50
 
51
    '-- Get package details
52
    Query_String = _
53
    " SELECT pv.pv_id, pv.owner_id, pkg.pkg_name, pv.pkg_version"&_
54
    " FROM package_versions pv, packages pkg"&_
55
    " WHERE pv.pv_id in("& parPvidList &")"&_
56
    "   AND pv.pkg_id = pkg.pkg_id" &_
57
    "   AND pv.owner_id != " & NNown_id &_
58
    " ORDER by Upper(pkg.pkg_name), Upper(pv.v_ext)"
59
 
60
    Set rsTemp = OraDatabase.CreateDynaset( Query_String, cint(0))
61
    index = 0
62
    While ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF))
63
 
64
        pkgInfoHash.Add "name_" & index, rsTemp("pkg_name") &" " & rsTemp("pkg_version")
65
        pkgInfoHash.Add "prev_" & index, rsTemp.Fields("owner_id").Value
66
        pkgInfoHash.Add "pvid_" & index, rsTemp.Fields("pv_id").Value
67
 
68
        index = index+1
69
        rsTemp.MoveNext
70
    WEnd
71
 
72
   rsTemp.Close
73
   Set rsTemp = nothing
74
 
75
   '-- Skip if there is no actual ownership changes
76
   If index > 0 Then
77
 
78
       '-- Update database to change the owner
79
       objEH.TryORA ( OraSession )
80
       On Error Resume Next
81
 
82
      OraDatabase.ExecuteSQL _
83
         " UPDATE PACKAGE_VERSIONS pv SET "&_
84
         " pv.owner_id = "& NNown_id &_
85
         " WHERE pv.pv_id in ("& parPvidList &")"
86
 
87
       objEH.CatchORA ( OraSession )
88
 
89
       If objEH.LastOraFailed = FALSE Then
90
          '-- Notify new owner
91
          '-- Generate a single email with the list of changed packages
92
          index = 0
93
          pkgList = "You are now the owner of the following packages:<ul>"
94
          While pkgInfoHash.Exists( "name_" & index) 
95
            pkgList = pkgList & "<li>" & pkgInfoHash.Item("name_" & index) & "</li>"
96
            index = index+1
97
          Wend
98
          pkgList = pkgList & "</ul>"
99
 
100
          Call Send_Email ( "Release Manager Notification", ADMIN_EMAIL, GetUserEmail( NNown_id ), "Package Ownership notification", pkgList, NULL )
101
 
102
          '-- Log the changes
103
          index = 0
104
          While pkgInfoHash.Exists( "name_" & index) 
105
            sComments = "Changed from "& GetUsername(pkgInfoHash.Item("prev_" & index)) &" to "& GetUsername(NNown_id)
106
            call Log_Action ( pkgInfoHash.Item("pvid_" & index), "owner_change", sComments )
107
 
108
            index = index+1
109
          Wend
110
 
111
       End If
112
   End If
113
End Sub
114
%>
115
<%
116
'Process submition
117
If CBool(QStrPar("action")) AND  objAccessControl.UserLogedIn AND NiceInt(Request("own_id"),0) <> 0 Then
118
   Call Update_Owner ( Request("own_id") )
119
   Call ReloadParentWindow
120
   Call CloseWindow
121
End If
122
%>
123
<html>
124
<head>
125
<title>Release Manager</title>
126
<link rel="shortcut icon" href="<%=FavIcon%>"/>
127
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
128
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
129
<link rel="stylesheet" href="images/release_manager_style.css?ver=<%=VixVerNum%>" type="text/css">
130
<link rel="stylesheet" href="images/navigation.css?ver=<%=VixVerNum%>" type="text/css">
131
<script language="JavaScript" src="images/tipster.js?ver=<%=VixVerNum%>"></script>
132
<script language="JavaScript" src="images/_help_tips.js?ver=<%=VixVerNum%>"></script>
133
<script language="JavaScript" src="images/common.js?ver=<%=VixVerNum%>"></script>
134
</head>
135
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" onload="self.focus();">
136
<form name="chowner" method="post" action="<%=scriptName%>" class="form_tight">
137
  <table border="0" cellspacing="0" cellpadding="2" width="100%">
138
    <tr>
139
      <td valign="top" nowrap colspan="3" class="wform_ttl" background="images/bg_form_lightgray.gif">
140
        <table width="100%" border="0" cellspacing="1" cellpadding="2">
141
          <tr>
142
            <td width="1%" nowrap class="form_field" background="images/bg_form_lightbluedark.gif">Packages Selected</td>
143
            <td nowrap width="100%" background="images/bg_form_lightbluedark.gif" class="form_txt"><%=Ubound(pvidArray)+1%></td>
144
          </tr>
145
          <tr>
146
            <td width="1%" nowrap class="form_field" background="images/bg_form_lightbluedark.gif">Owner</td>
147
            <td nowrap width="100%" background="images/bg_form_lightbluedark.gif">
148
         <select name="own_id" class="form_item">
149
<%
150
         Dim rsUsers
151
         Set rsUsers = OraDatabase.DbCreateDynaset( Users_List( ), cint(0))%>
152
            <option value=0>- Select User -</option>
153
<%
154
         While ((NOT rsUsers.BOF) AND (NOT rsUsers.EOF))%>
155
                <option value="<%=rsUsers.Fields("user_id")%>"><%=rsUsers.Fields("full_name")%></option>
156
<%            rsUsers.MoveNext
157
         WEnd
158
         rsUsers.Close
159
         set rsUsers = nothing
160
         %>
161
         </select>
162
            <input type="hidden" name="pvidList" value="<%=parPvidList%>">
163
         <input type="hidden" name="action" value="true">
164
            </td>
165
          </tr>
166
        </table>
167
      </td>
168
    </tr>
169
    <tr>
170
      <td align="right">
171
        <input type="submit" name="btn" value="Update" class="form_btn_comp">
172
        <input type="reset" name="btn" value="Cancel" class="form_btn_comp" onclick="parent.closeIFrame();">
173
      </td>
174
    </tr>
175
  </table>
176
</form>
177
</body>
178
</html>
179
<!-- DESTRUCTOR ------->
180
<!--#include file="common/destructor.asp"-->
181