Subversion Repositories DevTools

Rev

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

<%@LANGUAGE="VBSCRIPT"%>
<%
'=====================================================
'                  Rename Version
'               --- PROCESS FORM ---
'=====================================================
%>
<%
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/common_dbedit.asp"-->
<!--#include file="common/_popup_window_common.asp"-->
<!--#include file="_drawExtensionSelectBox.asp"-->
<%
'------------ ACCESS CONTROL ------------------
%>
<!--#include file="_access_control_login.asp"-->
<!--#include file="_access_control_general.asp"-->
<!--#include file="_access_control_project.asp"-->
<%
'------------ Variable Definition -------------
Dim parPv_id
Dim parRfile
Dim rsPkgInfo
Dim errMessage
Dim objPkgInfo
'------------ Constants Declaration -----------
'------------ Variable Init -------------------
parPv_id = QStrPar("pv_id")
parRfile = QStrPar("rfile")
Set objPkgInfo = CreateObject("Scripting.Dictionary")
'-----------------------------------------------------------------------------------------------------------------------------
Sub GetPackageInfo( nPvId, outPkgInfo )
   Dim rsTemp, Query_String
   If IsEmpty(nPvId) Then Exit Sub

   Query_String = _
   " SELECT pv.pv_id, pkg.pkg_id, pkg.pkg_name, pv.pkg_version, pv.v_ext, pv.build_type, pv.is_patch"&_
   "  FROM packages pkg, package_versions pv"&_
   " WHERE pkg.pkg_id = pv.pkg_id  AND pv.pv_id ="& nPvId

   Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))

   If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) Then
      outPkgInfo.Item("pv_id") = rsTemp.Fields("pv_id")
      outPkgInfo.Item("pkg_id") = rsTemp.Fields("pkg_id")
      outPkgInfo.Item("pkg_name") = rsTemp.Fields("pkg_name")
      outPkgInfo.Item("pkg_version") = rsTemp.Fields("pkg_version")
      outPkgInfo.Item("v_ext") = rsTemp.Fields("v_ext")
      outPkgInfo.Item("build_type") = rsTemp.Fields("build_type")
      outPkgInfo.Item("is_patch") = rsTemp.Fields("is_patch")

      If rsTemp.Fields("build_type") = "M" Then
         objPkgInfo.Item("M_checked") = "checked"
         objPkgInfo.Item("A_checked") = ""
         objPkgInfo.Item("M_display") = "style='display:inline;'"
         objPkgInfo.Item("A_display") = "style='display:none;'"
      ElseIf rsTemp.Fields("build_type") = "A" Then
         objPkgInfo.Item("M_checked") = ""
         objPkgInfo.Item("A_checked") = "checked"
         objPkgInfo.Item("M_display") = "style='display:none;'"
         objPkgInfo.Item("A_display") = "style='display:inline;'"
      End If
   End If

   rsTemp.Close
   Set rsTemp = nothing
End Sub

'-----------------------------------------------------------------------------------------------------------------------------
Function GetVersionNumber(SSpkg_version, SSv_ext)
   Dim versionNumber

   If SSv_ext <> "" Then
      versionNumber = Replace(SSpkg_version, SSv_ext, "")
   Else
      versionNumber = SSpkg_version
   End If

   GetVersionNumber = versionNumber
End Function
'-----------------------------------------------------------------------------------------------------------------------------
Sub Rename_Pkg_Version ( NNpv_id, SSnewVersion, errMessage )
   OraDatabase.Parameters.Add "RTAG_ID", parRtag_id, ORAPARM_INPUT, ORATYPE_NUMBER
   OraDatabase.Parameters.Add "NNpv_id", NNpv_id, ORAPARM_INPUT, ORATYPE_NUMBER

   If Request("build_type") = "M" Then
      ' Manual build
      OraDatabase.Parameters.Add "SSpkg_version",  SSnewVersion & Request("v_ext"),      ORAPARM_INPUT, ORATYPE_VARCHAR2
   Else
      ' Automated Build
      OraDatabase.Parameters.Add "SSpkg_version",  Request("v_ext"), ORAPARM_INPUT, ORATYPE_VARCHAR2

   End If

   OraDatabase.Parameters.Add "BUILD_TYPE", Request("build_type"), ORAPARM_INPUT, ORATYPE_CHAR
   OraDatabase.Parameters.Add "NNuser_id", objAccessControl.UserId, ORAPARM_INPUT, ORATYPE_NUMBER


   OraDatabase.Parameters.Add "errMessage", 0, ORAPARM_OUTPUT, ORATYPE_VARCHAR2


   objEH.TryORA ( OraSession )
   On Error Resume Next

   OraDatabase.ExecuteSQL _
   "BEGIN Rename_Package_Version ( :NNpv_id,"&_
   "                               :SSpkg_version,"&_
   "                               :BUILD_TYPE,"&_
   "                               :NNuser_id,"&_
   "                               :errMessage ); END;"

   objEH.CatchORA ( OraSession )

   errMessage = OraDatabase.Parameters("errMessage").Value

   OraDatabase.Parameters.Remove "RTAG_ID"
   OraDatabase.Parameters.Remove "NNpv_id"
   OraDatabase.Parameters.Remove "SSpkg_version"
   OraDatabase.Parameters.Remove "NNuser_id"
   OraDatabase.Parameters.Remove "errMessage"
   OraDatabase.Parameters.Remove "BUILD_TYPE"
