Subversion Repositories DevTools

Rev

Rev 7572 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<%@LANGUAGE="VBSCRIPT"%>
<%
'=====================================================
'|                                                   |
'|                        RTREE                      |
'|                                                   |
'=====================================================
%>
<%
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/daemon_status.asp"-->
<!--#include file="class/classActionButtonControl.asp"-->
<%
'------------ ACCESS CONTROL ------------------
%>
<!--#include file="_access_control_login_optional.asp"-->
<!--#include file="_access_control_general.asp"-->
<%
'------------ Variable Definition -------------
Dim ViewType
Dim bIsaTreeView
Dim rsQryStr
Dim rsQry
Dim parProjId
Dim parShowFilter
Dim objBtnControl
Dim currLevel, lastLevel
Dim dListFilter
Dim objDmSts
Dim hoverTitle, createdBy, comment, lastMod
Dim bCanMove
Dim bCanDestroy
Dim bCanClone
Dim bCanUnarchive
Dim bCanCloseArchive

Dim bCanOpenToClose
Dim bCanRestrictiveToClose
Dim bCanCloseToClose
Dim bCanPreserveToClose
Dim bCanArchiveToClose

Dim bCanOpenToPreserve
Dim bCanRestrictiveToPreserve
Dim bCanCloseToPreserve
Dim bCanPreserveToPreserve
Dim bCanArchiveToPreserve

Dim bCanOpenToArchive
Dim bCanRestrictiveToArchive
Dim bCanCloseToArchive
Dim bCanPreserveToArchive
Dim bCanArchiveToArchive


'------------ Constants Declaration -----------
Const LIMG_TREE_I_HALF = "<img src='images/spacer.gif' width='20' height='1'>"
Const LIMG_TREE_I_NONE = "<img src='images/spacer.gif' width='30' height='15'>"
Const LIMG_TREE_I_FULL = "<img src='images/dot1h.gif' width='30' height='15'>"
Const LIMG_TREE_T      = "<img src='images/dot1.gif' width='30' height='15'>"
Const LIMG_LIST_VIEW   = "<img src='images/abtn_list_view.gif' border='0' align=absmiddle' name='imgviewtype' usemap='#mapviewtype' id='imgviewtype'>"
Const LIMG_TREE_VIEW   = "<img src='images/abtn_tree_view.gif' border='0' align=absmiddle' name='imgviewtype' usemap='#mapviewtype' id='imgviewtype'>"

Const LCONST_LIST_VIEW = 1
Const LCONST_TREE_VIEW = 2

Const DEFAULT_SHOW_FILTER = "'N','R','C','O'"

'------------ Variable Init -------------------
'   Need either proj_id or rtag_id, for which we will calculate a project id
parProjId = Request("proj_id")
If parProjId = "" Then parProjId = DB_PROJ_ID
If parProjId = ""  OR parProjId < 0 Then
   Call Destroy_All_Objects
   Response.Redirect("index.asp")
End If
Call objPMod.StoreParameter("proj_id", parProjId)


' Get show_filter from query string or failing that, from the cookie.
' Make sure that if neither supplies it, use the default
parShowFilter = Request("show_filter")
If NOT IsNull(parShowFilter) AND parShowFilter <> "" Then
   Response.Cookies (COOKIE_RELEASE_MANAGER_MEMORY)("show_filter") = parShowFilter
Else
   parShowFilter = Request.Cookies (COOKIE_RELEASE_MANAGER_MEMORY)("show_filter")
   If IsNull(parShowFilter) OR parShowFilter = "" Then
      parShowFilter = DEFAULT_SHOW_FILTER
      Response.Cookies (COOKIE_RELEASE_MANAGER_MEMORY)("show_filter") = parShowFilter
   End If
End If

Set dListFilter = CreateObject("Scripting.Dictionary")

Set objBtnControl = New ActionButtonControl

' Init access control
bCanMove =  canActionControlInProject("ConfigureRelease") 
bCanDestroy = canActionControlInProject("DestroyRelease")
bCanClone =  canActionControlInProject("CreateNewRelease")

bCanOpenToClose             =  ReleaseModeAccessCheck(enumDB_RELEASE_IN_OPEN_MODE,enumDB_RELEASE_IN_CLOSED_MODE)
bCanRestrictiveToClose      =  ReleaseModeAccessCheck(enumDB_RELEASE_IN_RESTRICTIVE_MODE,enumDB_RELEASE_IN_CLOSED_MODE)
bCanCloseToClose            =  FALSE
bCanPreserveToClose         =  ReleaseModeAccessCheck(enumDB_RELEASE_IN_PRESERVE_MODE,enumDB_RELEASE_IN_CLOSED_MODE)
bCanArchiveToClose          =  ReleaseModeAccessCheck(enumDB_RELEASE_IN_ARCHIVE_MODE,enumDB_RELEASE_IN_CLOSED_MODE)

bCanOpenToPreserve          =  ReleaseModeAccessCheck(enumDB_RELEASE_IN_OPEN_MODE,enumDB_RELEASE_IN_PRESERVE_MODE)
bCanRestrictiveToPreserve   =  ReleaseModeAccessCheck(enumDB_RELEASE_IN_RESTRICTIVE_MODE,enumDB_RELEASE_IN_PRESERVE_MODE)
bCanCloseToPreserve         =  ReleaseModeAccessCheck(enumDB_RELEASE_IN_CLOSED_MODE,enumDB_RELEASE_IN_PRESERVE_MODE)
bCanPreserveToPreserve      =  FALSE
bCanArchiveToPreserve       =  ReleaseModeAccessCheck(enumDB_RELEASE_IN_ARCHIVE_MODE,enumDB_RELEASE_IN_PRESERVE_MODE)

