Subversion Repositories DevTools

Rev

Rev 7536 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
7536 dpurdie 1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
3
'=====================================================
4
'   View the snapshots associated with a Release
5
'   form_view_snapshots.asp
6
'=====================================================
7
%>
8
<%
9
Option explicit
10
' Good idea to set when using redirect
11
Response.Expires = 0   ' always load the page, dont store
12
%>
13
<!--#include file="common/conf.asp"-->
14
<!--#include file="common/globals.asp"-->
15
<!--#include file="common/formating.asp"-->
16
<!--#include file="common/qstr.asp"-->
17
<!--#include file="common/common_subs.asp"-->
18
<!--#include file="common/_form_window_common.asp"-->
19
<!--#include file="_action_buttons.asp"-->
20
 
21
<!--#include file="class/classActionButtonControl.asp"-->
22
<%
23
'------------ ACCESS CONTROL ------------------
24
%>
25
<!--#include file="_access_control_login_optional.asp"-->
26
<!--#include file="_access_control_general.asp"-->
27
<%
28
'------------ Variable Definition -------------
29
Dim parRtagId
30
Dim modifyState
31
Dim bReleaseSyncEnabled
7573 dpurdie 32
Dim bCanDestroy
7536 dpurdie 33
 
34
'------------ Constants Declaration -----------
35
'------------ Variable Init -------------------
36
parRtagId = Request("rtag_id")
37
objPMod.PersistInQryString("rtag_id")
38
ReleaseMode = GetReleaseMode( Request("rtag_id") )
39
bReleaseSyncEnabled = (releaseInfoHash("S3MANIFEST") = "Y")
7573 dpurdie 40
bCanDestroy = canActionControlInProject("DestroyRelease")
7536 dpurdie 41
 
42
Sub ShowSidePanel
43
End Sub
44
'----------------------------------------------
45
Sub ShowMainPanel
46
 %>
47
    <table class="embedded_table" style="margin-bottom:10px; width:70%">
48
      <tr>
49
         <td>
50
            <span nowrap class="form_ttl">View Release Snapshots</span>
51
            <!-- Section Top Border ---->
52
            <div class="rounded_box" style="background: white;">
53
                <!-- Section Body Header ---->
54
                <!-- Main Pane -->
55
                <table id="snapshotTable" width="100%" class="stripe">
56
                    <thead class="body_col">
57
                        <tr>
7573 dpurdie 58
                          <th class=tleft>Opr
7536 dpurdie 59
                          <th class=tleft>PV_ID
60
                          <th class=tleft>Release Name
61
                          <th class=tleft>Created
62
                          <th class=tleft>Comments
63
                          <th class=tleft>Gen Manifest
64
                          <th class=tleft>Done
65
                          <th class=tleft>Name
66
                        </tr>
67
                    </thead>
68
                    <tbody>
69
                    </tbody>
70
                </table>
71
                <!-- Info / Ajax Progress bar -->
72
                <div class='bg_dialog body_txt' style='position:relative;min-height:14px;' >
73
                    <div style='position: absolute;'><span id='ds_info'></span>
74
<%If not bReleaseSyncEnabled Then%>
75
                    <span class='err_alert'>This Release does not have S3 Manifest Generation Enabled</span>
76
<%End If%>
77
                    </div>
78
                </div>
79
            </div>
80
            </td>
81
        </tr>
82
    </table>
7573 dpurdie 83
    <div >
84
      <ul id="select-menu" style="display:none;">
85
       <li data-opr="open" title="Goto this Snapshot">Open ...</li>
86
        <li data-opr="edit" title="Edit the properties of the Snapshot">Edit Properties</li>
87
        <li>-</li>
88
        <li data-opr="diffRelease" title="Compare or Merge with parent Release">Merge/Diff with Release</li>
89
        <li data-opr="diffSelect" title="Select as the source (left side) of a comparison">Select for Diff</li>
90
        <li id="select-menu-diff" data-opr="diff" title="Compare from selected snapshot to this snapshot">Diff from selected</li>
91
        <li>-</li>
92
        <li id="select-menu-destroy" data-opr="delete", title="Delete the selected Snapshot">Destroy Snapshot</li>
93
        <li>-</li>
94
        <li>Close Menu</li>
95
      </ul>
96
    </div>
