Subversion Repositories DevTools

Rev

Blame | Last modification | View Log | RSS feed

<%
'===================================================================
'                                                       Package Common
'===================================================================
%>
<!--#include file="../class/classTemplateManager.asp"-->
<!--#include file="../class/classTabControl.asp"-->
<!--#include file="../class/classActionButtonControl.asp"-->
<%
'------------ VARIABLE DEFINITION -------------
Dim parPv_id
Dim nEnvTab                     ' remember environment tab
Dim objBtnControl
Dim aTabBtnsDef
'------------ CONSTANTS DECLARATION -----------
'------------ VARIABLE INIT -------------------
parPv_id = Request("pv_id")
Set objBtnControl = New ActionButtonControl
'------------ CONDITIONS ----------------------
'----------------------------------------------
%>
<%
'------------ RUN BEFORE PAGE RENDER ----------

'--- Make sure rtag_id is always present
If (Request("rtag_id") = "") AND (Request("pv_id") = "") Then Response.Redirect("index.asp")


'--- Rebuild Environment
If (Request("rtag_id") <> "") Then
        Call Rebuild_Environment ( parRtag_id )
End If

'--- Persist following parameters between postbacks
objPMod.PersistInQryString ( aPersistList(enumPAR_RTAG_ID) )
objPMod.PersistInQryString ( aPersistList(enumPAR_PV_ID) )


'--- Get Environment (lefthand side menu) tab
nEnvTab = GetEnvTab ( Request("envtab") )


'--- Get Package General Information
Set pkgInfoHash = CreateObject("Scripting.Dictionary")
If Request("pv_id") <> "" Then
        Call Get_Pkg_Info ( Request("pv_id"), Request("rtag_id") )

        ' Make sure pv_id exists as it may be removed
        If pkgInfoHash.Item("pv_id") = "" Then Response.Redirect ("dependencies.asp?rtag_id="& Request("rtag_id"))

Else
        If (ScriptName <> "dependencies.asp") AND (ScriptName <> "find.asp")Then  Response.Redirect ("dependencies.asp?rtag_id="& Request("rtag_id"))
End If


