Subversion Repositories DevTools

Rev

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


<%@LANGUAGE="VBSCRIPT"%>
<%
'=====================================================
'|                                                   |
'|         ADMIN 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"-->
<%
'------------ ACCESS CONTROL ------------------
%>
<!--#include file="_access_control_general.asp"-->
<%
'------------ Variable Definition -------------
Dim rsQry
Dim query_string
Dim styleAlt1
Dim styleAlt2
Dim styleNow
Dim param_refreshPeriod
Dim param_refreshEnabled
Dim bIndefinitelyPaused
'------------ Constants Declaration -----------
Const Min_Refresh_Time = 10
'------------ Variable Init -------------------

styleAlt1="class='body_rowg1'"
styleAlt2="class='body_rowg2'"
styleNow = styleAlt1

'----------------------------------------------
%>
<%
'--------------------------------------------------------------------------------------------------------------------------

'--------------------------------------------------------------------------------------------------------------------------
' Toggle row style between the two alternative styles
Sub ToggleStyleNow
   If styleNow = styleAlt1 Then
      styleNow = styleAlt2
   Else
      styleNow = styleAlt1
   End If
End Sub
'--------------------------------------------------------------------------------------------------------------------------
' Convert run level into a meaningful string
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 astate = 0 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
'--------------------------------------------------------------------------------------------------------------------------
' Is a build occurring for this dataset/row ?
Function Is_Actively_Building( nPkgId )
   Is_Actively_Building = False
   If (NOT IsNull(nPkgId)) AND (nPkgId <> "") Then
      Is_Actively_Building = True
   End If
End Function
'--------------------------------------------------------------------------------------------------------------------------
' Return True if the paramter values represent a possibly hung daemon
Function Daemon_Delta_Threshold_Exceeded( nDelta )
   Daemon_Delta_Threshold_Exceeded = False
   If (nDelta > 600) Then
      Daemon_Delta_Threshold_Exceeded = True
   End If
End Function

'--------------------------------------------------------------------------------------------------------------------------
' Return True if the paramter values represent a paused daemon
Function Is_Paused( nLevel, indefinitePause )
   If indefinitePause Then
      Is_Paused = True
   Else
      If nLevel = 2 Then
         Is_Paused = True
      Else
         Is_Paused = False
      End If
   End If
End Function

'--------------------------------------------------------------------------------------------------------------------------
' Return True if the paramter values represent a disabled or paused daemon
Function Is_Disabled( astate)
   If astate = 1 Then           ' if build daemon paused
      Is_Disabled = True
   ElseIf astate = 2 Then       ' if build daemon disabled
      Is_Disabled = True
   Else
      Is_Disabled = False
   End If
End Function

'--------------------------------------------------------------------------------------------------------------------------
' Convert daemon mode into a meaningful string
Function Get_Daemon_Mode( nMode )
   If nMode = "M" Then
      Get_Daemon_Mode = "Master"
   ElseIf nMode = "S" Then
      Get_Daemon_Mode = "Slave"
   Else
      Get_Daemon_Mode = "?"
   End If
End Function

'--------------------------------------------------------------------------------------------------------------------------
' Return HTML for a seperator line between rows in the table
Function HTML_Row_Divider( projectChanged, projectChecked, releaseChanged, last_row_displayed )
   Dim s
   s = ""
   If projectChanged Then
      s = s + "<tr>"
      s = s + "   <td colspan='8'><img src='images/spacer.gif' width='1' height='5'></td>"
      s = s + "</tr>"
      s = s + "<tr>"
      s = s + "   <td colspan='8' background='images/bg_rep_line.gif'><img src='images/spacer.gif' width='1' height='5'></td>"
      s = s + "</tr>"
   Else
      if projectChecked = "checked" AND last_row_displayed = True Then
         s = s + "<tr>"
         If releaseChanged Then
            s = s + "<td></td>"
            s = s + "<td colspan='7' background='images/bg_rep_line.gif'><img src='images/spacer.gif' width='1' height='1'></td>"
         Else
            s = s + "<td></td>"
            s = s + "<td colspan='7' background='images/bg_rep_line.gif'><img src='images/spacer.gif' width='1' height='1'></td>"
         End If
         s = s + "</tr>"
      End If
   End If
   HTML_Row_Divider = s
