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