Subversion Repositories DevTools

Rev

Rev 3936 | 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"-->
<%
objPMod.PersistInQryString("proj_id")
'------------ ACCESS CONTROL ------------------
'Let users view the build status without being logged in, but as soon as they try and submit the form, check
'their login status.
If Request("action") <> "" AND NOT objAccessControl.UserLogedIn Then%>
<!--#include file="_access_control_login.asp"-->
<!--#include file="_access_control_project.asp"-->
<%End If%>
<!--#include file="_access_control_general.asp"-->
<% '------------ Scripts -------------------------- %>
<script type="text/javascript" src="scripts/json2.js"></script>
<%
'------------ Variable Definition -------------
Dim objSortHelper
Dim rsQry
Dim parRtagId
Dim parSourceRtagId
Dim query_string
Dim rcon_id
Dim shref_base
'------------ Constants Declaration -----------
'------------ Variable Init -------------------
parRtagId = Request("rtag_id")
objPMod.PersistInQryString("rtag_id")

'----------------------------------------------
%>
<%
'--------------------------------------------------------------------------------------------------------------------------
Sub GetFormDetails ( parRtagId, ByRef outobjDetails )
   Dim rsQry, query
   OraDatabase.Parameters.Add "RTAG_ID",   parRtagId,    ORAPARM_INPUT, ORATYPE_NUMBER
   query = _
   " SELECT * "&_
   "  FROM RELEASE_TAGS rt"&_
   " WHERE rt.RTAG_ID = :RTAG_ID"

   Set rsQry = OraDatabase.DbCreateDynaset( query, ORADYN_DEFAULT )

   OraDatabase.Parameters.Remove "RTAG_ID"

   If rsQry.RecordCount > 0 Then
      outobjDetails.Item ("rtag_id") = rsQry("rtag_id")
      outobjDetails.Item ("rtag_name") = rsQry("rtag_name")
   Else
      Err.Raise 8, "Sub GetFormDetails in "& ScriptName, "Empty record set returned. parRtagId="& parRtagId
   End If

   rsQry.Close
   Set rsQry = Nothing
End Sub
'--------------------------------------------------------------------------------------------------------------------------
Sub RipplePackage (flag)

   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 )

   If flag Then
      OraDatabase.ExecuteSQL _
      "BEGIN  Ripple_Package( :PV_ID_LIST, :RTAG_ID, :USER_ID );  END;"
   Else
      OraDatabase.ExecuteSQL _
      "BEGIN  UnRipple_Package( :PV_ID_LIST, :RTAG_ID, :USER_ID );  END;"
   End If

   objEH.CatchORA ( OraSession )

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

End Sub
'--------------------------------------------------------------------------------------------------------------------------
Function PrettyDelta( delta, daemonState,pkgId )
    Dim style
    style = ""

    If (delta > 600) AND (IsNull(pkgId) OR pkgId = "") Then
      style = "style=color:Red"
      If (delta > 86400 ) Then
        Dim bdate, dd,mm,yy
        bdate = DateAdd("s", - delta,Now())
        dd = Day(bdate)
        mm = MonthName(Month(bdate),1)
        yy = Year( bdate)
        delta = dd & "-" & mm & "-" & yy
        If ( daemonState >= 2 ) Then
            style = ""
        End If
      ElseIf ( delta > 60*60 ) Then
        'Dim bdate, hh, mins, ss
        bdate = DateAdd("s", - delta,Now())
        delta = TimeValue( bdate)
        'delta = hh & ":" & mins & ":" & ss
      End If
    End If

    If style <> "" Then
        delta = "<span " & style & ">" & delta & "</span>"
    End If
    PrettyDelta = delta
End Function
'--------------------------------------------------------------------------------------------------------------------------
Function Get_Daemon_Mode( cMode )

   If cMode = "S" Then
      Get_Daemon_Mode = "Slave"
   ElseIf cMode = "M" Then
      Get_Daemon_Mode = "Master"
   End If