End Function
'--------------------------------------------------------------------------------------------------------------------------
' Use this function to determine the state of a specified project checkbox
Function Is_Project_Checked( nProjId )
   Dim hiddenProjects_arr
   Dim hiddenProjects
   Dim str

   hiddenProjects = Request("HideProj")
   Is_Project_Checked = "checked"

   hiddenProjects_arr = Split(hiddenProjects, ",")
   For Each str in hiddenProjects_arr
      If str = nProjId Then
         Is_Project_Checked = ""
         Exit For
      End If
   Next
End Function
'--------------------------------------------------------------------------------------------------------------------------
' Use this function to set/clear the filter on/off radio button checked state
' Format of Filter Param : Filter=ON,[problemDaemonSets}[,ActiveBuilds] | OFF
Function Display_Filtered(id)
   Dim filter

   Display_Filtered = ""

   filter  = Request("Filter")
   If NOT IsNull(filter) AND filter <> "" Then
      If InStr(filter, id) > 0 Then
         Display_Filtered = "checked"
      End If
   Else
      If id = "OFF" Then
         Display_Filtered = "checked"
      End If
   End If
End Function

Function Display_Filter_Is_On()
   If Display_Filtered("ON") = "checked" Then
      Display_Filter_Is_On = True
   Else
      Display_Filter_Is_On = False
   End If
End Function
'--------------------------------------------------------------------------------------------------------------------------
' Use this function to set/clear a filter option check box with the given ID
Function Filter_Checked(id)
   Dim filter

   Filter_Checked = ""

   filter  = Request("Filter")
   If NOT IsNull(filter) AND filter <> "" Then
      If InStr(filter, id) > 0 Then
         Filter_Checked = "checked"
      End If
   End If
End Function
'--------------------------------------------------------------------------------------------------------------------------
' Test to see if a particular filter option is on
Function Filter_Is_On(id)
   If Display_Filter_Is_On() Then
      If Filter_Checked(id) = "checked" Then
         Filter_Is_On = True
      Else
         Filter_Is_On = False
      End If
   Else
      Filter_Is_On = False
   End If
End Function
'--------------------------------------------------------------------------------------------------------------------------
' Get name of package given its ID. Return empty string if not able to do so.
Function Get_Pkg_Name( nPkgId )
   Dim rsQry2
   Dim query_string2

   Get_Pkg_Name = ""
   If (NOT IsNull(nPkgId)) AND (nPkgId <> "") Then

      query_string2 = "SELECT pkg.PKG_NAME " &_
                     "  FROM PACKAGES pkg" &_
                     " WHERE pkg.PKG_ID = " & nPkgId

      Set rsQry2 = OraDatabase.DbCreateDynaset( query_string2, ORADYN_DEFAULT )
      If rsQry2.RecordCount > 0 Then
         Get_Pkg_Name = rsQry2("pkg_name")
      End If
      rsQry2.Close()
      Set rsQry2 = nothing
   End If
End Function
'--------------------------------------------------------------------------------------------------------------------------
Function Indefinitely_Paused()
   Dim rsQry2
   Dim query_string2

   Indefinitely_Paused = False

   query_string2 = " select * from run_level_schedule rls where rls.indefinite_pause = 'P'"

   Set rsQry2 = OraDatabase.DbCreateDynaset( query_string2, ORADYN_DEFAULT )
   If rsQry2.RecordCount > 0 Then
      Indefinitely_Paused = True
   End If
End Function
'--------------------------------------------------------------------------------------------------------------------------

%>
<%
'------------ RUN BEFORE PAGE RENDER ----------

' Default values for Auto Refresh checkbox and edit input box
param_refreshEnabled = False
param_refreshPeriod  = "0"

