Subversion Repositories DevTools

Rev

Rev 5902 | Rev 5930 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
119 ghuddy 1
<%
2
'===============================================================
3
'					 Version Browser
4
'===============================================================
5
%>
6
<!--#include file="class/classSortHelper.asp"-->
7
<%
8
'------------ Variable Definition -------------
9
Dim parFLpkg_version, parFLuser_name
10
Dim imgLock, fieldRelease_Date, fieldReleased_By, fieldDownloadFullReleaseNotes
11
Dim rsVB
12
Dim rowColor, imgPointer
13
Dim URLstring
14
Dim anchorName
15
Dim filterInUse
4703 dpurdie 16
Dim hideRipple
17
Dim rippleFilter
119 ghuddy 18
Dim DestroyPackage
5902 dpurdie 19
Dim CanDestroyProjectPackage
119 ghuddy 20
Dim CanDestroyPackage
21
'------------ Constants Declaration -----------
22
Const IMGBG_ROW_HI = "background='images/bg_row_hi.gif'"
23
Const IMGBG_ROW = "bgcolor='#FFFFFF'"
24
Const IMG_PONTER = "<img src='images/i_pointer.gif' width='6' height='11' hspace='3'>"
5384 dpurdie 25
Const IMG_OFFICIAL = "<img src='images/i_locked.gif' width='7' height='10' hspace='5' vspace='2' title='Package has been Released'>"
5902 dpurdie 26
Const IMG_PENDING = "<img src='icons/i_pending.gif' width='7' height='10' hspace='5' vspace='2' title='Package pending autobuild'>"
5384 dpurdie 27
Const IMG_NOT_OFFICIAL = "<img src='images/spacer.gif' width='7' height='10' hspace='5' vspace='2' title='Package not yet released'>"
119 ghuddy 28
Const IMG_DOWNLOAD = "<img src='images/i_download_small.gif' alt='Download full release notes.' width='16' height='16' hspace='2' border='0'>"
29
'------------ Variable Init -------------------
30
If Request("filter_reset") <> "" Then 
31
	parFLpkg_version = "*"
32
	parFLuser_name	 = "*"
33
	filterInUse = FALSE
34
Else
5901 dpurdie 35
	parFLpkg_version = RequestDefault( "FLpkg_version", "*" )
36
	parFLuser_name	 = RequestDefault( "FLuser_name","*" )
119 ghuddy 37
	filterInUse = Is_Filter_In_Use ( "FLpkg_version, FLuser_name" )
38
End If
4703 dpurdie 39
 
40
If Request("hideRipple") = "True" Then 
41
	hideRipple = True
42
    rippleFilter = "AND PV.BUILD_TYPE != 'Y'"
43
Else
44
	hideRipple = False
45
    rippleFilter = ""
46
End If
47
 
119 ghuddy 48
'----------------------------------------------
49
%>
50
<%
51
'-----------------------------------------------------------------------------------------------------------------------------------
52
Function Get_All_Versions ( nPkg_id )
53
	Get_All_Versions = _
5759 dpurdie 54
	" SELECT DISTINCT PV.PV_ID," &_
55
    "   PV.PKG_VERSION," &_
56
    "   PV.DLOCKED," &_
57
    "   PV.MODIFIED_STAMP," &_
58
    "   USR.FULL_NAME," &_
59
    "   usr.user_name," &_
60
    "   USR.USER_EMAIL," &_
61
    "   PV.COMMENTS," &_
62
    "   PV.PKG_LABEL," &_
63
    "   PV.IS_PATCH," &_
64
    "   PV.RELEASE_NOTES_INFO," &_
65
    "   PV.BUILD_TYPE," &_
66
    "   pv.CREATOR_ID," &_
67
    "   pv.OWNER_ID," &_
68
    "   NVL2(rc.rtag_id,1,0) as inuse," &_
69
    "   trunc(SYSDATE - pv.CREATED_STAMP + 0.5) as age" &_
70
    " FROM PACKAGE_VERSIONS PV," &_
71
    "      USERS USR,"&_
72
    "      RELEASE_CONTENT rc" &_
73
	" WHERE PV.MODIFIER_ID = USR.USER_ID(+) " &_
74
	"   AND PV.PKG_ID = :PKG_ID" &_
75
    "   AND pv.pv_id = rc.pv_id(+)" &_
