1 /*jslint browser: true, devel: true */
5 =head1 UploadPedigrees.js
7 Dialogs for uploading pedigrees
12 Lukas Mueller <lam87@cornell.edu>, based on code by
13 Jeremy D. Edwards <jde22@cornell.edu>
20 var $j = jQuery.noConflict();
22 jQuery(document).ready(function ($) {
25 $('#upload_pedigrees_link').click(function () {
26 open_upload_pedigrees_dialog();
29 // jQuery("#upload_pedigrees_dialog").dialog({
34 // position: ['top', 75],
36 // "Cancel": function () {
37 // jQuery('#upload_pedigrees_dialog').dialog("close");
39 // "Ok": function () {
40 // upload_pedigrees_file();
41 // jQuery('#upload_pedigrees_dialog').dialog("close");
48 // $("#pedigrees_upload_spreadsheet_info_dialog").dialog( {
50 // buttons: { "OK" : function() { $("#pedigrees_upload_spreadsheet_info_dialog").dialog("close"); },},
52 // position: ['top', 75],
57 $("#upload_pedigrees_dialog_submit").click( function () {
58 $('#upload_pedigrees_dialog').modal("hide");
59 upload_pedigrees_file();
62 $("#pedigrees_upload_spreadsheet_format_info").click( function () {
63 $('#upload_pedigrees_dialog').modal("hide");
64 $("#pedigrees_upload_spreadsheet_info_dialog" ).modal("show");
67 // $("#pedigrees_upload_success_dialog_message").dialog({
71 // Ok: { id: "dismiss_pedigrees_upload_dialog",
72 // click: function() {
73 // //$("#upload_trial_form").dialog("close");
74 // //$( this ).dialog( "close" );
83 $('#upload_pedigrees_form').iframePostForm({
86 var uploadedPedigreesFile = $("#pedigrees_uploaded_file").val();
87 $('#working_modal').modal("show");
88 if (uploadedPedigreesFile === '') {
89 $('#working_modal').modal("hide");
90 alert("No file selected");
93 complete: function (response) {
94 $('#working_modal').modal("hide");
95 if (response.error_string) {
96 $("#upload_pedigrees_error_display tbody").html('');
97 $("#upload_pedigrees_error_display tbody").append(response.error_string);
98 $("#upload_pedigrees_error_display").modal('show');
102 // $("#upload_pedigrees_error_display").dialog({
106 // position: ['top', 250],
107 // title: "Errors in uploaded file",
110 // $(this).dialog("close");
117 if (response.error) {
118 alert(response.error);
121 if (response.success) {
122 $('#pedigrees_upload_success_dialog_message').modal("show");
123 //alert("File uploaded successfully");
128 function upload_pedigrees_file() {
129 var uploadFile = $("#pedigrees_uploaded_file").val();
130 $('#upload_pedigrees_form').attr("action", "/ajax/pedigrees/upload");
131 if (uploadFile === '') {
132 alert("Please select a file");
135 $("#upload_pedigrees_form").submit();
138 function open_upload_pedigrees_dialog() {
139 $('#upload_pedigrees_dialog').modal("show");
140 //add a blank line to design method select dropdown that dissappears when dropdown is opened