Subversion Repositories DevTools

Rev

Rev 157 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<%@LANGUAGE="VBSCRIPT"%>
<%
Option explicit
Response.Expires = 0   ' always load the page, dont store
%>
<%
'=====================================================
'              Change Group
'=====================================================
%>
<!--#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"-->
<!--#include file="common/daemon_instructions.asp"-->
<%
'------------ ACCESS CONTROL ------------------
%>
<!--#include file="_access_control_login.asp"-->
<!--#include file="_access_control_general.asp"-->
<!--#include file="_access_control_project.asp"-->
<%
'------------ Variable Definition -------------
Dim parPv_id
Dim parProj_id
Dim parNewRtag_id
Dim parRfile
Dim bPreventSubmit
'------------ Constants Declaration -----------
'------------ Variable Init -------------------
Set pkgInfoHash = CreateObject("Scripting.Dictionary")
parPv_id = QStrPar("pv_id")
parProj_id= QStrPar("proj_id")
parNewRtag_id = QStrPar("new_rtag_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

'----------------------------------------------
%>
<%
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 = "<td class='form_field' background='images/bg_form_lightbluedark.gif' >Project</td>"
   s = s + "<td background='images/bg_form_lightbluedark.gif'><select id='proj_id_list' name='proj_id_list' class='form_item' onChange=""MM_jumpMenu('parent',this,0)"">"

   While ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF))
      projName = UCase(rsTemp.Fields("proj_name"))

      tempLINK = scriptName & "?proj_id=" & rsTemp.Fields("proj_id") &_
                              "&rtag_id="& parRtag_id &_
                              "&new_rtag_id="& parNewRtag_id &_
                              "&pv_id="& parPv_id &_
                              "&rfile="& parRfile

      If ((NNproj_id = Cstr(rsTemp.Fields("proj_id"))) OR (NNproj_id = "0")) AND (selectedFound = False) Then
         s = s + "<option value='"& tempLINK &"' selected>"& projName &"</option>"
         selectedFound = True
         NNproj_id = CStr(rsTemp.Fields("proj_id"))
      Else
         s = s + "<option value='"& tempLINK &"'>"& projName &"</option>"
      End If

      rsTemp.MoveNext
   WEnd
   s = s + "</select>"

   ' 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 + "</td>"

   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, releaseName, 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 = "<td class='form_field'  background='images/bg_form_lightbluedark.gif' >Release</td>"
   s = s + "<td background='images/bg_form_lightbluedark.gif' ><select id='rtag_id_list' name='rtag_id_list' class='form_item' onChange=""MM_jumpMenu('parent',this,0)"">"

   While ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF))
      releaseName = rsTemp.Fields("rtag_name")

      tempLINK = scriptName & "?proj_id="& NNproj_id &_
                              "&rtag_id="& parRtag_id &_
                              "&new_rtag_id="& rsTemp.Fields("rtag_id") &_
                              "&pv_id="& parPv_id &_
                              "&rfile="& parRfile

      If ((NNrtag_id = CStr(rsTemp.Fields("rtag_id"))) OR (NNrtag_id = "0")) AND (selectedFound = False) Then
            s = s + "<option value='"& tempLINK &"' selected>"& releaseName &"</option>"
         selectedFound = True
         NNrtag_id = Cstr(rsTemp.Fields("rtag_id"))
      Else
         s = s + "<option value='"& tempLINK &"'>"& releaseName &"</option>"
      End If

      numReleases = numReleases + 1

      rsTemp.MoveNext
   WEnd
   s = s + "</select>"

   ' 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 = "<td>Release</td><td><a style=color:Red>WARNING: No active releases found. The operation cannot be performed.</a></td>"
   End If

   rsTemp.Close
   Set rsTemp = nothing

   s = s + "</td>"

   Get_Releases = s
End Function