bCanOpenToArchive           =  ReleaseModeAccessCheck(enumDB_RELEASE_IN_OPEN_MODE,enumDB_RELEASE_IN_ARCHIVE_MODE)            
bCanRestrictiveToArchive    =  ReleaseModeAccessCheck(enumDB_RELEASE_IN_RESTRICTIVE_MODE,enumDB_RELEASE_IN_ARCHIVE_MODE)     
bCanCloseToArchive          =  ReleaseModeAccessCheck(enumDB_RELEASE_IN_CLOSED_MODE,enumDB_RELEASE_IN_ARCHIVE_MODE)          
bCanPreserveToArchive       =  ReleaseModeAccessCheck(enumDB_RELEASE_IN_PRESERVE_MODE,enumDB_RELEASE_IN_ARCHIVE_MODE)                                                                                          
bCanArchiveToArchive        =  FALSE

'----------------------------------------------
%>
<%
'--------------------------------------------------------------------------------------------------------------------------
' Determines if the specified filter is on/off and returns a string to use to check the associated checkbox accordingly
Function isListFilterChecked (nFilterId)
    isListFilterChecked = dListFilter.Exists ( "'" & CStr(nFilterId) & "'"  )
End Function


Function GetIsListFilterChecked( nFilterId )
   GetIsListFilterChecked = ""

  If bIsaTreeView AND nFilterId <> enumDB_RELEASE_IN_SNAPSHOT_MODE Then
       ' Disable the control in Tree View
       GetIsListFilterChecked = GetIsListFilterChecked & "checked disabled"
  Else
       If isListFilterChecked (nFilterId) Then
          GetIsListFilterChecked = "checked"
       End If
  End If

End Function
'--------------------------------------------------------------------------------------------------------------------------
' Reads the cookie for the filter and creats a dictionary element for each item therein. the dictionary
' is used by the GetIsListFilterChecked function to determine checkbox state in the filter options
Sub GetListFilterValues ( outDepFilter )
   Dim FilterVal, aFilterValues

   If parShowFilter <> "" Then
      aFilterValues = Split( Replace( parShowFilter, " ", ""), ",")

      For Each FilterVal In aFilterValues
         outDepFilter.Item (CStr( FilterVal )) = ""
      Next
   End If
End Sub

'----------------------------------------------------------------------------------------------------------------------------------------------
Sub RenderIndent ( nLastLevel, nCurrLevel )
   Dim i

   If nCurrLevel <= 1 Then Exit Sub

   '-- Render half lines
   If nCurrLevel > 2 Then
      For i = 1 To nCurrLevel - 2
         Response.write LIMG_TREE_I_NONE
      Next
   End If


   '-- Render branch or line
   If nLastLevel < nCurrLevel Then
      Response.write LIMG_TREE_T
   Else
      Response.write LIMG_TREE_I_FULL
   End If

End Sub
'----------------------------------------------------------------------------------------------------------------------------------------------
Function GetViewType ()
   Dim CookieViewType

   CookieViewType = Request.Cookies (COOKIE_RELEASE_MANAGER_MEMORY)("RELEASE_VIEW")

   If CookieViewType <> "" Then
      ' Get current view type from cookie
      GetViewType = CInt(CookieViewType)
   Else
      ' Set current view to list view
      Response.Cookies (COOKIE_RELEASE_MANAGER_MEMORY)("RELEASE_VIEW") = LCONST_LIST_VIEW
      GetViewType = LCONST_LIST_VIEW
   End If

End Function
'----------------------------------------------------------------------------------------------------------------------------------------------
Sub SetViewType ()
   If Request("viewtype") = "" Then Exit Sub    ' Nothing to do

   Response.Cookies (COOKIE_RELEASE_MANAGER_MEMORY)("RELEASE_VIEW") = Request("viewtype")
End Sub
'----------------------------------------------------------------------------------------------------------------------------------------------
Sub RenderDaemonStatusConfig(nRtagId)%>
<table class="embedded_table">
    <tr>
        <td class=nowrap>
            <img src='icons/i_edit.gif' border=0 vspace=0 hspace=0 title='Configure Daemons' onclick='location.href="release_config.asp?rtag_id=<%=nRtagId%>"'>
            <img src='icons/ext_log.gif' border=0 vspace=0 hspace=0 title='View Build Log'onclick='location.href="build_release_log.asp?rtag_id=<%=nRtagId%>"'>
        </td>
        <td>
            <%Call objDmSts.RenderDaemonStatus(nRtagId,16)%>
        </td>
    </tr>
 </table>
<%End Sub

'----------------------------------------------------------------------------------------------------------------------------------------------
Sub RenderLxrState()
    Response.Write RenderLxrStateString(rsQry("rtag_id"),rsQry("lxr"),rsQry("lxrserver"),rsQry("official"),"")
    Response.Write RenderS3ManifestStateString(rsQry("rtag_id"), rsQry("S3MANIFEST"), rsQry("official"), "")