7536 dpurdie 97
<%
98
End Sub
99
'----------------------------------------------
100
%>
101
<html>
102
   <head>
103
        <title>Release Manager</title>
104
        <link rel="shortcut icon" href="<%=FavIcon%>"/>
105
        <meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
106
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
107
        <link rel="stylesheet" href="images/release_manager_style.css?ver=<%=VixVerNum%>" type="text/css">
108
        <link rel="stylesheet" href="images/navigation.css?ver=<%=VixVerNum%>" type="text/css">
109
        <script language="JavaScript" src="images/common.js?ver=<%=VixVerNum%>"></script>
110
        <%bJqueryDataTables = TRUE%>
111
        <!--#include file="_jquery_includes.asp"-->
112
        <!-- TIPS -->
113
        <script language="JavaScript" src="images/tipster.js?ver=<%=VixVerNum%>"></script>
114
        <script language="JavaScript" src="images/_help_tips.js?ver=<%=VixVerNum%>"></script>
115
        <script language="JavaScript" type="text/javascript">
116
        </script>
7573 dpurdie 117
        <!-- Dropdown action menu scripts -->
118
        <style>
119
            .ui-menu { position: absolute; text-align: left }
120
        </style>
7536 dpurdie 121
        <script type="text/javascript" charset="utf-8">
122
        var table;