'-------------------------------------------------------------------------------------------------------
' Call stored procedures to move the WIP from the source release to the destination release
'-------------------------------------------------------------------------------------------------------
Sub MoveWip(source_RtagId, destination_RtagId, pvId, viewId)

   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.TryORA ( OraSession )

   OraDatabase.ExecuteSQL _
   "BEGIN   PK_WORK_IN_PROGRESS.REMOVE_PACKAGE ( :PV_ID, :RTAG_ID, :USER_ID );   END;"

   If Err.Number = 0 Then
      OraDatabase.Parameters.Remove "RTAG_ID"
      OraDatabase.Parameters.Add "RTAG_ID", destination_RtagId, ORAPARM_INPUT, ORATYPE_NUMBER

      OraDatabase.ExecuteSQL _
      "BEGIN   PK_WORK_IN_PROGRESS.ADD_PACKAGE ( :PV_ID, :VIEW_ID, :RTAG_ID, :USER_ID );   END;"
   End If

   objEH.CatchORA ( OraSession )

   OraDatabase.Parameters.Remove "RTAG_ID"
   OraDatabase.Parameters.Remove "PV_ID"
   OraDatabase.Parameters.Remove "USER_ID"
   OraDatabase.Parameters.Remove "VIEW_ID"

End Sub

%>
<%
' get pkgInfoHash items for the source WIP
Call Get_Pkg_Info_From_Rel ( parRtag_id, parPv_id )

' Make sure this WIP can be moved - prevent if it has a pending test build instruction, etc
If (DaemonInstructionPreventsEditing(Request("rtag_id"), Request("pv_id"))) Then
   Call RaiseMsgInParent(enum_MSG_ERROR, "This WIP has one or more daemon instructions present.<br><br>"&_
                                         "Please delete them or allow them to be consumed before attempting to move the WIP.")
   Call CloseWindow
Else
   ' check for form submission
   If CBool(QStrPar("action")) AND (QStrPar("btn") = "Move") AND objAccessControl.UserLogedIn Then
      'Process submition
      Call MoveWip(parRtag_id, parNewRtag_id, parPv_id, pkgInfoHash.Item("view_id"))
      Call OpenInParentWindow (parRfile &"?pv_id="& parPv_id &"&rtag_id="& parNewRtag_id )
      Call CloseWindow
   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

%>

<html>
<head>
<title>Release Manager</title>
<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" type="text/css">
<link rel="stylesheet" href="images/navigation.css" type="text/css">
<script language="JavaScript" src="images/tipster.js"></script>
<script language="JavaScript" src="images/_help_tips.js"></script>
<script language="JavaScript" src="images/common.js"></script>
</head>

