Subversion Repositories DevTools

Rev

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

<%@LANGUAGE="VBSCRIPT"%>
<%
'=====================================================
'   View the snapshots associated with a Release
'   form_view_snapshots.asp
'=====================================================
%>
<%
Option explicit
' Good idea to set when using redirect
Response.Expires = 0   ' always load the page, dont store
%>
<!--#include file="common/conf.asp"-->
<!--#include file="common/globals.asp"-->
<!--#include file="common/formating.asp"-->
<!--#include file="common/qstr.asp"-->
<!--#include file="common/common_subs.asp"-->
<!--#include file="common/_form_window_common.asp"-->
<!--#include file="_action_buttons.asp"-->

<!--#include file="class/classActionButtonControl.asp"-->
<%
'------------ ACCESS CONTROL ------------------
%>
<!--#include file="_access_control_login_optional.asp"-->
<!--#include file="_access_control_general.asp"-->
<%
'------------ Variable Definition -------------
Dim parRtagId
Dim modifyState
Dim bReleaseSyncEnabled
Dim bCanDestroy

'------------ Constants Declaration -----------
'------------ Variable Init -------------------
parRtagId = Request("rtag_id")
objPMod.PersistInQryString("rtag_id")
ReleaseMode = GetReleaseMode( Request("rtag_id") )
bReleaseSyncEnabled = (releaseInfoHash("S3MANIFEST") = "Y")
bCanDestroy = canActionControlInProject("DestroyRelease")

Sub ShowSidePanel
End Sub
'----------------------------------------------
Sub ShowMainPanel
 %>
    <table class="embedded_table" style="margin-bottom:10px; width:70%">
      <tr>
         <td>
            <span nowrap class="form_ttl">View Release Snapshots</span>
            <!-- Section Top Border ---->
            <div class="rounded_box" style="background: white;">
                <!-- Section Body Header ---->
                <!-- Main Pane -->
                <table id="snapshotTable" width="100%" class="stripe">
                    <thead class="body_col">
                        <tr>
                          <th class=tleft>Opr
                          <th class=tleft>PV_ID
                          <th class=tleft>Release Name
                          <th class=tleft>Created
                          <th class=tleft>Comments
                          <th class=tleft>Gen Manifest
                          <th class=tleft>Done
                          <th class=tleft>Name
                        </tr>
                    </thead>
                    <tbody>
                    </tbody>
                </table>
                <!-- Info / Ajax Progress bar -->
                <div class='bg_dialog body_txt' style='position:relative;min-height:14px;' >
                    <div style='position: absolute;'><span id='ds_info'></span>
<%If not bReleaseSyncEnabled Then%>
                    <span class='err_alert'>This Release does not have S3 Manifest Generation Enabled</span>
<%End If%>
                    </div>
                </div>
            </div>
            </td>
        </tr>
    </table>
    <div >
      <ul id="select-menu" style="display:none;">
       <li data-opr="open" title="Goto this Snapshot">Open ...</li>
        <li data-opr="edit" title="Edit the properties of the Snapshot">Edit Properties</li>
        <li>-</li>
        <li data-opr="diffRelease" title="Compare or Merge with parent Release">Merge/Diff with Release</li>
        <li data-opr="diffSelect" title="Select as the source (left side) of a comparison">Select for Diff</li>
        <li id="select-menu-diff" data-opr="diff" title="Compare from selected snapshot to this snapshot">Diff from selected</li>
        <li>-</li>
        <li id="select-menu-destroy" data-opr="delete", title="Delete the selected Snapshot">Destroy Snapshot</li>
        <li>-</li>
        <li>Close Menu</li>
      </ul>
    </div>
