Subversion Repositories DevTools

Rev

Rev 5952 | Rev 5983 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<%@LANGUAGE="VBSCRIPT"%>
<%
'=====================================================
'   sdk_add_release
'   Add and SDK to a given Release
'   Called with two parameters
'   The page will either:
'       add the SDKTAG to the Release - and then redirect to the dependencies tab
'   or
'       Fail in adding the SDK to the Release - and display a page of conflicting package-versions
'  
'=====================================================
%>
<%
Option explicit
' Good idea to set when using redirect
Response.Expires = 0   ' always load the page, dont store
Const allowNoPackage = TRUE   ' Allow page display without pvid being present
Const showReleaseSdk = TRUE   ' Show the Release SDK div
%>

<!--#include file="common/conf.asp"-->
<!--#include file="common/globals.asp"-->
<!--#include file="common/formating.asp"-->
<!--#include file="common/qstr.asp"-->
<!--#include file="common/common_subs.asp"-->
<!--#include file="common/common_dbedit.asp"-->
<!--#include file="common/_package_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 sdkAdded
Dim rsQry
Dim rsView
'------------ Constants Declaration -----------
'------------ Variable Init -------------------
sdkAdded = FALSE
Set pkgInfoHash = CreateObject("Scripting.Dictionary")
'----------------------------------------------
%>
<%
'-------------------------------------------------
' Function:     AddReleaseSDK    
' Description:  Add the nominated sdktag to the release
' Args:         dMode. 0: No Delete, 1:Delete non-sdk packages
' Returns:      Number of Packages Inserted
'                < 0 - Error. Conflict list populated
'                      rsView is set to a list of PV_ID that cause the conflict
'                = 0 - No packages inserted
'                > 0 - Number of packages inserted 

Function AddReleaseSDK   ( nRtagId, nSdktagId, dMode  )
    OraDatabase.Parameters.Add "RTAG_ID",        nRtagId,                   ORAPARM_INPUT, ORATYPE_NUMBER
    OraDatabase.Parameters.Add "SDKTAG_ID",      nSdktagId,                 ORAPARM_INPUT, ORATYPE_NUMBER
    OraDatabase.Parameters.Add "USER_ID",        objAccessControl.UserId,   ORAPARM_INPUT, ORATYPE_NUMBER
    OraDatabase.Parameters.Add "DMODE",          dMode,                     ORAPARM_INPUT, ORATYPE_NUMBER
    OraDatabase.Parameters.Add "INSERT_COUNT",   NULL,                      ORAPARM_OUTPUT, ORATYPE_NUMBER
    OraDatabase.Parameters.Add "CONFLICT_LIST",  NULL,                      ORAPARM_OUTPUT, ORATYPE_CURSOR

    objEH.TryORA ( OraSession )
    On Error Resume Next

    OraDatabase.ExecuteSQL _
    " BEGIN "&_
    "    PK_RELEASE.ADD_RELEASE_SDK ( :RTAG_ID, :SDKTAG_ID, :USER_ID, :DMODE, :INSERT_COUNT, :CONFLICT_LIST ); "&_
    " END; "

    objEH.CatchORA ( OraSession )

     '  INSERT_COUNT < 0 - Error. Conflict list populated
     '  INSERT_COUNT = 0 - No packages inserted
     '  INSERT_COUNT > 0 - Number of packages inserted 
     AddReleaseSDK = OraDatabase.Parameters("INSERT_COUNT").Value

    ' NULL Conflict list indicates that the operation did not fail
    ' There may have been no items to insert 
    If NOT isNull(OraDatabase.Parameters("CONFLICT_LIST").Value) Then
        Set rsView = OraDatabase.Parameters("CONFLICT_LIST").Value
        AddReleaseSDK = -1
    End If

    OraDatabase.Parameters.Remove "RTAG_ID"
    OraDatabase.Parameters.Remove "SDKTAG_ID"
    OraDatabase.Parameters.Remove "USER_ID"
    OraDatabase.Parameters.Remove "DMODE"
    OraDatabase.Parameters.Remove "INSERT_COUNT"
    OraDatabase.Parameters.Remove "CONFLICT_LIST"
