Subversion Repositories DevTools

Rev

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

<%@LANGUAGE="VBSCRIPT"%>
<%
'=====================================================
'|                                                   |
'|                              RequestViewCointent.asp                  |
'|                                                   |
'=====================================================
%>
<%
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="_access_control_login.asp"-->
<!--#include file="_access_control_general.asp"-->
<%
'------------ Variable Definition -------------
Dim rsView
Dim sURL
Dim IMG_locked
Dim relContentsSTR
Dim parScriptName
Dim parRtagId
Dim parViewId
Dim parEnvtab
Dim parDview      ' enable/disable   deployment   view.
Dim nOperation
Dim checked
Dim disabled
Dim ReleaseMode


'------------ Constants Declaration -----------
Const LIMG_LOCKED = "<img src='images/i_locked.gif' width='7' height='10' border='0' hspace='2'>"
Const imgAdded     = "<img src='images/i_added.gif' width='11' height='11' border='0' hspace='5' align='absmiddle' title='To Be Added'>"
Const imgRemoved   = "<img src='images/i_removed.gif' width='11' height='11' border='0' hspace='5' align='absmiddle' title='To Be Removed'>"
'------------ Variable Init -------------------
parScriptName = Request("script_name")
parRtagId = Request("rtag_id")
parViewId = Request("view_id")
parEnvtab = CInt( Request("envtab") )
parDview = "disabled"
'----------------------------------------------
%>
<%
'------------------------------------------------------------------------------------------------------------------------
'------------------------------------------------------------------------------------------------------------------------
%>
<%
'------------------------ MAIN LINE ---------------------------------
If (Request("envtab") = "")  OR  (Request("rtag_id") = "")  OR  (Request("view_id") = "")  OR  (Request("script_name") = "") Then
        Response.write "ERROR: Missing Parameters at "& ScriptName
    Call Destroy_All_Objects
    Response.End
End If
ReleaseMode = GetReleaseMode(parRtagId)

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

<%
OraDatabase.Parameters.Add "RTAG_ID",   parRtagId,      ORAPARM_INPUT, ORATYPE_NUMBER
OraDatabase.Parameters.Add "VIEW_ID",   parViewId,      ORAPARM_INPUT, ORATYPE_NUMBER
OraDatabase.Parameters.Add "RECORD_SET",NULL,       ORAPARM_OUTPUT,ORATYPE_CURSOR

' Decide which environment list is to be displayed
Select Case parEnvtab
        Case enumENVTAB_WORK_IN_PROGRESS
                OraDatabase.ExecuteSQL "BEGIN  PK_WORK_IN_PROGRESS.GET_VIEW_CONTENT ( :RTAG_ID, :VIEW_ID, :RECORD_SET );  END;"

        Case enumENVTAB_PLANNED
                OraDatabase.ExecuteSQL "BEGIN  PK_PLANNED.GET_VIEW_CONTENT ( :RTAG_ID, :VIEW_ID, :RECORD_SET );  END;"

        Case enumENVTAB_RELEASED
                OraDatabase.ExecuteSQL "BEGIN  PK_RELEASE.GET_VIEW_CONTENT ( :RTAG_ID, :VIEW_ID, :RECORD_SET );  END;"

        Case Else
                OraDatabase.ExecuteSQL "BEGIN  PK_ENVIRONMENT.GET_VIEW_CONTENT ( :RTAG_ID, :VIEW_ID, :RECORD_SET );  END;"

End Select

Set rsView = OraDatabase.Parameters("RECORD_SET").Value

OraDatabase.Parameters.Remove "RTAG_ID"
OraDatabase.Parameters.Remove "VIEW_ID"
OraDatabase.Parameters.Remove "RECORD_SET"

' Retrun if no records found
If rsView.RecordCount < 1 Then
        relContentsSTR = "No packages found."
End If