'----------------------------------------------
%>
<%
'-----------------------------------------------------------------------------------------------------------------------------
Sub RenderPackageProperties ()
%>

  <tr>
    <td background="images/bg_lght_gray.gif"><IMG height="45" src="images/spacer.gif" width=1></td>

        <td valign="bottom" background="images/bg_lght_gray.gif" nowrap class="body_txt">
        <%
        If pkgInfoHash.Item ("is_patch") = "Y" Then
                '--- PATCH ---
                Response.write "<br><a href='patches.asp?pv_id="& pkgInfoHash.Item ("patch_parent_id") &"&rtag_id="& Request("rtag_id") &"' class='txt_linked'><img src='icons/i_caretone.gif' hspace='2' border='0' align='absmiddle'>Back To "& pkgInfoHash.Item ("pkg_name") &"</a><br><br>"

                If pkgInfoHash.Item ("is_obsolete") = "Y" Then
                        Dim rsTemp
                        Set rsTemp = OraDatabase.DbCreateDynaset( "select patch_obsoleted_by from package_patches where patch_id ="&pkgInfoHash.Item ("pv_id"), cint(0))

                        If rsTemp("patch_obsoleted_by") <> "" Then

                                Set rsTemp = OraDatabase.DbCreateDynaset( "select pkg_version from package_versions where pv_id ="&rsTemp("patch_obsoleted_by"), cint(0))
                                Call Messenger ( "<SPAN class='err_alert'><b>Patch Is Obsolete!</b></SPAN><br>"& NewLine_To_BR( "<b>Obsoleted by patch "& rsTemp("pkg_version") & ". </b> " ) & NewLine_To_BR( pkgInfoHash.Item ("obsolete_comments") ), 3, "100%" )

                                rsTemp.Close()
                                Set rsTemp = nothing
                        Else
                                Call Messenger ( "<SPAN class='err_alert'><b>Patch Is Obsolete!</b></SPAN><br>"& NewLine_To_BR( pkgInfoHash.Item ("obsolete_comments") ), 3, "100%" )
                        End If
                        Response.write enum_imgPatchObsolete
                Else
                        Response.write enum_imgPatch
                End If


                If pkgInfoHash.Item ("dlocked") = "Y" Then
                        Response.write "<SPAN class='lbox_ttl'>"& pkgInfoHash.Item ("pkg_version") &"<img src='images/i_locked.gif' width='12' height='14' border='0' hspace='5' align='top'></SPAN>"
                Else
                        Response.write "<SPAN class='lbox_ttl'>"& pkgInfoHash.Item ("pkg_version") &"</SPAN>"
                End If
        Else
                '--- PACKAGE ---
                If pkgInfoHash.Item ("dlocked") = "Y" Then
                        If pkgInfoHash.Item ("deprecated_state") = 6 Then
                                Response.write "<SPAN class='lbox_ttl'>"& pkgInfoHash.Item ("pkg_name") &"&nbsp;"& pkgInfoHash.Item ("pkg_version") &"<img src='images/i_locked.gif' width='12' height='14' border='0' hspace='5' align='top'>"&enum_imgDeprecated&"</SPAN>"
                        ElseIf pkgInfoHash.Item ("product_state") = 4 Then
                                Response.write "<SPAN class='lbox_ttl'>"& pkgInfoHash.Item ("pkg_name") &"&nbsp;"& pkgInfoHash.Item ("pkg_version") &"<img src='images/i_locked.gif' width='12' height='14' border='0' hspace='5' align='top'>"&enum_imgProductRejected&"</SPAN>"
                        Else
                                Response.write "<SPAN class='lbox_ttl'>"& pkgInfoHash.Item ("pkg_name") &"&nbsp;"& pkgInfoHash.Item ("pkg_version") &"<img src='images/i_locked.gif' width='12' height='14' border='0' hspace='5' align='top'></SPAN>"
                        End If
                Else
                        Response.write "<SPAN class='lbox_ttl'>"& pkgInfoHash.Item ("pkg_name") &"&nbsp;"& pkgInfoHash.Item ("pkg_version") &"</SPAN>"
                End If
        End If
        %>
        <br><br>
        </td>

    <td background="images/bg_lght_gray.gif">&nbsp;</td>
  </tr>

  <tr>
    <td background="images/bg_lght_gray.gif"></td>
        <td background="images/bg_lght_gray.gif">
        <SPAN id="spanShowDetails" name="spanShowDetails"><a href="javascript:;" class="body_scol" onClick="DisplaySPAN(true);" style="display:block">Show Details...</a></SPAN>
        <SPAN id="spanHideDetails" name="spanHideDetails" style="display:none;"><a href="javascript:;" class="body_colb" onClick="DisplaySPAN(false);">Hide Details</a></SPAN>
        <SPAN id="spanPkgInfo" name="spanPkgInfo" style="display:none;">
        <table width="400" border="0" cellspacing="0" cellpadding="3">
          <tr>
                <td background="images/bg_form_lightbluedark.gif" nowrap class="body_txt"><%Call Print_Pkg_Info()%></td>
          </tr>
        </table>
        </SPAN>
        <br>
        </td>
    <td background="images/bg_lght_gray.gif"></td>
  </tr>
<%
End Sub
'-----------------------------------------------------------------------------------------------------------------------------
Sub RenderPackageState ()
        If (pkgInfoHash.Item ("dlocked") = "Y") Then
                Response.write "<b>Status:</b>&nbsp;Released<br>"
        Else
                Response.write "<b>Status:&nbsp;</b>Not released<br>"
        End If
