Subversion Repositories DevTools

Rev

Rev 119 | Blame | Last modification | View Log | RSS feed

<%
'=====================================================
'                                         NEW VERSION
'                                        PAGE
'=====================================================
%>
<!--#include file="_tabs.asp"-->
<!--#include file="_drawExtensionSelectBox.asp"-->
<%
'------------ Variable Definition -------------
Dim parPv_id
Dim rsLocRel
Dim parPage_title
Dim objPkgInfo
Dim rsTemp2
'------------ Constants Declaration -----------
'------------ Variable Init -------------------
parPv_id = QStrPar("pv_id")
parPage_title = "NEW VERSION"
Set objPkgInfo = CreateObject("Scripting.Dictionary")
'-----------------------------------------------------------------------------------------------------------------------------
Function Get_Projects
        Get_Projects = _
        " SELECT * FROM projects ORDER BY proj_name ASC"
End Function
'-----------------------------------------------------------------------------------------------------------------------------
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"&_
        "  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")
        End If

        rsTemp.Close
        Set rsTemp = nothing
End Sub
'-----------------------------------------------------------------------------------------------------------------------------
%>
<%
'===================== MAIN LINE ============================
Call GetPackageInfo( parPv_id, objPkgInfo )
'============================================================
%>
<style TYPE="text/css">
        #spanVersionNumberAuto   { display:none }
        #spanVersionNumberManual { display:block }
</style>
<script language="JavaScript" type="text/JavaScript">
<!--

/*
Summary of Javascript functionality implemented by Haydon Knight for DEVI-044075 and DEVI-043066:

The form 'NEWVersion' invokes _new_version.asp when submitted.  The value of the FRnewver input box (which is hidden)  is passed
through to _new_version.asp.  This value is kept identical to the text in the span 'spanFullVersion' and stores the full version number+extension.
The full version (that displayed and that stored in FRnewver) is updated by updateFullVersion(), which is invoked whenever the user
changes the version base-number or version extension via any of:

1. clicking a radio button to select auto/manual
2. altering the value of the 'inputVersionNumberManual' text entry box
3. changing the extension via the 'v_ext' select pull-down menu.

The radio button to select auto/manual is 'build_type', and a value of 'M' = manual and 'A' = auto.  Changing what is selected
invokes changeVisibility(), which toggles which span out of spanVersionNumberAuto and spanVersionNumberManual is
selected.  Each of these spans has their own input box for the version base, but spanVersionNumberAuto's input text box
is disabled.
*/

window.onload = function()
{
    var fullVersion = "<%=objPkgInfo.Item("pkg_version")%>";
        var versionExt  = "<%=objPkgInfo.Item("v_ext")%>";

        if (versionExt.length == 0)
        {
                // is probably an old package version that was made in the days before we enforced all package versions
                // to have an extension.
                document.all['inputVersionNumberManual'].value = fullVersion;
        }
        else
        {
                // strip extension
                document.all['inputVersionNumberManual'].value = fullVersion.replace( /(.*)\..*/, "$1");
        }
        updateFullVersion();
}

//////////////////////////////////////////////////////////////////
// Function: updateFullVersion
//
// Purpose: Updates the version displayed at the bottom of the window, as well as the FRnewver field that is
// passed through to the _new_version.asp script
//
// Arguments: none
//
// Returns: none
//
// Notes: When the user updates the "version base" text field this function is called
//
function updateFullVersion()
{
        document.all['spanFullVersion'].innerHTML = getFullVersion();
        document.all['FRnewver'].value = document.all['spanFullVersion'].innerHTML;
}


//////////////////////////////////////////////////////////////////
// Function: getVersionBase
//
// Purpose: Works out what the version base is based on user input
//
// Arguments: none
//
// Returns: versionBase - a number of the form n.n.n where 'n' is an integer (.e.g. 1.2.3000)
//
// Notes: If auto just returns ("auto")
//
function getVersionBase()
{
        var isManualBuild = document.NEWversion.build_type[0].checked;

        if( !isManualBuild )
      return "(auto)";

    return document.all['inputVersionNumberManual'].value;
}


