Rev 3887 | Rev 3891 | 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 parPv_idDim rsLocRelDim parPage_titleDim objPkgInfoDim rsTemp2Dim rsLatestDim aVersionsDim lastRow, iDim objSortHelperDim newPackageDim majorStateDim minorStateDim patchStateDim parBase_view_idDim verNumberDim parPkgName'------------ Constants Declaration -----------'------------ Variable Init -------------------parPv_id = QStrPar("pv_id")parBase_view_id = Request("base_view_id")parPkgName = QStrPar("pkgName")parPage_title = "NEW VERSION"If ( parPkgName <> "" ) ThennewPackage = TRUEparPv_id = NULLEnd ifmajorState = ""minorState = ""patchState = "checked"Set objPkgInfo = CreateObject("Scripting.Dictionary")'-----------------------------------------------------------------------------------------------------------------------------Sub GetPackageInfo( nPvId, outPkgInfo )Dim rsTemp, Query_StringIf (IsEmpty(nPvId) OR newPackage) 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(aExt)Dim rsQry, Query_StringHasCotsExtension = FALSEif aExt <> "" ThenQuery_String = "SELECT EXT_NAME FROM PROJECT_EXTENTIONS pe WHERE " &_"pe.IS_COTS='Y' AND pe.EXT_NAME='" & LCase(aExt) & "'"Set rsQry = OraDatabase.DbCreateDynaset( Query_String, ORADYN_DEFAULT )If ((NOT rsQry.BOF) AND (NOT rsQry.EOF)) ThenHasCotsExtension = TRUEEnd IfrsQry.CloseElseHasCotsExtension = TRUEend IfSet rsQry = 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'-----------------------------------------------------------------------------------------------------------------------------Sub Get_All_Base_Views ( NNnewgroup_id )Dim rsTemp, Query_StringQuery_String = _" SELECT vi.view_id, vi.view_name "&_" FROM views vi "&_" WHERE UPPER(vi.base_view) = 'Y'"&_" ORDER BY vi.view_name ASC"Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))While ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF))If NNnewgroup_id = Cstr( rsTemp.Fields("view_id")) ThenResponse.write "<option value='"& rsTemp("view_id") &"' selected>"& rsTemp("view_name") &"</option>"ElseResponse.write "<option value='"& rsTemp("view_id") &"'>" & rsTemp("view_name") &"</option>"End IfrsTemp.MoveNextWEndrsTemp.CloseSet rsTemp = nothingEnd Sub'-----------------------------------------------------------------------------------------------------------------------------Sub Get_All_Personal_Views ( NNuser_id )Dim rsTemp, Query_StringIf NNuser_id = "" Then Exit SubQuery_String = _" SELECT vi.view_id, vi.view_name"&_" FROM view_settings vs,"&_" views vi"&_" WHERE vs.view_id = vi.view_id"&_" AND vs.user_id = vi.owner_id "&_" AND vs.user_id = "& NNuser_id &_" AND vi.base_view = 'N'"&_" ORDER BY UPPER(vi.view_name)"Set rsTemp = OraDatabase.DbCreateDynaset( Query_String, cint(0))While ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF))Response.write "<option value='"& rsTemp.Fields("view_id") &"'>"& rsTemp.Fields("view_name") &"</option>"rsTemp.MoveNextWEndrsTemp.CloseSet rsTemp = nothingEnd Sub'-----------------------------------------------------------------------------------------------------------------------------%><%'===================== MAIN LINE ============================Dim bDisableAuto, bPatchOnly, bIsCots, bIsAutoIf NOT newPackage ThenCall GetPackageInfo( parPv_id, objPkgInfo )parPkgName = objPkgInfo.Item("pkg_name")' Extract version number without extensionverNumber = objPkgInfo.Item("pkg_version")verNumber = Mid( verNumber,1, Len(verNumber) - Len(objPkgInfo.Item("v_ext")))bIsCots = HasCotsExtension(objPkgInfo.Item("v_ext"))'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 ThenbIsAuto = FALSE'else default to AutoElsebIsAuto = TRUEEnd IfElse' If New Package and First versionparPage_title = "NEW PACKAGE and FIRST VERSION"bIsCots = FALSEbDisableAuto = FALSEbPatchOnly = FALSEbIsAuto = TRUEmajorState = "checked"minorState = ""patchState = ""verNumber = "1.0.0000"End If'============================================================%><script language="JavaScript" type="text/JavaScript"><!--var savedVersion;window.onload = function(e){document.getElementById('FRvnumber').value = "<%=verNumber%>";var isAutobuild = document.NEWversion.build_type[0].checked;if (!isAutobuild){changeToManualVersionNumberAssignment();}else{changeToAutoVersionNumberAssignment();}}//////////////////////////////////////////////////////////////////// Function: changeToAutoVersionNumberAssignment//// Purpose: Hide the relevent sections of the form//function changeToAutoVersionNumberAssignment(){document.getElementById('change_type').style.display = 'table-row';//document.getElementById('pkgver').style.display = 'none';savedVersion = document.getElementById('FRvnumber').value;document.getElementById('FRvnumber').disabled = true;document.getElementById('FRvnumber').value = '(auto)';}//////////////////////////////////////////////////////////////////// Function: changeToManualVersionNumberAssignment//// Purpose: Show the relevent sections of the form//function changeToManualVersionNumberAssignment(){document.getElementById('change_type').style.display = 'none';document.getElementById('pkgver').style.display = 'table-row';document.getElementById('FRvnumber').disabled = false;document.getElementById('FRvnumber').value = savedVersion;}// Do not remove these next few lines, otherwise the page does not load properly in Microsoft IE.//--></script><script>function Dependency(){<%If newPackage Then%>parent.window.location.href="dependencies.asp?rtag_id=<%=parRtag_id%>";<%Else%>parent.window.location.href="dependencies.asp?rtag_id=<%=parRtag_id%>&pv_id=<%=parPv_id%>";<%End If%>}////////////////////////////////////////////////////////////////////////////////////////////////////////// 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{// New Forms Only// Check Package Name exists// Check Base ID has been providedif ( f.newPackage.value ){MM_validateForm('FRpkgName','Package Name','RisPackage','base_view_id','Base View','R');if ( ! document.MM_returnValue ){return false;}}// Hide progress bar that is exposed because the previous tests were OKMM_findObj('ProgressBar').style.visibility='hidden';// Get Full version - store into hidden field processingvar versionExt = document.all['v_ext'].value;var versionBase = document.all['FRvnumber'].value;document.all['FRnewver'].value = versionBase + versionExt;// check the version number is goodvar isAutobuild = document.NEWversion.build_type[0].checked;document.MM_returnValue = MM_ValidateVersion(null, versionBase, versionExt, isAutobuild, false);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"><!-- Package Name --><tr><td background="images/bg_form_lightbluedark.gif" width="20%" class="form_field">Package Name</td><% if newPackage Then %><td background="images/bg_form_lightgray.gif" class="form_item"><input type="text" id="FRpkgName" name="FRpkgName" class="form_item" size="40" value="<%=parPkgName%>"></td><% Else %><td background="images/bg_form_lightgray.gif" class="form_field"><%=parPkgName%></td><% End If %></tr><!--Base View --------------><% if newPackage Then %><tr><td background="images/bg_form_lightbluedark.gif" width="20%" class="form_field">To Base View</td><td colspan="2" width="1%" nowrap background="images/bg_form_lightgray.gif"><select name="base_view_id" id="base_view_id" class="form_item"><option></option><%Call Get_All_Base_Views(parBase_view_id)%></select></td></tr><!--Personal View --------------><tr><td background="images/bg_form_lightbluedark.gif" width="20%" class="form_field">To Personal View</td><td colspan="2" width="1%" nowrap background="images/bg_form_lightgray.gif"><select name="personal_view_id" class="form_item"><option value="">None</option><%Call Get_All_Personal_Views(objAccessControl.UserId )%></select></td></tr><!--Dummy Line to highlight New Package Data --------------><tr><td background="images/bg_form_lightbluedark.gif" width="20%" class="form_field"></td><td background="images/bg_form_lightbluedark.gif" class="form_field"></td></tr><% End If %><!--Version Number Assignment --------------><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"><%Dim flagAuto, flagManif bDisableAuto ThenflagAuto = "disabled"flagMan = "checked"ElseIf bIsAuto ThenflagAuto = "checked"flagMan = ""ElseflagAuto = ""flagMan = "checked"End ifEnd if%><table><tr><td background="images/bg_form_lightgray.gif" class="form_txt"><input name="build_type" id="build_type" type="radio" value="A" <%=flagAuto%> onclick="changeToAutoVersionNumberAssignment();"> Auto<input name="build_type" id="build_type" type="radio" value="M" <%=flagMan%> onclick="changeToManualVersionNumberAssignment();"> Manual</td></table></td></tr><!-- New Version Number --><tr><td background="images/bg_form_lightbluedark.gif" width="20%" class="form_field">New Version Number</td><td><table><tr><td background="images/bg_form_lightgray.gif" class="form_item"><input type="text" id="FRvnumber"name="FRvnumber"class="form_item" size="12"></td><td id="pkgver" background="images/bg_form_lightgray.gif" class="form_item"><%If NOT newPackage Then%><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)<%End If%></td></tr></table></td></tr><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"><%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><tr id="change_type"><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 majorState = "disabled" %><input name="change_type" type="radio" value="M" <%=majorState%>></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 minorState = "disabled" %><input name="change_type" type="radio" value="N" <%=minorState%>></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" <%=patchState%>></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><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="newPackage" value="<%=newPackage%>"></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>