Rev 5142 | Rev 6048 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<%@LANGUAGE="VBSCRIPT"%><%' sdk_version_add.asp' This file is designed to be injected (loaded) into a 'div' on a window' It is a pop up dialog'' Add a new version to the current sdk_id%><%Option explicit' Good idea to set when using redirectResponse.Expires = 0 ' always load the page, dont store' Determine mode of operation' inReleaseMode: true: Have rtag_id and proj_id, so we need to determine the sdk' false: Have sdk_id so we need to determine the releaseDim inReleaseMode : inReleaseMode = Request("proj_id") <> "" AND Request("rtag_id") <> ""%><!--#include file="common/conf.asp"--><!--#include file="common/globals.asp"--><!--#include file="common/formating.asp"--><!--#include file="common/qstr.asp"--><!--#include file="common/common_subs.asp"--><%'------------ ACCESS CONTROL ------------------%><!--#include file="_access_control_general.asp"--><!--#include file="common/globals_sdk.asp"--><script>$( "#fNewSdkVersion" ).dialog({autoOpen: true,width: 350,position: { my: "top", at: "top+100", of: window },modal: true,draggable: true,resizable: true,dialogClass: "rounded_box",buttons: [<%If canActionControlInProject("CreateSdk") Then %>{text : 'Create',class : 'hideOnError',click : function(){clearInfo();$( "#fNewSdkVersion" ).submit();},},<%End If%>{text : 'Cancel',click : function(){$( this ).dialog( "close" );},},],open: function( event, ui ) {},close : function(event, ui ){// Need to remove DOM elements on close so that// When it is opened again - the binds occur correctly$(this).dialog('destroy').remove();},});function setInfo(txt) {$("#sdkv_info").text( txt).addClass("error");}function clearInfo(txt) {$("#sdkv_info").text(" ").removeClass("error");}// Form Validation processing// Load in the required JavaScript support$.getScript("jquery/form-validator/jquery.form-validator.min.js", registerValidation);function registerValidation(){$.validate({form: '#fNewSdkVersion',validateOnBlur : false,onSuccess : function(f) {processSdkForm(f);},});}// Severe Error processing// Disable all the inputs on a form// Hide dialog buttons marked to be hidden// All the user can do is read the error message and close the formfunction disableForm(){var form = $("#fNewSdkVersion");form.dialog( "widget" ).find(".hideOnError").hide();form.find(":input").prop("disabled",true);}// Process the Form// Form has been validated and is ready to be saved// Once saved then// Close the dialog form// Trigger a custom event// Users can use this event to refresh any table being displayedfunction processSdkForm(f){<%If inReleaseMode Then%>// Enable the disabled fieldset so that the values within are sent as a part of the form$("#sel_base_release").prop("disabled", false);<%End If%>getAjaxData ("sdk_opr_json.asp",f.serializeArray(),function(data){f.dialog( "close" );<%If inReleaseMode Then%>window.location.href = "sdk_main_page.asp#url=sdk_details.asp&sdktag_id=" + data.SDKTAG_ID;<%Else%>$("#sdk_versions").trigger('sdkVersionAdded');<%End If%>});};// Attach a function to the submit event// Allows local processing$( "#fNewSdkVersion" ).submit(function(e) {e.preventDefault(); //STOP default actionreturn false;});function populateProjects(proj_id, rtag_id){getAjaxData ("sdk_opr_json.asp",{ action: "getProjectList" },function(data){// Populate selectionvar $options = $("#sel_project").empty();$options.append($("<option selected disabled/>").val(null).text('Select One'));$.each(data.aaData, function (index, value) {$options.append($("<option />").val(value.PROJ_ID).text(value.PROJ_NAME));});populateReleases( proj_id, rtag_id);});};function populateReleases(proj_id, rtag_id){getAjaxData ("sdk_opr_json.asp",{ action: "getReleaseList", proj_id : proj_id, rtag_id : rtag_id, mode: $("#chk_release").is(':checked') },function(data){// Populate selectionvar $options = $("#sel_release").empty();$options.append($("<option selected disabled/>").val(null).text('Select One'));$.each(data.aaData, function (index, value) {$options.append($("<option />").val(value.RTAG_ID).text(value.RTAG_NAME));});if (rtag_id != null)$options.val(rtag_id);$("#sel_project").val(data.proj_id);});};// getAjaxData - with error processing// url - url to fetch// data - additional data to pass to ajax request// success - function to call on successfunction getAjaxData( url, data, success ){clearInfo();$("#sdkv_progressBar").css('visibility', 'visible');$.ajax({url : url,type: "POST",data : data,dataType : "json",cache: false,success:function(data, textStatus, jqXHR){//data: return data from server//console.log ("UpdateData", data);if (data.result != 0){setInfo("Error:" + ((data.error != 0) ? data.emsgSummary : "Reason not given"));if (data.error >= 0) disableForm();return;}// call user success functionsuccess(data);},error: function(jqXHR, textStatus, errorThrown){setInfo("Error:" + errorThrown);disableForm();//if fails},complete : function(){$("#sdkv_progressBar").css('visibility', 'hidden');}});}// If we have a proj_id and rtag_id, then we need to populate the SDK selector// When this is complete we will polulate the rest of the page//<%If inReleaseMode Then%>getAjaxData ("sdk_opr_json.asp",{ action: "getSdkNames" , proj_id : <%=Request("proj_id")%>},function(data){// Populate selectionvar $options = $("#sel_sdkname").empty();var len = data.aaData.length;if ( len == 0 ) {$options.append($("<option selected disabled/>").val(null).text('None Available'));disableForm();setInfo("Project not configured for SDKs");return;} else if ( len > 1 ) {$options.append($("<option selected disabled/>").val(null).text('Select One'));}$.each(data.aaData, function (index, value) {$options.append($("<option />").val(value.SDK_ID).text(value.SDK_NAME));});// Display the controlling Project and ReleasepopulateProjects(<%=Request("proj_id")%>, <%=Request("rtag_id")%>);if( $options.val() > 0 ) {populateSdkVersions( $options.val());}});$("#sel_sdkname").change(function(){populateSdkVersions( $("#sel_sdkname").val());});function populateSdkVersions(sdk_id){getAjaxData ("sdk_opr_json.asp",{ action: "getSdkVersions", sdk_id : sdk_id, active: false, mode : true },function(data){// Populate selectionvar $options = $("#sel_sdkversion").empty();$options.append($("<option selected disabled />").val(null).text('Current Versions'));$.each(data.aaData, function (index, value) {$options.append($("<option />").val(value.SDKTAG_ID).text(value.SDKTAG_NAME));});});}<%End If%><%If NOT inReleaseMode Then%>// Get getSdkDetails// When this is complete we will populate the remainder of the page.getAjaxData ("sdk_opr_json.asp",{ action: "getSdkDetails", sdk_id : <%=Request("sdk_id")%> },function(data){$("#sdkDetails").val( data.aaData.SDK_NAME);// Populate the Projects Drop Down ListpopulateProjects(data.aaData.PROJ_ID);});// Wire up various controls to auto-populate others$("#sel_project").change(function(){populateReleases( $(this).val(), null);});$("#chk_release").change(function(){populateReleases( $("#sel_project").val(), $("#sel_release").val());});<%End If%>//# sourceURL=sdk_versions_add.asp</script><link rel="stylesheet" href="jquery/form-validator.css" type="text/css"><form title="Create new SDK Version" id=fNewSdkVersion action="sdk_opr_json.asp" class=td><div style='min-height:25px;position:relative;'><img id='sdkv_progressBar' src='icons/i_processing.gif' width='79' height='14'style='visibility:hidden;position:absolute;'><div id='sdkv_info' style='position:absolute;'></div></div><%If inReleaseMode Then%><fieldset><legend>SDK</legend><p>SDK Family:<br><select id=sel_sdkname name=sdk_id data-validation="required"></select><p>Current Versions: (for reference only)<br><select id=sel_sdkversion></select></fieldset><%Else%><p>SDK:<br><input id=sdkDetails disabled><input type="hidden" name="sdk_id" value="<%=Request("sdk_id")%>"><%End If%><fieldset><legend>SDK Version</legend><p>Name:<br><input id=sdk_name type="text" name="sdkName" maxlength=50 size=40 data-validation="length,alphanumeric" data-validation-length="min4" data-validation-allowing="_. -"><p>Description:<br><textarea id=sdk_comment name="sdkComment" cols=40 data-validation="length" data-validation-length="5-4000"></textarea></fieldset><fieldset id="sel_base_release" <%If inReleaseMode Then Response.Write(" disabled")%>><legend>Base Release</legend><br>Project:<br><select id=sel_project name=proj_id data-validation="required" disabled><option value="">Select One</option></select><p>Release:<input id=chk_release type=checkbox>Show all versions<br><select id=sel_release name=rtag_id data-validation="required"><option value="">Select One</option></select></fieldset><input type="hidden" name="action" value="addNewSdkVersion"></form>