Subversion Repositories DevTools

Rev

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

<%@LANGUAGE="VBSCRIPT"%>
<%
Option explicit
Response.Expires = 0   ' always load the page, dont store
%>
<%
'=====================================================
'               Change Owner
'=====================================================
%>
<!--#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/formating.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 parPPv_id ' pv_id of parent
'Dim parRtag_id
Dim parRfile
Dim parView_id
Dim parBase_view_id
Dim bPreventSubmit
'------------ Constants Declaration -----------
'------------ Constants Declaration -----------
Const imgPkgLocked = "<img src='images/i_locked.gif' width='7' height='10' hspace='4' align='absmiddle'>"
Const imgPkgLockSpacer = "<img src='images/spacer.gif' width='7' height='10' hspace='4' align='absmiddle'>"
'------------ Variable Init -------------------
Set pkgInfoHash = CreateObject("Scripting.Dictionary")
parPv_id = QStrPar("pv_id")
parPPv_id = QStrPar("ppv_id")
parRtag_id = QStrPar("rtag_id")
parRfile = Request("rfile")
parView_id = QStrPar("view_id")
parBase_view_id = QStrPar("base_view_id")
bPreventSubmit = false
'----------------------------------------------
%>
<%
Sub Get_Pkg_Information ( NNpv_id)
   Dim rsTemp, Query_String

   Query_String = _
   " SELECT pkg.pkg_id, pkg.pkg_name, pv.pkg_version, pv.dlocked,pv.modified_stamp,um.full_name as modifier,pv.created_stamp,uc.full_name as creator"&_
   "   FROM packages pkg, package_versions pv, users um, users uc"&_
   "  WHERE pkg.pkg_id = pv.pkg_id"&_
   "    AND pv.modifier_id = um.user_id (+)" &_
   "    AND pv.creator_id = uc.user_id (+)" &_
   "    AND pv.pv_id = "& NNpv_id

   Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))

   If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) Then
      pkgInfoHash.Add "pkg_id", (rsTemp.Fields("pkg_id"))
      pkgInfoHash.Add "pkg_name", (rsTemp.Fields("pkg_name"))
      pkgInfoHash.Add "pkg_version", (rsTemp.Fields("pkg_version"))
      pkgInfoHash.Add "dlocked", (rsTemp.Fields("dlocked"))
      pkgInfoHash.Add "modified_stamp", (rsTemp.Fields("modified_stamp"))
      pkgInfoHash.Add "modifier", (rsTemp.Fields("modifier"))
      pkgInfoHash.Add "created_stamp", (rsTemp.Fields("created_stamp"))
      pkgInfoHash.Add "creator", (rsTemp.Fields("creator"))
   End If

   rsTemp.Close
   Set rsTemp = nothing
End Sub

'----------------------------------------------
Sub Add_Missing_Dependency(RtagId, pvId, viewId)

   OraDatabase.Parameters.Add "RTAG_ID", 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 )

   ' check if the package already exists in a pending or wip state
   If PackageExists(RtagId, pvId, "planned") Then
     Call RaiseMsg ( enum_WMSG_ERROR, "Package " & pkgInfoHash.Item ("pkg_name") & " " & pkgInfoHash.Item ("pkg_version") & " already exists in a pending state")
   ElseIf PackageExists(RtagId, pvId, "work_in_progress") Then
     Call RaiseMsg ( enum_WMSG_ERROR, "Package " & pkgInfoHash.Item ("pkg_name") & " " & pkgInfoHash.Item ("pkg_version") & " already exists as a WIP")
   End If

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

   If Err.Number = 0 Then
     OraDatabase.ExecuteSQL _
     "BEGIN   PK_RELEASE.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

Function Release_Groups ( SSrtag_id, SSpkg_id )
        Release_Groups = _
    "SELECT vi.view_id, vi.view_name, bv.hint"&_
    "  FROM views vi,"&_
    "  ("&_
    "    SELECT DISTINCT rc.BASE_VIEW_ID, '>&nbsp;' AS hint"&_
    "    FROM release_content rc,"&_
    "         package_versions pv"&_
    "    WHERE rc.pv_id = pv.pv_id"&_
    "    AND pv.pkg_id IN (" & SSpkg_id & ")"&_
    "  ) bv "&_
    "WHERE"&_
    "   UPPER(vi.base_view) = 'Y'"&_
    "   AND bv.BASE_VIEW_ID (+) = vi.VIEW_ID "&_
    "ORDER BY vi.view_name ASC"