' Read the Refresh parameter which is of the form Refresh=<time-period>,ON|OFF
Dim param_refresh
param_refresh = Request("Refresh")
If param_refresh <> "" Then
   Dim pr_arr
   pr_arr = Split(param_refresh,",")
   param_refreshPeriod = pr_arr(0)

   ' Range check and end-stop the refresh period if necessary
   If CInt(param_refreshPeriod)  < Min_Refresh_Time Then
      param_refreshPeriod  = CStr(Min_Refresh_Time)
   End If

   ' determine checkbox state
   If UBound(pr_arr) >= 1 Then
      If InStr(UCase(pr_arr(1)), "ON") > 0 Then
         param_refreshEnabled = True
      Else
         param_refreshEnabled = False
      End If
   End If
End If

' Get indefinite pause status
bIndefinitelyPaused = Indefinitely_Paused()

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

//////////////////////////////////////////////////////////////////////////////////////////////////
// This function rebuilds the query string so that it either adds or removes the specified project ID from
// the HideProj= part of it, whilst leaving the rest of the string intact. The browser location is then
// updated and the server made to re-render the page. This function must be used from the project checkboxes
// to show/hide daemon status informaton for specific projects.
//////////////////////////////////////////////////////////////////////////////////////////////////
function toggle_project( proj_id )
{
   var found = false;
   var new_url_query_string = '';
   var new_hp_list = '';

   // get the full query string
   var url_query_string = '<%=Request.ServerVariables("QUERY_STRING")%>';

   // split it into each parameter
   var qs_arr = url_query_string.split('&');
   var i_qs_arr;
   for (i_qs_arr in qs_arr)
   {
      var qs_str = qs_arr[i_qs_arr];

      if (qs_str.length > 0)
      {
         // if we have found the HideProj parameter
         if (qs_str.indexOf('HideProj') >= 0)
         {
            // Split the HideProj parameter at the = symbol in order to process the comma seperated list of project IDs
            var qs_hp_arr;
            qs_hp_arr = qs_str.split('=');
            if (qs_hp_arr.length > 1)
            {
               // Split the comma seperated list of project IDs, and iterate through each item
               var hp_arr = qs_hp_arr[1].split(',');
               var i_hp_arr;
               for (i_hp_arr in hp_arr)
               {
                  var hp_str = hp_arr[i_hp_arr];

                  // If the item matches the specified project ID and the checkbox for that project is unchecked
                  if (hp_str == proj_id)
                  {
                     found = true;
                  }
                  else
                  {
                     // retain this other project ID in the list
                     if (new_hp_list != '')
                        new_hp_list += ',';
                     new_hp_list += hp_str;
                  }
               }
            }
         }
         else
         {
            // feed the existing paramter to the new query string
            if (new_url_query_string == '')
               new_url_query_string += '?';
            else
               new_url_query_string += '&';
            new_url_query_string += qs_str
         }
      }
   }

   // If the specified project ID was not found, then that project is not currently hidden
   // and must now be hidden, so add its number to the list to hide it on the next server side
   // page render operation
   if (!found)
   {
      if (new_hp_list != '')
         new_hp_list += ',';
      new_hp_list += proj_id
   }

   // Prepare the new query string
   if (new_url_query_string == '')
      new_url_query_string += '\?';
   else
      new_url_query_string += '\&';

   new_url_query_string += 'HideProj=';
   new_url_query_string += new_hp_list;

   // reload the page with the new query string
   var url = location.pathname + new_url_query_string;
   window.location.assign(url);
}