<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" onload="self.focus();">
<form name="chgroup" method="post" action="<%=scriptName%>">
   <table width="100%" border="0" cellspacing="0" cellpadding="2" height="100%">
      <tr>
         <td background="images/lbox_bg_orange.gif" width="1%" height="1%"><img src="images/i_change_group_off.gif" width="22" height="25" hspace="5"></td>
         <td background="images/lbox_bg_blue.gif" nowrap width="50%" class="wform_ttl">&nbsp;Move WIP To Another Release</td>
         <td background="images/lbox_bg_blue.gif" align="right" width="50%">
            <%If NOT bPreventSubmit Then%>
               <input type="submit" name="btn" value="Move" class="form_btn_comp">
            <%End If%>
            <input type="reset" name="btn" value="Cancel" class="form_btn_comp" onclick="self.close()">
         </td>
         <td background="images/lbox_bg_blue.gif" align="right" width="1%%" nowrap>
            <img src="images/h_trsp_dot.gif" width="5" height="22">
         </td>
      </tr>
      <tr>
         <td height="100%" width="1%">&nbsp;</td>
         <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%"><img src="images/h_trsp_dot.gif" width="10" height="30"></td>
                  <td width="1%" nowrap class="form_group" valign="bottom">WIP Details</td>
                  <td nowrap width="100%">&nbsp; </td>
               </tr>
               <tr>
                  <td width="1%">&nbsp;</td>
                  <td width="1%" nowrap class="form_field" background="images/bg_form_lightbluedark.gif">Package<a href="#" onMouseOver="formTips.show('group')" onMouseOut="formTips.hide()"></a></td>
                  <td nowrap width="100%" background="images/bg_form_lightbluedark.gif" class="form_txt">
                     <%=pkgInfoHash.Item("pkg_name")%>
                  </td>
               </tr>
               <tr>
                  <td width="1%">&nbsp;</td>
                  <td width="1%" nowrap class="form_field" background="images/bg_form_lightbluedark.gif">Version<a href="#" onMouseOver="formTips.show('group')" onMouseOut="formTips.hide()"></a></td>
                  <td nowrap width="100%" background="images/bg_form_lightbluedark.gif" class="form_txt">
                     <%=pkgInfoHash.Item("pkg_version")%>
                  </td>
               </tr>
               <tr>
                  <td width="1%">&nbsp;</td>
                  <td width="1%" nowrap class="form_field" background="images/bg_form_lightbluedark.gif">View<a href="#" onMouseOver="formTips.show('group')" onMouseOut="formTips.hide()"></a></td>
                  <td nowrap width="100%" background="images/bg_form_lightbluedark.gif" class="form_txt">
                     <%=pkgInfoHash.Item("view_name")%>
                  </td>
               </tr>

               <tr>
                  <td width="1%"><img src="images/h_trsp_dot.gif" width="10" height="30"></td>
                  <td width="1%" nowrap class="form_group" valign="bottom">Select Destination Release</td>
                  <td nowrap width="100%">&nbsp; </td>
               </tr>
               <tr>
                  <td width="1%">&nbsp;</td>
                  <%=Get_Projects(parProj_id)%>
                  <td nowrap width="100%">&nbsp; </td>
               </tr>
               <tr>
                  <td width="1%">&nbsp;</td>
                  <%=Get_Releases(parProj_id, parNewRtag_id)%>
                  <td nowrap width="100%">&nbsp; </td>
               </tr>

               <tr>
                  <td width="1%">&nbsp;</td>
                  <td width="1%" nowrap class="form_field"><img src="images/h_trsp_dot.gif" width="100" height="10"></td>
                  <td nowrap width="100%">&nbsp; </td>
                  <input type="hidden" name="pv_id" value="<%=parPv_id%>">
                  <input type="hidden" name="rtag_id" value="<%=parRtag_id%>">
                  <input type="hidden" name="new_rtag_id" value="<%=parNewRtag_id%>">
                  <input type="hidden" name="view_id" value="<%=pkgInfoHash.Item("view_id")%>">
                  <input type="hidden" name="rfile" value="<%=parRfile%>">
                  <input type="hidden" name="action" value="true">
               </tr>
            </table>
         </td>
      </tr>
      <tr>
         <td height="100%" width="1%">&nbsp;</td>
         <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%" wrap class="form_group" valign="bottom">
                     WARNING:<br>
                     The destination release may not satisfy any or all the dependencies that come with
                     the WIP you are about to move. It is your responsibility to rectify this in the
                     destination release.
                  </td>
               </tr>
            </table>
         </td>
      </tr>

      <tr>
         <td height="1%" width="1%"><img src="images/h_trsp_dot.gif" width="5" height="5"></td>
         <td valign="top" nowrap colspan="3" class="wform_ttl" background="images/lbox_bg_blue.gif"></td>
      </tr>
   </table>
</form>
<!-- TIPS LAYERS -------------------------------------->
<div id="formTipsLayer" style="position: absolute; z-index: 1000; visibility: hidden; left:0; top: 0; width: 10">&nbsp;</div>
<!----------------------------------------------------->
</body>
</html>


<!-- DESTRUCTOR ------->
<!--#include file="common/destructor.asp"-->