End Function
%>
<%
'-----------------------  MAIN LINE  ---------------------------

'------ ACCESS CONTROL ----------
If NOT canShowControlInProject("AddSdk") Then
    Call RaiseMsg(enum_MSG_ERROR, "User not authorized to add an SDK.<br>User login may have expired.")
End If
'--------------------------------

If (Request("rtag_id") <> "")  AND  (Request("sdktag_id") <> "") AND  (Request("dmode") <> "") Then

   '--- Process submition ---
   sdkAdded = AddReleaseSDK ( Request("rtag_id"), Request("sdktag_id"), Request("dmode")  )

   If sdkAdded >= 0 Then
      Call Destroy_All_Objects
      Response.Redirect( "dependencies.asp?rtag_id="& Request("rtag_id") )
   End If

Else

   Err.Raise 8, "This page requires more paramaters to run.<br>"& objPMod.ComposeURL()

End If

'-------------------------------------------------
' Function:     GetPackageInfo
' Description:  Build up a hash of the required package information for  the display
'               Start with the results of one query that is a list of pv_ids
Sub GetPackageInfo
   Dim listPvid : listPvid = ""
   Dim joiner : joiner = ""
   Dim rsTemp, sqlStr
   Dim nRtagId : nRtagId = Request("rtag_id")

   '    Build up a list of pv_id's to process

    While ((NOT rsView.BOF) AND (NOT rsView.EOF))
        listPvid = listPvid & joiner & rsView(0)
        joiner = ", "
    rsView.MoveNext
    WEnd

    sqlStr = "Select pv.pv_id, pv.pkg_version, p.pkg_name, NVL(rc.sdktag_id,0) as sdktag_id, sn.sdk_name || '::' || st.sdktag_name as sdk_name" &_
             " FROM RELEASE_CONTENT rc, PACKAGE_VERSIONS pv, PACKAGES p, SDK_TAGS st, SDK_NAMES sn" &_
             " WHERE rc.pv_id = pv.pv_id" &_
             " AND st.SDKTAG_ID(+) = rc.SDKTAG_ID" &_
             " AND st.SDK_ID = sn.SDK_ID(+)" &_
             " AND pv.PKG_ID = p.PKG_ID" &_
             " AND rc.rtag_id = :RTAG_ID " &_
             " AND pv.pv_id in ("&listPvid&")" &_
             " ORDER BY UPPER(p.pkg_name)"

    OraDatabase.Parameters.Add "RTAG_ID",        nRtagId,       ORAPARM_INPUT, ORATYPE_NUMBER

    Set rsTemp = OraDatabase.DbCreateDynaset( sqlStr, 0 )
      Do Until ((rsTemp.BOF) OR (rsTemp.EOF))
         Response.Write "<tr>"
         Response.Write "<td>"        
         If rsTemp("sdktag_id") <> 0 Then Response.Write enum_imgSdkImport        
         Response.Write "<td nowrap>" & rsTemp("pkg_name")         
         Response.Write "<td nowrap>" & rsTemp("pkg_version")         
         Response.Write "<td>"         
         If rsTemp("sdktag_id") <> 0 Then Response.Write rsTemp("sdk_name")         
         Response.Write "<td>"         
         If rsTemp("sdktag_id") = 0 Then Response.Write "<img src='images/i_delete_disable.gif' width='13' height='12' hspace='2' border='0' title='Delete this package from the Release'>"         
         Response.Write "</tr>"          
         rsTemp.MoveNext
      Loop
    rsTemp.Close
    Set rsTemp = nothing

    OraDatabase.Parameters.Remove "RTAG_ID"
