Rev 3865 | Rev 3885 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<%'=====================================================' NEW VERSION' PAGE'=====================================================%><!--#include file="_tabs.asp"--><!--#include file="_drawExtensionSelectBox.asp"--><!--#include file="class/classSortHelper.asp"--><%'------------ Variable Definition -------------Dim parAutoDim parPv_idDim rsLocRelDim parPage_titleDim objPkgInfoDim rsTemp2Dim rsLatestDim aVersionsDim lastRow, iDim objSortHelper'------------ Constants Declaration -----------'------------ Variable Init -------------------parPv_id = QStrPar("pv_id")parAuto = QStrPar("auto")parPage_title = "NEW VERSION"Set objPkgInfo = CreateObject("Scripting.Dictionary")'-----------------------------------------------------------------------------------------------------------------------------Function Get_ProjectsGet_Projects = _" SELECT * FROM projects ORDER BY proj_name ASC"End Function'-----------------------------------------------------------------------------------------------------------------------------Sub GetPackageInfo( nPvId, outPkgInfo )Dim rsTemp, Query_StringIf IsEmpty(nPvId) Then Exit SubQuery_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 ="& nPvIdSet rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))If ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF)) ThenoutPkgInfo.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 IfrsTemp.CloseSet rsTemp = nothingEnd Sub'-----------------------------------------------------------------------------------------------------------------------------Function Get_Latest_All_Ext ( NNpkg_id, nPv_id )Get_Latest_All_Ext = _" SELECT pv.pkg_version, pv.dlocked,"&_" DECODE ( pv.pv_id, "& nPv_id &", 'selected', NULL ) AS selected"&_" FROM PACKAGES pkg, package_versions pv"&_" WHERE pkg.pkg_id = pv.pkg_id AND pkg.pkg_id = "& NNpkg_idEnd Function'-------------------------------------------------------------------------------------------------------------' Returns TRUE if the specified version has a COTS extension' Really determines if the extension has to be strict Major.Minor.PatchBuild' or is allowed to be more relaxes. As in COTS and TOOL packages.'' Read from the database to determine type' If we cannot determine the project suffix then assume the worst'Function HasCotsExtension(aversion)Dim rsQry, Query_StringDim reResultHasCotsExtension = FALSE' Extract package suffix .xxxxDim re: Set re = New RegExpre.IgnoreCase = truere.Pattern = "(\.[a-z]{2,4})$"Set reResult = re.Execute(aversion)if reResult.Count = 1 ThenQuery_String = "SELECT EXT_NAME FROM PROJECT_EXTENTIONS pe WHERE " &_"pe.IS_COTS='Y' AND pe.EXT_NAME='"&_LCase(reResult.Item(0).Submatches(0)) & "'"Set rsQry = OraDatabase.DbCreateDynaset( Query_String, ORADYN_DEFAULT )If ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) ThenHasCotsExtension = TRUEEnd IfrsQry.CloseElseHasCotsExtension = TRUEend IfSet rsQry = NothingSet re = NothingSet reResult = NothingEnd Function'-------------------------------------------------------------------------------------------------------------'Returns TRUE if the specified version has a patch-build number.Function HasPatchBuildNumber(aversion)'test for a version with a patch build number, ie a dot and at least 4 digits before the extenstion.Dim re: Set re = New RegExpre.Pattern = "\.\d{4,}\.[^\.]+$"HasPatchBuildNumber = re.Test(aversion)Set re = NothingEnd Function'-------------------------------------------------------------------------------------------------------------'Returns TRUE if the specified version has a well formed version numberFunction HasWellFormedVersion(aversion)'If a package has a major.minor.patch-build number then it is well formedDim re: Set re = New RegExpre.Pattern = "^\d+\.\d+\.\d{4,}\.[^\.]+$"HasWellFormedVersion = re.Test(aversion)Set re = NothingEnd Function'-----------------------------------------------------------------------------------------------------------------------------%><%'===================== MAIN LINE ============================Call GetPackageInfo( parPv_id, objPkgInfo )Dim bDisableAuto, bPatchOnly, bIsCotsbIsCots = HasCotsExtension(objPkgInfo.Item("pkg_version"))'Disable the "Auto" build option if the package is a COTS package and the version doesn't have a patch-build number.bDisableAuto = bIsCots and not HasPatchBuildNumber(objPkgInfo.Item("pkg_version"))'Enable only the "Patch Change" option if the package is a COTS package and the version has a patch-build number.bPatchOnly = bIsCots and not HasWellFormedVersion(objPkgInfo.Item("pkg_version")) and HasPatchBuildNumber(objPkgInfo.Item("pkg_version"))'if "Auto" build option is disabled then select the Manual optionIf bDisableAuto ThenparAuto = "0"'else default to AutoElseIf IsNull(parAuto) OR parAuto = "" ThenparAuto = "1"End If'============================================================%><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 passedthrough to _new_version.asp. This value 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 userchanges the version base-number or version extension via any of:1. altering the value of the 'inputVersionNumber' text entry box2. 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 selectedinvokes changeToAutoVersionNumberAssignment() or changeToManualVersionNumberAssignment(), which re-builds the form on the serverwith the appropriate query string value to indicate the build type.*/window.onload = function(){var fullVersion = "<%=objPkgInfo.Item("pkg_version")%>";var versionExt = "<%=objPkgInfo.Item("v_ext")%>";var isAutobuild = document.NEWversion.build_type[0].checked;if (!isAutobuild){// We only update inputVersionNumber field on page load, for manual buildsif (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['inputVersionNumber'].value = fullVersion;}else{// strip extensiondocument.all['inputVersionNumber'].value = fullVersion.replace( /(.*)\..*/, "$1");}}// update FRnewver field from inputVersionNumber and v_ext fieldsupdateFullVersion();}//////////////////////////////////////////////////////////////////// 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['FRnewver'].value = getFullVersion();}//////////////////////////////////////////////////////////////////// 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 isAutobuild = document.NEWversion.build_type[0].checked;if( isAutobuild )return "(auto)";return document.all['inputVersionNumber'].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: changeToAutoVersionNumberAssignment//// Purpose: Re-loads the form for use in auto version number assignment//// Arguments: None//// Returns: none//function changeToAutoVersionNumberAssignment(){window.location.href = 'form_new_version.asp?rtag_id=<%=parRtag_id%>&pv_id=<%=parPv_id%>&auto=1';}//////////////////////////////////////////////////////////////////// Function: changeToManualVersionNumberAssignment//// Purpose: Re-loads the form for use in manual version number assignment//// Arguments: None//// Returns: none//function changeToManualVersionNumberAssignment(){window.location.href = 'form_new_version.asp?rtag_id=<%=parRtag_id%>&pv_id=<%=parPv_id%>&auto=0';}// 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%>";}////////////////////////////////////////////////////////////////////////////////////////////////////////// This function returns true if version is ok, else false////////////////////////////////////////////////////////////////////////////////////////////////////////function checkVersion(){var fullVersion = document.all['FRnewver'].value;var versionBase = fullVersion.replace( /(.*)(\..*)/, "$1");var versionExt = fullVersion.replace( /(.*)(\..*)/, "$2");var isAutobuild = document.NEWversion.build_type[0].checked;return MM_ValidateVersion(null, versionBase, versionExt, isAutobuild, false);}////////////////////////////////////////////////////////////////////////////////////////////////////////// This function returns true if form validation passes, else false// It is called when a user hits the submit button.////////////////////////////////////////////////////////////////////////////////////////////////////////function validateFormNEWversion(){var f = document.getElementById('NEWversion');if (f == null)alert('Failed To Get NEWversion'); // should never happen unless a coding/rendering mistake is made?else{// check the version number is gooddocument.MM_returnValue = checkVersion();if (document.MM_returnValue){// check the reason for change is good// NOTE: MM_validateForm returns its result through MM_returnValue : true if validation passes, else falseMM_validateForm('FRreason','Reason for This Version','maxLength:4000');if (document.MM_returnValue){f.action='_new_version.asp';parent.window.location.href='dependencies.asp?rtag_id=<%=parRtag_id%>&pv_id=<%=parPv_id%>';return true; // let the submit happen}}}return false; // prevent the submit}</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%"> </td><td align="right"><img src="images/h_trsp_dot.gif" width="30" height="30"></td><td width="1%"> </td></tr><tr><td width="1%"> </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 --> </td></tr></table></td><td width="1%"> </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 id="NEWversion" name="NEWversion" method="post"><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%"> </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" width="20%" class="form_field">Package Name</td><td background="images/bg_form_lightgray.gif" class="form_field"><%=objPkgInfo.Item("pkg_name")%></td></tr><tr><td background="images/bg_form_lightbluedark.gif" width="20%" class="form_field">Version Number Assignment</td><td background="images/bg_form_lightgray.gif" class="form_txt"><%If bDisableAuto Then%><input name="build_type" id="build_type" type="radio" value="A" disabled onclick="changeToAutoVersionNumberAssignment();"> Auto<input name="build_type" id="build_type" type="radio" value="M" checked onclick="changeToManualVersionNumberAssignment();"> Manual<%Else%><%If parAuto = "1" Then%><input name="build_type" id="build_type" type="radio" value="A" checked onclick="changeToAutoVersionNumberAssignment();"> Auto<input name="build_type" id="build_type" type="radio" value="M" onclick="changeToManualVersionNumberAssignment();"> Manual<%Else%><input name="build_type" id="build_type" type="radio" value="A" onclick="changeToAutoVersionNumberAssignment();"> Auto<input name="build_type" id="build_type" type="radio" value="M" checked onclick="changeToManualVersionNumberAssignment();"> Manual<%End If%><%End If%></td></tr></table><table width="100%" border="0" cellspacing="0" cellpadding="5"><tr><td background="images/bg_form_lightbluedark.gif" width="20%" class="form_field">New Version Number</td><td background="images/bg_form_lightgray.gif" class="form_item"><%If parAuto = "0" Then%><input type="text" id="inputVersionNumber" name="inputVersionNumber" class="form_item" size="12" onmouseout="updateFullVersion();" onblur="updateFullVersion();" onclick="updateFullVersion();" onmouseup="updateFullVersion();" onchange="updateFullVersion();" onkeyup="updateFullVersion();"><%Else%><input type="text" id="inputVersionNumber" name="inputVersionNumber" class="form_item" size="12" value="(auto)" disabled><%End If%></td><%If parAuto = "0" Then%><td background="images/bg_form_lightgray.gif" class="form_item"><select id="FRpkgver" name="FRpkgver" class="form_item"><option value=""></option><%Set rsLatest = OraDatabase.DbCreateDynaset( Get_Latest_All_Ext( objPkgInfo.Item("pkg_id"), parPv_id ), cint(0))If rsLatest.RecordCount > 0 ThenaVersions = rsLatest.GetRows()lastRow = UBound( aVersions, 2 )Set objSortHelper = New SortHelper' Sort versionsCall objSortHelper.VersionSort( aVersions, 0, lastRow, rsLatest.FieldIndex("pkg_version") )' Descending orderFor i = lastRow To 0 Step -1%><option value="<%=aVersions( rsLatest.FieldIndex("pkg_version"), i )%>" <%=aVersions( rsLatest.FieldIndex("selected"), i )%>><%If aVersions( rsLatest.FieldIndex("dlocked"), i ) = "Y" Then%>R <%Else%> <%End If%><%=aVersions( rsLatest.FieldIndex("pkg_version"), i )%></option><%NextSet objSortHelper = nothingEnd If%></select> Existing Versions (For Reference Only)</td><%End If%></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="5"><tr><td background="images/bg_form_lightbluedark.gif" width="20%" 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" width="20%" class="form_field">Reason For This Version</td><td background="images/bg_form_lightgray.gif" nowrap width="100%" class="form_field"><textarea name="FRreason" class="form_item" style="width: 420px; height: 150px"></textarea></td></tr></table><%If parAuto = "1" Then%><table width="100%" border="0" cellspacing="0" cellpadding="5"><tr><td background="images/bg_form_lightbluedark.gif" nowrap width="20%" class="form_field">Change Type</td><td background="images/bg_form_lightgray.gif" ><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="1%"><%If bPatchOnly Then%><input name="change_type" type="radio" value="M" disabled><%Else%><input name="change_type" type="radio" value="M"><%End If%></td><td nowrap><span class="form_field">Major Change</span></td><td> </td><td><span class="form_txt">A major number change indicates the contract of the package has changed in a non-backwardly compatible manner.</span></td></tr><tr><td colspan="4"><hr width="100%" size="1" noshade></td></tr><tr><td width="1%"><%If bPatchOnly Then%><input name="change_type" type="radio" value="N" disabled><%Else%><input name="change_type" type="radio" value="N"><%End If%></td><td align="center" nowrap><span class="form_field">Minor Change</span></td><td> </td><td><span class="form_txt">A minor number change indicates the contract of the package has changed in a backwardly compatible manner.</span></td></tr><tr><td colspan="4"><hr width="100%" size="1" noshade></td></tr><tr><td width="1%"><input name="change_type" type="radio" value="P" checked></td><td nowrap><span class="form_field">Patch Change</span></td><td> </td><td><span class="form_txt">A patch number change indicates the package has changed internally.</span></td></tr></table></td></tr></table><%End If%><table width="100%" border="0" cellspacing="1" cellpadding="0"><tr><td nowrap><img src="images/h_trsp_dot.gif" width="120" height="1"></td><td></td></tr><input type="hidden" name="FRnewver" id="FRnewver" value="hello"><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%>"></table></td></tr><tr><td width="1%"> </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 validateFormNEWversion();"><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"> </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>