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