Subversion Repositories DevTools

Rev

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

<%@LANGUAGE="VBSCRIPT"%>
<%
'=====================================================
'|
'|  wAddDaemonInstructionSimple.asp
'|      Either ripple or test-build the current package
'|      This window has few options
'|
'=====================================================
%>
<%
Option explicit
Response.Expires = 0
%>
<!--#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/_form_window_common.asp"-->
<!--#include file="common/common_dbedit.asp"-->
<!--#include file="common/daemon_instructions.asp"-->
<%
'------------ ACCESS CONTROL ------------------
%>
<!--#include file="_access_control_login_optional.asp"-->
<!--#include file="_access_control_general.asp"-->
<%
'------------ VARIABLE DEFINITION -------------
Dim sMessage, sMessageType
Dim parPv_id
Dim parOp_code
Dim parRfile
Dim bPreventSubmit
Dim ripplePresent, rippleDisable
Dim testPresent, testDisable, testChecked

'------------ CONSTANTS DECLARATION -----------


'------------ VARIABLE INIT -------------------
sMessage = NULL
sMessageType = 3
bPreventSubmit = False

' collect all parameters from query string
parPv_id = Request("pv_id")
parOp_code = Request("op_code")
parRfile = Request("rfile")
Set objFormCollector = CreateObject("Scripting.Dictionary")

'------------ CONDITIONS ----------------------
'----------------------------------------------
%>
<%
'------------------------------------------------------------------------------------------------------------------------------------------
' For the specified Release, get a list of all that release's daemon configurations.
' Return True if at least one daemon configuration was found, else False
'------------------------------------------------------------------------------------------------------------------------------------------
Function DaemonsAvailable(NNrtag_id)
   Dim rsTemp, Query_String

   DaemonsAvailable = True
   Query_String = "SELECT * "&_
                  "  FROM release_config rc"&_
                  " WHERE rc.rtag_id = "& NNrtag_id
        Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))
   If rsTemp.RecordCount = 0 Then
      DaemonsAvailable = False
   End If

   rsTemp.Close
   Set rsTemp = nothing
End Function
'
' Add a lineof text to the System Message
'
Sub sMessageAdd(text)
    If NOT isNull(sMessage) Then
        sMessage = sMessage & "<br>"
    End If
    sMessage = sMessage & text
End Sub
%>
<%
'------------ RUN BEFORE PAGE RENDER ----------

' Make sure we dont have any null strings or empty strings for our parameters
If IsNull(parOp_code) OR parOp_code = "" Then
   parOp_code = "-1"
End If
If IsNull(parRtag_id) OR parRtag_id = "" Then
   parRtag_id = "0"
End If
If IsNull(parRfile) OR parRfile = "" Then
   parRfile = "dependencies.asp"
End If

' Check if form submit is happening
If CBool(Request("action")) Then
    If CInt(parOp_code) >= 0 Then

       Dim RepeatSeconds
       Dim ScheduledDateTime
       Dim ReleaseMode
       Dim sErrorMsg

       ReleaseMode = GetReleaseMode(parRtag_id)

       If NOT objAccessControl.UserLogedIn Then
            sMessage = "User is no longer logged in"
            sMessageType = 1
       ElseIf NOT UserCanAddOrEditThisDaemonInst(DB_PROJ_ID, ReleaseMode, parOp_code) Then
            sMessage = "You have been denied permission to add/update daemon instructions for the specified release."
            sMessageType = 1
       End If

       If isNull(sMessage) Then

           ' do daemon instruction validation, continuing only if it passes
           If ValidateDaemonInstruction(parOp_code, parRtag_id, parPv_id, sErrorMsg) = True Then

             RepeatSeconds = 0
             ScheduledDateTime = ORA_SYSDATETIME

            ' We are adding a new record
             objEH.TryORA ( OraSession )
             On Error Resume Next

             OraDatabase.ExecuteSQL "BEGIN PK_BUILDAPI.insert_daemon_inst( "& parOp_code & ", " &_
                                                                            parRtag_id & ", " &_
                                                                            parPv_id & ", " &_
                                                                            ScheduledDateTime & ", " &_
                                                                            CStr(RepeatSeconds) & ", " &_
                                                                            ORA_SYSDATETIME & ", " &_
                                                                            objAccessControl.UserId & "); END;"
             objEH.CatchORA ( OraSession )
             If objEH.Finally Then
                Call OpenInParentWindow (parRfile & "?rtag_id=" & parRtag_id & "&pv_id=" & parPv_id)
                Call Destroy_All_Objects
                Response.End
             End If
           Else
            sMessage = sErrorMsg
            sMessageType = 1
           End If
       End If
    Else
        sMessage = "No action selected."
        sMessageType = 1
    End If
