Subversion Repositories DevTools

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
5051 dpurdie 1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
3
'=====================================================
4
'|  sdk_details.asp
5
'|  Edit an SDK Version
6
'|
7
'=====================================================
8
%>
9
<%
10
Option explicit
11
' Good idea to set when using redirect
12
Response.Expires = 0   ' always load the page, dont store
13
%>
14
<!--#include file="common/conf.asp"-->
15
<!--#include file="common/globals.asp"-->
16
<!--#include file="common/formating.asp"-->
17
<!--#include file="common/qstr.asp"-->
18
<!--#include file="common/common_subs.asp"-->
19
<%
20
'------------ ACCESS CONTROL ------------------
21
%>
22
<!--#include file="_access_control_general.asp"-->
5103 dpurdie 23
<!--#include file="common/globals_sdk.asp"-->
5051 dpurdie 24
<%
25
'------------ Variable Definition -------------
5089 dpurdie 26
dim modifyState
5051 dpurdie 27
 
28
'------------ Constants Declaration -----------
29
'------------ Variable Init -------------------
5102 dpurdie 30
'------------ Before Render -------------------
5089 dpurdie 31
modifyState = "disabled"
32
If canActionControlInProject("CreateSdk") Then modifyState = ""
33
 
5051 dpurdie 34
%>
35
<script language="JavaScript" type="text/javascript">
36
//# sourceURL=sdk_details.asp
5052 dpurdie 37
 
38
//  Get getSdkVersionDetails
39
//      When this is complete we will populate the remainder of the
40
//      page.
41
var sdkDetails = {};
42
getAjaxData (
43
    "sdk_opr_json.asp",
44
    { action: "getSdkVersionDetails", sdktag_id : <%=parSdkTag_id%> },
45
    function(data){
46
        sdkDetails = data.aaData;
47
        $("#sdkd_section_head").text( sdkDetails.SDK_NAME + " : " + sdkDetails.SDKTAG_NAME);
5098 dpurdie 48
        $("#sel_state").val([sdkDetails.SDK_STATE]);
5052 dpurdie 49
        detailsAvailable();
50
    });    
51
 
5054 dpurdie 52
//  Populate the bulk of the display
53
//      Called once the sdkDetails have been delivered 
5052 dpurdie 54
function detailsAvailable()
55
{
56
    //  Initial population of the Ref SDK Names   
5053 dpurdie 57
    populateSdkNames(sdkDetails.SDK_ID);
58
    populateContent(<%=parSdkTag_id%>);    
5052 dpurdie 59
 
60
    $("#sel_sdkname").change(function(){
61
        populateSdkVersions( $("#sel_sdkname").val());
62
    });
63
 
64
    $("#chk_sdkversion").change(function(){
65
        populateSdkVersions( $("#sel_sdkname").val());
66
    });
67
 
68
    $("#sel_sdkversion").change(function(){
5054 dpurdie 69
        $('#sdk_content').dataTable().api().ajax.reload();
5052 dpurdie 70
    });
71
 
72
    //  Detect change to the packages displayed
73
    //      Redisplay on change       
74
    $("#sel_exposed").change(function(){
75
        $('#sdk_content').dataTable().api().ajax.reload();
76
    });
77
 
78
    //  Detect change to the SDK State
5055 dpurdie 79
    //      Disable all clickable elements - unless a WIP
5098 dpurdie 80
    $("#sel_state").change(function(){
5055 dpurdie 81
        sdkDetails.SDK_STATE = $(this).val();
82
        $('.clickable').attr('disabled',$(this).val() !== 'U');
83
 
5052 dpurdie 84
        getAjaxData (
85
            "sdk_opr_json.asp",
86
            { action: "setSdkState", sdktagId : <%=parSdkTag_id%>, sdk_state : $(this).val() }
87
            );
88
    });
5051 dpurdie 89
}
90
 
5052 dpurdie 91
 
5051 dpurdie 92
//  Configure the Summary Table
5053 dpurdie 93
function populateContent(sdktag_id)
5052 dpurdie 94
{
5117 dpurdie 95
    table = $('#sdk_content').DataTable({
5052 dpurdie 96
        deferRender: true,
97
        dom: "frtiS",
5054 dpurdie 98
        sScrollY: $( document ).height() - 300,
5052 dpurdie 99
        scrollCollapse: true,
100
        processing: true,
101
        retrieve:true,
102
        serverSide: true,
5054 dpurdie 103
        ajax : {
5058 dpurdie 104
            url : "sdk_details_json.asp",
5054 dpurdie 105
            data : function (o){
106
                o.sdktag_id = sdktag_id;
107
                o.sdk_statefilter = $("#sel_exposed").is(':checked');
108
                var d = $("#sel_sdkversion").val();
109
                if (d != null ) {
110
                    o.sdk_reftag_id = d;
111
                }
112
            },
5052 dpurdie 113
        },
114
        "ordering": true,
115
        "order": [[ 1, "asc" ]],
5051 dpurdie 116
 
5052 dpurdie 117
         "columns": [
118
            { "data": "PV_ID", visible : false },
119
            { "data": "PKG_NAME" },
5055 dpurdie 120
            { "data": "PKG_VERSION" , width : "5%" },
121
            { "data": "REF_PKG_VERSION", width : "5%" },
122
            { "data": "REF_SDKPKG_CHECK" , width : "1%" },
123
            { "data": "SDKPKG_CHECK" , width : "1%"},
5052 dpurdie 124
        ],
125
    });
126
}
5051 dpurdie 127
 
