Subversion Repositories DevTools

Rev

Rev 6624 | Details | Compare with Previous | 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>
6625 dpurdie 134
<!--#include file="_jquery_includes.asp"-->
135
<script type="text/javascript" charset="utf-8">
136
	$(document).ready(function() {
137
        // Tricky code ALERT
138
        // If we have a lot of packages to update, then we can't pass the list into the iFrame via the URL
139
        // The trick is:
140
        //      Parent: Set the list of of pvid's into a hident element
141
        //      iFrame: Extract the data from the parent and insert it into a hidden form field
142
        //              When the form is submitted, it will be POSTed and the limit is not an issue
143
        var pvidList = $(window.parent.document.getElementById('iframeTxData')).text();
144
        $('#pvidList').val(pvidList);
145
        $('#pvidCount').text((pvidList.split(",").length));
146
    });
147
</script>
6624 dpurdie 148
</head>
149
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" onload="self.focus();">
150
<form name="chowner" method="post" action="<%=scriptName%>" class="form_tight">
151
  <table border="0" cellspacing="0" cellpadding="2" width="100%">
152
    <tr>
153
      <td valign="top" nowrap colspan="3" class="wform_ttl" background="images/bg_form_lightgray.gif">
154
        <table width="100%" border="0" cellspacing="1" cellpadding="2">
155
          <tr>
156
            <td width="1%" nowrap class="form_field" background="images/bg_form_lightbluedark.gif">Packages Selected</td>
6625 dpurdie 157
            <td id='pvidCount' nowrap width="100%" background="images/bg_form_lightbluedark.gif" class="form_txt">Loading</td>
6624 dpurdie 158
          </tr>
159
          <tr>
160
            <td width="1%" nowrap class="form_field" background="images/bg_form_lightbluedark.gif">Owner</td>
161
            <td nowrap width="100%" background="images/bg_form_lightbluedark.gif">
162
         <select name="own_id" class="form_item">
163
<%
164
         Dim rsUsers
165
         Set rsUsers = OraDatabase.DbCreateDynaset( Users_List( ), cint(0))%>
166
            <option value=0>- Select User -</option>
167
<%
168
         While ((NOT rsUsers.BOF) AND (NOT rsUsers.EOF))%>
169
                <option value="<%=rsUsers.Fields("user_id")%>"><%=rsUsers.Fields("full_name")%></option>
170
<%            rsUsers.MoveNext
171
         WEnd
172
         rsUsers.Close
173
         set rsUsers = nothing
174
         %>
175
         </select>
176
            </td>
177
          </tr>
178
        </table>
179
      </td>
180
    </tr>
181
    <tr>
182
      <td align="right">
6625 dpurdie 183
        <input id=pvidList type="hidden" name="pvidList" value="0">
184
        <input type="hidden" name="action" value="true">
6624 dpurdie 185
        <input type="submit" name="btn" value="Update" class="form_btn_comp">
186
        <input type="reset" name="btn" value="Cancel" class="form_btn_comp" onclick="parent.closeIFrame();">
187
      </td>
188
    </tr>
189
  </table>
190
</form>
191
</body>
192
</html>
193
<!-- DESTRUCTOR ------->
194
<!--#include file="common/destructor.asp"-->
195