End Function

%>
<%
'Process submition
If CBool(QStrPar("action")) AND  objAccessControl.UserLogedIn Then
   Call Add_Missing_Dependency(parRtag_id,parPv_id,parView_id)
   Call OpenInParentWindow ( "dependencies.asp?pv_id="& parPPv_id &"&rtag_id="& parRtag_id )
   Call CloseWindow

End If
%>
<%
Call Get_Pkg_Information ( parPv_id)
%>
<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="addmissingdep" 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_add_deps.gif" width="22" height="25" hspace="5"></td>
         <td background="images/lbox_bg_blue.gif" nowrap width="50%" class="wform_ttl">&nbsp;Add Missing Dependency</td>
         <td background="images/lbox_bg_blue.gif" align="right" width="50%">
            <input type="submit" name="btn" value="Add" style="width:50" class="form_btn_comp">
            <input type="reset" name="btn" value="Cancel" style="width:50" 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">Details of Dependency that will be Added:</td>
                  <td nowrap width="100%">&nbsp; </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</td>
                  <td nowrap width="100%" background="images/bg_form_lightbluedark.gif" class="form_txt">
                     <%=imgPkgLockSpacer%>
                     <%=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</td>
                  <td nowrap width="100%" background="images/bg_form_lightbluedark.gif" class="form_txt">
                     <%If pkgInfoHash.Item("dlocked") = "Y" Then%><%=imgPkgLocked%><%Else%><%=imgPkgLockSpacer%><%End If%>
                     <%=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">Last Modified</td>
                  <td nowrap width="100%" background="images/bg_form_lightbluedark.gif" class="form_txt">
                     <%=imgPkgLockSpacer%>
                     <%=EuroDateTime(pkgInfoHash.Item ("modified_stamp")) & " by " & pkgInfoHash.Item ("modifier")%>
                  </td>
               </tr>
               <tr>
                  <td width="1%">&nbsp;</td>
                  <td width="1%" nowrap class="form_field" background="images/bg_form_lightbluedark.gif">Created</td>
                  <td nowrap width="100%" background="images/bg_form_lightbluedark.gif" class="form_txt">
                     <%=imgPkgLockSpacer%>
                     <%=EuroDateTime(pkgInfoHash.Item ("created_stamp")) & " by " & pkgInfoHash.Item ("creator")%>
                  </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 View</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" valign=top>Base View</td>
                 <td nowrap width="100%" background="images/bg_form_lightbluedark.gif">
                   <table border=0 cellpadding=0 cellspacing=0 class="rep_small">
                     <tr>
                       <td>
                                 <select name="view_id" class="form_item">
                           <option></option>
                 <%
                   Dim iDefault_View_id: iDefault_View_id = -1
                   If Not IsNull(parBase_view_id) Then iDefault_View_id = parBase_view_id
                               Dim rsRelGroups
                   Dim bSelected: bSelected=False
                               Set rsRelGroups = OraDatabase.DbCreateDynaset( Release_Groups( parRtag_id,pkgInfoHash.Item ("pkg_id")), cint(0))
                               While ((NOT rsRelGroups.BOF) AND (NOT rsRelGroups.EOF))
                     If (NOT IsNull(rsRelGroups("hint"))) AND (NOT bSelected) Then
                       Response.write "<option selected value='"& rsRelGroups("view_id") &"'>"& rsRelGroups("hint") & rsRelGroups("view_name") &"</option>"
                       bSelected=True
                     Else
                       Response.write "<option value='"& rsRelGroups("view_id") &"'>"& rsRelGroups("hint") & rsRelGroups("view_name") &"</option>"
                     End If
                     rsRelGroups.MoveNext
                               WEnd
                               rsRelGroups.Close
                               set rsRelGroups = nothing
                             %>
                                     </select>
                       </td>
                     </tr>
                     <tr>
                       <td>
                         NOTE: '>' is a suggestion of where to place this dependency.
                         It denotes views where it has been placed in other releases.
                       </td>
                     </tr>
                   </table>
                 </td>
               </tr>
               <tr>
                  <input type="hidden" name="pv_id" value="<%=parPv_id%>">
                  <input type="hidden" name="rtag_id" value="<%=parRtag_id%>">
                  <input type="hidden" name="ppv_id" value="<%=parPPv_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
                     this dependency you are about to add. 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"-->