| 5050 |
dpurdie |
1 |
<%@LANGUAGE="VBSCRIPT"%>
|
|
|
2 |
<%
|
|
|
3 |
' sdk_version_add.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 |
' Add a new version to the current sdk_id
|
|
|
8 |
%>
|
|
|
9 |
<script>
|
|
|
10 |
$( "#f1" ).dialog({
|
|
|
11 |
autoOpen: true,
|
|
|
12 |
width: 350,
|
|
|
13 |
modal: true,
|
|
|
14 |
draggable: true,
|
|
|
15 |
resizable: true,
|
|
|
16 |
dialogClass: "rounded_box",
|
|
|
17 |
buttons: [
|
|
|
18 |
{
|
|
|
19 |
text : 'Create',
|
|
|
20 |
class : 'hideOnError',
|
|
|
21 |
click : function(){
|
|
|
22 |
clearInfo();
|
|
|
23 |
$( "#f1" ).submit();
|
|
|
24 |
},
|
|
|
25 |
},
|
|
|
26 |
{
|
|
|
27 |
text : 'Cancel',
|
|
|
28 |
click : function(){
|
|
|
29 |
$( this ).dialog( "close" );
|
|
|
30 |
},
|
|
|
31 |
},
|
|
|
32 |
],
|
|
|
33 |
open: function( event, ui ) {
|
|
|
34 |
},
|
|
|
35 |
close : function(event, ui ){
|
|
|
36 |
// Need to remove DOM elements on close so that
|
|
|
37 |
// When it is opened again - the binds occur correctly
|
|
|
38 |
$(this).dialog('destroy').remove();
|
|
|
39 |
},
|
|
|
40 |
});
|
|
|
41 |
|
|
|
42 |
function setInfo(txt) {
|
|
|
43 |
$("#sdkv_info").text( txt).addClass("error");
|
|
|
44 |
}
|
|
|
45 |
|
|
|
46 |
function clearInfo(txt) {
|
|
|
47 |
$("#sdkv_info").text(" ").removeClass("error");
|
|
|
48 |
}
|
|
|
49 |
|
|
|
50 |
$.validate({
|
|
|
51 |
form: '#f1',
|
|
|
52 |
validateOnBlur : false,
|
|
|
53 |
onSuccess : function(f) {
|
|
|
54 |
processSdkForm(f);
|
|
|
55 |
},
|
|
|
56 |
|
|
|
57 |
});
|
|
|
58 |
|
|
|
59 |
// Severe Error processing
|
|
|
60 |
// Disable all the inputs on a form
|
|
|
61 |
// Hide dialog buttons marked to be hidden
|
|
|
62 |
// All the user can do is read the error message and close the form
|
|
|
63 |
function disableForm()
|
|
|
64 |
{
|
|
|
65 |
var form = $("#f1");
|
|
|
66 |
form.dialog( "widget" ).find(".hideOnError").hide();
|
|
|
67 |
form.find(":input").prop("disabled",true);
|
|
|
68 |
}
|
|
|
69 |
|
|
|
70 |
// Process the Form
|
|
|
71 |
// Form has been validated and is ready to be saved
|
|
|
72 |
// Once saved then
|
|
|
73 |
// Close the dialog form
|
|
|
74 |
// Trigger a custom event
|
|
|
75 |
// Users can use this event to refresh any table being displayed
|
|
|
76 |
function processSdkForm(f)
|
|
|
77 |
{
|
|
|
78 |
getAjaxData (
|
|
|
79 |
"sdk_opr_json.asp",
|
|
|
80 |
f.serializeArray(),
|
|
|
81 |
function(data){
|
|
|
82 |
f.dialog( "close" );
|
| 5051 |
dpurdie |
83 |
$("#sdk_version").trigger('sdkVersionAdded');
|
| 5050 |
dpurdie |
84 |
});
|
|
|
85 |
};
|
|
|
86 |
|
|
|
87 |
// Attach a function to the submit event
|
|
|
88 |
// Allows local processing
|
|
|
89 |
$( "#f1" ).submit(function(e) {
|
|
|
90 |
e.preventDefault(); //STOP default action
|
|
|
91 |
return false;
|
|
|
92 |
});
|
|
|
93 |
|
|
|
94 |
function populateProjects(){
|
|
|
95 |
getAjaxData (
|
|
|
96 |
"sdk_opr_json.asp",
|
|
|
97 |
{ action: "getProjectList", rtag_id: <%=Request("rtag_id")%> },
|
|
|
98 |
function(data){
|
|
|
99 |
// Populate selection
|
|
|
100 |
var $options = $("#sel_project").empty();
|
|
|
101 |
$.each(data.aaData, function (index, value) {
|
|
|
102 |
$options.append($("<option />").val(value.PROJ_ID).text(value.PROJ_NAME));
|
|
|
103 |
});
|
|
|
104 |
//$options[0].selectedIndex = 0
|
|
|
105 |
//populateReleases( $options.val())
|
|
|
106 |
|
|
|
107 |
populateReleases( null, <%=Request("rtag_id")%>);
|
|
|
108 |
|
|
|
109 |
});
|
|
|
110 |
};
|
|
|
111 |
|
|
|
112 |
function populateReleases(proj_id, rtag_id){
|
|
|
113 |
getAjaxData (
|
|
|
114 |
"sdk_opr_json.asp",
|
|
|
115 |
{ action: "getReleaseList", proj_id : proj_id, rtag_id : rtag_id, mode: $("#chk_release").is(':checked') },
|
|
|
116 |
function(data){
|
|
|
117 |
// Populate selection
|
|
|
118 |
var $options = $("#sel_release").empty();
|
|
|
119 |
$options.append($("<option />").val(null).text('Select One'));
|
|
|
120 |
$.each(data.aaData, function (index, value) {
|
|
|
121 |
$options.append($("<option />").val(value.RTAG_ID).text(value.RTAG_NAME));
|
|
|
122 |
});
|
|
|
123 |
if (rtag_id != null)
|
|
|
124 |
$options.val(rtag_id);
|
|
|
125 |
$("#sel_project").val(data.proj_id);
|
|
|
126 |
});
|
|
|
127 |
};
|
|
|
128 |
|
|
|
129 |
// Populate the SDK Names selection drop down
|
|
|
130 |
// sdk_id - Current SDK Family.
|
|
|
131 |
// el - Eleemnt to set name into. Use .val() as it is an <input>
|
|
|
132 |
//
|
|
|
133 |
function populateSdkNames(sdk_id, el){
|
|
|
134 |
getAjaxData (
|
|
|
135 |
"sdk_opr_json.asp",
|
|
|
136 |
{ action: "getSdkNames" },
|
|
|
137 |
function(data){
|
|
|
138 |
// Populate selection
|
|
|
139 |
var $options = $("#sel_sdkname").empty();
|
|
|
140 |
var name
|
|
|
141 |
$options.append($("<option />").val(null).text('Select One'));
|
|
|
142 |
$.each(data.aaData, function (index, value) {
|
|
|
143 |
$options.append($("<option />").val(value.SDK_ID).text(value.SDK_NAME));
|
|
|
144 |
if ( sdk_id == value.SDK_ID ) name = value.SDK_NAME;
|
|
|
145 |
});
|
|
|
146 |
if ( sdk_id != null)
|
|
|
147 |
{
|
|
|
148 |
$options.val(sdk_id);
|
|
|
149 |
if ( el != null && name != null)
|
|
|
150 |
{
|
|
|
151 |
el.val(name);
|
|
|
152 |
}
|
|
|
153 |
}
|
|
|
154 |
|
|
|
155 |
populateSdkVersions( sdk_id );
|
|
|
156 |
|
|
|
157 |
});
|
|
|
158 |
};
|
|
|
159 |
|
|
|
160 |
// Populate the SDK Versions selection drop down
|
|
|
161 |
// sdk_id - Identify the family to select
|
|
|
162 |
//
|
|
|
163 |
function populateSdkVersions(sdk_id){
|
|
|
164 |
getAjaxData (
|
|
|
165 |
"sdk_opr_json.asp",
|
|
|
166 |
{ action: "getSdkVersions", sdk_id : sdk_id, mode: $("#chk_sdkversion").is(':checked') },
|
|
|
167 |
function(data){
|
|
|
168 |
// Populate selection
|
|
|
169 |
var $options = $("#sel_sdkversion").empty();
|
|
|
170 |
$options.append($("<option />").val(null).text('Select One'));
|
|
|
171 |
$.each(data.aaData, function (index, value) {
|
|
|
172 |
$options.append($("<option />").val(value.SDKTAG_ID).text(value.SDKTAG_NAME));
|
|
|
173 |
});
|
|
|
174 |
});
|
|
|
175 |
};
|
|
|
176 |
|
|
|
177 |
|
|
|
178 |
|
|
|
179 |
// getAjaxData - with error processing
|
|
|
180 |
// url - url to fetch
|
|
|
181 |
// data - additional data to pass to ajax request
|
|
|
182 |
// success - function to call on success
|
|
|
183 |
function getAjaxData( url, data, success )
|
|
|
184 |
{
|
|
|
185 |
clearInfo();
|
|
|
186 |
$("#sdkv_progressBar").css('visibility', 'visible');
|
|
|
187 |
$.ajax(
|
|
|
188 |
{
|
|
|
189 |
url : url,
|
|
|
190 |
type: "POST",
|
|
|
191 |
data : data,
|
|
|
192 |
dataType : "json",
|
|
|
193 |
cache: false,
|
|
|
194 |
success:function(data, textStatus, jqXHR)
|
|
|
195 |
{
|
|
|
196 |
//data: return data from server
|
|
|
197 |
//console.log ("UpdateData", data);
|
|
|
198 |
if (data.result != 0)
|
|
|
199 |
{
|
|
|
200 |
setInfo("Error:" + ((data.error != 0) ? data.emsgSummary : "Reason not given"));
|
|
|
201 |
if (data.error >= 0) disableForm();
|
|
|
202 |
return;
|
|
|
203 |
}
|
|
|
204 |
// call user success function
|
|
|
205 |
success(data);
|
|
|
206 |
},
|
|
|
207 |
error: function(jqXHR, textStatus, errorThrown)
|
|
|
208 |
{
|
|
|
209 |
setInfo("Error:" + errorThrown);
|
|
|
210 |
disableForm();
|
|
|
211 |
//if fails
|
|
|
212 |
},
|
|
|
213 |
complete : function()
|
|
|
214 |
{
|
|
|
215 |
$("#sdkv_progressBar").css('visibility', 'hidden');
|
|
|
216 |
}
|
|
|
217 |
});
|
|
|
218 |
|
|
|
219 |
}
|
|
|
220 |
|
|
|
221 |
// Populate the Projects Drop Down List
|
|
|
222 |
populateProjects();
|
|
|
223 |
populateSdkNames(<%=Request("sdk_id")%>, $("#sdk_familyname"));
|
|
|
224 |
|
|
|
225 |
// Wire up various controls to auto-populate others
|
|
|
226 |
$("#sel_project").change(function(){
|
|
|
227 |
setInfo("New project Value: " + $(this).val());
|
|
|
228 |
populateReleases( $(this).val(), null);
|
|
|
229 |
});
|
|
|
230 |
|
|
|
231 |
$("#chk_release").change(function(){
|
|
|
232 |
populateReleases( $("#sel_project").val(), $("#sel_release").val());
|
|
|
233 |
});
|
|
|
234 |
|
|
|
235 |
$("#sel_release").change(function(){
|
|
|
236 |
setInfo("New Release Value: " + $(this).val());
|
|
|
237 |
});
|
|
|
238 |
|
|
|
239 |
$("#sel_sdkname").change(function(){
|
|
|
240 |
populateSdkVersions( $("#sel_sdkname").val());
|
|
|
241 |
});
|
|
|
242 |
|
|
|
243 |
$("#chk_sdkversion").change(function(){
|
|
|
244 |
populateSdkVersions( $("#sel_sdkname").val());
|
|
|
245 |
});
|
|
|
246 |
|
|
|
247 |
//# sourceURL=sdk_versions_add.asp
|
|
|
248 |
</script>
|
|
|
249 |
<form title="Create new SDK Version" id=f1 action="sdk_opr_json.asp" class=td>
|
|
|
250 |
|
|
|
251 |
<div style='min-height:25px;position:relative;'>
|
|
|
252 |
<img id='sdkv_progressBar' src='icons/i_processing.gif' width='79' height='14'style='visibility:hidden;position:absolute;'>
|
|
|
253 |
<div id='sdkv_info' style='position:absolute;'></div>
|
|
|
254 |
</div>
|
|
|
255 |
|
|
|
256 |
<fieldset>
|
|
|
257 |
<legend>SDK Family</legend>
|
|
|
258 |
<input id=sdk_familyname type="text" readonly size=40>
|
|
|
259 |
</fieldset>
|
|
|
260 |
|
|
|
261 |
<fieldset>
|
|
|
262 |
<legend>SDK Version</legend>
|
|
|
263 |
<p>Name:
|
|
|
264 |
<br><input id=sdk_name type="text" name="sdkName" autofocus maxlength=50 size=40 data-validation="length" data-validation-length="min4">
|
|
|
265 |
|
|
|
266 |
<p>Description:
|
|
|
267 |
<br><textarea id=sdk_comment name="sdkComment" cols=40 data-validation="length" data-validation-length="5-4000"></textarea>
|
|
|
268 |
</fieldset>
|
|
|
269 |
|
|
|
270 |
<fieldset>
|
|
|
271 |
<legend>Base Release</legend>
|
|
|
272 |
<p>Project:<br>
|
|
|
273 |
<select id=sel_project name=proj_id data-validation="required">
|
|
|
274 |
<option value="">Select One</option>
|
|
|
275 |
</select>
|
|
|
276 |
|
|
|
277 |
<p>Release:<input id=chk_release type=checkbox>Show all versions
|
|
|
278 |
<br>
|
|
|
279 |
<select id=sel_release name=rtag_id data-validation="required">
|
|
|
280 |
<option value="">Select One</option>
|
|
|
281 |
</select>
|
|
|
282 |
</fieldset>
|
|
|
283 |
|
|
|
284 |
<fieldset>
|
|
|
285 |
<legend>Template SDK</legend>
|
|
|
286 |
<p>SDK Family:<br>
|
|
|
287 |
<select id=sel_sdkname name=sdk_id data-validation="required">
|
|
|
288 |
<option value="">Select One</option>
|
|
|
289 |
</select>
|
|
|
290 |
|
|
|
291 |
<p>Version:<br>
|
|
|
292 |
<select id=sel_sdkversion name=sdktag_id>
|
|
|
293 |
<option value="">Select One</option>
|
|
|
294 |
</select>
|
|
|
295 |
<input id=chk_sdkversion type=checkbox>Show all versions
|
|
|
296 |
</fieldset>
|
|
|
297 |
|
|
|
298 |
<input type="hidden" name="action" value="addNewSdkVersion">
|
|
|
299 |
</form>
|
|
|
300 |
|