Rev 5632 | Rev 5902 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<%'===============================================================' Version Browser'===============================================================%><!--#include file="class/classSortHelper.asp"--><%'------------ Variable Definition -------------Dim parFLpkg_version, parFLuser_nameDim imgLock, fieldRelease_Date, fieldReleased_By, fieldDownloadFullReleaseNotesDim rsVBDim rowColor, imgPointerDim URLstringDim anchorNameDim filterInUseDim hideRippleDim rippleFilterDim DestroyPackageDim CanDestroyPackage'------------ Constants Declaration -----------Const IMGBG_ROW_HI = "background='images/bg_row_hi.gif'"Const IMGBG_ROW = "bgcolor='#FFFFFF'"Const IMG_PONTER = "<img src='images/i_pointer.gif' width='6' height='11' hspace='3'>"Const IMG_OFFICIAL = "<img src='images/i_locked.gif' width='7' height='10' hspace='5' vspace='2' title='Package has been Released'>"Const IMG_NOT_OFFICIAL = "<img src='images/spacer.gif' width='7' height='10' hspace='5' vspace='2' title='Package not yet released'>"Const IMG_DOWNLOAD = "<img src='images/i_download_small.gif' alt='Download full release notes.' width='16' height='16' hspace='2' border='0'>"'------------ Variable Init -------------------If Request("filter_reset") <> "" ThenparFLpkg_version = "*"parFLuser_name = "*"filterInUse = FALSEElseparFLpkg_version = Request( "FLpkg_version" )parFLuser_name = Request( "FLuser_name" )filterInUse = Is_Filter_In_Use ( "FLpkg_version, FLuser_name" )End IfIf Request("hideRipple") = "True" ThenhideRipple = TruerippleFilter = "AND PV.BUILD_TYPE != 'Y'"ElsehideRipple = FalserippleFilter = ""End If'----------------------------------------------%><%'-----------------------------------------------------------------------------------------------------------------------------------Function Get_All_Versions ( nPkg_id )Get_All_Versions = _" SELECT DISTINCT PV.PV_ID," &_" PV.PKG_VERSION," &_" PV.DLOCKED," &_" PV.MODIFIED_STAMP," &_" USR.FULL_NAME," &_" usr.user_name," &_" USR.USER_EMAIL," &_" PV.COMMENTS," &_" PV.PKG_LABEL," &_" PV.IS_PATCH," &_" PV.RELEASE_NOTES_INFO," &_" PV.BUILD_TYPE," &_" pv.CREATOR_ID," &_" pv.OWNER_ID," &_" NVL2(rc.rtag_id,1,0) as inuse," &_" trunc(SYSDATE - pv.CREATED_STAMP + 0.5) as age" &_" FROM PACKAGE_VERSIONS PV," &_" USERS USR,"&_" RELEASE_CONTENT rc" &_" WHERE PV.MODIFIER_ID = USR.USER_ID(+) " &_" AND PV.PKG_ID = :PKG_ID" &_" AND pv.pv_id = rc.pv_id(+)" &_" /*-- Manual Filter --*/" &_" "& Construct_Filter ( parFLpkg_version, "pv.pkg_version" ) &_" "& Construct_Filter ( parFLuser_name, "usr.user_name" ) &_" "& rippleFilter &_" /*------------------*/"Get_All_Versions = Replace( Get_All_Versions, ":PKG_ID", nPkg_id)End Function'-----------------------------------------------------------------------------------------------------------------------------------Function Construct_Filter ( sPar_val, sCol_name )Select Case sPar_valCase EmptyConstruct_Filter = "AND "& sCol_name &" IS NULL"Case "*"Construct_Filter = ""Case ElseIf InStr( sPar_val, "*") > 0 Then' Asterisk found in string. Use LIKEConstruct_Filter = "AND "& sCol_name &" LIKE '"& Replace( sPar_val, "*", "%" ) &"'"Else' No asterisk. Use =Construct_Filter = "AND "& sCol_name &" = '"& sPar_val &"'"End IfEnd SelectEnd Function'-----------------------------------------------------------------------------------------------------------------------------------Function Is_Filter_In_Use ( sFilters )Dim filters, filterNameIs_Filter_In_Use = FALSEfilters = Split( Replace( sFilters, " ", "" ), "," )For Each filterName In filtersIf Request( filterName ) <> "*" ThenIs_Filter_In_Use = TRUEExit ForEnd IfNextEnd Function'-----------------------------------------------------------------------------------------------------------------------------------Function Set_Row_Style ( sLink, pvid )Set_Row_Style = "onMouseOver='this.style.cursor=""pointer""' onClick='selectVersion("""& sLink &""",event)' "End Function'-----------------------------------------------------------------------------------------------------------------------------------%><!--#include file="_jquery_includes.asp"--><script language="JavaScript" type="text/JavaScript">function useThisVersion (pkgName, pkgVersion, rtagId, oldPvid, newPvid) {console.log("useThisVersion:", pkgName, pkgVersion);debugger;//alert ("Use this version");$( "#dialog-confirm" ).dialog({position: { my: "top", at: "top+100", of: window },modal: true,draggable: true,resizable: true,dialogClass: "rounded_box",height:250,width:350,buttons: {"Direct": function() {window.opener.document.location="_new_version.asp?OLDpv_id=" + oldPvid + "&rtag_id=" + rtagId + "&pv_id=" + newPvidself.close();$( this ).dialog( "close" );},"Pending": function() {window.opener.document.location="_new_version.asp?OLDpv_id=" + oldPvid + "&rtag_id=" + rtagId + "&pv_id=" + newPvid + '&iMode=pending';self.close();$( this ).dialog( "close" );},Cancel: function() {$( this ).dialog( "close" );}},open: function() {$(this).siblings('.ui-dialog-buttonpane').find('button:eq(2)').focus();}});return false;}// This function is invoked when the user clicks within a row// The click will re-load and reposition the verion history to the selected version// The problem is that the 'Destroy Version' intercats with this.// Solution: The DestroyVersin is an image within an anchor.// If the anchor has a class of nogo, then don't navigatefunction selectVersion(href,event){if (! $(event.target).closest('a').hasClass('nogo')) {location.href = href;}}//# sourceURL=_version_browser_1.asp</script><!--------------- ACTION BUTTONS --------------------------><form name="filter" method="get" action="<%=scriptName%>"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="1" valign="middle" background="images/bg_action_norm.gif"><img src="images/spacer.gif" width="5" height="35"></td><td width="100%" valign="middle" background="images/bg_action_norm.gif"><%Dim bEnableUse : bEnableUse = FALSEIf Request("rtag_id") = "" OR _Request("pv_id") = "" OR _parOLDpv_id = ParPv_id OR _bIsPatch OR _(NOT bCanInsertPkg) OR _(NOT objAccessControl.UserLogedIn) OR _(NOT releaseIsWritable(ReleaseMode)) _ThenbEnableUse = FALSEElsebEnableUse = TRUEEnd IfIf bEnableUse Then%><div id='dialog-confirm' title="Confirm version change" style="display:none"><p>Replace the current version of package <%=sPkg_Name%> with Version <%=sPkg_Version%>.<p>The new version may be added directly into the release or the change may be made pending.</div><%Response.write "<a href=';' onClick='return useThisVersion("""& sPkg_Name &""","""& sPkg_Version & """,""" & parRtag_id & ""","""& parOLDpv_id & """,""" & parPv_id & """);'><img src='images/abtn_use_this_version.gif' title='Use this version in project release.' width='107' height='25' hspace='1' border='0'></a>"ElseResponse.write "<img src='images/abtn_use_this_version_off.gif' width='108' height='26' hspace='1' border='0'>"End IfResponse.write "<img src='images/spacer.gif' width='25' height='25'>"If filterInUse ThenResponse.write "<input type='image' name='btn' src='images/abtn_filter_on.gif' width='25' height='25' border='0' alt='Apply filter. (Filter is in use!)'>"ElseResponse.write "<input type='image' name='btn' src='images/abtn_filter.gif' width='25' height='25' border='0' alt='Apply filter'>"End IfResponse.write "<a href='"& scriptName &"?"& Persists_Query_String( "filter_reset=true" ) &"'><img src='images/abtn_remove_filter.gif' alt='Remove filter' width='25' height='25' hspace='2' border='0'></a>"Response.write "<img src='images/spacer.gif' width='25' height='25'>"Response.write "<a href='"& scriptName &"?"& Persists_Query_String( "hideRipple=" & not hideRipple ) &"'>"If hideRipple ThenResponse.write "<img src='images/RippleSquareOff.gif' width='25' height='25' border='0' title='Rippled Versions Hidden. Toggle'>"ElseResponse.write "<img src='images/RippleSquare.gif' width='25' height='25' border='0' title='Rippled Versions Shown. Toggle'>"End IfResponse.write "</a>"%></td><td width="1" valign="middle" background="images/bg_action_norm.gif"><a href="javascript:;" onClick="window.opener.document.location='dependencies.asp?pv_id=<%=parPv_id%>';self.close();"><img src="images/abtn_open.gif" width="46" height="25" hspace="5" border="0" alt="Open In Parent Window."></a></td><td width="1" valign="middle" background="images/bg_action_norm.gif"><a href="javascript:;" onClick="self.close();"><img src="images/abtn_close.gif" width="46" height="25" hspace="5" border="0" alt="Close this window."></a></td></tr></table><!--------------------- CAPTION ----------------------------><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td class="lbox_ttl_b" background="images/bg_action_dark.gif" align="center"><%=sPkg_Name%></td></tr></table><!------------------ VERSION LIST --------------------------><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td background="images/bg_action_norm.gif"><div id="LayerVersions" style="height: 350px; overflow: auto;" name="LayerVersions"><table width="100%" border="0" cellspacing="1" cellpadding="2"><tr><td width="1" nowrap background="images/bg_action_dark.gif"><img src="images/spacer.gif" width="15" height="10"></td><td width="1" nowrap background="images/bg_action_dark.gif"> </td><td width="1" valign="top" nowrap background="images/bg_action_dark.gif" class="form_field">Version <br><input name="FLpkg_version" type="text" class="form_ifilter" value="<%=parFLpkg_version%>" size="15"></td><td width="1" valign="top" nowrap background="images/bg_action_dark.gif" class="form_field">Last Mod. Date </td><td width="100%" valign="top" nowrap background="images/bg_action_dark.gif" class="form_field">Reason for this version</td><td width="1" valign="top" nowrap background="images/bg_action_dark.gif" class="form_field">Last Modified <br><input name="FLuser_name" type="text" class="form_ifilter" value="<%=parFLuser_name%>" size="15"></td><td width="1" nowrap background="images/bg_action_dark.gif"></td><td width="1" nowrap background="images/bg_action_dark.gif"></td></tr><%Dim aVersions, lastRow, i, objSortHelperSet rsVB = OraDatabase.DbCreateDynaset( Get_All_Versions ( parPkg_id ), cint(0))' Descending orderIf rsVB.RecordCount > 0 ThenaVersions = rsVB.GetRows()lastRow = UBound( aVersions, 2 )Set objSortHelper = New SortHelper' Sort versionsCall objSortHelper.VersionSort( aVersions, 0, lastRow, rsVB.FieldIndex("pkg_version") )CanDestroyPackage = canShowControlInProject ( "DestroyPackage" )' Descending orderFor i = lastRow To 0 Step -1%><% ' Highlight row caserowColor = IMGBG_ROWimgPointer = ""If CStr( aVersions( rsVB.FieldIndex("pv_id"), i ) ) = parPv_id ThenrowColor = IMGBG_ROW_HIimgPointer = IMG_PONTEREnd If' Official/Unofficial caseimgLock = IMG_NOT_OFFICIAL'fieldRelease_Date = ""'fieldReleased_By = ""If (aVersions( rsVB.FieldIndex("dlocked"), i ) = "Y") OR (aVersions( rsVB.FieldIndex("dlocked"), i ) = "A") ThenimgLock = IMG_OFFICIALEnd IffieldRelease_Date = DisplayShortDateTime ( aVersions( rsVB.FieldIndex("modified_stamp"), i ) )fieldReleased_By = "<a href='mailto:"& aVersions( rsVB.FieldIndex("user_email"), i ) &"' class='txt_linked'><img src='images/i_user.gif' width='10' height='13' hspace='2' border='0' align='absmiddle' alt='"& aVersions( rsVB.FieldIndex("full_name"), i ) &" <"& aVersions( rsVB.FieldIndex("user_email"), i ) &">'>"& aVersions( rsVB.FieldIndex("user_name"), i ) &"</a>"' Full Release Notes availabilityfieldDownloadFullReleaseNotes = ""If NOT IsNull( aVersions( rsVB.FieldIndex("release_notes_info"), i ) ) OR ( InStr( aVersions( rsVB.FieldIndex("release_notes_info"), i ), "MGS:") < 1) ThenfieldDownloadFullReleaseNotes = "<a href='"& HTTP_PKG_ARCHIVE & aVersions( rsVB.FieldIndex("release_notes_info"), i ) &"' target='_blank'><img src='images/i_download_small.gif' alt='Download full release notes.' width='16' height='16' hspace='2' border='0'></a>"End IfanchorName = "ANC_"& aVersions( rsVB.FieldIndex("pv_id"), i )If aVersions( rsVB.FieldIndex("is_patch"), i ) = "Y" ThenURLstring = "_wform_versions_history_release_notes.asp?"& Persists_Query_String( "pv_id="& aVersions( rsVB.FieldIndex("pv_id"), i ) ) &"#"& anchorNameElseURLstring = scriptName &"?"& Persists_Query_String( "pv_id="& aVersions( rsVB.FieldIndex("pv_id"), i ) ) &"#"& anchorNameEnd If' User can try to delete package iff' Have suffiecient access (unusual)' They created it or own it' The version is not in use by any release (allow to be in pendinf or WIP)' [Not at the moment] The package was created less than xxxx days ago' Is not locked or Approved for AutobuildIf CanDestroyPackage = false ThenIf objAccessControl.UserId = aVersions( rsVB.FieldIndex("CREATOR_ID"), i ) OR objAccessControl.UserId = aVersions( rsVB.FieldIndex("OWNER_ID"), i )ThenIf aVersions( rsVB.FieldIndex("inuse"), i ) = 0 Then'If aVersions( rsVB.FieldIndex("age") , i ) < 1000 ThenIf aVersions( rsVB.FieldIndex("dlocked"), i ) <> "Y" ThenIf aVersions( rsVB.FieldIndex("dlocked"), i ) <> "A" ThenCanDestroyPackage = trueEnd IfEnd If'End IfEnd IfEnd IfEnd If' Set destroy package actionIf CanDestroyPackage ThenDestroyPackage = "<a class='nogo' href='javascript:;'"&_" title='Destroy this package from the database.' "&_" onClick=""return vixConfirm('You are about to destroy ["& sPkg_Name &" "& aVersions( rsVB.FieldIndex("pkg_version"), i ) &"].<p>You cannot undo this operation.<br>Do you want to proceed?', {button : 'Destroy', url : '_destroy_package.asp?pv_id="& aVersions( rsVB.FieldIndex("pv_id"), i ) &"&bfile="& ScriptName &"&rtag_id="& parRtag_id &"&FLuser_name="& parFLuser_name &"&FLpkg_version="& parFLpkg_version &"&rfile="& parRfile &"&pkg_id="& parPkg_id &"&OLDpv_id="& parOLDpv_id &"'});"" >" &_" <img src='icons/i_destroy_package_sml.gif' width='15' height='15' border='0' ><a>"ElseDestroyPackage = ""End If%><tr <%=Set_Row_Style ( URLstring, CStr( aVersions( rsVB.FieldIndex("pv_id"), i ) ) )%>><td align="right" background="images/bg_action_dark.gif"><%=imgPointer%></td><td align="center" valign="top" <%=rowColor%>><%=imgLock%></td><td valign="top" nowrap <%=rowColor%>><a name="<%=anchorName%>"></a><a href="<%=URLstring%>" class="txt_linked"><%=aVersions( rsVB.FieldIndex("pkg_version"), i )%></a></td><td valign="top" nowrap <%=rowColor%> class="form_item"><%=fieldRelease_Date%></td><td valign="top" <%=rowColor%> class="form_item"><%=NewLine_To_BR ( To_HTML( aVersions( rsVB.FieldIndex("comments"), i ) ) )%></td><td valign="top" nowrap <%=rowColor%> class="form_item"><%=fieldReleased_By%></td><td align="center" valign="top" <%=rowColor%>><%=fieldDownloadFullReleaseNotes%></td><td align="center" valign="top" class="nogo" <%=rowColor%>><%=DestroyPackage%></td></tr><%NextEnd If%></table></div></td></tr></table><input type="hidden" name="rtag_id" value="<%=parRtag_id%>"><input type="hidden" name="pkg_id" value="<%=parPkg_id%>"><input type="hidden" name="rfile" value="<%=parRfile%>"><input type="hidden" name="OLDpv_id" value="<%=parOLDpv_id%>"><input type="hidden" name="pv_id" value="<%=parPv_id%>"><input type="hidden" name="filter_reset" value=""></form>