Subversion Repositories DevTools

Rev

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