128
 
129
//  Process each row of table data before it is presented to the table scroller
130
//  Process the raw Ajax data
131
//      Create a checkbox for the state
132
//      Add a data item to the entry - to allow traceback when saving
5055 dpurdie 133
$('#sdk_content').on('xhr.dt', function ( e, settings, json ) {
5114 dpurdie 134
        $.each(json.aaData, function(idx,row){
5055 dpurdie 135
            if (row.SDKPKG_STATE != null) {
136
                var checked = row.SDKPKG_STATE == "E" ? 'checked' : '';
137
                var disabled = (sdkDetails.SDK_STATE === 'U' ) ? '' : ' disabled ';
5089 dpurdie 138
                row.SDKPKG_CHECK = '<input type="checkbox" class=clickable <%=modifyState%> '+ checked + disabled + ' data-pvid='+ row.PV_ID +'>';
5055 dpurdie 139
            } else {
140
                row.SDKPKG_CHECK = "";
141
            }
142
 
143
            if (row.REF_SDKPKG_STATE != null)
144
            {
145
                var checked = row.REF_SDKPKG_STATE == "E" ? 'checked' : '';
146
                row.REF_SDKPKG_CHECK = '<input type="checkbox" ' + checked + ' disabled >';
147
            } else {
148
                row.REF_SDKPKG_CHECK = "";
149
            }
150
 
5051 dpurdie 151
        });
152
    } );
153
 
154
// Process click on checkboxes within the datatable
155
//      this - a DOM node
156
//      $(this) - The jquery wrapped node
157
//
158
$('#sdk_content').on( 'click', 'tbody td :checkbox', function () {
5052 dpurdie 159
    getAjaxData (
160
        "sdk_opr_json.asp",
161
        { action : 'setSdkContentState', 
162
          sdktagId : <%=parSdkTag_id%>, 
163
          pv_id : $(this).data('pvid'), 
164
          sdkpkg_state : this.checked ? 'E' : '-' 
165
        });
166
    });
5051 dpurdie 167
 
5117 dpurdie 168
// Single click on row - Highlight selected row
169
$('#sdk_content').on( 'click', 'tbody tr', function () {
170
    if ( $(this).hasClass('selected') ) {
171
        $(this).removeClass('selected');
172
    }
173
    else {
174
        table.$('tr.selected').removeClass('selected');
175
        $(this).addClass('selected');
176
    }
177
} );
178
 
179
 
5054 dpurdie 180
//  Populate the Reference Project
181
//      sdk_id  - Select this entry if possible
5053 dpurdie 182
function populateSdkNames(sdk_id) {
5052 dpurdie 183
    getAjaxData (
184
        "sdk_opr_json.asp",
185
        { action: "getSdkNames" },
186
        function(data){
187
            // Populate selection
188
            var $options = $("#sel_sdkname").empty();
189
            var name
190
            $options.append($("<option />").val(null).text('Select One'));
191
            $.each(data.aaData, function (index, value) {
192
                $options.append($("<option />").val(value.SDK_ID).text(value.SDK_NAME));
193
            });
5053 dpurdie 194
            $options.val(sdk_id);
195
            populateSdkVersions(sdk_id)
5052 dpurdie 196
        });    
197
}
198
 
199
//  Populate the SDK Versions selection drop down
200
//      sdk_id  - Identify the family to select
201
//
202
function populateSdkVersions(sdk_id){
203
    getAjaxData (
204
        "sdk_opr_json.asp",
205
        { action: "getSdkVersions", sdk_id : sdk_id, mode: $("#chk_sdkversion").is(':checked') },
206
        function(data){
207
            // Populate selection
208
            var $options = $("#sel_sdkversion").empty();
209
            $options.append($("<option />").val(null).text('Select One'));
210
            $.each(data.aaData, function (index, value) {
211
                $options.append($("<option />").val(value.SDKTAG_ID).text(value.SDKTAG_NAME));
212
            });
213
        });    
214
}
5051 dpurdie 215
 
5052 dpurdie 216
function setInfo(txt) {
217
    $("#sdkd_info").text( txt);
218
}
5051 dpurdie 219
 