76
	"    /*-- Manual Filter --*/" &_
119 ghuddy 77
	"    "& Construct_Filter ( parFLpkg_version, "pv.pkg_version" ) &_
78
	"    "& Construct_Filter ( parFLuser_name, "usr.user_name" ) &_
4703 dpurdie 79
    "    "& rippleFilter &_
119 ghuddy 80
	"    /*------------------*/"
81
 
82
	Get_All_Versions = Replace( Get_All_Versions, ":PKG_ID", nPkg_id)
83
End Function
84
'-----------------------------------------------------------------------------------------------------------------------------------
85
Function Construct_Filter ( sPar_val, sCol_name )
86
	Select Case sPar_val
87
	Case Empty
88
		Construct_Filter = "AND "& sCol_name &" IS NULL"
89
 
90
	Case "*"
91
		Construct_Filter = ""
92
 
93
	Case Else
94
		If InStr( sPar_val, "*") > 0 Then
95
			' Asterisk found in string. Use LIKE
96
			Construct_Filter = "AND "& sCol_name &" LIKE '"& Replace( sPar_val, "*", "%" ) &"'"
97
		Else
98
			' No asterisk. Use =
99
			Construct_Filter = "AND "& sCol_name &" = '"& sPar_val &"'"
100
		End If
101
 
102
	End Select
103
 
104
End Function
105
'-----------------------------------------------------------------------------------------------------------------------------------
106
Function Is_Filter_In_Use ( sFilters )
107
	Dim filters, filterName
108
	Is_Filter_In_Use = FALSE
109
 
110
	filters = Split( Replace( sFilters, " ", "" ), "," )
111
 
112
	For Each filterName In filters
113
		If Request( filterName ) <> "*" Then 
114
			Is_Filter_In_Use = TRUE
115
			Exit For
116
		End If
117
	Next
118
 