//////////////////////////////////////////////////////////////////
// Function: getFullVersion
//
// Purpose: Returns the full version based on the user input
//
// Arguments: none
//
// Returns: fullVersion - e.g. "1.2.3.cr"
//
// Notes:
//
function getFullVersion()
{
        var versionBase = getVersionBase();
    var versionExt = document.all['v_ext'].value;
        return versionBase + versionExt;
}


//////////////////////////////////////////////////////////////////
// Function: changeVisibility
//
// Purpose: Toggles whether the auto or manual version base input span is displayed
//
// Arguments: isManualBuild - boolean value indicating whether user has selected 'manual' or not
//
// Returns: none
//
// Notes: Called when user clicks the radio button to select auto/manual
//
function changeVisibility(isManualBuild)
{
        if( isManualBuild )
        {
                document.all['spanVersionNumberAuto'].style.display = 'none';
                document.all['spanVersionNumberManual'].style.display = 'block';
    }
    else
    {
                document.all['spanVersionNumberAuto'].style.display = 'block';
                document.all['spanVersionNumberManual'].style.display = 'none';
    }

    updateFullVersion();
}

// Do not remove these next few lines, otherwise the page does not load properly in Microsoft IE.
//-->
</script>

<script>


function Dependency()
{
parent.window.location.href="dependencies.asp?rtag_id=<%=parRtag_id%>&pv_id=<%=parPv_id%>";
}

function checkVersion()
{
        var fullVersion = document.all['FRnewver'].value

        var versionBase = fullVersion.replace( /(.*)(\..*)/, "$1");
        var versionExt =  fullVersion.replace( /(.*)(\..*)/, "$2");

        var isAutobuild = document.NEWversion.build_type[1].checked;

        document.MM_returnValue = MM_ValidateVersion(null, versionBase, versionExt, isAutobuild);

        if  (document.MM_returnValue == true)
        {
                parent.window.location.href="dependencies.asp?rtag_id=<%=parRtag_id%>&pv_id=<%=parPv_id%>";
        }

        return document.MM_returnValue;
}
</script>