End Sub
'----------------------------------------------------------------------------------------------------------------------------------------------
Function RenderActions(nRtagId, sOfficial, nCanDelete)
    Response.Write "<span title='Select operation from dropdown menu' " &_
                       "class='select-operation ui-icon ui-icon-triangle-1-s' " &_
                       "data-rtag-id='" & nRtagId &_
                       "' data-official='"& sOfficial &_
                       "' data-candelete='"& nCanDelete &_
                       "' style='display:inline-block'>"&_
                   "</span>"
End Function
'----------------------------------------------------------------------------------------------------------------------------------------------
Function GetMassRefComments (nRtagId)
   Dim UsedBy
   Dim rsQryUse
   Dim linkB
   Dim joiner : joiner = ""
   Dim comment : comment = ""

'   If parProjId <> 2 Then
'     assocMASSREF = rsQry("assoc_mass_ref")
'     If assocMASSREF <> "" Then
'        Set rsQryAssoc = OraDatabase.DbCreateDynaset("SELECT RTAG_NAME, RTAG_ID FROM RELEASE_TAGS WHERE RTAG_ID="&assocMASSREF , ORADYN_DEFAULT)
'        assocMASSREFName = rsQryAssoc("RTAG_NAME")
'        link = rsQryAssoc("rtag_id")
'        rsQryAssoc.Close
'        Set rsQryAssoc = Nothing
'     Else
'        assocMASSREFName = "None."
'     End If
'   Else
      UsedBy = nRtagId
      If UsedBy <> "" Then
         Set rsQryUse = OraDatabase.DbCreateDynaset("SELECT * FROM RELEASE_TAGS RT, PROJECTS P WHERE RT.ASSOC_MASS_REF=" & nRtagId & " AND RT.PROJ_ID=P.PROJ_ID", ORADYN_DEFAULT)

         While ((NOT rsQryUse.BOF) AND (NOT rsQryUse.EOF))
            If rsQryUse("assoc_mass_ref") = UsedBy Then
               linkB = "dependencies.asp?rtag_id="&rsQryUse("rtag_id")
               comment = joiner & rsQryUse("proj_name") & " -> <a href="&linkB&">"& rsQryUse("rtag_name") &"</a>"
               joiner = " <br> "
               rsQryUse.MoveNext
            End If
         WEnd
         rsQryUse.Close
         Set rsQryUse = Nothing
      End If
      GetMassRefComments = comment
End Function
'----------------------------------------------------------------------------------------------------------------------------------------------
Sub SidePanelScript%>
<script>
var pageTriggerDelay = 0;
$(document).ready(function() {
        $('#stateFilter :checkbox').click(function(){

            // Force refresh when check box changes
            // Delay the refesh 1 second so that multiple checkboxes can be ticked
            // Restart the delay if another trigger is invoked.

            $('#cbPending').show();
            $('#updateForm').removeAttr('disabled');

             if ( pageTriggerDelay != 0 ) {
                 clearTimeout(pageTriggerDelay);
                 pageTriggerDelay = 0;
             }

             pageTriggerDelay = setTimeout(function(){
                 $("#updateForm" ).trigger( "click" );
                 }, 1000);
        });
});
</script>
<%End Sub
Sub SidePanel%>
     <!-- ICON STATUS and FILTER -------------------------------------->
     <form name="FilterForm" method="post" action="<%=ScriptName%>">
         <table id='stateFilter' width="118" border="0" align="left" style="margin-top: 38px;">
            <tr class=form_field_bg>
               <td width="26"><span class="body_txt">Icon</span></td>
               <td width="82"><span class="body_txt">Release State </span></td>
            </tr>
            <tr class=form_field_grey_bg>
               <td><img src="images/i_rtag_open_mode.gif" width="15" height="13"></td>
               <td><span class="body_txt"><input name="listFilter" type="checkbox" value="'<%=enumDB_RELEASE_IN_OPEN_MODE%>'" <%=GetIsListFilterChecked(enumDB_RELEASE_IN_OPEN_MODE)%>>Open Mode</span></td>
            </tr>
            <tr class=form_field_grey_bg>
               <td><img src="images/i_rtag_restrictive_mode.gif" width="15" height="15"></td>
               <td nowrap><span class="body_txt"><input name="listFilter" type="checkbox" value="'<%=enumDB_RELEASE_IN_RESTRICTIVE_MODE%>'" <%=GetIsListFilterChecked(enumDB_RELEASE_IN_RESTRICTIVE_MODE)%>>Restrictive Mode</span></td>
            </tr>
            <tr class=form_field_grey_bg>
               <td><img src="images/i_rtag_ccb_mode.gif" width="15" height="15"></td>
               <td><span class="body_txt"><input name="listFilter" type="checkbox" value="'<%=enumDB_RELEASE_IN_CCB_MODE%>'" <%=GetIsListFilterChecked(enumDB_RELEASE_IN_CCB_MODE)%>>CCB Mode</span></td>
            </tr>
            <tr class=form_field_grey_bg>
               <td><img src="images/i_rtag_closed_mode.gif" width="15" height="14"></td>
               <td><span class="body_txt"><input name="listFilter" type="checkbox" value="'<%=enumDB_RELEASE_IN_CLOSED_MODE%>'" <%=GetIsListFilterChecked(enumDB_RELEASE_IN_CLOSED_MODE)%>>Closed Mode</span></td>
            </tr>
            <tr class=form_field_grey_bg>
               <td><img src="images/i_rtag_closed_mode_warn.gif" width="15" height="14"></td>
               <td><span class="body_txt"><input name="listFilter" type="checkbox" value="'<%=enumDB_RELEASE_IN_CLOSED_WARN%>'" <%=GetIsListFilterChecked(enumDB_RELEASE_IN_CLOSED_WARN)%>>Closed Aged</span></td>
            </tr>
            <tr class=form_field_grey_bg>
               <td><img src="images/i_rtag_preserve_mode.gif" width="15" height="14"></td>
               <td><span class="body_txt"><input name="listFilter" type="checkbox" value="'<%=enumDB_RELEASE_IN_PRESERVE_MODE%>'" <%=GetIsListFilterChecked(enumDB_RELEASE_IN_PRESERVE_MODE)%>>Preserve Mode</span></td>
            </tr>
            <tr class=form_field_grey_bg>
               <td><img src="images/i_rtag_archive_mode.gif" width="15" height="14"></td>
               <td><span class="body_txt"><input name="listFilter" type="checkbox" value="'<%=enumDB_RELEASE_IN_ARCHIVE_MODE%>'" <%=GetIsListFilterChecked(enumDB_RELEASE_IN_ARCHIVE_MODE)%>>Archive Mode</span></td>
            </tr>
            <tr class=form_field_grey_bg>
               <td><img src='images/snapshot.png' height="14"></td>
               <td><span class="body_txt"><input name="listFilter" type="checkbox" value="'<%=enumDB_RELEASE_IN_SNAPSHOT_MODE%>'" <%=GetIsListFilterChecked(enumDB_RELEASE_IN_SNAPSHOT_MODE)%>>Snapshots</span></td>
            </tr>
            <%If NOT bIsaTreeView OR TRUE Then%>
             <tr>
                <td>&nbsp;</td>
                <td><input id=updateForm name="btn" type="submit" class="form_btn" value="Update" disabled></td>
             </tr>
             <tr>
                <td colspan=2 class='tcenter nowrap body_rowg display-none' id=cbPending>&nbsp;Update Pending</td>
             </tr>
             <%End If%>
         </table>
        <%=objPMod.ComposeHiddenTags()%>
        <input type="hidden" name="action" value="true">
    </form>
