Subversion Repositories DevTools

Rev

Rev 4358 | Blame | Last modification | View Log | RSS feed

<%@LANGUAGE="VBSCRIPT"%>
<%
Option explicit
Response.Expires = 0    ' always load the page, dont store
%>
<%
'=====================================================
'                                       Import Release
'=====================================================
%>
<!--#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 parFRrtag_id    ' Current Release
Dim parFRproj_id    ' Selected Project
Dim hasDaemons      ' Current Release Has daemons configured 
Dim importHasDaemons   ' Selected Import has daemons configured

'------------ Constants Declaration -----------
'------------ Variable Init -------------------
parFRrtag_id = QStrPar("FRrtag_id")
parFRproj_id = QStrPar("FRproj_id")

If parFRproj_id = "" Then parFRproj_id = -1
'----------------------------------------------
%>
<%
'--------------------------------------------------------------------------------------------------------------------------
Sub Get_ProjectList ( nProjId )
        Dim rsQry,tempLINK
                
        OraDatabase.Parameters.Add "PROJ_ID", nProjId,  ORAPARM_INPUT, ORATYPE_NUMBER
        
        Set rsQry = OraDatabase.DbCreateDynaset( GetQuery("ProjectsCombo.sql"), ORADYN_DEFAULT )
        
        If NOT ((NOT rsQry.BOF) AND (NOT rsQry.EOF) ) Then
       If (nProjId > 0) Then
        Err.Raise 8, "Sub Get_ProjectList", "Empty record set returned. nProjId="& nProjId
       End If
        End If
        
    Response.write "<select name='FRproj_id' onChange=""MM_jumpMenu('parent',this,0)"" class='form_item'>"
    Response.write "<option value=''>Select Project</option>"
    While ((NOT rsQry.BOF) AND (NOT rsQry.EOF))
        tempLINK = scriptName &"?FRproj_id="& rsQry.Fields("proj_id") & "&"& objPMod.ComposeURL()
        Response.write "<option value='"& tempLINK &"'" &rsQry.Fields("SELECTED") &">"& (rsQry.Fields("proj_name")) &"</option>"
        rsQry.MoveNext
    WEnd
        Response.write "</select>"
        
     OraDatabase.Parameters.Remove "PROJ_ID"
     rsQry.Close
     Set rsQry = Nothing

End Sub

'--------------------------------------------------------------------------------------------------------------------------
Sub Get_ReleaseList ( nProjId, nRtagId )
        Dim rsQry,tempLINK
        
        OraDatabase.Parameters.Add "PROJ_ID", nProjId,  ORAPARM_INPUT, ORATYPE_NUMBER
        OraDatabase.Parameters.Add "RTAG_ID", nRtagId,  ORAPARM_INPUT, ORATYPE_NUMBER 
        
        Set rsQry = OraDatabase.DbCreateDynaset( GetQuery("ReleasesCombo.sql"), ORADYN_DEFAULT )
        
        If NOT ((NOT rsQry.BOF) AND (NOT rsQry.EOF) ) Then
        If (nProjId > 0) Then
                    Err.Raise 8, "Sub Get_ReleaseList", "Empty record set returned. nProjId="& nProjId
        End If
        End If
        
     Response.write "<select name='FRrtag_id' onChange=""MM_jumpMenu('parent',this,0)"" class='form_item'>"
     Response.write "<option value=''>Select Release</option>"
     While ((NOT rsQry.BOF) AND (NOT rsQry.EOF))
         tempLINK = scriptName & "?FRproj_id="& nProjId &"&FRrtag_id="& rsQry.Fields("rtag_id") & "&"& objPMod.ComposeURL()
         Response.write "<option value='"& tempLINK &"'" &rsQry.Fields("SELECTED") &">"& (rsQry.Fields("rtag_name")) &"</option>"
         rsQry.MoveNext
     WEnd
     Response.write "</select>"

        OraDatabase.Parameters.Remove "RTAG_ID"
        OraDatabase.Parameters.Remove "PROJ_ID"
        
        rsQry.Close
        Set rsQry = Nothing
End Sub

'--------------------------------------------------------------------------------------------------------------------------
Function check_for_daemons(nRtagId, DefVal)
    Dim sqlStr, rsQry
    If nRtagId <> "" Then
        sqlStr = "SELECT RCON_ID from RELEASE_CONFIG rc WHERE rc.rtag_id = :RTAG_ID"
        OraDatabase.Parameters.Add "RTAG_ID", nRtagId, ORAPARM_INPUT, ORATYPE_NUMBER 
        
        Set rsQry = OraDatabase.DbCreateDynaset( sqlStr, ORADYN_DEFAULT )
        
        If rsQry.BOF OR rsQry.EOF Then
            check_for_daemons = False
        Else
            check_for_daemons = True
        End If

        OraDatabase.Parameters.Remove "RTAG_ID"
        
        rsQry.Close
        Set rsQry = Nothing
    Else
        check_for_daemons = DefVal
    End If