' Get view content
While ((NOT rsView.BOF) AND (NOT rsView.EOF))

        sURL = parScriptName &"?pv_id="& rsView("pv_id") &"&rtag_id="& parRtagId
        IMG_locked = ""

        If rsView.Fields("dlocked") = "Y" Then IMG_locked = LIMG_LOCKED

        ' DEVI-45275 - Normally, dlocked=Y items are denoted with a padlock icon on the web page. Since we can now merge
        ' into the pending tab, the dlocked=Y items that end up there would not give any visual indication to the user
        ' as to why they are present. So, instead of the padlock icon, display the added or removed icon to indicate
        ' what the intended action is to be, once the pending item is approved.
        ' Obviously, this functionality only applies if viewing the PENDING or ALL environment tabs.
        ' With regard to the operation value, A = Added, S = Subtracted
        nOperation = " "
        If (parEnvtab = enumENVTAB_PLANNED OR parEnvtab = enumENVTAB_ALL) Then
                nOperation = rsView.Fields("operation") ' NB. this field is only availble if earlier query was PK_PLANNED.GET_VIEW_CONTENT or PK_ENVIRONMENT.GET_VIEW_CONTENT
                If nOperation = "A" Then
                        IMG_locked = imgAdded
                ElseIf nOperation = "S" Then
                        IMG_locked = imgRemoved
                End If
        End If

        relContentsSTR = relContentsSTR & "<tr>" & VBNewLine

         If rsView("pkg_state") = 0 And rsView.Fields("deprecated_state") <> "" Then
            relContentsSTR = relContentsSTR & "  <td width='1%'>" & DefineStateIcon ( rsView("deprecated_state"), rsView("dlocked"), NULL, NULL, rsView("build_type"), TRUE ) & "</td>" & VBNewLine
         Else
            If ((parDview <> "enable") AND parEnvtab = enumENVTAB_PLANNED) Then

               ' if package version is unlocked, rejected, or pending approval, or is to be added/subtracted to/from the release (DEVI-45275), then
               If (rsView("dlocked") = "N") OR (rsView("dlocked") = "R") OR (rsView("dlocked") = "P") OR (nOperation = "A") OR (nOperation = "S") Then
                  checked = NULL
                  disabled = NULL
                  ' disable check box if not logged in, or if not in open mode and user has no permission to approve pending
                  If objAccessControl.UserLogedIn Then
                     If ( ReleaseMode <> enumDB_RELEASE_IN_OPEN_MODE ) Then
                        If NOT canActionControlInProject("ApproveForAutoBuild") Then
                           disabled = "disabled"
                        End If
                     End If
                  Else
                     disabled = "disabled"
                  End If

               Else ' always check and disable the checkbox
                  checked = "checked"
                  disabled = "disabled"
               End If
               relContentsSTR = relContentsSTR & " <td width='1%'><input name='pv_id_list' id='pv_id_list' type=checkbox value="&rsView.Fields("pv_id")&" "&checked&" "&disabled&"></td>"& VBNewLine
            Else
                       relContentsSTR = relContentsSTR & "  <td width='1%'>"& DefineStateIcon ( rsView("pkg_state"), rsView("dlocked"), NULL, NULL, rsView("build_type"), TRUE ) &"</td>"& VBNewLine
            End If
         End If

        relContentsSTR = relContentsSTR & "  <td width='100%' nowrap><a href='"& sURL &"' class='body_txt_drk' title="""& HTMLEncode( rsView("pv_description") ) &""">"& rsView.Fields("pkg_name") &"</a></td>" & VBNewLine
        relContentsSTR = relContentsSTR & "  <td width='1%' nowrap class='envPkg'>"& rsView.Fields("pkg_version") &"</td>" & VBNewLine
        relContentsSTR = relContentsSTR & "  <td width='1%'>"& IMG_locked &"</td>"
        relContentsSTR = relContentsSTR & "</tr>" & VBNewLine

        rsView.MoveNext
WEnd


rsView.Close
Set rsView = nothing


relContentsSTR = "<table width='100%' border='0' cellspacing='0' cellpadding='1'>" & relContentsSTR & "</table>"


' Response the content
Response.write relContentsSTR

%>


<%
Call Destroy_All_Objects
%>