//////////////////////////////////////////////////////////////////////////////////////////////////
// This function rebuilds the query string to either hide all projects, or unhide all projects
// fromt he display
//////////////////////////////////////////////////////////////////////////////////////////////////
function toggle_all_projects(bAll)
{
   var new_url_query_string = '';
   var list_proj_ids = '';

   // If hiding all, then find all of the project enable/disable checkboxes, get the project ID
   // values from each one and accumulate them into a comma seperated list
   if (!bAll)
   {
      var inputs = document.getElementsByTagName('input');
      var i;
      for (i = 0; i < inputs.length; i++)
      {
         var str = inputs[i].name;
         if (str.indexOf("DIS_PRJ_") >= 0)
         {
            str = str.replace("DIS_PRJ_","");
            if (list_proj_ids != '')
               list_proj_ids += ',' + str;
            else
               list_proj_ids += str;
         }
      }
   }

   // get the full query string
   var url_query_string = '<%=Request.ServerVariables("QUERY_STRING")%>';

   // split it into each parameter
   var qs_arr = url_query_string.split('&');
   var i_qs_arr;
   for (i_qs_arr in qs_arr)
   {
      var qs_str = qs_arr[i_qs_arr];

      if (qs_str.length > 0)
      {
         // if we have found the HideProj parameter
         if (qs_str.indexOf('HideProj') >= 0)
         {
            // do nothing
         }
         else
         {
            // feed the existing paramter to the new query string
            if (new_url_query_string == '')
               new_url_query_string += '?';
            else
               new_url_query_string += '&';
            new_url_query_string += qs_str
         }
      }
   }

   // Prepare the new query string, only adding the HideProj parameter if the function is being
   // used to hide all projects
   if (!bAll)
   {
      if (new_url_query_string == '')
         new_url_query_string += '\?';
      else
         new_url_query_string += '\&';

      new_url_query_string += 'HideProj=' + list_proj_ids;
   }
   // reload the page with the new query string
   var url = location.pathname + new_url_query_string;
   window.location.assign(url);
}

//////////////////////////////////////////////////////////////////////////////////////////////////
// This function rebuilds the query string so that it either adds or removes the Refresh parameter
//////////////////////////////////////////////////////////////////////////////////////////////////
function toggle_refresh()
{
   var new_url_query_string = '';

   // get the full query string
   var url_query_string = '<%=Request.ServerVariables("QUERY_STRING")%>';

   // split it into each parameter
   var qs_arr = url_query_string.split('&');
   var i_qs_arr;
   for (i_qs_arr in qs_arr)
   {
      var qs_str = qs_arr[i_qs_arr];

      if (qs_str.length > 0)
      {
         // if we have found the Refresh parameter
         if (qs_str.indexOf('Refresh') >= 0)
         {
            // do nothing
         }
         else
         {
            // feed the existing paramter to the new query string
            if (new_url_query_string == '')
               new_url_query_string += '?';
            else
               new_url_query_string += '&';
            new_url_query_string += qs_str
         }
      }
   }

   // Prepare the new query string

   if (new_url_query_string == '')
      new_url_query_string += '\?';
   else
      new_url_query_string += '\&';

   new_url_query_string += 'Refresh=';
   if (document.getElementById('refreshPeriod').value < <%=Min_Refresh_Time%>)
   {
      document.getElementById('refreshPeriod').value = <%=Min_Refresh_Time%>;
      new_url_query_string += <%=Min_Refresh_Time%>;
   }
   else
      new_url_query_string += document.getElementById('refreshPeriod').value;

   if (document.getElementById('autoRefresh').checked)
      new_url_query_string += ',ON';
   else
      new_url_query_string += ',OFF';


   // reload the page with the new query string
   var url = location.pathname + new_url_query_string;
   window.location.assign(url);
}

//////////////////////////////////////////////////////////////////////////////////////////////////
// This function rebuilds the query string so that it either adds the Filter parameter
// according to the value of the radio button set used to control it
//////////////////////////////////////////////////////////////////////////////////////////////////
function toggle_Display_Filtered(newValue)
{
   var new_url_query_string = '';

   // get the full query string
   var url_query_string = '<%=Request.ServerVariables("QUERY_STRING")%>';

   // split it into each parameter
   var qs_arr = url_query_string.split('&');
   var i_qs_arr;
   for (i_qs_arr in qs_arr)
   {
      var qs_str = qs_arr[i_qs_arr];

      if (qs_str.length > 0)
      {
         // if we have found the Display parameter
         if (qs_str.indexOf('Filter') >= 0)
         {
            // do nothing
         }
         else
         {
            // feed the existing paramter to the new query string
            if (new_url_query_string == '')
               new_url_query_string += '?';
            else
               new_url_query_string += '&';
            new_url_query_string += qs_str
         }
      }
   }

   // Prepare the new query string
   if (new_url_query_string == '')
      new_url_query_string += '\?';
   else
      new_url_query_string += '\&';

   new_url_query_string += 'Filter=';
   new_url_query_string += newValue;

   if (document.getElementById('problemDaemonSets').checked)
   {
      new_url_query_string += ',problemDaemonSets';
   }

   if (document.getElementById('activeBuilds').checked)
   {
      new_url_query_string += ',activeBuilds';
   }

   if (document.getElementById('disabledDaemons').checked)
   {
      new_url_query_string += ',disabledDaemons';
   }
   
   // reload the page with the new query string
   var url = location.pathname + new_url_query_string;
   window.location.assign(url);
}

