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