<table width="650" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="1%">&nbsp;</td>
          <td align="right"><img src="images/h_trsp_dot.gif" width="30" height="30"></td>
          <td width="1%">&nbsp;</td>
        </tr>
        <tr>
          <td width="1%">&nbsp;</td>
          <td>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td nowrap class="form_ttl"><%=parPage_title%></td>
                <td align="right" valign="bottom">
                  <!-- TABS -->
                                  &nbsp;
                </td>
              </tr>
            </table>
          </td>
          <td width="1%">&nbsp;</td>
        </tr>
        <tr>
          <td align="left" valign="top" width="1%" 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"><!-- Heading --><img src="images/h_trsp_dot.gif" width="1" height="20"><!-- END Heading --></td>
          <td align="right" valign="top" width="1%" background="images/lbox_bg_blue.gif"><img src="images/lbox_tr_cnr_b.gif" width="13" height="13"></td>
        </tr>
        <tr>
          <td width="1%" bgcolor="#FFFFFF"><img src="images/h_trsp_dot.gif" width="10" height="100"></td>
          <td bgcolor="#FFFFFF" valign="top">
            <!-- Body -->
           <table width="100%" border="0" cellspacing="1" cellpadding="2">
                        <form name="NEWversion" method="post" action="_new_version.asp">
                          <tr>
                              <td width="1%"><img src="images/h_trsp_dot.gif" width="1" height="10"></td>
                              <td width="1%" nowrap class="form_group" valign="bottom"></td>
                              <td nowrap width="100%" align="right" class="form_step"></td>
              </tr>
              <tr>
                <td width="1%">&nbsp;</td>
                <td colspan="2" width="1%" nowrap class="form_field">
                                <table width="100%" border="0" cellspacing="1" cellpadding="5">
                                  <tr>
                                    <td background="images/bg_form_lightbluedark.gif" nowrap width="1" class="form_field">Package Name</td>
                                    <td background="images/bg_form_lightgray.gif" nowrap width="100%" class="form_field"><%=objPkgInfo.Item("pkg_name")%></td>
                                  </tr>
                                  <tr>
                                    <td background="images/bg_form_lightbluedark.gif" nowrap class="form_field">&nbsp;</td>
                        <td background="images/bg_form_lightgray.gif" class="form_txt">
                                                        <input name="build_type" id="build_type" type="radio" value="M" checked onclick="changeVisibility(true);"> Manual Build
                                                        <input name="build_type" id="build_type" type="radio" value="A"         onclick="changeVisibility(false);"> Automated Build
                                                </td>
                              </tr>
                                  <tr>
                                                <td background="images/bg_form_lightbluedark.gif" nowrap class="form_field">Version Number</td>
                                    <td background="images/bg_form_lightgray.gif" class="form_item">
                                                  <SPAN id="spanVersionNumberManual" name="spanVersionNumberManual">
                                                        <input type="text" id="inputVersionNumberManual" onmouseout="updateFullVersion();" onblur="updateFullVersion();" onclick="updateFullVersion();" onmouseup="updateFullVersion();" onchange="updateFullVersion();" onkeyup="updateFullVersion();" name="inputVersionNumberManual" class="form_item" size="12" ID="Text1">
                                                  </SPAN>
                                                  <SPAN id="spanVersionNumberAuto" name="spanVersionNumberAuto">
                                                    <input type="text" value="(auto)" disabled class="form_item" size="12" ID="Text1" NAME="Text1">
                                                  </SPAN>
                                                </td>
                                          </tr>
                                          <tr>
                                                <td background="images/bg_form_lightbluedark.gif" nowrap class="form_field">Version Extension</td>
                                    <td background="images/bg_form_lightgray.gif" class="form_item">
                                                  <DIV id="divVersionExt" name="divVersionExt">
                                                        <select name="v_ext" id="v_ext" onchange="updateFullVersion();">
                                                        <%
                                                        Call drawExtensionSelectBox( objPkgInfo.Item("v_ext"), true )
                                                        %>
                                                        </select>
                                                  </DIV>

                                                </td>
                                  </tr>
                                  <tr>
                                                <td background="images/bg_form_lightbluedark.gif" nowrap width="1" class="form_field">Version</td>
                                    <td background="images/bg_form_lightgray.gif" nowrap width="100%" class="form_field">
                                    <SPAN id="spanFullVersion" name="spanFullVersion"></SPAN>
                                    <input type="hidden" name="FRnewver" id="FRnewver" value="hello">
                                    </td>
                                  </tr>
                                          <input type="hidden" name="OLDpv_id" value="<%=parPv_id%>">
                                          <input type="hidden" name="rtag_id" value="<%=parRtag_id%>">
                                          <input type="hidden" name="page_title" value="<%=parPage_title%>">
                                          <input type="hidden" name="action" value="true">
                                  <tr>
                                    <td nowrap><img src="images/h_trsp_dot.gif" width="120" height="1"></td>
                                    <td></td>
                                  </tr>
                                </table>
                                </td>
              </tr>
              <tr>
                <td width="1%">&nbsp;</td>
                        <td width="1%" nowrap class="form_field"><img src="images/h_trsp_dot.gif" width="1" height="1"></td>
                <td nowrap width="100%" class="body_scol">
                                  <input type="submit" name="btn" value="Submit" class="form_btn" onClick="return checkVersion();">
                  <input type="reset" name="btn" value="Cancel" class="form_btn" onClick="Dependency();">
                                  <SPAN id="ProgressBar" name="ProgressBar" style="visibility:hidden;"><img src="images/i_processing.gif" width="11" height="17" align="absmiddle" hspace="3">Processing...</SPAN>
                                  <br><br>
                </td>
              </tr>
                        </form>
            </table>
            <!-- END Body-->
          </td>
          <td width="1%" background="images/lbox_bgside_white.gif">&nbsp;</td>
        </tr>
        <tr>
          <td width="1%" 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 width="1%" 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>
  </tr>
</table>