Subversion Repositories DevTools

Rev

Blame | Last modification | View Log | RSS feed

<%@LANGUAGE="VBSCRIPT"%>
<%
'=====================================================
'|  sdk_details.asp
'|  Edit an SDK Version
'|
'=====================================================
%>
<%
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"-->
<%
'------------ ACCESS CONTROL ------------------
%>
<!--#include file="_access_control_general.asp"-->
<%
'------------ Variable Definition -------------
Dim parSdkTag_id

'------------ Constants Declaration -----------
'------------ Variable Init -------------------
parSdkTag_id = Request("sdktag_id")
if parSdkTag_id = "" Then parSdkTag_id = 0
%>
<script language="JavaScript" type="text/javascript">
//# sourceURL=sdk_details.asp
function setInfo(txt) {
$("#info").text( txt);
}

//  Configure the Summary Table
$('#sdk_content').DataTable({
    deferRender: true,
    dom: "frtiS",
    sScrollY: $( document ).height() - 255,
    scrollCollapse: true,
    processing: true,
    retrieve:true,
    serverSide: true,
    ajaxSource: "sdk_content_json.asp",
    "fnServerParams": function ( aoData ) {
        aoData.push( { "name": "sdktag_id", "value": <%=parSdkTag_id%> } );
    },
    "ordering": true,
    "order": [[ 1, "asc" ]],

     "columns": [
        { "data": "PV_ID" },
        { "data": "PKG_NAME" },
        { "data": "PKG_VERSION" },
        { "data": "SDKPKG_CHECK" },
    ],

    //"columnDefs" : [ 
    //    {"visible" : false, "targets" : [0]},
    //    ],

    });

//  Process each row of table data before it is presented to the table scroller
//  Process the raw Ajax data
//      Create a checkbox for the state
//      Add a data item to the entry - to allow traceback when saving
$('#sdk_content')
    .on('xhr.dt', function ( e, settings, json ) {
        json.aaData.forEach(function(row){
            var checked = row.SDKPKG_STATE == "E" ? 'checked' : '';
            row.SDKPKG_CHECK = '<input type="checkbox" class=clickable '+ checked +' data-pvid='+ row.PV_ID +'>';
        });
    } );

// Process click on checkboxes within the datatable
//      this - a DOM node
//      $(this) - The jquery wrapped node
//
$('#sdk_content').on( 'click', 'tbody td :checkbox', function () {
setInfo("checked:" +  this.checked + ", pvid:" + $(this).data('pvid'));

var table = $('#sdk_content').DataTable();
var row = $(this).closest('tr');
var d = table.row( row ).data();


        $("#progressBar").css('visibility', 'visible');
        $.ajax(
        {
            url : 'sdk_opr_json.asp',
            type: "POST",
            data : { action : 'setSdkContentState', sdktagId : <%=parSdkTag_id%>, pv_id : $(this).data('pvid'), sdkpkg_state : this.checked ? 'E' : '-' },
            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"));
                    //if (data.error >= 0) disableForm();
                    return;
                }
                //  call user success function
                //success(data);
            },
            error: function(jqXHR, textStatus, errorThrown)
            {
                setInfo("Error:" + errorThrown);
                //disableForm();
                //if fails
            },
            complete : function()
            {
                $("#progressBar").css('visibility', 'hidden');
            }
        });
    } );
    </script>
<table id=main_section class="full_table">
  <!-- Section Header ---->
  <tr>
     <td nowrap class="form_ttl">DON'T KNOW YET</td>
  </tr>

  <!-- Section Body ---->
  <tr>
  <td>
    <div class="rounded_box">
      <table id=sdk_content class="full_table" >
          <thead>
          <tr class="body_col form_align">
            <th width="1%"> PV_ID
            <th width="10%"> Package Name
            <th> Package Version
            <th width="1%"> State
          </thead>
      </table>

      <!-- Info / Ajax Progress bar -->
      <div class='bg_dialog body_txt' style='position:relative;min-height:1em;' >
          <img id='progressBar' style='visibility:hidden;position: absolute' src='icons/i_processing.gif' width='79' height='14'>
          <div id=info  style='position: absolute;'></div>
      </div>

    </div>
</table>