Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<%@LANGUAGE="VBSCRIPT"%><%Option explicitResponse.Expires = 0 ' always load the page, dont store%><%'=====================================================' _wform_change_owner_bulk.asp'=====================================================%><!--#include file="common/conf.asp"--><!--#include file="common/globals.asp"--><!--#include file="common/qstr.asp"--><!--#include file="common/common_subs.asp"--><!--#include file="common/common_dbedit.asp"--><!--#include file="common/_popup_window_common.asp"--><%'------------ ACCESS CONTROL ------------------%><!--#include file="_access_control_login.asp"--><!--#include file="_access_control_general.asp"--><!--#include file="_access_control_project.asp"--><%'------------ Variable Definition -------------Dim parPvidListDim pvidArray'------------ Constants Declaration -----------'------------ Variable Init -------------------Set pkgInfoHash = CreateObject("Scripting.Dictionary")parPvidList = QStrPar("pvidList")pvidArray = Split(parPvidList,",")'----------------------------------------------%><%Function Users_List ( )Users_List = _" SELECT usr.user_id, usr.full_name"&_" FROM users usr"&_" WHERE usr.IS_DISABLED IS NULL"&_" ORDER BY UPPER(usr.full_name)"End Function'' Update the owner field on all packages in the pvidArray list'Sub Update_Owner (NNown_id )Dim rsTemp, Query_String, sComments, previousOwnerDim pkgListDim index'-- Get package detailsQuery_String = _" SELECT pv.pv_id, pv.owner_id, pkg.pkg_name, pv.pkg_version"&_" FROM package_versions pv, packages pkg"&_" WHERE pv.pv_id in("& parPvidList &")"&_" AND pv.pkg_id = pkg.pkg_id" &_" AND pv.owner_id != " & NNown_id &_" ORDER by Upper(pkg.pkg_name), Upper(pv.v_ext)"Set rsTemp = OraDatabase.CreateDynaset( Query_String, cint(0))index = 0While ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF))pkgInfoHash.Add "name_" & index, rsTemp("pkg_name") &" " & rsTemp("pkg_version")pkgInfoHash.Add "prev_" & index, rsTemp.Fields("owner_id").ValuepkgInfoHash.Add "pvid_" & index, rsTemp.Fields("pv_id").Valueindex = index+1rsTemp.MoveNextWEndrsTemp.CloseSet rsTemp = nothing'-- Skip if there is no actual ownership changesIf index > 0 Then'-- Update database to change the ownerobjEH.TryORA ( OraSession )On Error Resume NextOraDatabase.ExecuteSQL _" UPDATE PACKAGE_VERSIONS pv SET "&_" pv.owner_id = "& NNown_id &_" WHERE pv.pv_id in ("& parPvidList &")"objEH.CatchORA ( OraSession )If objEH.LastOraFailed = FALSE Then'-- Notify new owner'-- Generate a single email with the list of changed packagesindex = 0pkgList = "You are now the owner of the following packages:<ul>"While pkgInfoHash.Exists( "name_" & index)pkgList = pkgList & "<li>" & pkgInfoHash.Item("name_" & index) & "</li>"index = index+1WendpkgList = pkgList & "</ul>"Call Send_Email ( "Release Manager Notification", ADMIN_EMAIL, GetUserEmail( NNown_id ), "Package Ownership notification", pkgList, NULL )'-- Log the changesindex = 0While pkgInfoHash.Exists( "name_" & index)sComments = "Changed from "& GetUsername(pkgInfoHash.Item("prev_" & index)) &" to "& GetUsername(NNown_id)call Log_Action ( pkgInfoHash.Item("pvid_" & index), "owner_change", sComments )index = index+1WendEnd IfEnd IfEnd Sub%><%'Process submitionIf CBool(QStrPar("action")) AND objAccessControl.UserLogedIn AND NiceInt(Request("own_id"),0) <> 0 ThenCall Update_Owner ( Request("own_id") )Call ReloadParentWindowCall CloseWindowEnd If%><html><head><title>Release Manager</title><link rel="shortcut icon" href="<%=FavIcon%>"/><meta HTTP-EQUIV="Pragma" CONTENT="no-cache"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link rel="stylesheet" href="images/release_manager_style.css?ver=<%=VixVerNum%>" type="text/css"><link rel="stylesheet" href="images/navigation.css?ver=<%=VixVerNum%>" type="text/css"><script language="JavaScript" src="images/tipster.js?ver=<%=VixVerNum%>"></script><script language="JavaScript" src="images/_help_tips.js?ver=<%=VixVerNum%>"></script><script language="JavaScript" src="images/common.js?ver=<%=VixVerNum%>"></script></head><body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" onload="self.focus();"><form name="chowner" method="post" action="<%=scriptName%>" class="form_tight"><table border="0" cellspacing="0" cellpadding="2" width="100%"><tr><td valign="top" nowrap colspan="3" class="wform_ttl" background="images/bg_form_lightgray.gif"><table width="100%" border="0" cellspacing="1" cellpadding="2"><tr><td width="1%" nowrap class="form_field" background="images/bg_form_lightbluedark.gif">Packages Selected</td><td nowrap width="100%" background="images/bg_form_lightbluedark.gif" class="form_txt"><%=Ubound(pvidArray)+1%></td></tr><tr><td width="1%" nowrap class="form_field" background="images/bg_form_lightbluedark.gif">Owner</td><td nowrap width="100%" background="images/bg_form_lightbluedark.gif"><select name="own_id" class="form_item"><%Dim rsUsersSet rsUsers = OraDatabase.DbCreateDynaset( Users_List( ), cint(0))%><option value=0>- Select User -</option><%While ((NOT rsUsers.BOF) AND (NOT rsUsers.EOF))%><option value="<%=rsUsers.Fields("user_id")%>"><%=rsUsers.Fields("full_name")%></option><% rsUsers.MoveNextWEndrsUsers.Closeset rsUsers = nothing%></select><input type="hidden" name="pvidList" value="<%=parPvidList%>"><input type="hidden" name="action" value="true"></td></tr></table></td></tr><tr><td align="right"><input type="submit" name="btn" value="Update" class="form_btn_comp"><input type="reset" name="btn" value="Cancel" class="form_btn_comp" onclick="parent.closeIFrame();"></td></tr></table></form></body></html><!-- DESTRUCTOR -------><!--#include file="common/destructor.asp"-->