123
        $(document).ready(function() {
124
            /* Init DataTables */
125
            table = $("#snapshotTable").DataTable({
126
            processing: true,
127
            deferRender: true,
128
            dom: "frtiS",
129
            sScrollY: $( document ).height() - 45 - 200 - 15,
130
            scrollCollapse: true,
131
            retrieve:true,
132
            serverSide: true,
133
            ajax : {
134
                url : "view_snapshots_json.asp",
135
                data : function (o){
136
                    o.rtag_id = <%=parRtagId%>;
137
                },
138
                dataSrc : function (json){
139
                    //  Process the raw Ajax data
140
                    //      Create a checkbox for the state
141
                    //      Add a data item to the entry - to allow traceback when saving
142
                    $.each(json.data, function(idx,row){
143
                        var checked = row[4] == "Y" ? 'checked' : '';
144
                        row[4] = '<input style="height:11px; margin:1px" type="checkbox" '+ checked + ' disabled>';
145
 
146
                        checked = row[5] == "Y" ? 'checked' : '';
147
                        row[5] = '<input style="height:11px; margin:1px" type="checkbox" '+ checked + ' disabled>';
148
 
149
                        row[1] = '<a href=dependencies.asp?rtag_id='+row[0]+'>'+row[1]+'</a>'
150
 
151
                        row[6] = '';
152
                        if ( checked != '' ) {
153
                            row[6] = 'manifest_<%=parRtagId%>_'+row[0]+'.json' + "&nbsp<%=enum_imgClipBoard10%>"
154
                        }
7573 dpurdie 155
 
156
                        row.unshift("<span title='Select operation from dropdown menu' " +
157
                                    "class='select-operation ui-icon ui-icon-triangle-1-s' " +
158
                                    "data-rtag-id='" + row[0] +
159
                                    "' style='display:inline-block'>" +
160
                                    "</span>" );
7536 dpurdie 161
 
162
                    });
163
                    return json.data;
164
                }
165
            },
166
            ordering: true,
167
            order: [[ 2, "desc" ]],
168
            lengthChange : false,
169
 
170
            scroller : {
171
                loadingIndicator : true,
172
                displayBuffer: 9,
173
            },
174
            columns: [
7573 dpurdie 175
               { width: "1%", className: "dt-nowrap",orderable: false },
7536 dpurdie 176
               { visible : false },
177
               { width: "10%", className: "dt-nowrap"  },
178
               { width: "10%", className: "dt-nowrap"  },
179
               { width: "70%",orderable: false },
180
               { width: "1%", className: "dt-nowrap" ,orderable: false },
181
               { width: "1%", className: "dt-nowrap" ,orderable: false },
182
               { width: "1%", className: "dt-nowrap clipThis" ,orderable: false },
183
               //{ width: "10%",className: "dt-nowrap" },
184
           ]
185
        });
7573 dpurdie 186
 
187
    // Create and Hide the Menu
188
    $( "#select-menu" ).hide().menu();
189
 
190
    // Register menuselect event handler
191
    $( "#select-menu" ).on( "menuselect", function( event, ui ) {
192
       var opr = ui.item.data('opr');
193
 
194
        // Invoke operation within the menu data structure
195
        if (typeof $.miniMenu[opr] == 'function' ) {
196
          $.miniMenu['event'] = event;
197
          $.miniMenu[opr]($.miniMenu);
198
          return;
199
        }
200
        console.log ("Menu Operation:", opr, "Not found");
201
    });
202
 
203
    $.miniMenu = {
204
        //  Data
205
 
206
        //  Menu operations
207
        open : function (data) {
208
            //console.log("Opening:", data.rtagid);
209
            this.gotoUrl("dependencies.asp", {rtag_id : data.rtagid});
210
         },
211
 
212
         edit : function (data) {
213
             //console.log("Editing:", data.rtagid);
214
             this.gotoUrl("form_edit_release.asp", {rtag_id : data.rtagid, rfile : "<%=ScriptName%>"});
215
         },
216
 
217
         diffSelect : function (data) {
218
             //console.log("Merge from:", data.rtagid );
219
             $('#snapshotTable .body_row_sel2').removeClass('body_row_sel2');
220
             if (data.mergeLeft != data.rtagid) {
221
                 data.mergeLeft = data.rtagid;
222
                 $.miniMenu.currentRow.removeClass('body_row_sel');
223
                 $.miniMenu.currentRow.addClass('body_row_sel2');
224
             } else {
225
                 delete(data.mergeLeft);
226
             }
227
         },
228
 
229
         diffRelease : function (data) {
230
             //console.log ("diffRelease", data.mergeLeft, data.rtagid);
231
             this.gotoUrl("diff.asp", { rtagA : data.rtagid, rtagB : <%=parRtagId%>});
232
         },
233
 
234
 
235
         diff : function (data) {
236
             //console.log ("Merge:Diff", data.mergeLeft, data.rtagid);
237
             this.gotoUrl("diff.asp", { rtagA : data.mergeLeft, rtagB : data.rtagid});
238
         },
239
 
240
<%If objAccessControl.UserLogedIn Then%>
241
         delete : function (data) {
242
             //console.log("Delete:", data.rtagid);
243
             $.miniMenu.currentRow.addClass('body_row_sel_outline');
244
             var that = this;
245
             vixConfirm("This Snapshot will be permanently destroyed.<p>Are you sure?", { 
246
                deferred : true, 
247
                title: 'Destroy Snapshot', 
248
                button : 'Destroy Snapshot',
249
                icon : 'images/i_critical.gif' }
250
             ).done(function(){
251
                 that.gotoUrl("_destroy_release.asp", {rtag_id_list : data.rtagid, proj_id : <%=DB_PROJ_ID%>, parentRtag : <%=DB_RTAG_ID%> ,rfile : "<%=ScriptName%>"});
252
             }).fail(function(){
253
                 $('#snapshotTable .body_row_sel_outline').removeClass('body_row_sel_outline');
254
             });
255
         },
256
<%End If%>
257
 
258
         //
259
         // Internal functions
260
         // Goto url, or open in new tab
261
         gotoUrl: function (url, params)
262
         {
263
             // Open in new tab - not as simple as it sounds
264
             // Need to create a form and submit it
265
             if(this.event.shiftKey){
266
                 var form = $('<form>',{
267
                     action : url,
268
                     target : '_blank',
269
                     //method : 'GET'
270
                     });
271
 
272
                 $.each(params,function(n,v){
273
                     var item = $('<input>',{
274
                         name : n,
275
                         value : v
276
                     });
277
                     form.append(item);
278
                    });
279
 
280
 
281
                 form.appendTo(document.body);
282
                 form.submit();
283
                 form.remove();
284
             }
285
             else {
286
                 if (params)
287
                     url += '?' + jQuery.param(params)
288
                 window.location.href = url;
289
             }
290
         },
291
};
292
 
293
    // Add menu to all require instances
294
$( '#snapshotTable' ).on ('click', '.select-operation', function(event) {
295
     // When clicked - create and show the menu
296
     // Insert rtag-id
297
 
298
    // In order to have the menu positioing work correctly
299
    //   Create a div that covers the visible screen area
300
    //   Us it within the menu poistioning
301
    //   Then delete it again
302
    var positionDiv = $( "<div></div>" ).css({
303
            position: 'absolute',
304
            top : $(document).scrollTop(),
305
            left : $(document).scrollLeft(),
306
            width: '100vw',
307
            height: '100vh',
308
            'z-index' : -1,
309
        });
310
    positionDiv.appendTo(document.body);
311
 
312
     //  Create the menu
313
     var menu = $("#select-menu").show().position({
314
          my: "left top",
315
          at: "center bottom",
316
          of: this,
317
          within : positionDiv,
318
     }).zIndex(10);
319
 
320
     // Cleanup the poistioning div
321
     positionDiv.remove();
322
 
323
     // Setup global data
324
     $.miniMenu.rtagid = $(this).data('rtag-id');
325
 
326
     // Set initial menu state - merge target
327
     $('#select-menu-diff').toggleClass('ui-state-disabled',!('mergeLeft' in $.miniMenu ));
328
 
329
    // Set initial state destroy
330
    var canDestroy = <%=iif(bCanDestroy,"1","0")%>
331
    $('#select-menu-destroy').toggleClass('ui-state-disabled',(canDestroy == 0));
332
 
333
    // Highlight the row selected
334
    $('#snapshotTable .body_row_sel').removeClass('body_row_sel');
335
    $.miniMenu.currentRow = $(event.target).closest('tr').addClass('body_row_sel');
336
 
337
    // Allow click outside of the menu to close it
338
    $( document ).one( "click", function() {
339
        menu.hide();
340
    });
341
 
342
 
343
        // Prevent propagation of event
344
    return false;
345
    });
346
 
7536 dpurdie 347
});
348
 
