%@LANGUAGE="VBSCRIPT"%>
<%
Option explicit
Response.Expires = 0 ' always load the page, dont store
%>
<%
'=====================================================
' Change Group
'=====================================================
%>
<%
'------------ ACCESS CONTROL ------------------
%>
<%
'------------ Variable Definition -------------
Dim sMessage, sMessageType
Dim parPv_id
Dim parProj_id
Dim parNewRtag_id
Dim parRfile
Dim bPreventSubmit
'------------ Constants Declaration -----------
'------------ Variable Init -------------------
sMessage = NULL
sMessageType = 3
Set pkgInfoHash = CreateObject("Scripting.Dictionary")
parPv_id = QStrPar("pv_id")
parProj_id= QStrParDefault("proj_id",DB_PROJ_ID)
parNewRtag_id = QStrParDefault("new_rtag_id", parRtag_id)
parRfile = Request("rfile")
If IsNull(parProj_id) Then parProj_id = "0"
If IsNull(parNewRtag_id) Then parNewRtag_id = "0"
If IsNull(parRfile) Then parRfile = "dependencies.asp"
bPreventSubmit = false
'----------------------------------------------
%>
<%
'------------------------------------------------------------------------------------------------------------------------------------------
' Add a line of text to the System Message
'
Sub sMessageAdd(eLevel, text)
If NOT isNull(sMessage) Then
sMessage = sMessage & " "
End If
sMessage = sMessage & text
If eLevel < sMessageType Then
sMessageType = eLevel
End If
End Sub
'------------------------------------------------------------------------------------------------------------------------------------------
Sub Get_Pkg_Info_From_Rel ( SSrtag_id, SSpv_id )
Dim rsTemp, Query_String
Query_String = _
" SELECT pkg.pkg_name, pv.pkg_version, wip.view_id, vi.view_name"&_
" FROM packages pkg, package_versions pv, work_in_progress wip, views vi"&_
" WHERE pkg.pkg_id = pv.pkg_id"&_
" AND pv.pv_id = wip.pv_id"&_
" AND vi.view_id = wip.view_id"&_
" AND wip.rtag_id = "& SSrtag_id &_
" AND wip.pv_id = "& SSpv_id
Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) Then
pkgInfoHash.Add "pkg_name", (rsTemp.Fields("pkg_name"))
pkgInfoHash.Add "pkg_version", (rsTemp.Fields("pkg_version"))
pkgInfoHash.Add "view_id", (rsTemp.Fields("view_id"))
pkgInfoHash.Add "view_name", (rsTemp.Fields("view_name"))
End If
rsTemp.Close
Set rsTemp = nothing
End Sub
'------------------------------------------------------------------------------------------------------------------------------------------
' Formulate the HTML for a combo box listing all the Projects, and select the one that matches
' the proj-id passed in as a parameter. If the parameter value could not be found, correct it to the first valid proj-id
' in the list.
'------------------------------------------------------------------------------------------------------------------------------------------
Function Get_Projects ( NNproj_id )
Dim rsTemp, Query_String, projName, tempLINK, selectedFound, s
selectedFound = False
Query_String = "SELECT * FROM projects ORDER BY UPPER( proj_name )"
Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
s = "
Project
"
s = s + "
"
' Correct for a situation where selectedFound is still FALSE.
If NOT selectedFound Then
rsTemp.MoveFirst
If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) Then
NNproj_id = CStr(rsTemp.Fields("proj_id"))
Else
NNproj_id = "0"
End If
End If
rsTemp.Close
Set rsTemp = nothing
s = s + "
"
Get_Projects = s
End Function
'------------------------------------------------------------------------------------------------------------------------------------------
' Formulate the HTML for a combo box listing all the Release for a specified project, and select the one that matches
' the release-tag passed in as a parameter. If the parameter value could not be found, correct it to the first valid release-tag
' in the list.
'------------------------------------------------------------------------------------------------------------------------------------------
Function Get_Releases ( NNproj_id, NNrtag_id )
Dim rsTemp, Query_String, rName, tempLINK, selectedFound, s, numReleases
selectedFound = False
numReleases = 0
Query_String = "SELECT rtag_id, rtag_name "&_
" FROM release_tags rt"&_
" WHERE rt.proj_id = "& NNproj_id &_
" AND ((rt.official = 'N') OR (rt.official = 'C') OR (rt.official = 'R'))"&_
" ORDER BY UPPER(rtag_name)"
Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
s = ""
' Correct for a situation where selectedFound is still FALSE.
If NOT selectedFound Then
rsTemp.MoveFirst
If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) Then
NNrtag_id = CStr(rsTemp.Fields("rtag_id"))
Else
NNrtag_id = "0"
End If
End If
' If no releases were found then replace drop down list with some warning text and disable form submission
If numReleases = 0 Then
bPreventSubmit = True
s = "No active releases"
Call sMessageAdd( 1, "No active releases found. The operation cannot be performed")
End If
rsTemp.Close
Set rsTemp = nothing
s = "
Release
" + "
" + s + "
"
Get_Releases = s
End Function
'-------------------------------------------------------------------------------------------------------
' Call stored procedures to move the WIP from the source release to the destination release
' Return false on failure
'-------------------------------------------------------------------------------------------------------
Function MoveWip(source_RtagId, destination_RtagId, pvId, viewId)
MoveWip = False
OraDatabase.Parameters.Add "RTAG_ID", source_RtagId, ORAPARM_INPUT, ORATYPE_NUMBER
OraDatabase.Parameters.Add "PV_ID", pvId, ORAPARM_INPUT, ORATYPE_VARCHAR2
OraDatabase.Parameters.Add "USER_ID", objAccessControl.UserId, ORAPARM_INPUT, ORATYPE_NUMBER
OraDatabase.Parameters.Add "VIEW_ID", viewId, ORAPARM_INPUT, ORATYPE_NUMBER
objEH.ErrorRedirect = FALSE
objEH.TryORA ( OraSession )
On Error Resume Next
OraDatabase.ExecuteSQL _
"BEGIN PK_WORK_IN_PROGRESS.REMOVE_PACKAGE ( :PV_ID, :RTAG_ID, :USER_ID ); END;"
If Err.Number = 0 Then
' First step is OK
OraDatabase.Parameters.Remove "RTAG_ID"
OraDatabase.Parameters.Add "RTAG_ID", destination_RtagId, ORAPARM_INPUT, ORATYPE_NUMBER
objEH.ErrorRedirect = FALSE
objEH.TryORA ( OraSession )
On Error Resume Next
OraDatabase.ExecuteSQL _
"BEGIN PK_WORK_IN_PROGRESS.ADD_PACKAGE ( :PV_ID, :VIEW_ID, :RTAG_ID, :USER_ID ); END;"
End If
objEH.CatchORA ( OraSession )
If objEH.Finally Then
MoveWip = True
End IF
OraDatabase.Parameters.Remove "RTAG_ID"
OraDatabase.Parameters.Remove "PV_ID"
OraDatabase.Parameters.Remove "USER_ID"
OraDatabase.Parameters.Remove "VIEW_ID"
End Function
%>
<%
' get pkgInfoHash items for the source WIP
Call Get_Pkg_Info_From_Rel ( parRtag_id, parPv_id )
' Access control
If NOT objAccessControl.UserLogedIn Then
Call sMessageAdd (1,"User is no longer logged in")
bPreventSubmit = True
ElseIf NOT canActionInProject() Then
Call sMessageAdd (1, "You have been denied permission to modify the source release")
bPreventSubmit = True
' Make sure this WIP can be moved - prevent if it has a pending test build instruction, etc
ElseIf (DaemonInstructionPreventsEditing(Request("rtag_id"), Request("pv_id"))) Then
bPreventSubmit = True
Call sMessageAdd (1, "This WIP has one or more daemon instructions present. "&_
"Please delete them or allow them to complete before moving WIPs.")
Else
' check for form submission
If CBool(QStrPar("action")) AND (QStrPar("btn") = "Move") AND objAccessControl.UserLogedIn Then
'Process submition
If MoveWip(parRtag_id, parNewRtag_id, parPv_id, pkgInfoHash.Item("view_id")) Then
Call OpenInParentWindow (parRfile &"?pv_id="& parPv_id &"&rtag_id="& parNewRtag_id )
Call CloseWindow
End If
Else
' Call HTML rendering functions, but throw away the strings returned since we only want to ensure that
' the current state of the bPreventSubmit flag has been acquired in order to show/hide the submit button
Call Get_Projects(parProj_id)
Call Get_Releases(parProj_id, parNewRtag_id)
End If
End If
' Prevent moving to myself
If (parNewRtag_id = parRtag_id) Then
Call sMessageAdd (3,"Select a release")
bPreventSubmit = True
End If
%>
Release Manager