<%End Sub
'----------------------------------------------------------------------------------------------------------------------------------------------
Sub MainPanel%>
 <!-- ACTION BUTTONS ---------------------------------------------->
 <table width="100%"  border="0" cellspacing="0" cellpadding="7" style="background-color:#DAD7C8">
    <tr>
       <td width="1">
          <%
          If bIsaTreeView Then
             Response.write LIMG_TREE_VIEW
          Else
             Response.write LIMG_LIST_VIEW
          End If
          %>
       </td>
       <td width="100%">
          <%
          Dim aBtnsDef
          ' Define action buttons
          aBtnsDef = Array("btnNewRelease", "width=5", "btnMergeManager", "width=5", "btnAdminView", "width=5", "btnNotificationView","width=5", "btnProjectReplication")

          ' Load action buttons from database
          Call objBtnControl.LoadActionButtons ( aBtnsDef, OraDatabase )

          ' Set spacing to minimum between buttons
          objBtnControl.ButtonSpacer = 0
          objBtnControl.ImageHspace = 2

          ' Access Control
          If NOT canActionControlInProject("CreateNewRelease") Then Call objBtnControl.Active ( "btnNewRelease", "N" )
          If NOT canActionControlInProject("ConfigureRelease") Then Call objBtnControl.Active ( "btnMoveRelease", "N" )

          ' -- Render Buttons
          Call objBtnControl.Render  ( aBtnsDef, objAccessControl )
          %>
       </td>
    </tr>
 </table>
 <!-- ACTION BUTTONS END  ------------------------------------------>
 <!-- RELEASE INFORMATION  ----------------------------------------->
 <table id=releaseTree width="100%"  border="0" cellspacing="10" cellpadding="0">
       <tr>
          <td>
             <!-- TREE VIEW ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
             <%If bIsaTreeView Then%>
                <table width="100%"  border="0" cellspacing="1" cellpadding="1" class=stdGrey>
                    <thead>
                       <tr class='form_field_bg' style="height:21px">
                          <th width="25%" class="body_txt">Release Name </th>

                          <%If parProjId <> 2 Then %>
                             <th width="15%" class="body_txt">Created</th>
                             <th width="47%" class="body_txt">Comments</th>
                          <%Else%>
                             <th width="15%" class="body_txt">Created</th>
                             <th width="25%" class="body_txt">Used By </th>
                             <th width="22%" class="body_txt">Comments</th>
                          <%End If%>
                       <th width="1%" title="Features available">Features</th>
                       <th width="3%" nowrap class="body_txt">Daemon&nbsp;Status</th>
                       </tr>
                    </thead>
                   <%
                   OraDatabase.Parameters.Add "PROJ_ID",  parProjId,  ORAPARM_INPUT, ORATYPE_NUMBER
                   OraDatabase.Parameters.Add "USER_ID",  objAccessControl.UserId,  ORAPARM_INPUT, ORATYPE_NUMBER

                   Dim treeFilter : treeFilter = ""
                   If NOT isListFilterChecked(enumDB_RELEASE_IN_SNAPSHOT_MODE) Then
                       treeFilter = " AND rt.OFFICIAL != 'S'"
                   End If
                   rsQryStr = GetQuery ("ReleaseVersionTree.sql")
                   rsQryStr = Replace(rsQryStr, "/*TREE_FILTER*/", treeFilter )

                   Set rsQry = OraDatabase.DbCreateDynaset( rsQryStr, ORADYN_DEFAULT )
                   lastLevel = 0

                   OraDatabase.Parameters.Remove "USER_ID"
                   OraDatabase.Parameters.Remove "PROJ_ID"

                   Dim lastRtagId, parentRtag_id

                   If rsQry.RecordCount > 0 Then

                      Set objDmSts = New DaemonStatus
                      Call objDmSts.GetDaemonStatus(parProjId)

                      While (NOT rsQry.BOF) AND (NOT rsQry.EOF)
                         currLevel = CInt(rsQry("hierarchy"))
                         createdBy = rsQry("created_stamp") & " by " & rsQry("creator")
                         lastMod = rsQry("lastModified") 
                         hoverTitle = "State Last Change : "& rsQry("OFFICIAL_STAMP") & " by " & rsQry("modifier") & ". " & rsQry("OFFICIAL_STAMP_DAYS")& " Days ago" &_
                                 "&#10;Content Last Modified: " & lastMod & ". " & rsQry("LastModified_DAYS")& " Days ago" 
                          
                         If rsQry("userCanDelete") = 1 Then
                             createdBy = createdBy & "<br>Creator can delete"
                         End If
                         
                         %>
                         <tr>
                            <td nowrap valign=top>
                               <%Call RenderIndent( lastLevel, currLevel )%>
                               <%Call RenderActions(rsQry("rtag_id"),rsQry("official"),rsQry("userCanDelete"))%>
                               <a href="dependencies.asp?rtag_id=<%=rsQry("rtag_id")%>" class="body_link" >
                               <%=ReleaseIcon( rsQry("official") )%>&nbsp;<%=rsQry("rtag_name")%></a>
                            </td>
                            <td nowrap  valign=top title="<%=hoverTitle%>"><img src="icons/s_note.gif" height="10" width="10" >&nbsp;</img><%=createdBy%>
                            <%
                            If parProjId = 2 Then
                               comment = GetMassRefComments(rsQry("rtag_id"))
                               If comment = "" Then comment = "None."
                               %>
                               <td><%=comment%></td>
                            <%End If%>

                            <td><%=NewLine_To_BR(rsQry("description"))%></td>
                            <td nowrap valign="top"><%Call RenderLxrState() %></td>
                            <td valign="top"><%Call RenderDaemonStatusConfig(rsQry("rtag_id"))%></td>
                         </tr>
                         <%
                         lastLevel = currLevel
                         rsQry.MoveNext
                      WEnd
                      Set objDmSts = Nothing
                   End If
                   rsQry.Close
                   Set rsQry = Nothing
                   %>
                </table>
             <!-- LIST VIEW ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
             <%Else%>
                <table width="100%"  border="0" cellspacing="1" cellpadding="1" class='stdGrey'>
                    <thead>
                       <tr class='form_field_bg' style="height:21px">
                          <th width="1%">&nbsp;</th>
                          <th width="20%" >Release Name </th>
                          <th width="10%" >Created</th>
                          <%If parProjId <> 2 Then %>
                             <th width="47%" >Comments</th>
                          <%Else%>
                             <th width="24%" >Used By </th>
                             <th width="22%" >Comments</th>
                          <%End If%>
                          <th width="1%" title="Features available">Features</th>
                          <th width="3%">Daemon Status</th>
                       </tr>
                    </thead>
                   <%
                      OraDatabase.Parameters.Add "PROJ_ID",  parProjId,                ORAPARM_INPUT, ORATYPE_NUMBER
                      OraDatabase.Parameters.Add "USER_ID",  objAccessControl.UserId,  ORAPARM_INPUT, ORATYPE_NUMBER

                      rsQryStr = GetQuery ("ReleaseVersionList.sql")
                      rsQryStr = Replace(rsQryStr, "/*SHOW_FILTER*/", parShowFilter )

                      Set rsQry = OraDatabase.DbCreateDynaset( rsQryStr, ORADYN_DEFAULT )

                      OraDatabase.Parameters.Remove "USER_ID"
                      OraDatabase.Parameters.Remove "PROJ_ID"

                      If rsQry.RecordCount > 0 Then

                         Set objDmSts = New DaemonStatus
                         Call objDmSts.GetDaemonStatus(parProjId)

                         While (NOT rsQry.BOF) AND (NOT rsQry.EOF)
                            createdBy = rsQry("created_stamp") & " by " & rsQry("creator")
                            lastMod = rsQry("LastModified")
                            hoverTitle = "State Last Change : "& rsQry("OFFICIAL_STAMP") & " by " & rsQry("modifier") & ". " & rsQry("OFFICIAL_STAMP_DAYS")& " Days ago" &_
                                    "&#10;Content Last Modified: " & lastMod & ". " & rsQry("LastModified_DAYS")& " Days ago" 
                            If rsQry("userCanDelete") = 1 Then
                                createdBy = createdBy & "<br>Creator can delete"
                            End If

                            %>
                            <tr>
                               <td valign="top">
                                  <%Call RenderActions(rsQry("rtag_id"),rsQry("official"),rsQry("userCanDelete"))%>
                               </td>
                               <td nowrap valign="top">
                                  <a href="dependencies.asp?rtag_id=<%=rsQry("rtag_id")%>" class="body_link" >
                                  <%=ReleaseIcon( rsQry("official"))%>&nbsp;<%=rsQry("rtag_name")%></a>
                               </td>
                               <td nowrap  valign=top title="<%=hoverTitle%>"><img src="icons/s_note.gif" height="10" width="10" >&nbsp;</img><%=createdBy%>
                               <%
                               If parProjId = 2 Then
                                  comment = GetMassRefComments(rsQry("rtag_id"))
                                  If comment = "" Then comment = "None."
                                  %>
                                    <td><%=comment%></td>
                               <%End If%>
                               <td><%=NewLine_To_BR(  rsQry("description")   )%></td>
                               <td nowrap valign="top"><%Call RenderLxrState() %></td>
                               <td valign="top"><%Call RenderDaemonStatusConfig(rsQry("rtag_id"))%>
                               </td>
                            </tr>
                            <%
                            rsQry.MoveNext
                         WEnd
                         Set objDmSts = Nothing
                      End If
                      rsQry.Close
                      Set rsQry = Nothing
                      %>
                </table>
             <%End If%>
             <!-- LIST VIEW END ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
             <!-- MESSAGE +++++++++++++++++++++++++++++++++++++++++++++++++++ -->
             <!--#include file="messages/_msg_inline.asp"-->
             <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
          </td>
       </tr>
 </table>