End Function
'--------------------------------------------------------------------------------------------------------------------------
Sub importDaemons( NSrcRtag_id, NDstRtag_id) 
    If (NSrcRtag_id <> "") AND (NDstRtag_id <> "") Then
        ' All mandatory parameters FOUND
        ' COMPLETE THE REQUEST...

        On Error Resume Next
        objEH.ErrorRedirect = TRUE
        
        OraDatabase.Parameters.Add "FROMRTAG_ID", NSrcRtag_id,   ORAPARM_INPUT, ORATYPE_NUMBER 
        OraDatabase.Parameters.Add "TORTAG_ID",   NDstRtag_id,   ORAPARM_INPUT, ORATYPE_NUMBER 
        OraDatabase.Parameters.Add "USER_ID",     objAccessControl.UserId,    ORAPARM_INPUT, ORATYPE_NUMBER 
        
        
        objEH.TryORA ( OraSession )
        
        ' Remove old Work in Progress Contents
        OraDatabase.ExecuteSQL "BEGIN  PK_BUILDAPI.IMPORT_DAEMONS (:FROMRTAG_ID, :TORTAG_ID, :USER_ID); END;"
        
        objEH.CatchORA ( OraSession )
        
        OraDatabase.Parameters.Remove "FROMRTAG_ID"
        OraDatabase.Parameters.Remove "TORTAG_ID"
        OraDatabase.Parameters.Remove "USER_ID"
        
        
        If objEH.Finally Then
            Response.Redirect("build_status.asp?rtag_id="& NDstRtag_id )
        End If
        
    Else
        Response.write "Some mandatory parameters are missing!" & "<br>" 'TODO
        Response.write QSTR_FullQuery 
    End If
End Sub
'--------------------------------------------------------------------------------------------------------------------------
%>
<%
'Process submition
If CBool(QStrPar("action")) Then
    Call importDaemons(Request.Form("FromRtag_id"),Request("rtag_id"))
        Call CloseWindow
Response.Write "Debug. End of Processing"
Response.End
End If

' Run before render
hasDaemons = check_for_daemons(Request("rtag_id"), False)
importHasDaemons = check_for_daemons(parFRrtag_id, True)
%>
<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/common.js"></script>
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" onload="self.focus();">
<form name="importrel" 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">Import Daemon Configuration</td>
      <td background="images/lbox_bg_blue.gif" align="right" width="50%">
        <%If (NOT hasDaemons) AND (importHasDaemons) Then %>
        <input type="submit" name="btn" value="Import" class="form_btn_comp" onClick="MM_validateForm('FRproj_id','Project','R','FRrtag_id','Release','R');return document.MM_returnValue">
        <%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"></td>
            <td width="100%" class="form_txt">&nbsp;
            <%If hasDaemons Then %>
                <%=enum_imgWarning%>&nbsp;
                The current release already has build daemons configured. It is not possible to import a daemon 
                configuration into this release.
              <%End If%>
            </td>
          </tr>
          <tr> 
            <td width="1%">&nbsp;</td>
            <td width="1%" nowrap class="form_field" background="images/bg_form_lightbluedark.gif">Project</td>
            <td nowrap width="100%" background="images/bg_form_lightbluedark.gif" class="form_txt">
              <%Call Get_ProjectList ( parFRproj_id )%>
            </td>
          </tr>
          <tr> 
            <td width="1%">&nbsp;</td>
            <td width="1%" nowrap class="form_field" background="images/bg_form_lightbluedark.gif">Release</td>
            <td nowrap width="100%" background="images/bg_form_lightbluedark.gif" class="form_txt">
              <%Call Get_ReleaseList ( parFRproj_id, parFRrtag_id )%>
              <%
                If NOT importHasDaemons Then
                    Response.Write enum_imgWarning & "&nbsp;No Daemons in this Release to be imported"   
                End If
                %>
              
                          <input type="hidden" name="rtag_id" value="<%=Request("rtag_id")%>">
                          <input type="hidden" name="FromRtag_id" value="<%=parFRrtag_id%>">
              <input type="hidden" name="action" value="true">
            </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 width="100%" class="form_txt"> 
              <p>Import the build daemon configuration from another release.
              </p>
            </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>
</body>
</html>


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