Subversion Repositories DevTools

Rev

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

<%@LANGUAGE="VBSCRIPT"%>
<%
'=====================================================
'
'  Build Status Information
'
'=====================================================
%>
<%
Option explicit
' Good idea to set when using redirect
Response.Expires = 0  ' always load the page, dont store
%>
<!--#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="_action_buttons.asp"-->
<!--#include file="class/classActionButtonControl.asp"-->
<!--#include file="common/daemon_instructions.asp"-->
<!--#include file="common/common_daemon.asp"-->
<% '------------ ACCESS CONTROL ------------------ %>
<!--#include file="_access_control_login_optional.asp"-->
<!--#include file="_access_control_general.asp"-->
<!--#include file="_access_control_action_project.asp"-->
<% '------------ Scripts -------------------------- %>
<%
'------------ Variable Definition -------------
Dim objSortHelper
Dim rsQry
Dim parRtagId
Dim query_string
Dim rcon_id
Dim shref_base
'------------ Constants Declaration -----------
'------------ Variable Init -------------------
parRtagId = Request("rtag_id")
objPMod.PersistInQryString("rtag_id")
'----------------------------------------------
Sub IncludePackages()

   On Error Resume Next
   objEH.ErrorRedirect = TRUE
   OraDatabase.Parameters.Add "PV_ID_LIST",  Request("pv_id_list"),  ORAPARM_INPUT, ORATYPE_VARCHAR2
   OraDatabase.Parameters.Add "RTAG_ID",     parRtag_id,  ORAPARM_INPUT, ORATYPE_NUMBER
   OraDatabase.Parameters.Add "USER_ID",     objAccessControl.UserId,  ORAPARM_INPUT, ORATYPE_NUMBER

   objEH.TryORA ( OraSession )
   OraDatabase.ExecuteSQL "BEGIN  Ripple_Package( :PV_ID_LIST, :RTAG_ID, :USER_ID );  END;"
   objEH.CatchORA ( OraSession )

   OraDatabase.Parameters.Remove "PV_ID_LIST"
   OraDatabase.Parameters.Remove "RTAG_ID"
   OraDatabase.Parameters.Remove "USER_ID"

End Sub
'--------------------------------------------------------------------------------------------------------------------------
'------------ RUN BEFORE PAGE RENDER ----------
shref_base = "http://" & archive_server & "/devl/abtlog/"

'----------------------------------------------------
' --- RUN onPostBack ---
If Request("action") <> "" AND objAccessControl.UserLogedIn Then

  If objEH.Finally Then
    If Request("action") = "include" Then
      Call IncludePackages ()
      ' Redirect to the current page so that a refesh will not
      ' cause a form re-submit.
      Call Destroy_All_Objects
      Response.Redirect(ScriptName & "?rtag_id=" & parRtagId)
    Else
      Call OpenInWindow ( "dependencies.asp?rtag_id="& parRtagId )
    End If
  End If

End If