End Function
'--------------------------------------------------------------------------------------------------------------------------
Function Get_Run_Level( nLevel, indefinitePause, astate)

   If indefinitePause Then
      Get_Run_Level = "<span class='err_alert'>Stopped</span>"
   ElseIf astate = 1 Then      ' if build daemon paused
      Get_Run_Level = "Paused"
   ElseIf astate = 2 Then      ' if build daemon disabled
      Get_Run_Level = "Disabled"
   ElseIf IsNull(astate) Then  ' if build daemon enabled
      If nLevel = 1 Then
         Get_Run_Level = "Cannot Continue"
      ElseIf nLevel = 2 Then
         Get_Run_Level = "Paused"
      ElseIf nLevel = 3 Then
         Get_Run_Level = "Building"
      ElseIf nLevel = 4 Then
         Get_Run_Level = "Idle"
      ElseIf nLevel = 5 Then
         Get_Run_Level = "Waiting"
      ElseIf nLevel = 6 Then
         Get_Run_Level = "Publishing"
      Else
         Get_Run_Level = "<span class='err_alert'>Unknown!</span>"
      End If
   End If

End Function

'--------------------------------------------------------------------------------------------------------------------------
Function Get_Package_Name( sPackageName )

  If IsNull(sPackageName) Then
    Get_Package_Name = "None"
  Else
    Get_Package_Name = sPackageName
  End If

End Function
'--------------------------------------------------------------------------------------------------------------------------


%>
<%
'------------ RUN BEFORE PAGE RENDER ----------
shref_base = "http://" & archive_server & "/devl/abtlog/"

' --- Get Form details from DB ---
Call GetFormDetails ( Request("rtag_id"), objFormCollector )

' --- Load Validation Rules ---
'Call objForm.LoadValidationRules ( Array("rtag_name","rtag_description", "config_spec_branch"), OraDatabase )    ' Load Validation Rules

' --- Enter Form Validation Rule Changes here... ----
'----------------------------------------------------

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

  If objEH.Finally Then
    If Request("action") = "include" Then
      Call RipplePackage (True)
    Else
      Call OpenInWindow ( "dependencies.asp?rtag_id="& parRtagId )
    End If
  End If

End If

'----------------------------------------------
%>
<script language="JavaScript" type="text/JavaScript">

window.addEventListener ?
window.addEventListener("load",InitShow,false) :
window.attachEvent && window.attachEvent("onload",InitShow);

