Subversion Repositories DevTools

Rev

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
{
95
    $('#sdk_content').DataTable({
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
 
5054 dpurdie 168
//  Populate the Reference Project
169
//      sdk_id  - Select this entry if possible
5053 dpurdie 170
function populateSdkNames(sdk_id) {
5052 dpurdie 171
    getAjaxData (
172
        "sdk_opr_json.asp",
173
        { action: "getSdkNames" },
174
        function(data){
175
            // Populate selection
176
            var $options = $("#sel_sdkname").empty();
177
            var name
178
            $options.append($("<option />").val(null).text('Select One'));
179
            $.each(data.aaData, function (index, value) {
180
                $options.append($("<option />").val(value.SDK_ID).text(value.SDK_NAME));
181
            });
5053 dpurdie 182
            $options.val(sdk_id);
183
            populateSdkVersions(sdk_id)
5052 dpurdie 184
        });    
185
}
186
 
187
//  Populate the SDK Versions selection drop down
188
//      sdk_id  - Identify the family to select
189
//
190
function populateSdkVersions(sdk_id){
191
    getAjaxData (
192
        "sdk_opr_json.asp",
193
        { action: "getSdkVersions", sdk_id : sdk_id, mode: $("#chk_sdkversion").is(':checked') },
194
        function(data){
195
            // Populate selection
196
            var $options = $("#sel_sdkversion").empty();
197
            $options.append($("<option />").val(null).text('Select One'));
198
            $.each(data.aaData, function (index, value) {
199
                $options.append($("<option />").val(value.SDKTAG_ID).text(value.SDKTAG_NAME));
200
            });
201
        });    
202
}
5051 dpurdie 203
 
5052 dpurdie 204
function setInfo(txt) {
205
    $("#sdkd_info").text( txt);
206
}
5051 dpurdie 207
 
5052 dpurdie 208
function clearInfo(txt) {
209
    $("#sdkd_info").text(" ");
210
}
211
 
212
//  getAjaxData - with error processing
213
//      url - url to fetch
214
//      data    - additional data to pass to ajax request
215
//      success - function to call on success
216
function getAjaxData( url, data, success )
217
{
218
    clearInfo();
219
    $("#sdkd_progressBar").css('visibility', 'visible');
220
    $.ajax(
221
    {
222
        url : url,
223
        type: "POST",
224
        data : data,
225
        dataType : "json",
226
        cache: false,
227
        success:function(data, textStatus, jqXHR)
5051 dpurdie 228
        {
5052 dpurdie 229
            //data: return data from server
230
            //console.log ("UpdateData", data);
231
            if (data.result != 0)
5051 dpurdie 232
            {
5052 dpurdie 233
                setInfo("Error:" + ((data.error != 0) ? data.emsgSummary : "Reason not given"));
234
                return;
235
            }
236
            //  call user success function
237
            if (jQuery.isFunction(success))
5051 dpurdie 238
            {
5052 dpurdie 239
                success(data);
5051 dpurdie 240
            }
5052 dpurdie 241
        },
242
        error: function(jqXHR, textStatus, errorThrown)
243
        {
244
            setInfo("Error:" + errorThrown);
245
            //if fails
246
        },
247
        complete : function()
248
        {
249
            $("#sdkd_progressBar").css('visibility', 'hidden');
250
        }
251
    });
252
 
253
}
5098 dpurdie 254
 
255
// Local Help
256
formTips.tips.sdk_state = stdTip(200, 'State', 
257
                                     'WIP - Under development. Can be modified but is not available for use by other releases.' +
258
                                     '<p>Release - Available for other releases to use' +
259
                                     '<p>Deprecated - This version of the SDK has been superceded. Not available for use.');
260
 
5051 dpurdie 261
    </script>
5052 dpurdie 262
<!-- Tool Bar -->
263
<div class=rmbutton style="position:relative;background-color:#DAD7c8;height:38px;padding:7px;margin-bottom: 7px;">
264
 
265
    <div style="float:left">
266
        <fieldset style="padding:2px">
267
            <legend>Display</legend>
268
            <span>Show Exposed</span>
269
            <input id=sel_exposed type=checkbox>
270
        </fieldset>
271
    </div>
272
 
5098 dpurdie 273
    <div style="float:left">
5089 dpurdie 274
        <fieldset style="padding:2px" <%=modifyState%>>
5052 dpurdie 275
            <legend>State</legend>
5098 dpurdie 276
            <select id=sel_state>
277
                <option value="U">WIP</option>
278
                <option value="R">Released</option>
279
                <option value="D">Deprecated</option>
280
            </select>
281
            <%=Quick_Help("sdk_state")%>
5052 dpurdie 282
        </fieldset>
283
    </div>
284
 
285
    <div style="float:left">
286
        <fieldset style="padding:2px">
287
            <legend>Ref Sdk</legend>
288
            <select id=sel_sdkname>
289
                <option>Select One</option>
290
            </select>
291
            <select id=sel_sdkversion>
292
            </select>
293
            <input id=chk_sdkversion type=checkbox>Show All
294
        </fieldset>
295
    </div>
296
 
297
</div>
298
 
299
<div class="form_ttl tleft" id=sdkd_section_head>
5051 dpurdie 300
  <!-- Section Header ---->
5052 dpurdie 301
</div>
5051 dpurdie 302
 
5052 dpurdie 303
<!-- Section Body ---->
304
<div class="rounded_box">
305
  <table id=sdk_content class="full_table" >
306
      <thead>
307
      <tr class="body_col form_align">
308
        <th width="1%"> PV_ID
309
        <th width="10%"> Package Name
310
        <th> Package Version
5055 dpurdie 311
        <th> Ref Version
312
        <th> Ref State
5052 dpurdie 313
        <th width="1%"> State
314
      </thead>
315
  </table>
5051 dpurdie 316
 
5052 dpurdie 317
  <!-- Info / Ajax Progress bar -->
5116 dpurdie 318
  <div class='bg_dialog body_txt' style='position:relative;min-height:14px;' >
319
      <img id='sdkd_progressBar' style='visibility:hidden;position: absolute;display: block' src='icons/i_processing.gif' width='79' height='14'>
5052 dpurdie 320
      <div id=sdkd_info  style='position: absolute;'></div>
321
  </div>
5102 dpurdie 322
<%If isDefined("rmDebug") Then%>
323
    <div class="rmDebug" >RmDebug: <%=rmDebug%></div>
324
<%End If%>
5052 dpurdie 325
</div>