'----------------------------------------------
Sub ShowBuildStatus
    <!-- FORM START -->
    objFormComponent.FormName = "FormName"
    objFormComponent.Action = ScriptName &"?rtag_id="& parRtagId
    Call objFormComponent.FormStart()
    %>
    <table class="embedded_table" style="margin-bottom:20px">
      <tr>
         <td>
            <table width="95%" border="0" cellspacing="0" cellpadding="0" align="center">
                <tr>
                    <td nowrap class="form_ttl" align="left">BUILD STATUS INFORMATION</td>
                </tr>
            </table>
                <tr>
                    <td>
                        <table class="rounded_box embedded_table">
                            <tr>
                                <td bgcolor="#FFFFFF"><img src="images/h_trsp_dot.gif" width="10"></td>
                                <td bgcolor="#FFFFFF" valign="top">
                                <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
                                <!--#include file="messages/_msg_inline.asp"-->
                                <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
                                <table width="100%" border="0" cellspacing="2" cellpadding="0">
                                    <tr>
                                        <td colspan=4 class='err_alert'><font size='2'><b>Packages Excluded From Build</b></font></td>
                                    </tr>
                                    <tr>
                                    <td></td>
                                    <td  colspan=3 class="body_row">
                                       <fieldset class="fset" align="right" style=" border: 1px groove;">
                                            Show
                                            <input type="checkbox" checked value=0 name="showManual"   id="manualCause"   onClick="toggleDispClass('manualCause',1);">Manual Exclusions
                                            <input type="checkbox" checked value=0 name="showCause"    id="rootCause"     onClick="toggleDispClass('rootCause',1);">Config Errors
                                            <input type="checkbox" checked value=0 name="showNoEnv"    id="rootNoEnv"     onClick="toggleDispClass('rootNoEnv',1);">Env Errors
                                            <input type="checkbox" checked value=0 name="showFile"     id="rootFile"      onClick="toggleDispClass('rootFile',1);">Build Errors
                                            <input type="checkbox" checked value=0 name="showIndirect" id="rootIndirect"  onClick="toggleDispClass('rootIndirect',1);">Indirect Exclusions
                                       </fieldset>
                                       </td>
                                    </tr>

                                   <tr>
                                      <td background="images/bg_table_col.gif" class="err_alert"><b>Directly</b></td>
                                      <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Package</td>
                                      <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Version</td>
                                      <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Root Cause</td>
                                   </tr>
                                   <tr>
               <%
               query_string = " select pkg.pkg_name, pv.pkg_version, pv.pv_id, dnr.rtag_id, dnr.root_cause, dnr.root_file, pv.pv_description, dnr.root_pv_id"&_
                              "   from do_not_ripple dnr, package_versions pv, packages pkg"&_
                              "  where dnr.rtag_id = "& parRtagId &_
                              "    and pv.pv_id    = dnr.pv_id"&_
                              "    and pkg.pkg_id  = pv.pkg_id"&_
                              "    and nvl(dnr.root_pv_id, -1) < 0 " &_
                              "  order by pkg_name"
               Set rsQry = OraDatabase.DbCreateDynaset( query_string, ORADYN_DEFAULT )
               '--- Render rows ---
               Do While (NOT rsQry.BOF) AND (NOT rsQry.EOF)
                Dim rowClass
                Dim rowData
                '
                ' Manually excluded packages have no root_cause or root_file or root_pv_id
                '
                ' root_file, if supplied, indicates a build failure log file exists
                ' this should always prevail over the textual root_cause
                '
                If (IsNull(rsQry("root_file")) AND IsNull(rsQry("root_cause"))) Then
                    rowData = "Manually Excluded"
                    rowClass = "manualCause"

                ElseIf IsNull(rsQry("root_file")) Then
                   rowData = rsQry("root_cause")
                   If InStr(rowData, "no build env") Then
                       rowClass = "rootNoEnv"
                   Else
                       rowClass = "rootCause"
                   End If

                Else
                    rowClass = "rootFile"
                    rowData = "<a class=""txt_linked"" title=""" & rsQry("root_file") &_
                              " Log file may have expired."" " &_
                              "href=""" & shref_base & rsQry("root_file") & """>" &_
                              "Build Failure Log File</a>"
                End If

                Dim checkBoxData, checkBoxClass
                If NiceInt(rsQry("root_pv_id"), -1) = -1   Then
                    checkBoxData = ""
                    checkBoxClass = "directInclude"
                Else
                    checkBoxData = "disabled"
                    checkBoxClass = ""    
                End If

               %>
                  <tr class="<%=rowClass%>">
                     <td colspan="5" background="images/bg_rep_line.gif"><img src="images/spacer.gif" width="1" height="1"></td>
                  </tr>
                  <tr class="<%=rowClass%>">
                     <td nowrap width="1%">
                        <a name="PkgName_<%=rsQry("pkg_name")%>">
                        <input class="<%=checkBoxClass%>" type="checkbox" value="<%=rsQry("pv_id")%>" name="pv_id_list" <%=checkBoxData%>>
                        </a>
                     </td>
                     <td nowrap class="body_rowg"><a class="txt_linked" href="dependencies.asp?pv_id=<%=rsQry("pv_id")%>&rtag_id=<%=rsQry("rtag_id")%>" title="<%=rsQry("pv_description")%>"><%=rsQry("pkg_name")%></a></td>
                     <td nowrap class="body_rowg"><%=rsQry("pkg_version")%></td>
                     <td nowrap class="body_rowg"><%=rowData%></td>
                  </tr>
               <%
                rsQry.MoveNext
               Loop

               query_string = " select pv.pv_id, pkg.pkg_name, pv.pkg_version, qkg.pkg_name, dnr.rtag_id, pv.pv_description"&_
                              "   from do_not_ripple dnr, package_versions pv, package_versions qv, packages pkg, packages qkg"&_
                              "  where dnr.rtag_id = "& parRtagId &_
                              "    and pv.pv_id    = dnr.pv_id"&_
                              "    and pkg.pkg_id  = pv.pkg_id"&_
                              "    and qv.pv_id    = dnr.root_pv_id"&_
                              "    and qkg.pkg_id  = qv.pkg_id"&_
                              "    and nvl(dnr.root_pv_id, -1) > 0"&_
                              "  order by pkg.pkg_name"
               Dim rsQry2
               Set rsQry2 = OraDatabase.DbCreateDynaset( query_string, ORADYN_DEFAULT )
               ' -- DISPLAY INDIRECTLY EXCLUDED PACKAGES
               '--- Render rows ---
                If rsQry2.recordCount > 0    Then 
                %>
                  <tr>
                  <td background="images/bg_table_col.gif" class="err_alert"><b>Indirectly</b></td>
                  <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Package</td>
                  <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Version</td>
                  <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Root Cause Package</td>
                  </tr>
               <%
                End If
               Do While (NOT rsQry2.BOF) AND (NOT rsQry2.EOF)%>
                  <tr class="rootIndirect">
                     <td colspan="5" background="images/bg_rep_line.gif"><img src="images/spacer.gif" width="1" height="1"></td>
                  </tr>
                  <tr class="rootIndirect">

                     <td nowrap><input type="checkbox" value=0 disabled=true name="notused"></td>
                     <td nowrap class="body_rowg"><a class="txt_linked" href="dependencies.asp?pv_id=<%=rsQry2(0)%>&rtag_id=<%=rsQry2(4)%>" title="<%=rsQry2(5)%>"><%=rsQry2(1)%></a></td>
                     <td nowrap class="body_rowg"><%=rsQry2(2)%></td>
                     <td nowrap class="body_rowg"><a href="#PkgName_<%=rsQry2(3)%>" style="text-decoration: none;">&raquo;&nbsp;<%=rsQry2(3)%></a></td>
                  </tr>
                  <%
                  rsQry2.MoveNext
               Loop%>
            </table>
         </td>
         <td background="images/lbox_bgside_white.gif">&nbsp;</td>
      </tr>
      <tr background="images/bg_action_norm.gif">
         <td></td>
         <td>
         <table class="full_table">
             <tr>
                 <td><input id="toggleDirect" 
                            <%=Iif(rsQry.RecordCount > 0, "", " disabled ")%>
                            type="checkbox" title="Toggle all visible directly excluded packages"></td>
                 <td align="right">
                    <%
                    Response.Write(objFormComponent.SubmitButton ( "Include", "name='IncludeSubmit' id='IncludeSubmit' class='form_btn' disabled style='color:silver' onClick=""return vixConfirm('Are you sure you want to include these packages for building?',{title:'Include Packages', post : 'FormName'})""" ))
                    Response.Write(objPMod.ComposeHiddenTags())
                    %>
                 </td>
             </tr>
         </table>
         </td>
         <td background="images/bg_action_norm.gif"><img src="images/h_trsp_dot.gif" width="5" height="30"></td>
      </tr>
    </table>
    </td>
    </tr>
    </table>
    <!-- ACTION BUTTONS ---------------------------------------------->
    <input type="hidden" name="action" value="include">
    <!-- ACTION BUTTONS END  ------------------------------------------>
    <%Call objFormComponent.FormEnd()%>
    <!-- FORM END ----------------------------------------------------->
    <%
    rsQry.Close()
    Set rsQry = nothing
    rsQry2.Close()
    Set rsQry2 = nothing
