Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
5055 dpurdie 1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
3
'   sdk_version_edit.asp
4
'   This file is designed to be injected (loaded) into a 'div' on a window
5
'   It is a pop up dialog
6
'
7
'   Edit the Version Metadata for  sdktag_id
8
%>
5089 dpurdie 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"-->
5055 dpurdie 23
<script>
24
//# sourceURL=sdk_version_edit.asp
25
$( "#fEditSdkVersion" ).dialog({
26
    autoOpen: true,
27
    width: 350,
28
    modal: true,
29
    draggable: true,
30
    resizable: true,
31
    dialogClass: "rounded_box",
32
        buttons: [
5089 dpurdie 33
<%If canActionControl("AdminSdk") Then %>
5055 dpurdie 34
            {
35
            text  : 'Update',
36
            class : 'hideOnError',
37
            click : function(){
38
                        clearInfo();
39
                        $( "#fEditSdkVersion" ).submit();
40
                        },
41
            },
5089 dpurdie 42
<%End If%>
5055 dpurdie 43
            {
44
            text : 'Cancel',
45
            click : function(){ 
46
                        $( this ).dialog( "close" );
47
                        },
48
            },
49
        ],
50
    open: function( event, ui ) {
51
        },
52
    close : function(event, ui ){
53
        // Need to remove DOM elements on close so that
54
        // When it is opened again - the binds occur correctly
55
        $(this).dialog('destroy').remove();
56
        },
57
    });
58
 
59
function setInfo(txt) {
60
    $("#sdkv_info").text( txt).addClass("error");
61
}
62
 
63
function clearInfo(txt) {
64
    $("#sdkv_info").text(" ").removeClass("error");
65
}
66
 
67
$.validate({
68
    form: '#fEditSdkVersion',
69
    validateOnBlur : false,
70
    onSuccess : function(f) {
71
        processSdkForm(f);
72
    },
73
 
74
});
75
 
76
// Severe Error processing
77
//  Disable all the inputs on a form
78
//  Hide dialog buttons marked to be hidden
79
//  All the user can do is read the error message and close the form
80
function disableForm()
81
{   
82
    var form = $("#fEditSdkVersion");
83
    form.dialog( "widget" ).find(".hideOnError").hide();
84
    form.find(":input").prop("disabled",true);
85
}
86
 
87
//  Process the Form
88
//      Form has been validated and is ready to be saved
89
//      Once saved then
90
//          Close the dialog form
91
//          Trigger a custom event
92
//              Users can use this event to refresh any table being displayed
93
function processSdkForm(f)
94
{
95
    getAjaxData (
96
        "sdk_opr_json.asp",
97
        f.serializeArray(),
98
        function(data){
99
            f.dialog( "close" );
100
            $("#sdk_versions").trigger('sdkVersionAdded');
101
        });    
102
};
103
 
104
//  Attach a function to the submit event
105
//  Allows local processing
106
$( "#fEditSdkVersion" ).submit(function(e) {
107
        e.preventDefault(); //STOP default action
108
        return false;
109
        });
110
 
111
 
112
//  getAjaxData - with error processing
113
//      url - url to fetch
114
//      data    - additional data to pass to ajax request
115
//      success - function to call on success
116
function getAjaxData( url, data, success )
117
{
118
    clearInfo();
119
    $("#sdkv_progressBar").css('visibility', 'visible');
120
    $.ajax(
121
    {
122
        url : url,
123
        type: "POST",
124
        data : data,
125
        dataType : "json",
126
        cache: false,
127
        success:function(data, textStatus, jqXHR)
128
        {
129
            //data: return data from server
130
            //console.log ("UpdateData", data);
131
            if (data.result != 0)
132
            {
133
                setInfo("Error:" + ((data.error != 0) ? data.emsgSummary : "Reason not given"));
134
                if (data.error >= 0) disableForm();
135
                return;
136
            }
137
            //  call user success function
138
            success(data);
139
        },
140
        error: function(jqXHR, textStatus, errorThrown)
141
        {
142
            setInfo("Error:" + errorThrown);
143
            disableForm();
144
            //if fails
145
        },
146
        complete : function()
147
        {
148
            $("#sdkv_progressBar").css('visibility', 'hidden');
149
        }
150
    });
151
 
152
}
153
 
154
//  Get getSdkDetails
155
//      When this is complete we will populate the remainder of the page.
156
getAjaxData (
157
    "sdk_opr_json.asp",
158
    { action: "getSdkVersionDetails", sdktag_id : <%=Request("sdktag_id")%> },
159
    function(data){
160
 
161
        $("#sdkDetails").val( data.aaData.SDK_NAME);
162
        $("#sdk_name").val( data.aaData.SDKTAG_NAME);
163
        $("#sdk_comment").val( data.aaData.DESCRIPTION);
164
    });    
165
 
166
</script>
167
<form title="Edit SDK Version Details" id=fEditSdkVersion action="sdk_opr_json.asp" class=td>
168
 
169
	<div style='min-height:25px;position:relative;'>
170
        <img id='sdkv_progressBar' src='icons/i_processing.gif' width='79' height='14'style='visibility:hidden;position:absolute;'>
171
        <div id='sdkv_info' style='position:absolute;'></div>
172
    </div>
173
 
174
    <p>SDK:
175
    <br><input id=sdkDetails disabled>
176
 
177
    <fieldset>
178
    <legend>SDK Version</legend>
179
    <p>Name:
180
    <br><input id=sdk_name type="text" name="sdkTagName" maxlength=50 size=40 data-validation="length,alphanumeric" data-validation-length="min4" data-validation-allowing="_. -">
181
 
182
    <p>Description:
183
    <br><textarea id=sdk_comment name="sdkTagComment" cols=40  data-validation="length" data-validation-length="5-4000"></textarea>                                              
184
    </fieldset>
185
 
186
    <input type="hidden" name="sdktag_id" value="<%=Request("sdktag_id")%>">
187
    <input type="hidden" name="action" value="updateSdkVersionDetails">
188
</form>
189