End Sub
'-----------------------------------------------------------------------------------------------------------------------------
%>
<%
'-----------------------  MAIN LINE  ---------------------------
'--- Process submition ---
If CBool(QStrPar("action")) AND  objAccessControl.UserLogedIn  Then

   Call Rename_Pkg_Version ( parPv_id, Request("FRnewver"), errMessage )

   If NOT IsNull(errMessage) Then
      Call RaiseMsgInParent ( Eval(errMessage), parRtag_id &"|"& parPv_id)
   Else
      Call OpenInParentWindow ( parRfile &"?pv_id="& parPv_id &"&rtag_id="& parRtag_id )
   End If

   Call CloseWindow
End If
%>
<%Call GetPackageInfo( parPv_id, objPkgInfo )%>
<html>
<head>
<title>Release Manager</title>
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="images/release_manager_style.css" type="text/css">
<link rel="stylesheet" href="images/navigation.css" type="text/css">
<script language="JavaScript" src="images/common.js"></script>
<script language="JavaScript" type="text/JavaScript">
<!--
   function validateVersion(is_patch)
   {
      var versionBase = document.getElementsByName('FRnewver')[0].value;

      var exts = document.getElementsByName('v_ext')[0]
      var versionExt =  exts.options[exts.options.selectedIndex].value

      var typeButtons = document.getElementsByName('build_type');
      var isAutobuild = typeButtons[0].checked || false;

      MM_validateForm({vBase:versionBase, vExt:versionExt, isAuto:isAutobuild, isPatch:is_patch == "Y"},'Version Number','RisVersionNumber');
      return document.MM_returnValue;
   }

   // Change the elements displayed on the page depending on the build type selected.
   function configurePage(buildType)
   {
      var typeButtons = document.getElementsByName('build_type');


      if (buildType == "M")
      {
         Visible ('divVersionNumber','inline', 'divAutoVersion','none');
         typeButtons[1].checked = true;
         showCots();
      }
      else if (buildType == "A")
      {
         Visible ('divVersionNumber','none', 'divAutoVersion','inline');
         typeButtons[0].checked = true;
         hideCots();
      }
   }

   // Show the .cots/.tool extension. It's not included in the intial query results.
   // Show extensions that are Allowed in Manual mode
   function showCots()
   {
      var exts = document.getElementsByName('v_ext')[0];

      for (index = 0; index < exts.length; index++)
      {
         if (exts.options[index].getAttribute("isCOTS") == "Y")
         {
            exts.options[index].style.display = "inline";
            exts.options[index].disabled=false;
         }
      }
   }

   // Hide the .cots/.tool extension from the list of extensions.
   // Hide extensions that are not allowed in AUTO mode
   // IE does not honor .style.display - so just disable it.
   function hideCots()
   {
      var exts = document.getElementsByName('v_ext')[0];

      for (index = 0; index < exts.length; index++)
      {
         if (exts.options[index].getAttribute("isCOTS") == "Y")
         {
            exts.options[index].style.display = "none";
            exts.options[index].disabled=true;
         }
      }
   }

   // Change the selected extensions in the list to the existing package extension.
   function selectExtension(extension)
   {
      var exts = document.getElementsByName('v_ext')[0];

      // Set the first option as selected by default
      exts.options[0].selected = true;

      for (index = 0; index < exts.length; index++)
      {
         if (exts.options[index].value == extension)
         {
            exts.options[index].selected = true;
         }
      }
   }