End Sub
'-------------------------------------------------
' 
Sub ShowDaemonStatus
%>
<table class="embedded_table" style="margin-bottom:20px">
  <tr>
     <td>
        <table width="95%" align="center" class="embedded_table">
           <tr>
              <td nowrap class="form_ttl"><p>DAEMON STATUS INFORMATION</p>
              </td>
              <td  valign="bottom" class="body_rowg">
                Last Build: <%=GetLastBuildAge(parRtagId)%> [<%=GetModifiedSeqNo(parRtagId)%>]
              </td>
              <td align="right" valign="bottom">
                <a class="txt_linked" href="<%=scriptName%>?rtag_id=<%=parRtagId%>" title="Refresh Page">[Refresh]</a>
              </td>
           </tr>
        </table>
     </td>
  </tr>
  <tr>
   <td>
   <table class="rounded_box embedded_table">
  <tr>
     <td bgcolor="#FFFFFF"><img src="images/h_trsp_dot.gif" width="10" height="100"></td>
     <td bgcolor="#FFFFFF" valign="top">
        <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
        <!--#include file="messages/_msg_inline.asp"-->
        <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
        <br>
        <table width="100%" border="0" cellspacing="2" cellpadding="0">
           <%
           Dim bInactiveMachine : bInactiveMachine = false
           Dim indefinitelyPaused : indefinitelyPaused = Indefinitely_Paused()
           ' Insert a warning into the page if the build daemons are indefintely paused.
           If indefinitelyPaused Then %>
              <tr>
                 <span class='err_alert'>
                    <font size='2'><b>WARNING: Build Daemons are all stopped - please contact an administrator</b></font>
                 </span>
              </tr>
           <%End If
           %>
           <td width="9%" valign="top"></td>
           <tr>
              <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Daemon Host</td>
              <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Machine Type</td>
              <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Mode</td>
              <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Run Level</td>
              <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Current Package</td>
              <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Est Duration<%=Quick_Help("h_buildtime")%></td>
              <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Last Change<%=Quick_Help("h_lastchange")%></td>
              <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Control State</td>
           </tr>
           <%
           ' Get the number of release configurations for this RTAG_ID, and iterate through them
           query_string = " select rc.rcon_id, display_name, gbe_value, daemon_mode, NVL(ACTIVE, 'U') as ACTIVE" &_
                          " from release_config rc, gbe_machtype gm, build_machine_config bm"&_
                          "  where rc.rtag_id = "& parRtagId &_
                          "    and gm.gbe_id = rc.gbe_id"&_
                          "    and rc.bmcon_id=bm.bmcon_id(+)" &_
                          "  order by bm.display_name, rc.rcon_id"

           Set rsQry = OraDatabase.DbCreateDynaset( query_string, ORADYN_DEFAULT )

           Do While (NOT rsQry.BOF) AND (NOT rsQry.EOF)
              rcon_id = rsQry("rcon_id")

              Dim pkgName
              Dim pkgPvid
              Dim pkgBuildTime
              Dim currentRunLevel
              Dim daemonState
              Dim delta
              Dim pkgId
              Dim bActive : bActive = rsQry("active")
              If bActive = "N" Then bInactiveMachine = true

              ' For this release configuration, get its entry from the run_level table. This table may not
              ' have an entry so we must handle that outcome too.
              query_string = " select rl.pause, rl.current_run_level, rl.current_pkg_id_being_built, "&_
                             "        TRUNC (86400*(SYSDATE - rl.KEEP_ALIVE)) as delta" &_
                             "   from run_level rl"&_
                             "  where rl.rcon_id = "& rcon_id

              Dim rsQry2
              Set rsQry2 = OraDatabase.DbCreateDynaset( query_string, ORADYN_DEFAULT )

              currentRunLevel = -1
              pkgId = Null
              pkgName = NULL
              pkgPvid = NULL
              pkgBuildTime = NULL
              daemonState = 0
              delta = NULL

              If (rsQry2.RecordCount > 0) Then
                ' Get the run level from the run_level table
                currentRunLevel = rsQry2("current_run_level")
                pkgId = rsQry2("current_pkg_id_being_built")

                daemonState = rsQry2("pause")
                If IsNull(daemonState) Then daemonState = 0
                If daemonState = "2" Then pkgId = Null

                delta = rsQry2("delta")

              End If

              ' If we got an entry from the run_level table, try and use the pkg_id it contains, to obtain a
              ' package name from the packages table
              Dim rsQry3
              If NOT IsNull(pkgId) Then
                 query_string = " select pkg_name,rl.current_pv_id, pv.build_time from run_level rl, packages pk, package_versions pv"&_
                                "  where rl.rcon_id = "& rcon_id &_
                                "   and  rl.current_pkg_id_being_built = pk.pkg_id" &_
                                "   and  rl.current_pv_id = pv.pv_id"

                 Set rsQry3 = OraDatabase.DbCreateDynaset( query_string, ORADYN_DEFAULT )
                 If (rsQry3.RecordCount > 0) Then
                    pkgName = rsQry3("pkg_name")
                    pkgPvid = rsQry3("current_pv_id")
                    pkgBuildTime = rsQry3("build_time")
                 End If
                 rsQry3.Close()
                 Set rsQry3 = nothing
              End If

              ' --- Now render HTML for this release configuration ---
              %>
              <tr>
                 <td colspan="8" background="images/bg_rep_line.gif"><img src="images/spacer.gif" width="1" height="1"></td>
              </tr>
              <tr>
                 <td nowrap class="body_rowg"><%=rsQry("display_name")%></td>
                 <td nowrap class="body_rowg"><%=rsQry("gbe_value")%></td>
                 <td nowrap class="body_rowg"><%=Get_Daemon_Mode(rsQry("daemon_mode"))%></td>
                 <td nowrap class="body_rowg"><%=Get_Run_Level(currentRunLevel, indefinitelyPaused, daemonState, bActive)%></td>
                 <td nowrap class="body_rowg"><%=Get_Package_Name(pkgName,parRtagId,pkgPvid, bActive)%></td>
                 <td nowrap class="body_rowg"><%=IIF(rsQry("daemon_mode") = "M", pkgBuildTime, "")%></td>
                 <td nowrap class="body_rowg"><%=PrettyDelta(delta, daemonState,pkgName )%></td>
                 <td nowrap class="body_rowg">
                    <%
                    If (rsQry2.RecordCount > 0) AND NOT indefinitelyPaused  Then
                       If canActionControlInProject("BuildControl") Then
                          If bActive = "U" Then
                          ElseIf bActive = "N" Then
                             Call Action_Buttons ( "Daemon Unavailable" )
                          ElseIf daemonState = 0 Then
                             Call Action_Buttons ( "Daemon Pause" )
                          ElseIf daemonState = 1 Then
                             Call Action_Buttons ( "Daemon Resume" )
                          ElseIf daemonState = 2 Then
                             Call Action_Buttons ( "Daemon Start" )
                          Else
                             Call Action_Buttons ( "Daemon Resume" )
                          End If
                       Else
                          If bActive = "U" Then
                          ElseIf bActive = "N" Then
                             Call Action_Buttons ( "Daemon Unavailable" )
                          ElseIf daemonState = 0 Then
                             Call Action_Buttons ( "Daemon Pause Disabled" )
                          ElseIf daemonState = 1 Then
                             Call Action_Buttons ( "Daemon Resume Disabled" )
                          ElseIf daemonState = 2 Then
                             Call Action_Buttons ( "Daemon Start Disabled" )
                          Else
                             Call Action_Buttons ( "Daemon Resume Disabled" )
                          End If
                       End If
                    Else
                       %>Unavailable<%
                    End If
                    %>
                 </td>
              </tr>
              <%
              rsQry2.Close()
              Set rsQry2 = nothing
              rsQry.MoveNext
           Loop
           %>
           <tr>
             <td nowrap background="images/bg_table_col.gif" class="body_col" colspan=7>
             <%If CheckConfigErrors(parRtagId) OR bInactiveMachine Then%><span class="err_alert">&nbsp;Daemon configuration errors detected</span>
                <a class="txt_linked" href="release_config.asp?rtag_id=<%=parRtagId%>">
                    <img src="images/i_link.gif" hspace="2" border="0" align="absmiddle" title="Goto Configuration">
                </a>
             <%End If%>
             </td>
             <td valign="bottom" nowrap background="images/bg_table_col.gif" class="body_col">
             <%
               If (rsQry.RecordCount > 0) AND NOT indefinitelyPaused Then
                 If objAccessControl.UserLogedIn AND canActionControlInProject("BuildControl") Then
                   Call Action_Buttons ( "Daemon Control All" )
                 Else 
                   Call Action_Buttons ( "Daemon Control All Disabled" )
                 End If
               Else
                 %>&nbsp<%
               End If
             %>
             </td>
           </tr>
           <%
             rsQry.Close()
             Set rsQry = nothing
           %>
        </table>
     </td>
     <td background="images/lbox_bgside_white.gif">&nbsp;</td>
  </tr>
  <tr>
     <input type="hidden" name="action" value="true">
     <%=objPMod.ComposeHiddenTags()%>
  </tr>
