Rev 6827 | Rev 6879 | 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 pvidNameDim idxNameDim filterInUseDim hideRippleDim rippleFilterDim DestroyPackageDim CanDestroyProjectPackageDim 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_PENDING = "<img src='icons/i_pending.gif' width='7' height='10' hspace='5' vspace='2' title='Package pending autobuild'>"Const IMG_NOT_OFFICIAL = "<img src='images/spacer.gif' width='7' height='10' hspace='5' vspace='2' title='Package not yet released'>"Const IMG_NOT_BUILDABLE = "<img src='icons/s_unbuildable.png' width='14' height='14' hspace='5' vspace='0' title='Package is not buildable'>"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 = RequestDefault( "FLpkg_version", "*" )parFLuser_name = RequestDefault( "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," &_" pv.BUILD_TYPE," &_" 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 version history to the selected version// The problem is that the 'Destroy Version' interacts with this.// Also the mailto operation interacts with this// Solution: The DestroyVersion is an image within a 'td'.// If the 'td' has a class of nogo, then don't navigatefunction selectVersion(href,event){if (! ($(event.target).closest('td').hasClass('nogo') || $(event.target).closest('span').hasClass('mailto')) ) {location.href = href;}}// Encode data into URLfunction encodeData(data) {return Object.keys(data).map(function(key) {return [key, data[key]].map(encodeURIComponent).join("=");}).join("&");}// Destroy a package versionfunction DestroyVersion(pvid, idx) {var data = {pv_id : pvid,bfile : "<%=ScriptName%>",rtag_id : "<%=parRtag_id%>",FLuser_name : "<%=parFLuser_name%>",FLpkg_version : "<%=parFLpkg_version%>",rfile : "<%=parRfile%>",pkg_id : "<%=parPkg_id%>",OLDpv_id : "<%=parOLDpv_id%>",index : idx};MM_openVixIFrame('_destroy_package.asp?' + encodeData(data), 'Destroy Package Version')}// Scroll to package// Order of preference// index - location of last package deleted// index-1 - Near last pakage deleted// pvid - PVID being viewed// oldPVID - PVID Deletedfunction scrollToPvId() {var oldpvid = Number('<%=parOLDpv_id%>');var pvid = Number('<%=parPv_id%>');var idx = Number('<%=parIndex%>');var els;if (idx > 0) {els = document.getElementById('IDX_' + idx.toString() );if (!els) {idx = idx -1;els = document.getElementById('IDX_' + idx.toString() );}}if (!els) els = document.getElementById('PVID_' + pvid.toString() );if (!els)els = document.getElementById('PVID_' + oldpvid.toString() );if (els) els.scrollIntoView();}// Set the height of the two areas in the History Window// Note: Divs may not always be available.function setLayerHeight () {try {var h = screen.height;MM_findObj("LayerVersions").style.height = (h-300)/2 +"px";MM_findObj("LayerDetails").style.height = (h-300)/2 +"px";} catch(e) {}}//# sourceURL=_version_browser_1.asp</script><!--------------- ACTION BUTTONS --------------------------><div style="width:100vw;"><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' title='Apply filter. (Filter is in use!)'>"ElseResponse.write "<input type='image' name='btn' src='images/abtn_filter.gif' width='25' height='25' border='0' title='Apply filter'>"End IfResponse.write "<span class=pointer onClick=""location.href='"& scriptName &"?"& Persists_Query_String( "filter_reset=true" ) &"'""><img src='images/abtn_remove_filter.gif' title='Remove filter' width='25' height='25' hspace='2' border='0'></a>"Response.write "<img src='images/spacer.gif' width='25' height='25'>"Response.write "<span class=pointer onClick=""location.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 "</span>"%></td><td width="1" class=pointer valign="middle" background="images/bg_action_norm.gif" 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."></td><td width="1" class=pointer valign="middle" background="images/bg_action_norm.gif" onClick="self.close();"><img src="images/abtn_close.gif" width="46" height="25" hspace="5" border="0" alt="Close this window."></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; width:100vw; 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, objSortHelper, idxSet 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") )CanDestroyProjectPackage = canShowControlInProject ( "DestroyPackage" )' Descending orderidx = 0For i = lastRow To 0 Step -1idx = idx + 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("build_type"), i ) = "U") ThenimgLock = IMG_NOT_BUILDABLEElseIf (aVersions( rsVB.FieldIndex("dlocked"), i ) = "Y") ThenimgLock = IMG_OFFICIALElseIf (aVersions( rsVB.FieldIndex("dlocked"), i ) = "A") ThenimgLock = IMG_PENDINGEnd IffieldRelease_Date = DisplayShortDateTime ( aVersions( rsVB.FieldIndex("modified_stamp"), i ) )fieldReleased_By = emailField(enum_imgUser & aVersions( rsVB.FieldIndex("full_name"), i ), aVersions( rsVB.FieldIndex("user_email"), i ))' 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 IfpvidName = "PVID_"& aVersions( rsVB.FieldIndex("pv_id"), i )idxName = "IDX_" & idxIf aVersions( rsVB.FieldIndex("is_patch"), i ) = "Y" ThenURLstring = "_wform_versions_history_release_notes.asp?"& Persists_Query_String_Trim( "pv_id="& aVersions( rsVB.FieldIndex("pv_id"), i ), "index" )ElseURLstring = scriptName &"?"& Persists_Query_String_Trim( "pv_id="& aVersions( rsVB.FieldIndex("pv_id"), i ), "index" )End 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 pending or WIP)' [Not at the moment] The package was created less than xxxx days ago' Is not locked or [Not at the moment] Approved for AutobuildCanDestroyPackage = CanDestroyProjectPackageIf NOT CanDestroyPackage 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" Then'If aVersions( rsVB.FieldIndex("dlocked"), i ) <> "A" ThenCanDestroyPackage = true'End IfEnd If'End IfEnd IfEnd IfEnd If' Set destroy package actionIf CanDestroyPackage ThenDestroyPackage = "<span "&_" title='Destroy this version of the package.' "&_" onClick=DestroyVersion("& aVersions( rsVB.FieldIndex("pv_id"), i ) &"," & idx &")>" &_" <img src='icons/i_destroy_package_sml.gif' width='15' height='15' border='0' ><span>"ElseDestroyPackage = ""End If%><tr id="<%=idxName%>" <%=Set_Row_Style ( URLstring, CStr( aVersions( rsVB.FieldIndex("pv_id"), i ) ) )%>><td align="right" background="images/bg_action_dark.gif"><%=imgPointer%><span id="<%=pvidName%>"></span></td><td align="center" valign="top" <%=rowColor%>><%=imgLock%></td><td valign="top" nowrap <%=rowColor%>><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></div>