<%End Sub
'------------ RUN BEFORE PAGE RENDER ----------
If (Request("action") <> "") Then

   If Request("btn") = "Update" Then
      ' Store filter in cookie
      Response.Cookies (COOKIE_RELEASE_MANAGER_MEMORY)("show_filter") = Request("listFilter")

      ' Redirect to the current page so that a refesh will not ' cause a form re-submit.
      Call Destroy_All_Objects
      Response.Redirect(ScriptName & "?proj_id=" & parProjId)
   End If

End If

' Set view type  if required
Call SetViewType ()

' Get current view type
ViewType = GetViewType()
bIsaTreeView = (ViewType = LCONST_TREE_VIEW)

'----------------------------------------------
%>
<html>
<head>
<%
   Set rsQry = OraDatabase.DbCreateDynaset( "SELECT PROJ_NAME FROM PROJECTS WHERE PROJ_ID="& parProjId, ORADYN_DEFAULT )
%>
<title><%=rsQry("proj_name")%></title>
<link rel="shortcut icon" href="<%=FavIcon%>"/>
<%
   rsQry.Close
   Set rsQry = Nothing
%>
<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?ver=<%=VixVerNum%>" type="text/css">
<link rel="stylesheet" href="images/navigation.css?ver=<%=VixVerNum%>" type="text/css">
<script language="JavaScript" src="images/common.js?ver=<%=VixVerNum%>"></script>
<!-- DROPDOWN MENUS -->
<!--#include file="_menu_def.asp"-->
<script language="JavaScript1.2" src="images/popup_menu.js?ver=<%=VixVerNum%>"></script>