//-->
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" onload="self.focus();configurePage('<%=objPkgInfo("build_type")%>');selectExtension('<%=objPkgInfo("v_ext")%>');">
<form name="renameversion" method="post" action="<%=scriptName%>" onsubmit="return validateVersion('<%=objPkgInfo("is_patch")%>');">
   <table width="100%" border="0" cellspacing="0" cellpadding="2" height="100%">
      <tr>
         <td background="images/lbox_bg_orange.gif" width="1%" height="1%"><img src="images/i_new_off.gif" width="18" height="23" hspace="5" border="0"></td>
         <td background="images/lbox_bg_blue.gif" nowrap width="50%" class="wform_ttl">&nbsp;Reversion Package </td>
         <td background="images/lbox_bg_blue.gif" align="right" width="50%">
            <input type="submit" name="btn" value="Submit" class="form_btn_comp">
            <input type="reset" name="btn" value="Cancel" class="form_btn_comp" onclick="self.close()">
         </td>
         <td background="images/lbox_bg_blue.gif" align="right" width="1%%" nowrap>
         <img src="images/h_trsp_dot.gif" width="5" height="22"> </td>
      </tr>
      <tr>
         <td height="100%" width="1%">&nbsp;</td>
         <td valign="top" nowrap colspan="3" class="wform_ttl" background="images/bg_form_lightgray.gif">
         <table width="100%" border="0" cellspacing="1" cellpadding="2">
            <tr>
               <td width="1%"><img src="images/h_trsp_dot.gif" width="10" height="30"></td>
               <td width="1%" nowrap class="form_group" valign="bottom"></td>
               <td width="100%" nowrap></td>
            </tr>
            <tr>
               <td width="1%">&nbsp;</td>
               <td width="1%"   nowrap background="images/bg_form_lightbluedark.gif" class="form_field">Package</td>
               <td width="100%" nowrap background="images/bg_form_lightbluedark.gif" class="form_txt"><%=objPkgInfo.Item("pkg_name")%></td>
            </tr>
            <tr>
               <td width="1%">&nbsp;</td>
               <td width="1%"   nowrap background="images/bg_form_lightbluedark.gif" class="form_field">Version Number Assignment</td>
               <td width="100%" nowrap background="images/bg_form_lightbluedark.gif" class="form_txt">
                  <%
                  ' Patches are never auto-built so tell user this if they try to make them so and make sure Manual
                  ' build_type value of the radio button is checked afterwards.
                  If objPkgInfo("is_patch") = "Y" Then%>
                     <input name="build_type" type="radio" value="A" onclick="alert('Patches must be manually versioned'); document.renameversion.build_type[1].click()">Auto
                  <%Else%>
                     <input name="build_type" type="radio" value="A" onclick="configurePage('A')">Auto
                  <%End If%>
                  <input name="build_type" type="radio" value="M" onclick="configurePage('M')">Manual
               </td>
            </tr>
            <tr>
               <td>&nbsp;</td>
               <td nowrap background="images/bg_form_lightbluedark.gif" class="form_field">Version</td>
               <td nowrap background="images/bg_form_lightbluedark.gif" class="form_txt">
                  <DIV id="divVersionNumber" name="divVersionNumber">
                     <input type="text" name="FRnewver" class="form_item" size="10" value="<%=GetVersionNumber(objPkgInfo.Item("pkg_version"), objPkgInfo.Item("v_ext"))%>">
                  </DIV>
                  <div id="divAutoVersion" name="divAutoVersion">(auto-number)</div>
                  <div id="divVersionExtension" name="divVersionExtension" style="display:inline;">
                     <select name="v_ext" id="v_ext" class="form_item">
                        <%
                        Call drawExtensionSelectBox( objPkgInfo.Item("v_ext"), false )
                        %>
                     </select>
                  </div>
               </td>
            </tr>
            <tr>
               <td width="1%">&nbsp;</td>
               <td width="1%" nowrap class="form_field"><img src="images/h_trsp_dot.gif" width="100" height="10"></td>
               <td nowrap width="100%"> <p>&nbsp;</p></td>
            </tr>
         </table>
         </td>
      </tr>
      <tr>
         <td height="1%" width="1%"><img src="images/h_trsp_dot.gif" width="5" height="5"></td>
         <td valign="top" nowrap colspan="3" class="wform_ttl" background="images/lbox_bg_blue.gif"></td>
      </tr>
   </table>
<input type="hidden" name="pv_id" value="<%=parPv_id%>">
<input type="hidden" name="rtag_id" value="<%=parRtag_id%>">
<input type="hidden" name="rfile" value="<%=parRfile%>">
<input type="hidden" name="action" value="true">
</form>
</body>
</html>


<!-- DESTRUCTOR ------->
<!--#include file="common/destructor.asp"-->