</table>
</td>
</table>

<%
End Sub
'-------------------------------------------------
'
Sub ShowDaemonInstructions
%>
<!-- Daemon Instructions Display -->
<table class="embedded_table" style="margin-bottom:10px">
  <tr>
     <td>
        <table align="center" width="95%" class="embedded_table">
           <tr>
              <td nowrap class="form_ttl">DAEMON INSTRUCTIONS FOR THIS RELEASE</td>
           </tr>
        </table>
     </td>
  </tr>
  <tr>
   <td>
   <table class="rounded_box embedded_table">
  <tr>
     <td bgcolor="#FFFFFF"><img src="images/h_trsp_dot.gif" width="10" ></td>
     <td bgcolor="#FFFFFF" valign="top">
        <table width="100%" border="0" cellspacing="2" cellpadding="0">
           <tr>
              <td align="left" nowrap background="images/bg_table_col.gif" class="body_col">Operation</td>
              <td align="left" nowrap background="images/bg_table_col.gif" class="body_col">Package</td>
              <td align="left" nowrap background="images/bg_table_col.gif" class="body_col">Version</td>
              <td align="left" nowrap background="images/bg_table_col.gif" class="body_col">Scheduled Time<%=Quick_Help("SchedTime")%>
              <td align="left" nowrap background="images/bg_table_col.gif" class="body_col">Repeat</td>
              <td align="left" nowrap background="images/bg_table_col.gif" class="body_col">In Progress</td>
           </tr>
           <%
           Dim PkgVersion
           Dim UserName
           Dim UserEmail
           Dim bInProgress
           Dim bIsOverdue
           Dim bIsReady

           Set rsQry = OraDatabase.DbCreateDynaset( "SELECT DAEMON_INSTRUCTIONS_ID,"&_
                                                  "       OP_CODE,"&_
                                                  "       RTAG_ID,"&_
                                                  "       PV_ID,"&_
                                                  "       SCHEDULED_DATETIME,"&_
                                                  "       REPEAT_SECS,"&_
                                                  "       ADDED_DATETIME,"&_
                                                  "       USER_ID,"&_
                                                  "       IN_PROGRESS,"&_
                                                  "       (CASE WHEN SCHEDULED_DATETIME <= SYSDATE THEN 1 ELSE 0 END) AS READY,"&_
                                                  "       (CASE WHEN (SCHEDULED_DATETIME + (1/144)) < SYSDATE THEN 1 ELSE 0 END) AS OVERDUE"&_
                                                  "  FROM DAEMON_INSTRUCTIONS "&_
                                                  "  WHERE RTAG_ID = "& parRtagId &_
                                                  "  ORDER BY PV_ID, SCHEDULED_DATETIME, DAEMON_INSTRUCTIONS_ID", ORADYN_DEFAULT )
           While (NOT rsQry.BOF) AND (NOT rsQry.EOF)

              If IsNull(rsQry("IN_PROGRESS")) OR rsQry("IN_PROGRESS") = "0" Then
                 bInProgress = False
              Else
                 bInProgress = True
              End If

              ' only flag as overdue if time threshold has been met but the daemon has not marked the instruction as being in progress.
              If rsQry("OVERDUE") AND NOT bInProgress Then
                 bIsOverdue = True
              Else
                 bIsOverdue = False
              End If

              If rsQry("READY") Then
                 bIsReady = True
              Else
                 bIsReady = False
              End If

              ' Get as much info about the package as we can
              Dim PkgId: PkgId = 0
              Dim PkgName : PkgName = "N/A"
              If (NOT IsNull(rsQry("PV_ID"))) AND (rsQry("PV_ID") <> "") Then
                 Call Get_Pkg_Short_Info(rsQry("PV_ID"), PkgId, PkgName, PkgVersion, NULL, NULL, NULL)
              End If
              %>
              <tr>
                 <td colspan="6" background="images/bg_rep_line.gif"><img src="images/spacer.gif" width="1" height="1"></td>
              </tr>
              <tr>
                 <td align="left" valign="top" class="body_rowg nowrap">
                    <%=DaemonInstructionOperationName(rsQry("OP_CODE"))%>
                 </td>

                 <td align="left" valign="top" class="body_rowg">
                    <%If (NOT IsNull(rsQry("PV_ID"))) AND (rsQry("PV_ID") <> "") Then%>
                       <a href='fixed_issues.asp?rtag_id=<%=rsQry("RTAG_ID")%>&pv_id=<%=rsQry("PV_ID")%>'><%=PkgName%>
                    <%Else%>
                       <%=PkgName%>
                    <%End If%>
                 </td>

                 <td align="left" valign="top" class="body_rowg">
                    <%=PkgVersion%>
                 </td>

                 <td align="left" valign="top" class="body_rowg" <%If bIsOverdue Then%>style=color:Red<%Elseif bIsReady Then%>style=color:Green<%End If%>><%=DisplayDateTime(rsQry("SCHEDULED_DATETIME"))%></td>

                 <td align="left" valign="top" class="body_rowg"><%=DaemonInstructionRepeatString(rsQry("OP_CODE"), rsQry("REPEAT_SECS"))%></td>

                 <td align="left" valign="top" class="body_rowg">
                    <%If bInProgress Then%>
                       YES
                    <%Else%>
                       NO
                    <%End If%>
                 </td>
              </tr>
              <%
              rsQry.MoveNext()
           Wend
           rsQry.Close()
           Set rsQry = nothing
           %>
        </table>
     </td>
     <td background="images/lbox_bgside_white.gif">&nbsp;</td>
  </td>
  </tr>
  </table>
  </td>
   </tr>