<!-- Dropdown action menu scripts -->
<style>
    .ui-menu { position: absolute; }
</style>
<!--#include file="_jquery_includes.asp"-->
<%Call SidePanelScript%>
<script>
    $(function() {
        // Global menu data structure
        //  Persist between invocations of the menu
        //      Used to mergeLeft rtagid
        //      Used to store current menu info
        $.acData = {
            //  Data
            bCanOpenToClose                 : <%=iif(bCanOpenToClose          , "true", "false")%> ,             
            bCanRestrictiveToClose          : <%=iif(bCanRestrictiveToClose   , "true", "false")%> ,
            bCanCloseToClose                : <%=iif(bCanCloseToClose         , "true", "false")%> ,
            bCanPreserveToClose             : <%=iif(bCanPreserveToClose      , "true", "false")%> ,
            bCanArchiveToClose              : <%=iif(bCanArchiveToClose       , "true", "false")%> ,
                                                                              
            bCanOpenToPreserve              : <%=iif(bCanOpenToPreserve       , "true", "false")%> ,
            bCanRestrictiveToPreserve       : <%=iif(bCanRestrictiveToPreserve, "true", "false")%> ,
            bCanCloseToPreserve             : <%=iif(bCanCloseToPreserve      , "true", "false")%> ,
            bCanPreserveToPreserve          : <%=iif(bCanPreserveToPreserve   , "true", "false")%> ,
            bCanArchiveToPreserve           : <%=iif(bCanArchiveToPreserve    , "true", "false")%> ,
                                                                              
            bCanOpenToArchive               : <%=iif(bCanOpenToArchive        , "true", "false")%> ,
            bCanRestrictiveToArchive        : <%=iif(bCanRestrictiveToArchive , "true", "false")%> ,
            bCanCloseToArchive              : <%=iif(bCanCloseToArchive       , "true", "false")%> ,
            bCanPreserveToArchive           : <%=iif(bCanPreserveToArchive    , "true", "false")%> ,
            bCanArchiveToArchive            : <%=iif(bCanArchiveToArchive     , "true", "false")%> ,
            };

            // Convert from Release Mode to [canClose, canPreserve, canArchive, canDestroy]
        $.mode2access = {

            N: [$.acData.bCanOpenToClose,$.acData.bCanOpenToPreserve,$.acData.bCanOpenToArchive, 0],
            R: [$.acData.bCanRestrictiveToClose,$.acData.bCanRestrictiveToPreserve,$.acData.bCanRestrictiveToArchive, 0],
            C: [$.acData.bCanRestrictiveToClose,$.acData.bCanRestrictiveToPreserve,$.acData.bCanRestrictiveToArchive, 0],
            Y: [$.acData.bCanCloseToClose,$.acData.bCanCloseToPreserve,$.acData.bCanCloseToArchive ,1],
            O: [$.acData.bCanCloseToClose,$.acData.bCanCloseToPreserve,$.acData.bCanCloseToArchive, 1],
            P: [$.acData.bCanPreserveToClose,$.acData.bCanPreserveToPreserve,$.acData.bCanPreserveToArchive, 1],
            A: [$.acData.bCanArchiveToClose,$.acData.bCanArchiveToPreserve,$.acData.bCanArchiveToArchive, 1],
            S: [false, false, false, 1],

            canAccess : function(state, index) {
                if ( this.hasOwnProperty(state)) {
                    return this[state][index];
                } else {
                    return false;
                }
            },
        };

        $.miniMenu = {
            //  Data

            //  Menu operations
            open : function (data) {
                //console.log("Opening:", data.rtagid);
                this.gotoUrl("dependencies.asp", {rtag_id : data.rtagid});
             },

             edit : function (data) {
                 //console.log("Editing:", data.rtagid);
                 this.gotoUrl("form_edit_release.asp", {rtag_id : data.rtagid, rfile : "<%=ScriptName%>"});
             },

             mergeSelect : function (data) {
                 //console.log("Merge from:", data.rtagid );
                 $('#releaseTree .body_row_sel2').removeClass('body_row_sel2');
                 if (data.mergeLeft != data.rtagid) {
                     data.mergeLeft = data.rtagid;
                     $.miniMenu.currentRow.addClass('body_row_sel2');
                 } else {
                     delete(data.mergeLeft);
                 }
             },

             merge : function (data) {
                 //console.log ("Merge:", data.mergeLeft, data.rtagid);
                 this.gotoUrl("diff.asp", { rtagA : data.mergeLeft, rtagB : data.rtagid});
             },

             close : function (data) {
                 //console.log("Closing:", data.rtagid);
                  this.closeRelease('Close', data.rtagid , 3);
             },

             preserve : function (data) {
                 //console.log("Preserving:", data.rtagid);
                  this.closeRelease('Preserve', data.rtagid , 6);
             },

             archive : function (data) {
                 //console.log("Archiving:", data.rtagid);
                  this.closeRelease('Archive', data.rtagid , 5);
             },
<%If objAccessControl.UserLogedIn Then%>
             delete : function (data) {
                 //console.log("Delete:", data.rtagid);
                 $.miniMenu.currentRow.addClass('body_row_sel_outline');
                 var that = this;
                 vixConfirm("This Release will be permanently destroyed.<p>Are you sure?", { 
                    deferred : true, 
                    title: 'Destroy Release', 
                    button : 'Destroy Release',
                    icon : 'images/i_critical.gif' }
                 ).done(function(){
                     that.gotoUrl("_destroy_release.asp", {rtag_id_list : data.rtagid, proj_id : <%=parProjId%>, rfile : "<%=ScriptName%>"});
                 }).fail(function(){
                     $('#releaseTree .body_row_sel_outline').removeClass('body_row_sel_outline');
                 });
             },
<%End If%>
<%If bCanMove Then%>
             move : function (data) {
                 //console.log("Move:", data.rtagid);
                 this.gotoUrl("form_move_release.asp", { rtag_id_list : data.rtagid, proj_id : <%=parProjId%> });
             },
<%End If%>
<%If bCanClone Then%>
             clone : function(data) {
                 //console.log("Clone:", data.rtagid);
                 this.gotoUrl("new_release.asp", { rtag_id_list : data.rtagid, proj_id : <%=parProjId%>, branch : "Y" });
             },
<%End If%>

             // Confirm Close/Preserve/Archive
             closeRelease : function (text, rtag_id, mode) {
                  var that = this;
                  $.miniMenu.currentRow.addClass('body_row_sel_outline');
                  vixConfirm("Are you sure you want to '" + text + "' this Release", { deferred : true } )
                    .done(function(){
                      that.gotoUrl("_change_release_mode.asp", {rtag_id : rtag_id, mode_code : mode , rfile : "<%=ScriptName%>"});
                    })
                    .fail(function(){
                            $('#releaseTree .body_row_sel_outline').removeClass('body_row_sel_outline');
                        });
             },

             //
             // Internal functions
             // Goto url, or open in new tab
             gotoUrl: function (url, params)
             {
                 // Open in new tab - not as simple as it sounds
                 // Need to create a form and submit it
                 if(this.event.shiftKey){
                     var form = $('<form>',{
                         action : url,
                         target : '_blank',
                         //method : 'GET'
                         });

                     $.each(params,function(n,v){
                         var item = $('<input>',{
                             name : n,
                             value : v
                         });
                         form.append(item);
                        });


                     form.appendTo(document.body);
                     form.submit();
                     form.remove();
                 }
                 else {
                     if (params)
                         url += '?' + jQuery.param(params)
                     window.location.href = url;
                 }
             },
    };

    // Create and Hide the Menu
    $( "#select-menu" ).hide().menu();

    // Register menuselect event handler
    $( "#select-menu" ).on( "menuselect", function( event, ui ) {
       var opr = ui.item.data('opr');

        // Invoke operation within the menu data structure
        if (typeof $.miniMenu[opr] == 'function' ) {
            $.miniMenu['event'] = event;
            $.miniMenu[opr]($.miniMenu);
            return;
        }
        //console.log ("Menu Operation:", opr, "Not found");
    });


    // Add menu to all require instances
   $( ".select-operation" ).click(function(event) {
        // When clicked - create and show the menu
        // Insert rtag-id

       // In order to have the menu positioing work correctly
       //   Create a div that covers the visible screen area
       //   Us it within the menu poistioning
       //   Then delete it again
       var positionDiv = $( "<div></div>" ).css({
               position: 'absolute', 
               top : $(document).scrollTop(), 
               left : $(document).scrollLeft(),
               width: '100vw',
               height: '100vh',
               'z-index' : -1,
           });
       positionDiv.appendTo(document.body);

        //  Create the menu
        var menu = $("#select-menu").show().position({
             my: "left top",
             at: "center bottom",
             of: this,
             within : positionDiv,
        });

        // Cleanup the poistioning div
        positionDiv.remove();

        // Setup global data
        $.miniMenu.rtagid = $(this).data('rtag-id');

        // Set initial menu state - merge target
        $('#select-menu-merge').toggleClass('ui-state-disabled',!('mergeLeft' in $.miniMenu ));

        // Set initial state close/archive
        //
        var official = $(this).data('official');
        $('#select-menu-close').toggleClass('ui-state-disabled',  ! $.mode2access.canAccess(official,0));
        $('#select-menu-preserve').toggleClass('ui-state-disabled',!$.mode2access.canAccess(official,1));
        $('#select-menu-archive').toggleClass('ui-state-disabled',! $.mode2access.canAccess(official,2));

        // Set initial state destroy
        var canDestroy = ($.mode2access.canAccess(official,3)) && ( $(this).data('candelete') || <%=iif(bCanDestroy,"1","0")%> );
        $('#select-menu-destroy').toggleClass('ui-state-disabled',(canDestroy == 0));

        // Highlight the row selected
        $('#releaseTree .body_row_sel').removeClass('body_row_sel');
        $.miniMenu.currentRow = $(event.target).closest('tr').addClass('body_row_sel');

        // Allow click outside of the menu to close it
        $( document ).one( "click", function() {
            menu.hide();
            $('#releaseTree .body_row_sel').removeClass('body_row_sel');
        });


        // Prevent propagation of event
        return false;
    });
});
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" >
<!-- HEADER -->
<!--#include file="_header.asp"-->
<!-- BODY ---->
<%Call GetListFilterValues ( dListFilter )%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
   <tr>
      <td class='bg_panel'>
            <%Call SidePanel%>
      </td>
      <td rowspan="2" valign="top" width="100%">
        <%Call MainPanel%>
      </td>
   </tr>