349
//  getAjaxData - with error processing
350
//      url - url to fetch
351
//      data    - additional data to pass to ajax request
352
//      success - function to call on success
353
//      always -  function to call at completion
354
function getAjaxData( url, data, success, always )
355
{
356
    clearInfo();
357
    $("#progressSpinner").css('visibility', 'visible');
358
    $(document.body).css({ 'cursor': 'progress' })
359
    $.ajax(
360
    {
361
        url : url,
362
        type: "POST",
363
        data : data,
364
        dataType : "json",
365
        cache: false,
366
        success:function(data, textStatus, jqXHR) {
367
            //data: return data from server
368
            //console.log ("UpdateData", data);
369
            if (data.result != 0) {
370
                setInfo("Error:" + ((data.error != 0) ? data.emsgSummary : "Reason not given"));
371
                return;
372
            }
373
            //  call user success function
374
            if (jQuery.isFunction(success)) {
375
                success(data);
376
            }
377
        },
378
        error: function(jqXHR, textStatus, errorThrown) {
379
            setInfo("Error:" + errorThrown);
380
            //if fails
381
        },
382
        complete : function() {
383
            $("#progressSpinner").css('visibility', 'hidden');
384
            $(document.body).css({ 'cursor': 'auto' });
385
            //  call user always function
386
            if (jQuery.isFunction(always)) {
387
                always();
388
            }
389
        }
390
    });
391
 
392
function setInfo(txt) {
393
    $("#ds_info").text( txt);
394
}
395
 
396
function clearInfo(txt) {
397
    $("#ds_info").text(" ");
398
}
399
 
400
}
401
</script>
402
      <!-- DROPDOWN MENUS -->
403
      <!--#include file="_menu_def.asp"-->
404
      <script language="JavaScript1.2" src="images/popup_menu.js?ver=<%=VixVerNum%>"></script>
405
   </head>
406
   <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0">
407
      <!-- HEADER -->
408
      <!--#include file="_header.asp"-->
409
      <!-- BODY ---->
410
      <table class="full_table">
411
         <tr>
412
            <td class="bg_panel" valign="top" style="min-width:146px">
413
                <%Call ShowSidePanel%>
414
            </td>
415
            <td width="100%" rowspan="2" align="center" valign="top" bgcolor="#EEEFEF">
416
                <%Call ShowMainPanel%>
417
            </td>
418
         </tr>
419
         <tr>
420
            <td class="bg_panel_btm" height="350"></td>
421
         </tr>
422
      </table>
423
      <!-- FOOTER -->
424
      <!--#include file="_footer.asp"-->
425
   </body>
426
</html>