Subversion Repositories DevTools

Rev

Blame | Last modification | View Log | RSS feed

<%@LANGUAGE="VBSCRIPT"%>
<%
Option explicit
Response.Expires = 0   ' always load the page, dont store
%>
<%
'=====================================================
'   _wform_change_eref.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 parPv_id
Dim sMessage, sMessageType
'------------ Constants Declaration -----------
'------------ Variable Init -------------------
Set pkgInfoHash = CreateObject("Scripting.Dictionary")
parPv_id = QStrPar("pv_id")
sMessage = NULL
sMessageType = 3
'----------------------------------------------
%>
<%
'------------------------------------------------------------------------------------------------------------------------------------------
'
' Add a line of text to the System Message
'   eLevel - 1 == Critical, 2==Warning, 3==Note
Sub sMessageAdd(eLevel, text)
    If NOT isNull(sMessage) Then
        sMessage = sMessage & "<br>"
    End If
    sMessage = sMessage & text

    If eLevel < sMessageType  Then
        sMessageType = eLevel
    End If
End Sub

Sub Get_Pkg_Info_With_Eref ( NNpv_id )
   Dim rsTemp, Query_String

   Query_String = _
   " SELECT pkg.pkg_name, pv.pkg_version, pe.eref"&_
   "   FROM packages pkg, package_versions pv, package_eref pe"&_
   "  WHERE pkg.pkg_id = pv.pkg_id"&_
   "    AND pv.pv_id = "& NNpv_id &_
   "    AND pe.pv_id(+) = pv.pv_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 "eref", (rsTemp.Fields("eref"))
   End If

   rsTemp.Close
   Set rsTemp = nothing
End Sub


Sub Update_Eref ( NNpv_id, erefText )
   Dim rsTemp, Query_String, sComments

   'If the entry is empty then delete the table element
   If erefText = "" Then
       Delete_Eref(NNpv_id)
       Exit Sub
   End If

   '-- Update database to change the eRef
   objEH.TryORA ( OraSession )
   On Error Resume Next

   Query_String = _
        "MERGE INTO PACKAGE_EREF pe" &_
        " USING (SELECT "& NNpv_id & " pv_id, '"& erefText & "' eref from dual) s" &_
        " ON (pe.pv_id = s.pv_id)" &_
        " WHEN MATCHED THEN UPDATE SET pe.eref = s.eref" &_
        " WHEN NOT MATCHED THEN INSERT (pv_id, eref) VALUES (s.pv_id, s.eref)"

   OraDatabase.ExecuteSQL Query_String

   objEH.CatchORA ( OraSession )

   If objEH.LastOraFailed = FALSE Then
        '-- Log the change
        sComments = "Set: "& erefText
        call Log_Action ( NNpv_id, "eref_change", sComments )
   End If

   rsTemp.Close
   Set rsTemp = nothing
End Sub

'-------------------------------------------------
' Function:     Delete_Eref
' Description:  Delete a Package external Reference
'
Sub Delete_Eref ( NNpv_id )
   Dim rsTemp, Query_String, sComments

   '-- Update database to change the eRef
   objEH.TryORA ( OraSession )
   On Error Resume Next

   Query_String = _
        "DELETE FROM PACKAGE_EREF pe" &_
        " WHERE PV_ID = " & NNpv_id

   OraDatabase.ExecuteSQL Query_String

   objEH.CatchORA ( OraSession )

   If objEH.LastOraFailed = FALSE Then
        '-- Log the change
        sComments = "Deleted"
        call Log_Action ( NNpv_id, "eref_change", sComments )
    Else
        bOraError = TRUE
   End If

   rsTemp.Close
   Set rsTemp = nothing
End Sub

%>
<%
'Process submition
If CBool(QStrPar("action")) AND objAccessControl.UserLogedIn Then
   Call Update_Eref ( parPv_id, Request("eref") )
   If isNULL(sMessage) AND NOT objEH.LastOraFailed Then
       Call ReloadParentWindow
       Call CloseWindow
   End If
End If
%>
<%
Call Get_Pkg_Info_With_Eref ( parPv_id )
%>
<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">
         <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
         <%Call Messenger ( sMessage , sMessageType, "100%" )%>
         <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
         <!--#include file="messages/_msg_inline.asp"-->
        <table width="100%" border="0" cellspacing="1" cellpadding="2">
          <tr>
            <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">
              <%=pkgInfoHash.Item ("pkg_name") &" "& pkgInfoHash.Item ("pkg_version")%></td>
          </tr>
          <tr>
            <td width="1%" nowrap class="form_field" background="images/bg_form_lightbluedark.gif">External Reference</td>
            <td nowrap width="100%" background="images/bg_form_lightbluedark.gif">
            <input type="text" name="eref" value='<%=pkgInfoHash.Item ("eref")%>' size='60' max=500>
            <input type="hidden" name="pv_id" value="<%=parPv_id%>">
            <input type="hidden" name="rtag_id" value="<%=parRtag_id%>">
            <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"-->