</table>
<!-- Dropdown Menu -->
<div id=testdiv></div>
<div >
  <ul id="select-menu" style="display:none;">
   <li data-opr="open" title="Goto this Release">Open ...</li>
    <li data-opr="edit" title="Edit the properties of the Release">Edit Properties</li>
    <li <%=iif(bCanMove,"data-opr=move","class=ui-state-disabled")%> title="Change the order in which releases are displayed">Change display order</li>
    <li>-</li>
    <li data-opr="mergeSelect" title="Select as the source (left side) of a merge or comparison">Select for Merge/Diff</li>
    <li id="select-menu-merge" data-opr="merge" title="Merge or Compare from selected release to this release">Merge/Diff from selected</li>
    <li>-</li>
    <li id="select-menu-close" data-opr="close">Close Release</li>
    <li id="select-menu-preserve" data-opr="preserve" >Preserve Release</li>
    <li id="select-menu-archive" data-opr="archive" >Archive Release</li>
    <li>-</li>
    <li <%=iif(bCanClone,"data-opr=clone","class=ui-state-disabled")%> title="Create a new Release based on selected Release">Clone Release</li>
    <li>-</li>
    <li id="select-menu-destroy" data-opr="delete", title="Delete the selected Release">Destroy Release</li>
    <li>-</li>
    <li>Close Menu</li>
  </ul>
</div>
<map name="mapviewtype">
  <area shape="rect" coords="2,2,69,23" href="<%=ScriptName%>?viewtype=1&<%=objPMod.ComposeURL()%>" title="Switch to List View">
  <area shape="rect" coords="73,2,143,23" href="<%=ScriptName%>?viewtype=2&<%=objPMod.ComposeURL()%>" title="Switch to Tree View">
</map>
<!-- FOOTER -->
<!--#include file="_footer.asp"-->
</body>
</html>