//////////////////////////////////////////////////////////////////////////////////////////////////
// Rebuild the query string and reload the page based on the current setting of the filter
// radio buttons
//////////////////////////////////////////////////////////////////////////////////////////////////
function update_Display_Filter()
{
   if (document.getElementById('displayfiltered_off').checked)
      toggle_Display_Filtered("OFF");
   else
      toggle_Display_Filtered("ON");
}

//-->
</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">
      <%If param_refreshEnabled AND param_RefreshPeriod <> 0 Then%>
         <META HTTP-EQUIV=REFRESH CONTENT=<%=param_RefreshPeriod%>>
      <%End If%>
      <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>
      <!-- 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" >
      <!-- MENU LAYERS -------------------------------------->
      <div id="popmenu" class="menuskin" onmouseover="clearhidemenu();highlightmenu(event,'on')" onmouseout="highlightmenu(event,'off');dynamichide(event)"></div>
      <!-- TIPS LAYERS -------------------------------------->
      <div id="formTipsLayer" style="position: absolute; z-index: 1000; visibility: hidden; left:0; top: 0; width: 10">&nbsp;</div>
      <!----------------------------------------------------->
      <!-- HEADER -->
      <!--#include file="_header.asp"-->
      <!-- BODY ---->
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
         <tr>
            <td 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>BUILD DAEMON STATUS INFORMATION</p>
                              </td>
                              <td align="right" valign="bottom"></td>
                           </tr>

                           <tr>
                              <!-- Monitoring Options Selection Box ---->
                              <td width="100%">
                                 <fieldset style="width:700px;">
                                    <legend><a href="javascript:;" class="body_scol" >&nbsp;Monitoring&nbsp;Options</a></legend>
                                    <table width="100%" border="0" cellspacing="1" cellpadding="3">
                                       <tr>
                                          <td valign="top" width="200px" nowrap background="images/bg_table_col.gif" class="body_col">Auto Refresh</td>
                                          <td valign="top" width="100px" nowrap background="images/bg_table_col.gif" class="body_col">Filter</td>
                                          <td valign="top" width="200px" nowrap background="images/bg_table_col.gif" class="body_col">Filter Options</td>
                                       </tr>

                                       <tr>
                                          <td class="body_rowg">
                                             <input name="autoRefresh" id="autoRefresh" type="checkbox" <%If param_refreshEnabled Then%>checked<%End If%> value="1" onclick='toggle_refresh()'>
                                             <input style="width:50px" name="refreshPeriod" id="refreshPeriod" type="input" maxlength="3" value=<%=param_refreshPeriod%> onchange='toggle_refresh()' >Seconds (min. 10)
                                          </td>
                                          <td class="body_rowg">
                                             <input type="radio" name="displayfiltered" id="displayfiltered_off" value="OFF" <%=Display_Filtered("OFF")%> onclick="toggle_Display_Filtered('OFF')" >Off
                                             <input type="radio" name="displayfiltered" id="displayfiltered_on"  value="ON"  <%=Display_Filtered("ON")%>  onclick="toggle_Display_Filtered('ON')"  >On
                                          </td>
                                          <td class="body_rowg">
                                             <input name="activeBuilds" id="activeBuilds" type="checkbox" <%=Filter_Checked("activeBuilds")%> value="activeBuilds" onclick='update_Display_Filter()'>Active Builds
                                             <input name="disabledDaemons"  id="disabledDaemons"  type="checkbox" <%=Filter_Checked("disabledDaemons")%>  value="disabledDaemons"  onclick='update_Display_Filter()'>Disabled Daemons
                                             <input name="problemDaemonSets"  id="problemDaemonSets"  type="checkbox" <%=Filter_Checked("problemDaemonSets")%>  value="problemDaemonSets"  onclick='update_Display_Filter()'>Problem Daemon Sets
                                          </td>
                                       </tr>
                                       <tr>
                                          <td class="body_rowg">
                                          </td>
                                          <td class="body_rowg">
                                          </td>
                                       </tr>
                                    </table>
                                 </fieldset>
                              </td>
                           </tr>
                           <%If bIndefinitelyPaused Then%>
                              <tr>
                                 <td>
                                    <span class='err_alert'>
                                       <font size='2'><b>WARNING: Indefinite Pause, Build Daemons are all stopped - please contact an administrator</b></font>
                                    </span>
                                 </td>
                              </tr>
                           <%End If%>
                        </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="0" cellpadding="0">
                           <td width="9%" valign="top"></td>
                           <tr>
                              <td valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Project
                                 <input name="NOPRJ" id="NOPRJ" type="Button" value="All" onclick="toggle_all_projects(1)">
                                 <input name="NOPRJ" id="NOPRJ" type="Button" value="None" onclick="toggle_all_projects(0)">
                              </td>
                              <td valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Release</td>
                              <td valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Release<br>Mode</td>
                              <td valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Daemon<br>Mode</td>
                              <td valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Daemon<br>Host</td>
                              <td valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Daemon<br>State</td>
                              <td valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Building<br>Package</td>
                              <td valign="middle" nowrap background="images/bg_table_col.gif" class="body_col">Last Change<br>Delta (secs)</td>
                           </tr>
                           <%

                           query_string = "SELECT rc.RCON_ID, " &_
                                          "       rc.RTAG_ID, " &_
                                          "       bm.DISPLAY_NAME, " &_
                                          "       rc.DAEMON_MODE, "&_
                                          "       rt.RTAG_NAME, " &_
                                          "       rt.OFFICIAL, " &_
                                          "       p.PROJ_ID, " &_
                                          "       p.PROJ_NAME, " &_
                                          "       rl.CURRENT_PKG_ID_BEING_BUILT, "&_
                                          "       rl.CURRENT_RUN_LEVEL, "&_
                                          "       rl.PAUSE, " &_
                                          "       TRUNC (86400*(SYSDATE - rl.KEEP_ALIVE)) as delta" &_
                                          " FROM RELEASE_CONFIG rc, RELEASE_TAGS rt, PROJECTS p, RUN_LEVEL rl, BUILD_MACHINE_CONFIG bm " &_
                                          " WHERE rt.RTAG_ID = rc.RTAG_ID " &_
                                          "   AND rc.DAEMON_HOSTNAME is not null" &_
                                          "   AND rt.PROJ_ID = p.PROJ_ID " &_
                                          "   AND rt.OFFICIAL != 'A' " &_
                                          "   AND rt.OFFICIAL != 'Y' " &_
                                          "   AND rl.RCON_ID = rc.RCON_ID" &_
                                          "   AND rc.DAEMON_HOSTNAME = bm.MACHINE_HOSTNAME(+)" &_
                                          " ORDER BY p.PROJ_NAME, rt.RTAG_NAME, rc.DAEMON_MODE, bm.DISPLAY_NAME"

                           Set rsQry = OraDatabase.DbCreateDynaset( query_string, ORADYN_DEFAULT )

                           ' String variables
                           Dim strProject_checked        ' Can be "" or "checked". Determines appearance of project enable checkbox

                           ' Boolean variables
                           Dim bProject_changed          ' signals a row change due to a different project
                           Dim bRelease_changed          ' signals a row change due to a different release
                           Dim bRow_displayed            ' signals whether a row should be displayed or not
                           Dim bRelease_link_displayed   ' indicates whether the release name has been rendered yet
                           Dim bDisplay_whole_set        ' forces the whole daemon set for a release to be displayed
                           Dim bDisplayFilterIsOn        ' Indicates if Filtering is on or off
                           Dim bShowProblemDaemonSets    ' Indicates if problem daemons must be shown during filtering
                           Dim bShowDisabledDaemons      ' Indicates if a disabled daemon must be shown during filtering
                           Dim bShowActiveBuilds         ' Indicates if active builds must be shown during filtering

                           ' Integer variables
                           Dim pkgId
                           Dim lastProjID                ' Used to detect project changes from one row to the next
                           Dim lastRtagId                ' Used to detect release changes from one row to the next
                           Dim daemonState

                           ' Initialise variables
                           strProject_checked = ""

                           bProject_changed = True
                           bRelease_changed = True
                           bRow_displayed   = True
                           bRelease_link_displayed = False
                           bDisplay_whole_set  = False
                           bDisplayFilterIsOn  = Display_Filter_Is_On()
                           bShowProblemDaemonSets = Filter_Is_On("problemDaemonSets")
                           bShowActiveBuilds   = Filter_Is_On("activeBuilds")
                           bShowDisabledDaemons = Filter_Is_On("disabledDaemons")

                           lastProjID = 0
                           lastRtagId = 0

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

                              ' determine if user has checked the project checkbox
                              strProject_checked = Is_Project_Checked(rsQry("proj_id"))


                              ' Has the project changed since the last row. If so, signal it via bProject_changed variable, and
                              ' reset the bRelease_link_displayed variable to force the display of the release column value on the
                              ' render of the next unfiltered row
                              bProject_changed = False
                              If lastProjID <> rsQry("proj_id") Then
                                 lastProjID =  rsQry("proj_id")
                                 bProject_changed = True
                                 bRelease_link_displayed = False
                                 bDisplay_whole_set = False
                              End If

                              ' Has the release changed since the last row of displayed data. If so, signal it via the bRelease_changed variable,
                              ' and reset the bRelease_link_displayed variable to force the display of the release column value on the
                              ' render of the next unfiltered row.
                              bRelease_changed = False
                              If lastRtagId <> rsQry("rtag_id") Then
                                 lastRtagId =  rsQry("rtag_id")
                                 bRelease_changed = True
                                 bRelease_link_displayed = False
                                 bDisplay_whole_set = False
                              End If

                              daemonState = rsQry("pause")
                              If IsNull(daemonState) Then
                                daemonState = 0
                              End If

                              ' generate the table row divider - this uses the bRow_displayed value from the previous iteration in order
                              ' to prevent dividers being drawn between rows that were not actually rendered due to any filtering that
                              ' may be in effect.
                              %>
                              <%=HTML_Row_Divider( bProject_changed, strProject_checked, bRelease_changed, bRow_displayed )%>
                              <%

                              ' If this is a Master Daemon, look ahead at all the slaves and evaluate if any daemons in the set appear to
                              ' be having a problem. If any are and the user has turned the "Show Problem Daemon Sets" filter on then
                              ' set the bDisplay_whole_set variable to True else set it to False
                              If rsQry("daemon_mode") = "M" Then

                                 ' Initial default value is to not show the entire daemon set
                                 bDisplay_whole_set = False

                                 ' If the filter is turned on and master daemon is NOT actively building a package and it is NOT paused...
                                 If bDisplayFilterIsOn _
                                    AND bShowProblemDaemonSets _
                                    AND (NOT Is_Actively_Building(rsQry("current_pkg_id_being_built"))) _
                                    AND (NOT Is_Paused(rsQry("current_run_level"), bIndefinitelyPaused) ) _
                                    AND (NOT Is_Disabled(daemonState) ) _
                                    Then

                                    ' Display the whole set if the master daemons delta exceeds the threshold
                                    bDisplay_whole_set = Daemon_Delta_Threshold_Exceeded(rsQry("delta"))

                                    ' If nothing appears wrong with the Master Daemon, look ahead at all the slaves in the set
                                    If NOT bDisplay_whole_set Then
                                       Dim thisRtagId
                                       Dim rtag_id_set_count
                                       Dim i

                                       thisRtagId = rsQry("rtag_id")
                                       rtag_id_set_count = 1

                                       rsQry.MoveNext
                                       Do While (NOT rsQry.BOF) AND (NOT rsQry.EOF) AND rsQry("rtag_id") = thisRtagId
                                          rtag_id_set_count = rtag_id_set_count + 1

                                          ' If this slave daemon is NOT actively building a package and it is NOT paused and its Delta exceeds the threshold...
                                          If (NOT Is_Actively_Building(rsQry("current_pkg_id_being_built"))) _
                                             AND (NOT Is_Paused(rsQry("current_run_level"), bIndefinitelyPaused)) _
                                             AND (NOT Is_Disabled(daemonState) ) _
                                             AND Daemon_Delta_Threshold_Exceeded(rsQry("delta")) Then

                                             bDisplay_whole_set = True
                                          End If
                                          rsQry.MoveNext
                                       Loop
                                       For i = 1 to rtag_id_set_count
                                          rsQry.MovePrevious
                                       Next
                                    End If
                                 End If
                              End If


                              ' Now figure out if this row of data is to be displayed or not
                              bRow_displayed  =   ( NOT bDisplayFilterIsOn ) _
                                               OR ( bDisplay_whole_set ) _
                                               OR ( bShowDisabledDaemons AND Is_Disabled(daemonState) ) _
                                               OR ( bShowActiveBuilds AND Is_Actively_Building(pkgId) )


                              ' If the release has changed and we are going to display this row, toggle the row style to give
                              ' it a slightly different look to the previous displayed row which was for a different release
                              If bRelease_changed AND bRow_displayed Then
                                 Call ToggleStyleNow
                              End If

                              ' Now we are ready to render the HTML content for the row, but we may still circumvent rendering if the user
                              ' has unchecked the project checkbox
                              %>
                              <tr>
                                 <%If bProject_changed Then%>
                                    <td nowrap class="body_rowg">
                                       <input name='DIS_PRJ_<%=rsQry("proj_id")%>' id='DIS_PRJ_<%=rsQry("proj_id")%>' type='checkbox' value=1 <%=strProject_checked%> onclick=toggle_project(<%=rsQry("proj_id")%>)>
                                       <a href='rtree.asp?proj_id=<%=rsQry("proj_id")%>'><%=rsQry("proj_name")%>
                                    </td>
                                 <%Else%>
                                    <td nowrap class="body_rowg"></td>
                                 <%End If%>

                                 <%If strProject_checked = "checked" Then%>

                                    <%If bRow_displayed Then%>

                                       <%If bRelease_changed OR NOT bRelease_link_displayed Then%>
                                          <%bRelease_link_displayed = True%>
                                          <td nowrap <%=styleNow%>><a href='build_status.asp?rtag_id=<%=rsQry("rtag_id")%>'><%=rsQry("rtag_name")%></a></td>
                                       <%Else%>
                                          <td nowrap <%=styleNow%>></td>
                                       <%End If%>


                                       <td nowrap <%=styleNow%>><%=Get_Official(rsQry("official"))%></td>
                                       <td nowrap <%=styleNow%>><%=Get_Daemon_Mode(rsQry("daemon_mode"))%></td>
                                       <td nowrap <%=styleNow%>><%=rsQry("display_name")%></td>
                                       <td nowrap <%=styleNow%>><%=Get_Run_Level(rsQry("current_run_level"), bIndefinitelyPaused,daemonState)%></td>
                                       <td nowrap <%=styleNow%>><%=Get_Pkg_Name(pkgId)%></td>

                                       <%Dim style, delta
                                       style = ""
                                       delta = rsQry("delta")
                                       If (delta > 600) AND (IsNull(pkgId) OR pkgId = "") Then
                                          style = "style=color:Red"
                                          if( daemonState >= 2 ) AND (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
                                                style = ""
                                          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%>
                                       <td nowrap <%=styleNow%><%=style%>><%=delta%></td>
                                    <%End If%>

                                 </tr>
                                 <%End If%>
                              <%
                              rsQry.MoveNext
                           Loop
                           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>
            </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
%>