End If

' Prevent editing if build instruction is already present
testPresent   = DaemonInstructionPresent(parRtag_id, parPv_id, 1 )
ripplePresent = DaemonInstructionPresent(parRtag_id, parPv_id, 0 )

If ripplePresent Then
    rippleDisable = " disabled"
    sMessageAdd "Ripple Instruction already present"
End If

If testPresent Then
    testDisable = " disabled"
    sMessageAdd "Test Instruction already present"
End If

If ripplePresent AND testPresent Then
    bPreventSubmit = true
    If sMessageType = 3 Then
        sMessageType = 2
    End If
End If
'----------------------------------------------
%>
<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 href="images/release_manager_style.css?ver=<%=VixVerNum%>" rel="stylesheet" type="text/css">
      <script language="JavaScript" src="scripts/common.js"></script>
   </head>

   <body leftmargin="0" topmargin="0">
      <table width="600px"  border="0" cellspacing="0" cellpadding="5">
         <%
         '-- FROM START --------------------------------------------------------------------------------------------------------------
         objFormComponent.FormName = "DaemonInstruction"
         objFormComponent.FormClass = "form_tight"
         objFormComponent.Action = ScriptName &_
                                   "?proj_id="& DB_PROJ_ID &_
                                   "&rtag_id="& parRtag_id &_
                                   "&pv_id="  & parPv_id &_
                                   "&rfile="  & parRfile
         objFormComponent.OnSubmit = "ShowProgress();"
         Call objFormComponent.FormStart()
         %>
         <tr>
            <td>
               <!-- MESSAGE ++++++++++++++++++++++++++++++++++++++++++++++ -->
               <%Call Messenger ( sMessage , sMessageType, "100%" )%>
               <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
               <!--#include file="messages/_msg_inline.asp"-->
               <table class="full_table form_item form_field_bg" style="padding: 5;">
                  <tr>
                      <td class="nowrap form_align" >
                        <input type="radio" name="op_code" value="0" <%=rippleDisable%>> Ripple the current package. 
                      <td>This will cause a new package version to be created.<br>All packages that depend on this package will also be rippled.
                  </tr>
                  <tr>
                    <td colspan=2><hr width=80%>
                  </tr>
                  <tr>
                      <td class="nowrap form_align">
                        <input type="radio" name="op_code" value="1" <%=testChecked%><%=testDisable%>> Test Build the current package. 
                       <td>No new version will be created, nor will a build ripple be propagated.<br>This will simply ensure that the current package can be built with<br>the current build machine configuration.
                  </tr>
               </table>
            </td>
          <%
              Dim disableText : disableText = ""
              If NOT (DaemonsAvailable(parRtag_id) AND NOT bPreventSubmit) Then
                  disableText = "disabled=""disabled"""
              End If
          %>
          <tr>
             <td>
                <span  style="float:left"><%=ProgressBar()%></span>
                <button name="btn"  style="float:right" type="reset" onclick="parent.closeIFrame();">Cancel</button>
                <button name="btn"  style="float:right;margin-right: 5px;" type="submit" <%=disableText%> >Add/Update</button>
          </tr>
         <%=objPMod.ComposeHiddenTags()%>
         <input type="hidden" name="action" value="true">
         <input type="hidden" id="rtag_id"     name="rtag_id"      value="<%=parRtag_id%>">
         <input type="hidden" id="pv_id"       name="pv_id"        value="<%=parPv_id%>">
         <input type="hidden" id="rfile"       name="rfile"        value="<%=parRfile%>">
         <%
         Call objFormComponent.FormEnd()
         '-- FROM END ----------------------------------------------------------------------------------------------------------------
         %>
      </table>
   </body>
</html>
<%
'------------ RUN AFTER PAGE RENDER -----------
Set objFormCollector = Nothing
'----------------------------------------------
Call Destroy_All_Objects
%>