5052 dpurdie 220
function clearInfo(txt) {
221
    $("#sdkd_info").text(" ");
222
}
223
 
224
//  getAjaxData - with error processing
225
//      url - url to fetch
226
//      data    - additional data to pass to ajax request
227
//      success - function to call on success
228
function getAjaxData( url, data, success )
229
{
230
    clearInfo();
231
    $("#sdkd_progressBar").css('visibility', 'visible');
232
    $.ajax(
233
    {
234
        url : url,
235
        type: "POST",
236
        data : data,
237
        dataType : "json",
238
        cache: false,
239
        success:function(data, textStatus, jqXHR)
5051 dpurdie 240
        {
5052 dpurdie 241
            //data: return data from server
242
            //console.log ("UpdateData", data);
243
            if (data.result != 0)
5051 dpurdie 244
            {
5052 dpurdie 245
                setInfo("Error:" + ((data.error != 0) ? data.emsgSummary : "Reason not given"));
246
                return;
247
            }
248
            //  call user success function
249
            if (jQuery.isFunction(success))
5051 dpurdie 250
            {
5052 dpurdie 251
                success(data);
5051 dpurdie 252
            }
5052 dpurdie 253
        },
254
        error: function(jqXHR, textStatus, errorThrown)
255
        {
256
            setInfo("Error:" + errorThrown);
257
            //if fails
258
        },
259
        complete : function()
260
        {
261
            $("#sdkd_progressBar").css('visibility', 'hidden');
262
        }
263
    });
264
 
265
}
5098 dpurdie 266
 
267
// Local Help
268
formTips.tips.sdk_state = stdTip(200, 'State', 
269
                                     'WIP - Under development. Can be modified but is not available for use by other releases.' +
270
                                     '<p>Release - Available for other releases to use' +
271
                                     '<p>Deprecated - This version of the SDK has been superceded. Not available for use.');
272
 
5051 dpurdie 273
    </script>
5052 dpurdie 274
<!-- Tool Bar -->
275
<div class=rmbutton style="position:relative;background-color:#DAD7c8;height:38px;padding:7px;margin-bottom: 7px;">
276
 
277
    <div style="float:left">
278
        <fieldset style="padding:2px">
279
            <legend>Display</legend>
280
            <span>Show Exposed</span>
281
            <input id=sel_exposed type=checkbox>
282
        </fieldset>
283
    </div>
284
 
5098 dpurdie 285
    <div style="float:left">
5089 dpurdie 286
        <fieldset style="padding:2px" <%=modifyState%>>
5052 dpurdie 287
            <legend>State</legend>
5098 dpurdie 288
            <select id=sel_state>
289
                <option value="U">WIP</option>
290
                <option value="R">Released</option>
291
                <option value="D">Deprecated</option>
292
            </select>
293
            <%=Quick_Help("sdk_state")%>
5052 dpurdie 294
        </fieldset>
295
    </div>
296
 
297
    <div style="float:left">
298
        <fieldset style="padding:2px">
299
            <legend>Ref Sdk</legend>
300
            <select id=sel_sdkname>
301
                <option>Select One</option>
302
            </select>
303
            <select id=sel_sdkversion>
304
            </select>
305
            <input id=chk_sdkversion type=checkbox>Show All
306
        </fieldset>
307
    </div>
308
 
309
</div>
310
 
311
<div class="form_ttl tleft" id=sdkd_section_head>
5051 dpurdie 312
  <!-- Section Header ---->
5052 dpurdie 313
</div>
5051 dpurdie 314
 
5052 dpurdie 315
<!-- Section Body ---->
316
<div class="rounded_box">
5117 dpurdie 317
  <table id=sdk_content class="full_table display" >
5052 dpurdie 318
      <thead>
319
      <tr class="body_col form_align">
320
        <th width="1%"> PV_ID
321
        <th width="10%"> Package Name
322
        <th> Package Version
5055 dpurdie 323
        <th> Ref Version
324
        <th> Ref State
5052 dpurdie 325
        <th width="1%"> State
326
      </thead>
327
  </table>
5051 dpurdie 328
 
5052 dpurdie 329
  <!-- Info / Ajax Progress bar -->
5116 dpurdie 330
  <div class='bg_dialog body_txt' style='position:relative;min-height:14px;' >
331
      <img id='sdkd_progressBar' style='visibility:hidden;position: absolute;display: block' src='icons/i_processing.gif' width='79' height='14'>
5052 dpurdie 332
      <div id=sdkd_info  style='position: absolute;'></div>
333
  </div>
5102 dpurdie 334
<%If isDefined("rmDebug") Then%>
335
    <div class="rmDebug" >RmDebug: <%=rmDebug%></div>
336
<%End If%>
5052 dpurdie 337
</div>