<%
End Sub
'----------------------------------------------
%>
<html>
   <head>
        <title>Release Manager</title>
        <link rel="shortcut icon" href="<%=FavIcon%>"/>
        <meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
        <link rel="stylesheet" href="images/release_manager_style.css?ver=<%=VixVerNum%>" type="text/css">
        <link rel="stylesheet" href="images/navigation.css?ver=<%=VixVerNum%>" type="text/css">
        <script language="JavaScript" src="images/common.js?ver=<%=VixVerNum%>"></script>
        <%bJqueryDataTables = TRUE%>
        <!--#include file="_jquery_includes.asp"-->
        <!-- TIPS -->
        <script language="JavaScript" src="images/tipster.js?ver=<%=VixVerNum%>"></script>
        <script language="JavaScript" src="images/_help_tips.js?ver=<%=VixVerNum%>"></script>
        <script language="JavaScript" type="text/javascript">
        </script>
        <!-- Dropdown action menu scripts -->
        <style>
            .ui-menu { position: absolute; text-align: left }
        </style>
        <script type="text/javascript" charset="utf-8">
        var table;
        $(document).ready(function() {
            /* Init DataTables */
            table = $("#snapshotTable").DataTable({
            processing: true,
            deferRender: true,
            dom: "frtiS",
            sScrollY: $( document ).height() - 45 - 200 - 15,
            scrollCollapse: true,
            retrieve:true,
            serverSide: true,
            ajax : {
                url : "view_snapshots_json.asp",
                data : function (o){
                    o.rtag_id = <%=parRtagId%>;
                },
                dataSrc : function (json){
                    //  Process the raw Ajax data
                    //      Create a checkbox for the state
                    //      Add a data item to the entry - to allow traceback when saving
                    $.each(json.data, function(idx,row){
                        var checked = row[4] == "Y" ? 'checked' : '';
                        row[4] = '<input style="height:11px; margin:1px" type="checkbox" '+ checked + ' disabled>';

                        checked = row[5] == "Y" ? 'checked' : '';
                        row[5] = '<input style="height:11px; margin:1px" type="checkbox" '+ checked + ' disabled>';

                        row[1] = '<a href=dependencies.asp?rtag_id='+row[0]+'>'+row[1]+'</a>'

                        row[6] = '';
                        if ( checked != '' ) {
                            row[6] = 'manifest_<%=parRtagId%>_'+row[0]+'.json' + "&nbsp<%=enum_imgClipBoard10%>"
                        }

                        row.unshift("<span title='Select operation from dropdown menu' " +
                                    "class='select-operation ui-icon ui-icon-triangle-1-s' " +
                                    "data-rtag-id='" + row[0] +
                                    "' style='display:inline-block'>" +
                                    "</span>" );
                        
                    });
                    return json.data;
                }
            },
            ordering: true,
            order: [[ 2, "desc" ]],
            lengthChange : false,

            scroller : {
                loadingIndicator : true,
                displayBuffer: 9,
            },
            columns: [
               { width: "1%", className: "dt-nowrap",orderable: false },
               { visible : false },
               { width: "10%", className: "dt-nowrap"  },
               { width: "10%", className: "dt-nowrap"  },
               { width: "70%",orderable: false },
               { width: "1%", className: "dt-nowrap" ,orderable: false },
               { width: "1%", className: "dt-nowrap" ,orderable: false },
               { width: "1%", className: "dt-nowrap clipThis" ,orderable: false },
               //{ width: "10%",className: "dt-nowrap" },
           ]
        });

    // Create and Hide the Menu
    $( "#select-menu" ).hide().menu();

    // Register menuselect event handler
    $( "#select-menu" ).on( "menuselect", function( event, ui ) {
       var opr = ui.item.data('opr');

        // Invoke operation within the menu data structure
        if (typeof $.miniMenu[opr] == 'function' ) {
          $.miniMenu['event'] = event;
          $.miniMenu[opr]($.miniMenu);
          return;
        }
        console.log ("Menu Operation:", opr, "Not found");
    });

    $.miniMenu = {
        //  Data

        //  Menu operations
        open : function (data) {
            //console.log("Opening:", data.rtagid);
            this.gotoUrl("dependencies.asp", {rtag_id : data.rtagid});
         },

         edit : function (data) {
             //console.log("Editing:", data.rtagid);
             this.gotoUrl("form_edit_release.asp", {rtag_id : data.rtagid, rfile : "<%=ScriptName%>"});
         },

         diffSelect : function (data) {
             //console.log("Merge from:", data.rtagid );
             $('#snapshotTable .body_row_sel2').removeClass('body_row_sel2');
             if (data.mergeLeft != data.rtagid) {
                 data.mergeLeft = data.rtagid;
                 $.miniMenu.currentRow.removeClass('body_row_sel');
                 $.miniMenu.currentRow.addClass('body_row_sel2');
             } else {
                 delete(data.mergeLeft);
             }
         },

         diffRelease : function (data) {
             //console.log ("diffRelease", data.mergeLeft, data.rtagid);
             this.gotoUrl("diff.asp", { rtagA : data.rtagid, rtagB : <%=parRtagId%>});
         },


         diff : function (data) {
             //console.log ("Merge:Diff", data.mergeLeft, data.rtagid);
             this.gotoUrl("diff.asp", { rtagA : data.mergeLeft, rtagB : data.rtagid});
         },

<%If objAccessControl.UserLogedIn Then%>
         delete : function (data) {
             //console.log("Delete:", data.rtagid);
             $.miniMenu.currentRow.addClass('body_row_sel_outline');
             var that = this;
             vixConfirm("This Snapshot will be permanently destroyed.<p>Are you sure?", { 
                deferred : true, 
                title: 'Destroy Snapshot', 
                button : 'Destroy Snapshot',
                icon : 'images/i_critical.gif' }
             ).done(function(){
                 that.gotoUrl("_destroy_release.asp", {rtag_id_list : data.rtagid, proj_id : <%=DB_PROJ_ID%>, parentRtag : <%=DB_RTAG_ID%> ,rfile : "<%=ScriptName%>"});
             }).fail(function(){
                 $('#snapshotTable .body_row_sel_outline').removeClass('body_row_sel_outline');
             });
         },
<%End If%>

         //
         // Internal functions
         // Goto url, or open in new tab
         gotoUrl: function (url, params)
         {
             // Open in new tab - not as simple as it sounds
             // Need to create a form and submit it
             if(this.event.shiftKey){
                 var form = $('<form>',{
                     action : url,
                     target : '_blank',
                     //method : 'GET'
                     });

                 $.each(params,function(n,v){
                     var item = $('<input>',{
                         name : n,
                         value : v
                     });
                     form.append(item);
                    });


                 form.appendTo(document.body);
                 form.submit();
                 form.remove();
             }
             else {
                 if (params)
                     url += '?' + jQuery.param(params)
                 window.location.href = url;
             }
         },
};

    // Add menu to all require instances
$( '#snapshotTable' ).on ('click', '.select-operation', function(event) {
     // When clicked - create and show the menu
     // Insert rtag-id

    // In order to have the menu positioing work correctly
    //   Create a div that covers the visible screen area
    //   Us it within the menu poistioning
    //   Then delete it again
    var positionDiv = $( "<div></div>" ).css({
            position: 'absolute',
            top : $(document).scrollTop(),
            left : $(document).scrollLeft(),
            width: '100vw',
            height: '100vh',
            'z-index' : -1,
        });
    positionDiv.appendTo(document.body);

     //  Create the menu
     var menu = $("#select-menu").show().position({
          my: "left top",
          at: "center bottom",
          of: this,
          within : positionDiv,
     }).zIndex(10);

     // Cleanup the poistioning div
     positionDiv.remove();

     // Setup global data
     $.miniMenu.rtagid = $(this).data('rtag-id');

     // Set initial menu state - merge target
     $('#select-menu-diff').toggleClass('ui-state-disabled',!('mergeLeft' in $.miniMenu ));

    // Set initial state destroy
    var canDestroy = <%=iif(bCanDestroy,"1","0")%>
    $('#select-menu-destroy').toggleClass('ui-state-disabled',(canDestroy == 0));

    // Highlight the row selected
    $('#snapshotTable .body_row_sel').removeClass('body_row_sel');
    $.miniMenu.currentRow = $(event.target).closest('tr').addClass('body_row_sel');

    // Allow click outside of the menu to close it
    $( document ).one( "click", function() {
        menu.hide();
    });


        // Prevent propagation of event
    return false;
    });

});