End Sub
'----------------------------------------------------------------
'
'   The body of this page will be displayed only if an error in the insertion process
'   occured. Not packages will have been inserted as the transaction will have been
'   rolled back. We have a list if PV_ID's that conflicted
'
'   Generate a display showing:
'       Conflicting package name and version
'       If the package is imported via an SDK - then highlight this
'       If the package is not, then allow the user to delete the package-version from the release
%>
<html>
<head>
<title><%=Title(Request("rtag_id"))%></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" type="text/css">
<link rel="stylesheet" href="images/navigation.css" type="text/css">
<script language="JavaScript" src="images/common.js"></script>
<script language="JavaScript" src="scripts/remote_scripting.js"></script>
<!--#include file="_jquery_includes.asp"-->
<!-- TIPS -->
<script language="JavaScript" src="images/tipster.js"></script>
<script language="JavaScript" src="images/_help_tips.js"></script>

<!-- DROPDOWN MENUS -->
<!--#include file="_menu_def.asp"-->
<script language="JavaScript1.2" src="images/popup_menu.js"></script>
</head>
<body bgcolor="White" text="Black" leftmargin=0 topmargin=0>
<!-- MENU LAYERS -------------------------------------->
<div id="popmenu" class="menuskin" onMouseover="clearhidemenu();highlightmenu(event,'on')" onMouseout="highlightmenu(event,'off');dynamichide(event)"></div>
<!-- TIPS LAYERS -------------------------------------->
<div id="formTipsLayer" style="position: absolute; z-index: 1000; visibility: hidden; left:0; top: 0; width: 10">&nbsp;</div>
<!----------------------------------------------------->
<!-- HEADER -->
<!--#include file="_header.asp"-->
<!-- BODY ---->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
                <td valign="top" width="1" background="images/bg_bage.gif">
                <!-- LEFT -->
                <!--#include file="_environment.asp"-->
                </td>
                <td width="1" bgcolor="#999999"><img src="images/h_trsp_dot.gif" width="1" height="1"></td>
                <td valign="top" width="100%" class="form_item_grey">
                <!-- MIDDLE -->
            <table width="100%" height="98%"  border="0" cellpadding="0" cellspacing="0">
               <tr>
                  <td align="center" valign="middle" class="form_item_grey">
                     <table width="70%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                           <td>
                              <table class="full_table rounded_box" bgcolor="#FFFFFF" style="margin-top: 30px;">
                                 <tr>
                                    <td width="10px"></td>
                                    <td valign="top">
                                       <!-- Body -->
                                       <table class="full_table">
                                             <tr>
                                                <td width="10px" height=10"px"></td>
                                             </tr>
                                             <tr>
                                                <td nowrap class="form_field">
                                                   <table class="full_table form_item_grey" style="border-spacing: 1px 1px;">
                                                      <tr>
                                                         <td colspan=5 class="form_field_bg"><p class="err_ttl">Import SDK. Conflicting Packages</p></td>
                                                      </tr>
                                                      <tr class="form_field form_field_bg">
                                                          <td width="15px"></td>
                                                          <td width="1%">Name</td>
                                                          <td>Version</td>
                                                          <td>SDK</td>
                                                          <td width="1%"></td>
                                                      </tr>
                                                      <tr>
                                                        <% Call GetPackageInfo %>
                                                      </tr>
                                                      <tr>
                                                         <td colspan=5>&nbsp;</td>
                                                      </tr>
                                                      <tr>
                                                         <td colspan=5 class="form_field_hdr">
                                                            The SDK was not imported
                                                          </td>
                                                      </tr>
                                                   </table>
                                                </td>
                                             </tr>
                                             <tr>
                                                <td height="10px"></td>
                                       </table>
                                       <!-- END Body-->
                                    </td>
                                    <td width="10px"></td>
                                 </tr>
                              </table>
                           </td>
                        </tr>
                     </table>
                  </td>
               </tr>
            </table>
        <!-- End MIDDLE -->
                </td>
        </tr>
</table>
<!-- FOOTER -->
<!--#include file="_footer.asp"-->
</body>
</html>