function InitShow(e)
{
    toggleDispClass('rootCause',0);
    toggleDispClass('rootFile',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>

<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>
      <!-- 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="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" onload="isChecked('pv_id_list','submit');">
      <!-- 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">
         <%
         '-- FORM START ---------------------------------------------------------------------------------------------------------
         objFormComponent.FormName = "FormName"
         objFormComponent.Action = ScriptName &"?rtag_id="& parRtagId
         Call objFormComponent.FormStart()
         %>
         <tr>
            <td width="1" background="images/bg_home_orange.gif" valign="top"></td>
            <td width="100%" rowspan="1" align="center" valign="top" bgcolor="#EEEFEF">
               <table width="10" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                     <td width="1%"></td>
                     <td width="100%">
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                           <tr>
                              <td nowrap class="body_txt"></td>
                           </tr>
                        </table>
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                           <tr>
                              <td nowrap class="form_ttl"><p>&nbsp;</p>
                                 <p>BUILD STATUS INFORMATION</p>
                              </td>
                              <td align="right" valign="bottom"></td>
                           </tr>
                        </table>
                     </td>
                     <td width="1%"></td>
                  </tr>
                  <tr>
                     <td align="left" valign="top" background="images/lbox_bg_blue.gif"><img src="images/lbox_tl_cnr_b.gif" width="13" height="13"></td>
                     <td background="images/lbox_bg_blue.gif" class="lbox_ttl_w"><img src="images/h_trsp_dot.gif" width="600" height="15"></td>
                     <td align="right" valign="top" background="images/lbox_bg_blue.gif"><img src="images/lbox_tr_cnr_b.gif" width="13" height="13"></td>
                  </tr>
                  <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">
                           <span class='err_alert'>
                              <font size='2'><b>Packages Excluded From Build (Daemon Build Failure)</b></font>
                           </span>
                           <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 NAME</td>
                              <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">PACKAGE VERSION</td>
                              <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">ROOT CAUSE</td>
                           </tr>
                           <tr>
                           <td colspan=3></td>
                           <td class="body_row">
                           <fieldset class="fset" align="right">
                                Show
                                <input type="checkbox" checked value=0 name="showCause" id="rootCause" onClick="toggleDispClass('rootCause',1);">Config Errors
                                <input type="checkbox" checked value=0 name="showFile"  id="rootFile"  onClick="toggleDispClass('rootFile',1);">Build Errors
                           </fieldset>
                           </td>
                           </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"&_
                                          "   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 dnr.root_pv_id is null"&_
                                          "  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
                            ' 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")) Then
                               rowClass = "rootCause"
                               rowData = rsQry("root_cause")
                            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
                           %>
                              <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%">
                                    <!-- The use of the isChecked() javascript function below, enables the submit button if any checkboxes are checked, -->
                                    <!-- else it will disable the submit button. The function is badly named, but nevertheless, that is what it does.   -->
                                    <input type="checkbox" value="<%=rsQry("pv_id")%>" name="pv_id_list" id="pv_id_list" onClick="isChecked('pv_id_list','submit');">
                                 </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%>
                           <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 NAME</td>
                              <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">PACKAGE VERSION</td>
                              <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">ROOT CAUSE PACKAGE NAME</td>
                           </tr>
                           <%
                           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 dnr.root_pv_id is not null"&_
                                          "  order by pkg.pkg_name"
                           Dim rsQry2
                           Set rsQry2 = OraDatabase.DbCreateDynaset( query_string, ORADYN_DEFAULT )
                           '--- Render rows ---
                           Do While (NOT rsQry2.BOF) AND (NOT rsQry2.EOF)%>
                              <tr>
                                 <td colspan="5" background="images/bg_rep_line.gif"><img src="images/spacer.gif" width="1" height="1"></td>
                              </tr>
                              <tr>
                                 <td nowrap width="1%">
                                    <input type="checkbox" value=0 disabled=true name="notused" id="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"><%=rsQry2(3)%></td>
                              </tr>
                              <%
                              rsQry2.MoveNext
                           Loop%>
                        </table>
                     </td>
                     <td background="images/lbox_bgside_white.gif">&nbsp;</td>
                  </tr>
                  <%If rsQry.RecordCount > 0 Then%>
                     <tr>
                        <td background="images/bg_action_norm.gif"></td>
                        <td align="right" background="images/bg_action_norm.gif">
                           <%
                           Response.Write(objFormComponent.SubmitButton ( "Include", "name='submit' id='submit' class='form_btn' disabled style='color:silver' onClick='return confirmAction(""Are you sure you want to include these packages for building?"")'" ))
                           Response.Write(objPMod.ComposeHiddenTags())
                           %>
                        </td>
                        <td background="images/bg_action_norm.gif"><img src="images/h_trsp_dot.gif" width="5" height="30"></td>
                     </tr>
                  <%End If%>
                  <tr>
                     <td background="images/lbox_bg_blue.gif" valign="bottom"><img src="images/lbox_bl_cnr_b.gif" width="13" height="13"></td>
                     <td background="images/lbox_bg_blue.gif"></td>
                     <td background="images/lbox_bg_blue.gif" valign="bottom" align="right"><img src="images/lbox_br_cnr_b.gif" width="13" height="13"></td>
                  </tr>
               </table>
               <!-- ACTION BUTTONS ---------------------------------------------->
               <input type="hidden" name="action" value="include">
               <!-- ACTION BUTTONS END  ------------------------------------------>
            </td>
            <td width="1" valign="top"><img src="images/h_trsp_dot.gif" width="1" height="1"></td>
         </tr>
         <%
         Call objFormComponent.FormEnd()
         rsQry.Close()
         Set rsQry = nothing
         rsQry2.Close()
         Set rsQry2 = nothing
         '-- FORM END ----------------------------------------------------------------------------------------------------------------
         %>
         <tr>
            <td width="1" background="images/bg_home_orange.gif" valign="top"></td>
            <td width="100%" rowspan="2" align="center" valign="top" bgcolor="#EEEFEF">
               <table width="10" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                     <td width="1%"></td>
                     <td width="100%">
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                           <tr>
                              <td nowrap class="form_ttl"><p>&nbsp;</p>
                                 <p>DAEMON STATUS INFORMATION</p>
                              </td>
                              <td align="right" valign="bottom">
                                <a class="txt_linked" href="build_status.asp?rtag_id=<%=parRtagId%>" title="Refresh Page">[Refresh]</a></td>
                              </td>
                           </tr>
                        </table>
                     </td>
                     <td width="1%"></td>
                  </tr>
                  <tr>
                     <td align="left" valign="top" background="images/lbox_bg_blue.gif"><img src="images/lbox_tl_cnr_b.gif" width="13" height="13"></td>
                     <td background="images/lbox_bg_blue.gif" class="lbox_ttl_w"><img src="images/h_trsp_dot.gif" width="600" height="15"></td>
                     <td align="right" valign="top" background="images/lbox_bg_blue.gif"><img src="images/lbox_tr_cnr_b.gif" width="13" height="13"></td>
                  </tr>
                  <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 indefinitelyPaused
                           indefinitelyPaused = FALSE
                           ' Insert a warning into the page if the build daemons are indefintely paused.
                           query_string = " select * from run_level_schedule rls where rls.indefinite_pause = 'P'"

                           Set rsQry = OraDatabase.DbCreateDynaset( query_string, ORADYN_DEFAULT )
                           If rsQry.RecordCount > 0 Then
                              indefinitelyPaused = TRUE %>
                              <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

                           rsQry.Close()
                           Set rsQry = nothing
                           %>
                           <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">GBE Machtype</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">Last Change<br>Delta (secs)</td>
                              <td valign="top" nowrap background="images/bg_table_col.gif" class="body_col">Switch State</td>
                           </tr>
                           <%
                           ' Get the number of release configurations for this RTAG_ID, and iterate through them
                           query_string = " select * 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.daemon_hostname = bm.machine_hostname(+)" &_
                                          "  order by rc.daemon_hostname,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 currentRunLevel
                              Dim daemonState
                              Dim delta

                              ' 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

                              Set rsQry2 = OraDatabase.DbCreateDynaset( query_string, ORADYN_DEFAULT )

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

                              daemonState = NULL
                              If (rsQry2.RecordCount > 0) Then                                
                                daemonState = rsQry2("pause")
                              End If

                              delta = NULL
                              If (rsQry2.RecordCount > 0) Then
                                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
                              pkgName = NULL
                              If (rsQry2.RecordCount > 0) AND NOT IsNull(rsQry2("current_pkg_id_being_built")) Then

                                 query_string = " select pkg_name from run_level rl, packages pk"&_
                                                "  where rl.rcon_id = "& rcon_id &_
                                                "   and  rl.current_pkg_id_being_built = pk.pkg_id"

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

                              ' --- Now render HTML for this release configuration ---
                              %>
                              <tr>
                                 <td colspan="6" 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)%></td>
                                 <td nowrap class="body_rowg"><%=Get_Package_Name(pkgName)%></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 objAccessControl.UserLogedIn Then
                                          If IsNull(daemonState) 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 IsNull(daemonState) 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 valign="bottom" background="images/bg_table_col.gif" class="body_col"></td>
                             <td valign="bottom" nowrap background="images/bg_table_col.gif" class="body_col"></td>
                             <td valign="bottom" nowrap background="images/bg_table_col.gif" class="body_col"></td>
                             <td valign="bottom" background="images/bg_table_col.gif" class="body_col"></td>
                             <td valign="bottom" nowrap background="images/bg_table_col.gif" class="body_col"></td>
                             <td valign="bottom" nowrap background="images/bg_table_col.gif" class="body_col"></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 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()%>
                     <td background="images/lbox_bg_blue.gif" valign="bottom"><img src="images/lbox_bl_cnr_b.gif" width="13" height="13"></td>
                     <td background="images/lbox_bg_blue.gif"></td>
                     <td background="images/lbox_bg_blue.gif" valign="bottom" align="right"><img src="images/lbox_br_cnr_b.gif" width="13" height="13"></td>
                  </tr>
               </table>

               <table width="10" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                     <td width="1%"></td>
                     <td width="100%">
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                           <tr>
                              <td nowrap class="form_ttl"><p>&nbsp;</p>
                                 <p>DAEMON INSTRUCTIONS FOR THIS RELEASE</p>
                              </td>
                              <td align="right" valign="bottom"></td>
                           </tr>
                        </table>
                     </td>
                     <td width="1%"></td>
                  </tr>
                  <tr>
                     <td align="left" valign="top" background="images/lbox_bg_blue.gif"><img src="images/lbox_tl_cnr_b.gif" width="13" height="13"></td>
                     <td background="images/lbox_bg_blue.gif" class="lbox_ttl_w"><img src="images/h_trsp_dot.gif" width="600" height="15"></td>
                     <td align="right" valign="top" background="images/lbox_bg_blue.gif"><img src="images/lbox_tr_cnr_b.gif" width="13" height="13"></td>
                  </tr>
                  <tr>
                     <td bgcolor="#FFFFFF"><img src="images/h_trsp_dot.gif" width="10" height="100"></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<br>(<SPAN style=color:Red>Red</SPAN> = overdue)<br>(<SPAN style=color:Green>Green</SPAN> = ready)</td>
                              <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 PkgId
                           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
                              PkgId = 0
                              PkgName = "N/A"
                              PkgVersion = "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 align="left" valign="top" class="body_txt">
                                    <%=DaemonInstructionOperationName(rsQry("OP_CODE"))%>
                                 </td>

                                 <td align="left" valign="top" class="body_txt">
                                    <%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_txt">
                                    <%=PkgVersion%>
                                 </td>

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

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

                                 <td align="left" valign="top" class="body_txt">
                                    <%If bInProgress Then%>
                                       YES
                                    <%Else%>
                                       NO
                                    <%End If%>
                                 </td>
                              </tr>
                              <tr>
                                 <td colspan="6" background="images/bg_rep_line.gif"><img src="images/spacer.gif" width="1" height="1"></td>
                              </tr>
                              <%
                              rsQry.MoveNext()
                           Wend
                           rsQry.Close()
                           Set rsQry = nothing
                           %>
                        </table>
                     </td>
                     <td background="images/lbox_bgside_white.gif">&nbsp;</td>
                  </tr>
                  <tr>
                     <td background="images/lbox_bg_blue.gif" valign="bottom"><img src="images/lbox_bl_cnr_b.gif" width="13" height="13"></td>
                     <td background="images/lbox_bg_blue.gif"></td>
                     <td background="images/lbox_bg_blue.gif" valign="bottom" align="right"><img src="images/lbox_br_cnr_b.gif" width="13" height="13"></td>
                  </tr>
               </table>

            </td>
            <td width="1" valign="top"><img src="images/h_trsp_dot.gif" width="1" height="1"></td>
         </tr>
         <tr>
            <td valign="bottom" align="center" background="images/bg_home_orange.gif"><img src="images/img_vtree.gif" width="86" height="99" vspace="20" hspace="30"></td>
            <td background="images/bg_lght_gray.gif" valign="top"><img src="images/h_trsp_dot.gif" width="1" height="350"></td>
         </tr>
      </table>
      <!-- FOOTER -->
      <!--#include file="_footer.asp"-->
   </body>
</html>
<%
Call Destroy_All_Objects
%>