//  getAjaxData - with error processing
//      url - url to fetch
//      data    - additional data to pass to ajax request
//      success - function to call on success
//      always -  function to call at completion
function getAjaxData( url, data, success, always )
{
    clearInfo();
    $("#progressSpinner").css('visibility', 'visible');
    $(document.body).css({ 'cursor': 'progress' })
    $.ajax(
    {
        url : url,
        type: "POST",
        data : data,
        dataType : "json",
        cache: false,
        success:function(data, textStatus, jqXHR) {
            //data: return data from server
            //console.log ("UpdateData", data);
            if (data.result != 0) {
                setInfo("Error:" + ((data.error != 0) ? data.emsgSummary : "Reason not given"));
                return;
            }
            //  call user success function
            if (jQuery.isFunction(success)) {
                success(data);
            }
        },
        error: function(jqXHR, textStatus, errorThrown) {
            setInfo("Error:" + errorThrown);
            //if fails
        },
        complete : function() {
            $("#progressSpinner").css('visibility', 'hidden');
            $(document.body).css({ 'cursor': 'auto' });
            //  call user always function
            if (jQuery.isFunction(always)) {
                always();
            }
        }
    });

function setInfo(txt) {
    $("#ds_info").text( txt);
}

function clearInfo(txt) {
    $("#ds_info").text(" ");
}

}
</script>
      <!-- DROPDOWN MENUS -->
      <!--#include file="_menu_def.asp"-->
      <script language="JavaScript1.2" src="images/popup_menu.js?ver=<%=VixVerNum%>"></script>
   </head>
   <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0">
      <!-- HEADER -->
      <!--#include file="_header.asp"-->
      <!-- BODY ---->
      <table class="full_table">
         <tr>
            <td class="bg_panel" valign="top" style="min-width:146px">
                <%Call ShowSidePanel%>
            </td>
            <td width="100%" rowspan="2" align="center" valign="top" bgcolor="#EEEFEF">
                <%Call ShowMainPanel%>
            </td>
         </tr>
         <tr>
            <td class="bg_panel_btm" height="350"></td>
         </tr>
      </table>
      <!-- FOOTER -->
      <!--#include file="_footer.asp"-->
   </body>
</html>