End Sub
'-----------------------------------------------------------------------------------------------------------------------------
Sub Print_Pkg_Info()

        ' Status:
        If IsNull(pkgInfoHash.Item ("is_patch")) Then
                If  objAccessControl.IsDataActive ("PROJECTS", DB_PROJ_ID, "EditProjects") AND (objAccessControl.IsActive("UnlockPackage"))  Then
                        If (pkgInfoHash.Item ("dlocked") = "Y") OR (pkgInfoHash.Item ("dlocked") = "A")Then
                                ' Unlock package.
                                Response.write "<a href='_s_unlock_package.asp?pv_id="& parPv_id &"&rtag_id="& parRtag_id &"' class='body_txt' title='Unlock the package.'><b>Status:</b><img src='images/i_edit.gif' width='12' height='12' border='0' ></a>&nbsp;Released<br>"
                        Else
                                ' Lock Package
                                Response.write "<a href='_s_lock_package.asp?pv_id="& parPv_id &"&rtag_id="& parRtag_id &"' class='body_txt' title='Lock the package. Release requirements are not applied.'><b>Status:</b><img src='images/i_edit.gif' width='12' height='12' border='0'></a>&nbsp;Not Released<br>"
                        End If
                Else
                        Call RenderPackageState ()
                End If
        Else
                If  objAccessControl.IsDataActive ("PROJECTS", DB_PROJ_ID, "EditProjects") AND (objAccessControl.IsActive("UnlockPatch"))  Then
                        If (pkgInfoHash.Item ("dlocked") = "Y") OR (pkgInfoHash.Item ("dlocked") = "A")Then
                                ' Unlock package.
                                Response.write "<a href='_s_unlock_package.asp?pv_id="& parPv_id &"&rtag_id="& parRtag_id &"' class='body_txt' title='Unlock the package.'><b>Status:</b><img src='images/i_edit.gif' width='12' height='12' border='0' ></a>&nbsp;Released<br>"
                        Else
                                ' Lock Package
                                Response.write "<a href='_s_lock_package.asp?pv_id="& parPv_id &"&rtag_id="& parRtag_id &"' class='body_txt' title='Lock the package. Release requirements are not applied.'><b>Status:</b><img src='images/i_edit.gif' width='12' height='12' border='0'></a>&nbsp;Not Released<br>"
                        End If
                Else
                        Call RenderPackageState ()
                End If
        End If

        ' Base View:
        Response.write "<b>Base View:&nbsp;</b>"& Get_Pkg_Base_View ( parPv_id, parRtag_id ) &"<br>"

        ' Previous Version:
        If IsNull(pkgInfoHash.Item ("is_patch")) Then
                If objAccessControl.IsActive("ChangePreviousVersion") Then
                        If IsNull(pkgInfoHash.Item ("previous_version")) Then
                                Response.write "<a href='javascript:;' onClick='MM_openBrWindow(""_wform_change_previous_version.asp?rfile="& scriptName &"&pv_id="& parPv_id &"&rtag_id="& parRtag_id &""",""ChangeOwner"",""resizable=yes,width=400,height=200"")' class='body_txt'><b>Previous Version:</b><img src='images/i_edit.gif' width='12' height='12' border='0' alt='Edit'></a>&nbsp;Unknown!<br>"
                        Else
                                Response.write "<a href='javascript:;' onClick='MM_openBrWindow(""_wform_change_previous_version.asp?rfile="& scriptName &"&pv_id="& parPv_id &"&rtag_id="& parRtag_id &""",""ChangeOwner"",""resizable=yes,width=400,height=200"")' class='body_txt'><b>Previous Version:</b><img src='images/i_edit.gif' width='12' height='12' border='0' alt='Edit'>&nbsp;"& pkgInfoHash.Item ("previous_version") &"</a><br>"
                        End If
                Else
                        If IsNull(pkgInfoHash.Item ("previous_version")) Then
                                Response.write "<b>Previous Version:</b><img src='images/i_edit_disable.gif' width='12' height='12' border='0' alt='Edit'></a>&nbsp;Unknown!<br>"
                        Else
                                Response.write "<b>Previous Version:</b><img src='images/i_edit_disable.gif' width='12' height='12' border='0' alt='Edit'>&nbsp;"& pkgInfoHash.Item ("previous_version") &"</a><br>"
                        End If
                End If
        End If
        Response.write "<br>"

        Response.write "<table width='100' border='0' cellspacing='0' cellpadding='1'>"

        ' Owner:
        Response.write "<tr>"
        If objAccessControl.UserLogedIn() Then
                Response.write "<td nowrap><a href='javascript:;' onClick='MM_openBrWindow(""_wform_change_owner.asp?pv_id="& parPv_id &"&rtag_id="& parRtag_id &""",""ChangeOwner"",""resizable=yes,width=400,height=200"")' class='body_txt'><b>Owner:</b><img src='images/i_edit.gif' width='12' height='12' border='0' alt='Change owner'></a>&nbsp;</td>"
        Else
                Response.write "<td nowrap class='body_txt'><b>Owner:</b><img src='images/i_edit_disable.gif' width='12' height='12' border='0' alt='Change owner'></td>"
        End If
        Response.write "<td nowrap class='body_txt'>"& pkgInfoHash.Item ("owner") &"</td>"
        Response.write "<td><a href='mailto:"& pkgInfoHash.Item ("owner_email") &"' class='txt_linked'><img src='images/bt_send_email.gif' width='36' height='13' hspace='3' border='0' align='absmiddle' alt='"& pkgInfoHash.Item ("owner_email") &"'></a></td>"
        Response.write "</tr>"

        ' Created:
        Response.write "<tr>"
        Response.write "<td nowrap class='body_txt'><b>Created:&nbsp;</b></td>"
        Response.write "<td nowrap class='body_txt'>"& EuroDate(pkgInfoHash.Item ("created_stamp")) &" by "& pkgInfoHash.Item ("creator") &"</td>"
        Response.write "<td><a href='mailto:"& pkgInfoHash.Item ("creator_email") &"' class='txt_linked'><img src='images/bt_send_email.gif' width='36' height='13' hspace='3' border='0' align='absmiddle' alt='"& pkgInfoHash.Item ("creator_email") &"'></a></td>"
        Response.write "</tr>"

        ' Last Modified:
        Response.write "<tr>"
        Response.write "<td nowrap class='body_txt'><b>Last Modified:&nbsp;</b></td>"
        Response.write "<td nowrap class='body_txt'>"& EuroDateTime(pkgInfoHash.Item ("modified_stamp")) &" by "& pkgInfoHash.Item ("modifier") &"</td>"
        Response.write "<td><a href='mailto:"& pkgInfoHash.Item ("modifier_email") &"' class='txt_linked'><img src='images/bt_send_email.gif' width='36' height='13' hspace='3' border='0' align='absmiddle' alt='"& pkgInfoHash.Item ("modifier_email") &"'></a></td>"
        Response.write "</tr>"
        If IsNull(pkgInfoHash.Item ("is_patch"))  AND  (Request("rtag_id") <> "") Then
                Response.write "<tr>"
                If pkgInfoHash.Item ("insertor") <> "" Then
                        Response.write "<td nowrap class='body_txt'><b>Added to Release:&nbsp;</b></td>"
                        Response.write "<td nowrap class='body_txt'>"& EuroDate(pkgInfoHash.Item ("insert_stamp")) &" by "& pkgInfoHash.Item ("insertor") &"</td>"
                        Response.write "<td><a href='mailto:"& pkgInfoHash.Item ("insertor_email") &"' class='txt_linked'><img src='images/bt_send_email.gif' width='36' height='13' hspace='3' border='0' align='absmiddle' alt='"& pkgInfoHash.Item ("insertor_email") &"'></a></td>"
                End If
                Response.write "</tr>"
        End If

        ' Config Specs:
        Call Config_Spec (Request("rtag_id"), Request("pv_id"))
        Call Config_Spec_Template (pkgInfoHash.Item("dlocked"), rsQry("config_spec_branch"), rsQry("pkg_label"), rsQry("src_path"))

        ' Jats commands
        Call Jats_Commands (pkgInfoHash.Item("dlocked"), rsQry("config_spec_branch"), rsQry("pkg_label"), rsQry("src_path"))

        rsQry.Close()
        Set rsQry = nothing
        Response.write "</table>"

End Sub
'---------------------------------------------------------------
Sub Config_Spec (NNRtag_id, NNPv_id)
        OraDatabase.Parameters.Add "RTAG_ID", NNRtag_id,        ORAPARM_INPUT, ORATYPE_NUMBER
        OraDatabase.Parameters.Add "PV_ID", NNPv_id,    ORAPARM_INPUT, ORATYPE_NUMBER



        If NNRtag_id <> "" Then
                If pkgInfoHash.Item ("dlocked") <> "Y" Then
                        Set rsQry = OraDatabase.DbCreateDynaset( GetQuery("config_spec.sql"), cint(0))
                Else
                        Set rsQry = OraDatabase.DbCreateDynaset( Replace(GetQuery("config_spec.sql"), "PV.LAST_PV_ID", "PV.PV_ID"), cint(0))
                End If
        Else
                If pkgInfoHash.Item ("dlocked") <> "Y" Then
                        Set rsQry = OraDatabase.DbCreateDynaset( GetQuery("config_spec_nortag.sql"), cint(0))
                Else
                        Set rsQry = OraDatabase.DbCreateDynaset( Replace(GetQuery("config_spec_nortag.sql"), "PV.LAST_PV_ID", "PV.PV_ID"), cint(0))
                End If
        End If

        OraDatabase.Parameters.Remove "RTAG_ID"
        OraDatabase.Parameters.Remove "PV_ID"

End Sub

'---------------------------------------------------------------
' Function: Config_Spec_Template
'
' Purpose:  Generates HTML to display the config spec to use
'           to create a view loaded with the particular package version.
'
' Arguments: dlocked       : dlocked state of the package version
'            config_branch : The branch, or null
'            pkg_label     : The package label
'            src_path      : The source path for the package
' Notes:
'
Sub Config_Spec_Template (dlocked, config_branch, pkg_label, src_path)

        Dim Template

        If (pkg_label <> "" AND src_path <> "") Then
                If (dlocked <> "Y" AND NOT IsNull(config_branch) AND config_branch <> "" ) Then
                        Template = "element * CHECKEDOUT <br>" & _
                        "element .../lost+found -none <br>" & _
                        "element * .../" & config_branch & "/LATEST <br>" & _
                        "element * " & pkg_label & " -mkbranch " & config_branch & "<br>" & _
                        "element * /main/0 -mkbranch " & config_branch & "<br>"  & _
                        "load " & chr(34) & src_path & chr(34)
                Else
                        Template = "element * CHECKEDOUT <br>" & _
                        "element .../lost+found -none <br>" & _
                        "element * " & pkg_label &"<br>" & _
                        "load " & chr(34) & src_path & chr(34)
                End If
        Else
                Template = "UNAVAILABLE - missing label and/or source path"
        End If

        Response.write "<tr>"
        Response.write "<td nowrap class='body_txt'><b>Config Specs:&nbsp;</b></td>"
        Response.write "<td nowrap class='body_txt'>"& Template &"</td>"
        Response.write "<td nowrap class='body_txt'></td>"
        Response.write "</tr>"

End Sub

'---------------------------------------------------------------
' Function: Jats_Commands
'
' Purpose:  Generates HTML for displaying the JATS commands for extracting
'           a view for the package version, and for building the targets
'           within a previously extracted view for the package version.
'
' Arguments: dlocked       : dlocked state of the package version
'            config_branch : The branch, or null
'            pkg_label     : The package label
'            src_path      : The source path for the package
' Notes:
'
Sub Jats_Commands (dlocked, config_branch, pkg_label, src_path)

        Dim Template1, Template2

        If (pkg_label <> "" AND src_path <> "") Then
                If (dlocked <> "Y" AND NOT IsNull(config_branch) AND config_branch <> "" ) Then
                        Template1 = "jats release -extract " & pkg_label & " -path " & chr(34) & Replace(src_path, "\", "/") & chr(34) &" -branch "& config_branch
                Else
                        Template1 = "jats release -extract " & pkg_label & " -path " & chr(34) & Replace(src_path, "\", "/") & chr(34)
                End If
                Template2 = "jats release -test " & pkgInfoHash.Item("pkg_label") & " -path " & chr(34) & Replace(src_path, "\", "/") & chr(34)
        Else
                Template1 = "UNAVAILABLE - missing label and/or source path"
                Template2 = "UNAVAILABLE - missing label and/or source path"
        End If

        Response.write "<tr>"
        Response.write "<td nowrap class='body_txt'><b>JATS Extract:&nbsp;</b></td>"
        Response.write "<td nowrap class='body_txt'>" & Template1 & "</td>"
        Response.write "<td nowrap class='body_txt'></td>"
        Response.write "</tr>"
        Response.write "<tr>"
        Response.write "<td nowrap class='body_txt'><b>JATS Test:&nbsp;</b></td>"
        Response.write "<td nowrap class='body_txt'>" & Template2 & "</td>"
        Response.write "<td nowrap class='body_txt'></td>"
        Response.write "</tr>"

End Sub

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