119
End Function
120
'-----------------------------------------------------------------------------------------------------------------------------------
5190 dpurdie 121
Function Set_Row_Style ( sLink, pvid )
122
	Set_Row_Style = "onMouseOver='this.style.cursor=""pointer""' onClick='selectVersion("""& sLink &""",event)' "
123
End Function
124
'-----------------------------------------------------------------------------------------------------------------------------------
119 ghuddy 125
%>
5173 dpurdie 126
<!--#include file="_jquery_includes.asp"-->
127
<script language="JavaScript" type="text/JavaScript">
128
function useThisVersion (pkgName, pkgVersion, rtagId, oldPvid, newPvid) {
129
    console.log("useThisVersion:", pkgName, pkgVersion);
130
    debugger;
131
    //alert ("Use this version");
132
    $( "#dialog-confirm" ).dialog({
133
      position: { my: "top", at: "top+100", of: window },
134
      modal: true,
135
      draggable: true,
136
      resizable: true,
137
      dialogClass: "rounded_box",
138
      height:250,
139
      width:350,
140
      buttons: {
141
        "Direct": function() {
142
          window.opener.document.location="_new_version.asp?OLDpv_id=" + oldPvid + "&rtag_id=" + rtagId + "&pv_id=" + newPvid
143
          self.close();
144
          $( this ).dialog( "close" );
145
        },
146
        "Pending": function() {
147
          window.opener.document.location="_new_version.asp?OLDpv_id=" + oldPvid + "&rtag_id=" + rtagId + "&pv_id=" + newPvid + '&iMode=pending';
148
          self.close();
149
          $( this ).dialog( "close" );
150
        },
151
        Cancel: function() {
152
          $( this ).dialog( "close" );
153
        }
154
      },
155
      open: function() {
156
          $(this).siblings('.ui-dialog-buttonpane').find('button:eq(2)').focus(); 
157
      }
158
    });
159
 
160
    return false;
161
}
5190 dpurdie 162
 
163
//  This function is invoked when the user clicks within a row
164
//  The click will re-load and reposition the verion history to the selected version
165
//  The problem is that the 'Destroy Version' intercats with this.
166
//  Solution: The DestroyVersin is an image within an anchor. 
167
//            If the anchor has a class of nogo, then don't navigate
168
function selectVersion(href,event)
169
{
170
    if (! $(event.target).closest('a').hasClass('nogo')) {
171
        location.href = href;
172
    }
173
}
174
 
5173 dpurdie 175
//# sourceURL=_version_browser_1.asp	
176
</script>
177
 
119 ghuddy 178
	  <!--------------- ACTION BUTTONS -------------------------->
5904 dpurdie 179
      <div  style="width:100vw;">
119 ghuddy 180
	  <form name="filter" method="get" action="<%=scriptName%>">
181
	  <table width="100%" border="0" cellspacing="0" cellpadding="0">
182
        <tr>
183
          <td width="1" valign="middle" background="images/bg_action_norm.gif"><img src="images/spacer.gif" width="5" height="35"></td>
184
          <td width="100%" valign="middle" background="images/bg_action_norm.gif"><%
5082 dpurdie 185
          Dim bEnableUse : bEnableUse = FALSE
119 ghuddy 186
		  If Request("rtag_id") = ""  OR  _
187
		  	 Request("pv_id") = "" OR _
5173 dpurdie 188
             parOLDpv_id = ParPv_id OR _
119 ghuddy 189
			 bIsPatch OR _
5082 dpurdie 190
             (NOT bCanInsertPkg) OR _
119 ghuddy 191
			 (NOT objAccessControl.UserLogedIn) OR _
5178 dpurdie 192
             (NOT releaseIsWritable(ReleaseMode))  _
119 ghuddy 193
		  Then
5082 dpurdie 194
                bEnableUse = FALSE
119 ghuddy 195
		  Else
5082 dpurdie 196
                bEnableUse = TRUE
119 ghuddy 197
		  End If
5082 dpurdie 198
 
199
          If bEnableUse Then
5173 dpurdie 200
          %>
201
          <div id='dialog-confirm' title="Confirm version change" style="display:none">
202
          <p>Replace the current version of package <%=sPkg_Name%> with Version <%=sPkg_Version%>.
203
          <p>The new version may be added directly into the release or the change may be made pending. 
204
          </div>
205
          <%
206
            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>"
5082 dpurdie 207
          Else
208
		    Response.write "<img src='images/abtn_use_this_version_off.gif' width='108' height='26' hspace='1' border='0'>"
209
          End If
119 ghuddy 210
 
211
		  Response.write "<img src='images/spacer.gif' width='25' height='25'>"
212
		  If filterInUse Then
213
		  	Response.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!)'>"
214
		  Else
215
		    Response.write "<input type='image' name='btn' src='images/abtn_filter.gif' width='25' height='25' border='0' alt='Apply filter'>"
216
		  End If
217
		  Response.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>"
4703 dpurdie 218
 
219
		  Response.write "<img src='images/spacer.gif' width='25' height='25'>"
220
          Response.write "<a href='"& scriptName &"?"& Persists_Query_String( "hideRipple=" & not hideRipple ) &"'>"
221
    		  If hideRipple Then
222
    		  	Response.write "<img src='images/RippleSquareOff.gif' width='25' height='25' border='0' title='Rippled Versions Hidden. Toggle'>"
223
    		  Else
224
    		    Response.write "<img src='images/RippleSquare.gif' width='25' height='25' border='0' title='Rippled Versions Shown. Toggle'>"
225
    		  End If
226
          Response.write "</a>"
227
 
119 ghuddy 228
		  %></td>
229
		  <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>
230
		  <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>
231
        </tr>
232
      </table>
233
	  <!--------------------- CAPTION ---------------------------->
234
	  <table width="100%" border="0" cellspacing="0" cellpadding="0">
235
	    <tr>
236
	      <td class="lbox_ttl_b" background="images/bg_action_dark.gif" align="center"><%=sPkg_Name%></td>
237
		</tr>
238
      </table>
239
	  <!------------------ VERSION LIST -------------------------->
240
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
241
        <tr>
242
          <td background="images/bg_action_norm.gif"> 
5904 dpurdie 243
            <div id="LayerVersions" style="height: 350px; width:100vw; overflow: auto;" name="LayerVersions"> 
119 ghuddy 244
              <table width="100%" border="0" cellspacing="1" cellpadding="2">
245
                <tr>
246
                  <td width="1" nowrap background="images/bg_action_dark.gif"><img src="images/spacer.gif" width="15" height="10"></td>
247
                  <td width="1" nowrap background="images/bg_action_dark.gif">&nbsp;</td>
248
                  <td width="1" valign="top" nowrap background="images/bg_action_dark.gif" class="form_field">Version&nbsp;&nbsp;<br><input name="FLpkg_version" type="text" class="form_ifilter" value="<%=parFLpkg_version%>" size="15"></td>
249
                  <td width="1" valign="top" nowrap background="images/bg_action_dark.gif" class="form_field">Last Mod. Date&nbsp;&nbsp;</td>
250
                  <td width="100%" valign="top" nowrap background="images/bg_action_dark.gif" class="form_field">Reason for this version</td>
251
				  <td width="1" valign="top" nowrap background="images/bg_action_dark.gif" class="form_field">Last Modified&nbsp;&nbsp;<br><input name="FLuser_name" type="text" class="form_ifilter" value="<%=parFLuser_name%>" size="15"></td>
252
                  <td width="1" nowrap background="images/bg_action_dark.gif"></td>
253
				  <td width="1" nowrap background="images/bg_action_dark.gif"></td>
254
                </tr>
255
				<%
256
				Dim aVersions, lastRow, i, objSortHelper
257
 
258
 
259
				Set rsVB = OraDatabase.DbCreateDynaset( Get_All_Versions ( parPkg_id ), cint(0))
260
 
261
 
262
 
263
 
264
			  	' Descending order
265
				If rsVB.RecordCount > 0 Then
266
				aVersions = rsVB.GetRows()
267
				lastRow = UBound( aVersions, 2 )
268
 
269
				Set objSortHelper = New SortHelper
270
 
271
 
272
				' Sort versions
273
				Call objSortHelper.VersionSort( aVersions, 0, lastRow, rsVB.FieldIndex("pkg_version") )
274
 
5902 dpurdie 275
				CanDestroyProjectPackage = canShowControlInProject ( "DestroyPackage" )
119 ghuddy 276
 
277
			  	' Descending order
278
				For i = lastRow To 0 Step -1
4703 dpurdie 279
 
119 ghuddy 280
				%>
281
				<%	' Highlight row case
282
					rowColor = IMGBG_ROW
283
					imgPointer = ""
284
					If CStr( aVersions( rsVB.FieldIndex("pv_id"), i ) ) = parPv_id Then 
285
						rowColor = IMGBG_ROW_HI
286
						imgPointer = IMG_PONTER
287
					End If
288
 
289
					' Official/Unofficial case
290
					imgLock = IMG_NOT_OFFICIAL
291
					'fieldRelease_Date = ""
292
					'fieldReleased_By = ""
5902 dpurdie 293
					If (aVersions( rsVB.FieldIndex("dlocked"), i ) = "Y")  Then
119 ghuddy 294
						imgLock = IMG_OFFICIAL
5902 dpurdie 295
                    ElseIf (aVersions( rsVB.FieldIndex("dlocked"), i ) = "A") Then 
296
						imgLock = IMG_PENDING
119 ghuddy 297
					End If
298
 
5632 dpurdie 299
					fieldRelease_Date = DisplayShortDateTime ( aVersions( rsVB.FieldIndex("modified_stamp"), i ) )
119 ghuddy 300
					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 ) &" &lt;"& aVersions( rsVB.FieldIndex("user_email"), i ) &"&gt;'>"& aVersions( rsVB.FieldIndex("user_name"), i ) &"</a>"
301
 
302
					' Full Release Notes availability
303
					fieldDownloadFullReleaseNotes = ""
304
					If NOT IsNull( aVersions( rsVB.FieldIndex("release_notes_info"), i ) ) OR ( InStr( aVersions( rsVB.FieldIndex("release_notes_info"), i ), "MGS:") < 1)  Then
177 brianf 305
						fieldDownloadFullReleaseNotes = "<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>"
119 ghuddy 306
					End If
307
 
308
					anchorName = "ANC_"& aVersions( rsVB.FieldIndex("pv_id"), i )
309
					If aVersions( rsVB.FieldIndex("is_patch"), i ) = "Y" Then
310
						URLstring = "_wform_versions_history_release_notes.asp?"& Persists_Query_String( "pv_id="& aVersions( rsVB.FieldIndex("pv_id"), i ) ) &"#"& anchorName
311
					Else
312
						URLstring = scriptName &"?"& Persists_Query_String( "pv_id="& aVersions( rsVB.FieldIndex("pv_id"), i ) ) &"#"& anchorName
313
					End If
314
 
5759 dpurdie 315
                    ' User can try to delete package iff
316
                    '   Have suffiecient access (unusual)
317
                    '   They created it or own it
5902 dpurdie 318
                    '   The version is not in use by any release (allow to be in pending or WIP)
5759 dpurdie 319
                    '   [Not at the moment] The package was created less than xxxx days ago
5902 dpurdie 320
                    '   Is not locked or [Not at the moment] Approved for Autobuild
321
                    CanDestroyPackage = CanDestroyProjectPackage
322
                    If NOT CanDestroyPackage Then
323
                        If (objAccessControl.UserId = aVersions( rsVB.FieldIndex("CREATOR_ID"), i )) OR (objAccessControl.UserId = aVersions( rsVB.FieldIndex("OWNER_ID"), i ))Then
5759 dpurdie 324
                            If aVersions( rsVB.FieldIndex("inuse"), i ) = 0 Then
325
                                'If aVersions( rsVB.FieldIndex("age") , i ) < 1000 Then
326
                                    If aVersions( rsVB.FieldIndex("dlocked"), i ) <> "Y" Then
5902 dpurdie 327
                                        'If aVersions( rsVB.FieldIndex("dlocked"), i ) <> "A" Then
5759 dpurdie 328
                                            CanDestroyPackage = true
5902 dpurdie 329
                                        'End If
5759 dpurdie 330
                                    End If
331
                                'End If
332
                            End If
333
                        End If
334
                    End If
119 ghuddy 335
 
336
					' Set destroy package action
337
					If CanDestroyPackage Then
5190 dpurdie 338
						DestroyPackage = "<a class='nogo' href='javascript:;'"&_
119 ghuddy 339
										 " title='Destroy this package from the database.' "&_
5190 dpurdie 340
										 " 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 &"'});"" >" &_
341
                                         " <img src='icons/i_destroy_package_sml.gif' width='15' height='15' border='0' ><a>"
5759 dpurdie 342
                    Else
343
                        DestroyPackage = ""
119 ghuddy 344
					End If
345
				%>
5190 dpurdie 346
                <tr <%=Set_Row_Style ( URLstring, CStr( aVersions( rsVB.FieldIndex("pv_id"), i ) ) )%>> 
119 ghuddy 347
                  <td align="right" background="images/bg_action_dark.gif"><%=imgPointer%></td>
348
                  <td align="center" valign="top" <%=rowColor%>><%=imgLock%></td>
349
                  <td valign="top" nowrap <%=rowColor%>><a name="<%=anchorName%>"></a><a href="<%=URLstring%>" class="txt_linked"><%=aVersions( rsVB.FieldIndex("pkg_version"), i )%></a></td>
350
                  <td valign="top" nowrap <%=rowColor%> class="form_item"><%=fieldRelease_Date%></td>
351
                  <td valign="top" <%=rowColor%> class="form_item"><%=NewLine_To_BR ( To_HTML( aVersions( rsVB.FieldIndex("comments"), i ) ) )%></td>
352
                  <td valign="top" nowrap <%=rowColor%> class="form_item"><%=fieldReleased_By%></td>
353
                  <td align="center" valign="top" <%=rowColor%>><%=fieldDownloadFullReleaseNotes%></td>
5190 dpurdie 354
				  <td align="center" valign="top" class="nogo" <%=rowColor%>><%=DestroyPackage%></td>
119 ghuddy 355
                </tr>
356
				<%
357
				Next
358
				End If
359
				%>
360
              </table>
361
            </div></td>
362
        </tr>
363
      </table> 
364
	  <input type="hidden" name="rtag_id" value="<%=parRtag_id%>">
365
	  <input type="hidden" name="pkg_id" value="<%=parPkg_id%>">
366
	  <input type="hidden" name="rfile" value="<%=parRfile%>">
367
	  <input type="hidden" name="OLDpv_id" value="<%=parOLDpv_id%>">
1268 iaugusti 368
	  <input type="hidden" name="pv_id" value="<%=parPv_id%>">
119 ghuddy 369
	  <input type="hidden" name="filter_reset" value="">
370
	  </form>
5904 dpurdie 371
      </div>
119 ghuddy 372
 
373
 
5173 dpurdie 374