</table>
<%
End Sub
%>
<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" type="text/css">
      <link rel="stylesheet" href="images/navigation.css" type="text/css">
      <script language="JavaScript" src="images/common.js"></script>
      <!--#include file="_jquery_includes.asp"-->
      <!-- TIPS -->
      <script type="text/javascript" src="scripts/json2.js"></script>
      <script language="JavaScript" src="images/tipster.js"></script>
      <script language="JavaScript" src="images/_help_tips.js"></script>
      <script language="JavaScript" type="text/JavaScript">
      formTips.tips.h_buildtime       = stdTip(300, 'Est. Build Duration', 'Estimated build duration in seconds. Based simply on the last build duration for this package');

      formTips.tips.h_lastchange       = stdTip(300, 'Last Change', 'This is an indication of the time since the daemon interogated the database.' +
                                                                  '<p>Short times will be shown as seconds. Longer times will be shown as a time within ' + 
                                                                  'the last 24 hours. Longer times will be shown as a date.' 
                                                                  );
      </script>
    <script language="JavaScript" type="text/JavaScript">
    $(document).ready(function() {
        //
        //  Init the check boxes
        InitShow();
        isChecked('pv_id_list','IncludeSubmit');

        // Attach function to toggle checkbox
        // toggle all visible checkboxes
         $('#toggleDirect').click(function(){
            var state = this.checked;
            var list = $('.directInclude:visible:enabled');
            list.prop('checked', state);
            isChecked('pv_id_list','IncludeSubmit');
         });

         $('.directInclude').click(function(){
             isChecked('pv_id_list','IncludeSubmit');
         });

    });

    function InitShow(e)
    {
        toggleDispClass('rootCause',0);
        toggleDispClass('rootNoEnv',0);
        toggleDispClass('rootFile',0);
        toggleDispClass('rootIndirect',0);
        toggleDispClass('manualCause',0);
    }

    function toggleDispClass(cname,flip)
    {
        var cookieName = 'RELMGR_BUILDSTATUS';
        var cv = JSON.parse(getCookie(cookieName));
        if (!cv)
            cv = new Object;
        if (!cv.BuildStatus)
            cv.BuildStatus = new Object;

        var state = cv.BuildStatus[cname];
        if (state === undefined)
            state = true;

        if (flip>0)
            state = !state;

        cv.BuildStatus[cname] = state;

        // Reflect the current state in the checkbox
        var de = document.getElementById(cname);
        if (de)
            de.checked = state;

        var elements = new Array();
        elements = getElementsByClassName(cname);
        for(i in elements ){
            if (state) {
                elements[i].style.display = "";
            }
            else {
                elements[i].style.display = "none";
            }
        }
        setCookie(cookieName, JSON.stringify(cv), 365 );
    }

    </script>
      <!-- DROPDOWN MENUS -->
      <!--#include file="_menu_def.asp"-->
      <script language="JavaScript1.2" src="images/popup_menu.js"></script>
   </head>
   <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0">
      <!-- HEADER -->
      <!--#include file="_header.asp"-->
      <!-- BODY ---->
      <table class="full_table">
         <tr>
            <td width="146px" class="panel_bg" valign="top">
                <%Call BuildMenuPane%>
            </td>
            <td width="100%" rowspan="2" align="center" valign="top" bgcolor="#EEEFEF">
                <%Call ShowBuildStatus%>
                <%Call ShowDaemonStatus%>
                <%Call ShowDaemonInstructions%>
            </td>
         </tr>
         <tr>
            <td class="panel_bg" valign="bottom" align="center" height="350">
                <img src="images/img_gears.png" vspace="20" hspace="30"></td>
         </tr>
      </table>
      <!-- FOOTER -->
      <!--#include file="_footer.asp"-->
   </body>
</html>