Merge pull request #930 from AndreasK79/refactor_footer_split_js
[Refactoring] Split js for Distances Worked, Days with QSOs and QRZ L…
这个提交包含在:
		
						当前提交
						6b7a32dce8
					
				
					共有  5 个文件被更改,包括 353 次插入 和 362 次删除
				
			
		|  | @ -782,43 +782,7 @@ $(document).ready(function(){ | |||
| 
 | ||||
| <?php if ($this->uri->segment(1) == "dayswithqso") { ?>
 | ||||
|     <script src="<?php echo base_url(); ?>assets/js/chart.js"></script> | ||||
|     <script> | ||||
|         var baseURL= "<?php echo base_url();?>"; | ||||
|         $.ajax({ | ||||
|             url: baseURL+'index.php/dayswithqso/get_days', | ||||
|             success: function(data) { | ||||
|                 var labels = []; | ||||
|                 var dataDxcc = []; | ||||
|                 $.each(data, function(){ | ||||
|                     labels.push(this.Year); | ||||
|                     dataDxcc.push(this.Days); | ||||
|                 }); | ||||
|                 var ctx = document.getElementById("myChartDiff").getContext('2d'); | ||||
|                 var myChart = new Chart(ctx, { | ||||
|                     type: 'bar', | ||||
|                     data: { | ||||
|                         labels: labels, | ||||
|                         datasets: [{ | ||||
|                             label: 'Days with QSOs', | ||||
|                             data: dataDxcc, | ||||
|                             backgroundColor: 'rgba(54, 162, 235, 0.2)', | ||||
|                             borderColor: 'rgba(54, 162, 235, 1)', | ||||
|                             borderWidth: 2 | ||||
|                         }] | ||||
|                     }, | ||||
|                     options: { | ||||
|                         scales: { | ||||
|                             yAxes: [{ | ||||
|                                 ticks: { | ||||
|                                 beginAtZero:true | ||||
|                                 } | ||||
|                             }] | ||||
|                         }, | ||||
|                     } | ||||
|                 }); | ||||
|             } | ||||
|         }); | ||||
|     </script> | ||||
| 	<script src="<?php echo base_url(); ?>assets/js/sections/dayswithqso.js"></script> | ||||
| <?php } ?>
 | ||||
| 
 | ||||
| <?php if ($this->uri->segment(1) == "distances") { ?>
 | ||||
|  | @ -826,111 +790,7 @@ $(document).ready(function(){ | |||
|     <script src="<?php echo base_url(); ?>assets/js/highstock/exporting.js"></script> | ||||
|     <script src="<?php echo base_url(); ?>assets/js/highstock/offline-exporting.js"></script> | ||||
|     <script src="<?php echo base_url(); ?>assets/js/highstock/export-data.js"></script> | ||||
| <script> | ||||
| 
 | ||||
|     $('#distplot_bands').change(function(){ | ||||
|         var band = $("#distplot_bands option:selected").text(); | ||||
|         if (band != "SAT") { | ||||
|             $("#distplot_sats").prop('disabled', true); | ||||
|         } else { | ||||
|             $("#distplot_sats").prop('disabled', false); | ||||
|         } | ||||
|     }); | ||||
| 
 | ||||
|   function distPlot(form) { | ||||
|       $(".alert").remove(); | ||||
|       var baseURL= "<?php echo base_url();?>"; | ||||
|       $.ajax({ | ||||
|           url: baseURL+'index.php/distances/get_distances', | ||||
|           type: 'post', | ||||
|           data: {'band': form.distplot_bands.value, | ||||
|                 'sat': form.distplot_sats.value}, | ||||
|           success: function(tmp) { | ||||
|               if (tmp.ok == 'OK') { | ||||
|                   if (!($('#information').length > 0)) | ||||
|                       $("#distances_div").append('<div id="information"></div><div id="graphcontainer" style="height: 600px; margin: 0 auto"></div>'); | ||||
|                   var options = { | ||||
|                       chart: { | ||||
|                           type: 'column', | ||||
|                           zoomType: 'xy', | ||||
|                           renderTo: 'graphcontainer' | ||||
|                       }, | ||||
|                       title: { | ||||
|                           text: 'Distance Distribution' | ||||
|                       }, | ||||
|                       xAxis: { | ||||
|                           categories: [], | ||||
|                           crosshair: true, | ||||
|                           type: "category", | ||||
|                           min:0, | ||||
|                           max:100 | ||||
| 
 | ||||
|                       }, | ||||
|                       yAxis: { | ||||
|                           title: { | ||||
|                               text: '# QSOs' | ||||
|                           } | ||||
|                       }, | ||||
|                       navigator: { | ||||
|                           enabled: true, | ||||
|                           xAxis: { | ||||
|                               labels: { | ||||
|                                   formatter: function() { | ||||
|                                       return this.value * '50' + ' ' + tmp.unit; | ||||
|                                   } | ||||
|                               } | ||||
|                           } | ||||
|                       }, | ||||
|                       rangeSelector: { | ||||
|                           selected: 1 | ||||
|                       }, | ||||
|                       tooltip: { | ||||
|                           formatter: function () { | ||||
|                               if(this.point) { | ||||
|                                   return "Distance: " + options.xAxis.categories[this.point.x] + | ||||
|                                       "<br />Callsign(s) worked (max 5 shown): " + myComments[this.point.x] + | ||||
|                                       "<br />Number of QSOs: <strong>" + series.data[this.point.x] + "</strong>"; | ||||
|                               } | ||||
|                           } | ||||
|                       }, | ||||
|                       series: [] | ||||
|                   }; | ||||
|                   var myComments=[]; | ||||
| 
 | ||||
|                   var series = { | ||||
|                       data: [], | ||||
|                       showInNavigator: true | ||||
|                   }; | ||||
| 
 | ||||
|                   $.each(tmp.qsodata, function(){ | ||||
|                       myComments.push(this.calls); | ||||
|                       options.xAxis.categories.push(this.dist); | ||||
|                       series.name = 'Number of QSOs'; | ||||
|                       series.data.push(this.count); | ||||
| 
 | ||||
|                   }); | ||||
| 
 | ||||
|                   options.series.push(series); | ||||
| 
 | ||||
|                   $('#information').html(tmp.qrb.Qsoes + " contacts were plotted.<br /> Your furthest contact was with " + tmp.qrb.Callsign | ||||
|                       + " in gridsquare "+ tmp.qrb.Grid | ||||
|                       +"; the distance was " | ||||
|                       +tmp.qrb.Distance + tmp.unit +"."); | ||||
| 
 | ||||
|                   var chart = new Highcharts.Chart(options); | ||||
|               } | ||||
|               else { | ||||
|                   if (($('#information').length > 0)) { | ||||
|                       $("#information").remove(); | ||||
|                       $("#graphcontainer").remove(); | ||||
|                   } | ||||
|                   $("#distances_div").append('<div class="alert alert-danger" role="alert"><a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>' + tmp.Error + '</div>'); | ||||
|               } | ||||
|           } | ||||
|       }); | ||||
|   } | ||||
| 
 | ||||
| </script> | ||||
| 	<script src="<?php echo base_url(); ?>assets/js/sections/distances.js"></script> | ||||
| <?php } ?>
 | ||||
| 
 | ||||
|     <?php if ($this->uri->segment(2) == "import") { ?>
 | ||||
|  | @ -946,56 +806,7 @@ $(document).ready(function(){ | |||
|     <?php } ?>
 | ||||
| 
 | ||||
|     <?php if ($this->uri->segment(1) == "qrz") { ?>
 | ||||
|         <script> | ||||
|             function ExportQrz(station_id) { | ||||
|                 if ($(".alert").length > 0) { | ||||
|                     $(".alert").remove(); | ||||
|                 } | ||||
|                 if ($(".errormessages").length > 0) { | ||||
|                     $(".errormessages").remove(); | ||||
|                 } | ||||
|                 $(".ld-ext-right").addClass('running'); | ||||
|                 $(".ld-ext-right").prop('disabled', true); | ||||
|                 var baseURL= "<?php echo base_url();?>"; | ||||
|                 $.ajax({ | ||||
|                     url: baseURL + 'index.php/qrz/upload_station', | ||||
|                     type: 'post', | ||||
|                     data: {'station_id': station_id}, | ||||
|                     success: function (data) { | ||||
|                         $(".ld-ext-right").removeClass('running'); | ||||
|                         $(".ld-ext-right").prop('disabled', false); | ||||
|                         if (data.status == 'OK') { | ||||
|                             $.each(data.info, function(index, value){ | ||||
|                                 $('#modcount'+value.station_id).html(value.modcount); | ||||
|                                 $('#notcount'+value.station_id).html(value.notcount); | ||||
|                                 $('#totcount'+value.station_id).html(value.totcount); | ||||
|                             }); | ||||
|                             $(".card-body").append('<div class="alert alert-success" role="alert"><a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>' + data.infomessage + '</div>'); | ||||
|                         } | ||||
|                         else { | ||||
|                             $(".card-body").append('<div class="alert alert-danger" role="alert"><a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>' + data.info + '</div>'); | ||||
|                         } | ||||
| 
 | ||||
|                         if (data.errormessages.length > 0) { | ||||
|                             $(".card-body").append('' + | ||||
|                                 '<div class="errormessages"><p>\n' + | ||||
|                                 '                            <button class="btn btn-danger" type="button" data-toggle="collapse" data-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample">\n' + | ||||
|                                 '                                Show error messages\n' + | ||||
|                                 '                            </button>\n' + | ||||
|                                 '                            </p>\n' + | ||||
|                                 '                            <div class="collapse" id="collapseExample">\n' + | ||||
|                                 '                                <div class="card card-body"><div class="errors"></div>\n' + | ||||
|                                 '                            </div>\n' + | ||||
|                                 '                            </div></div>'); | ||||
|                             $.each(data.errormessages, function(index, value) { | ||||
|                                 $(".errors").append('<li>' + value); | ||||
|                             }); | ||||
|                         } | ||||
|                     } | ||||
|                 }); | ||||
|             } | ||||
| 
 | ||||
|         </script> | ||||
| 		<script src="<?php echo base_url(); ?>assets/js/sections/qrzlogbook.js"></script> | ||||
|     <?php } ?>
 | ||||
| 
 | ||||
| 	<script> | ||||
|  | @ -1739,139 +1550,7 @@ $(document).ready(function(){ | |||
| 
 | ||||
| <?php if ($this->uri->segment(1) == "accumulated") { ?>
 | ||||
|     <script src="<?php echo base_url(); ?>assets/js/chart.js"></script> | ||||
|     <script> | ||||
|         function accumulatePlot(form) { | ||||
|             $(".ld-ext-right").addClass('running'); | ||||
|             $(".ld-ext-right").prop('disabled', true); | ||||
| 
 | ||||
|             // using this to change color of legend and label according to background color
 | ||||
|             var background = $('body').css( "background-color"); | ||||
|             var color = 'grey'; | ||||
|             if (background != ('rgb(255, 255, 255)')) { | ||||
|                 color = 'white'; | ||||
|             } | ||||
| 
 | ||||
|             var baseURL= "<?php echo base_url();?>"; | ||||
|             var award = form.awardradio.value; | ||||
|             var mode = form.mode.value; | ||||
|             var period = form.periodradio.value; | ||||
|             $.ajax({ | ||||
|                 url: baseURL+'index.php/accumulated/get_accumulated_data', | ||||
|                 type: 'post', | ||||
|                 data: {'Band': form.band.value, 'Award': award, 'Mode': mode, 'Period': period}, | ||||
|                 success: function(data) { | ||||
|                     // used for switching award text in the table and the chart
 | ||||
|                     switch(award) { | ||||
|                         case 'dxcc': var awardtext = "DXCC\'s"; break; | ||||
|                         case 'was':  var awardtext = "states";break; | ||||
|                         case 'iota': var awardtext = "IOTA\'s";break; | ||||
|                         case 'waz':  var awardtext = "CQ zones"; break; | ||||
|                     } | ||||
| 
 | ||||
|                     var periodtext = 'Year'; | ||||
|                     if (period == 'month') { | ||||
|                         periodtext += ' + month'; | ||||
|                     } | ||||
|                     // removing the old chart so that it will not interfere when loading chart again
 | ||||
|                     $("#accumulateContainer").empty(); | ||||
|                     $("#accumulateContainer").append("<canvas id=\"myChartAccumulate\" width=\"400\" height=\"150\"></canvas><div id=\"accumulateTable\"></div>"); | ||||
| 
 | ||||
|                     // appending table to hold the data
 | ||||
|                     $("#accumulateTable").append('<table style="width:100%" class="accutable table table-sm table-bordered table-hover table-striped table-condensed text-center"><thead>' + | ||||
|                         '<tr>' + | ||||
|                         '<td>#</td>' + | ||||
|                         '<td>' + periodtext + '</td>' + | ||||
|                         '<td>Accumulated # of ' + awardtext + ' worked </td>'+ | ||||
|                         '</tr>' + | ||||
|                         '</thead>' + | ||||
|                         '<tbody></tbody></table>'); | ||||
|                     var labels = []; | ||||
|                     var dataDxcc = []; | ||||
| 
 | ||||
|                     var $myTable = $('.accutable'); | ||||
|                     var i = 1; | ||||
| 
 | ||||
|                     // building the rows in the table
 | ||||
|                     var rowElements = data.map(function ( row ) { | ||||
| 
 | ||||
|                         var $row = $('<tr></tr>'); | ||||
| 
 | ||||
|                         var $iterator = $('<td></td>').html(i++); | ||||
|                         var $type = $('<td></td>').html(row.year); | ||||
|                         var $content = $('<td></td>').html(row.total); | ||||
| 
 | ||||
|                         $row.append($iterator, $type, $content); | ||||
| 
 | ||||
|                         return $row; | ||||
|                     }); | ||||
| 
 | ||||
|                     // finally inserting the rows
 | ||||
|                     $myTable.append(rowElements); | ||||
| 
 | ||||
|                     $.each(data, function(){ | ||||
|                         labels.push(this.year); | ||||
|                         dataDxcc.push(this.total); | ||||
|                     }); | ||||
| 
 | ||||
|                     var ctx = document.getElementById("myChartAccumulate").getContext('2d'); | ||||
|                     var myChart = new Chart(ctx, { | ||||
|                         type: 'bar', | ||||
|                         data: { | ||||
|                             labels: labels, | ||||
|                             datasets: [{ | ||||
|                                 label: 'Accumulated number of ' + awardtext + ' worked each ' + period, | ||||
|                                 data: dataDxcc, | ||||
|                                 backgroundColor: 'rgba(54, 162, 235, 0.2)', | ||||
|                                 borderColor: 'rgba(54, 162, 235, 1)', | ||||
|                                 borderWidth: 2, | ||||
|                             }] | ||||
|                         }, | ||||
|                         options: { | ||||
|                             scales: { | ||||
|                                 yAxes: [{ | ||||
|                                     ticks: { | ||||
|                                         beginAtZero:true, | ||||
|                                         fontColor: color | ||||
|                                     } | ||||
|                                 }], | ||||
|                                 xAxes: [{ | ||||
|                                     ticks: { | ||||
|                                         fontColor: color | ||||
|                                     } | ||||
|                                 }] | ||||
|                             }, | ||||
|                             legend: { | ||||
|                                 labels: { | ||||
|                                     fontColor: color, | ||||
|                                 } | ||||
|                             }, | ||||
|                         } | ||||
|                     }); | ||||
|                     $(".ld-ext-right").removeClass('running'); | ||||
|                     $(".ld-ext-right").prop('disabled', false); | ||||
|                     $('.accutable').DataTable({ | ||||
|                         responsive: false, | ||||
|                         ordering: false, | ||||
|                         "scrollY":        "400px", | ||||
|                         "scrollCollapse": true, | ||||
|                         "paging":         false, | ||||
|                         "scrollX": true, | ||||
|                         dom: 'Bfrtip', | ||||
|                         buttons: [ | ||||
|                             'csv' | ||||
|                         ] | ||||
|                     }); | ||||
| 
 | ||||
|                     // using this to change color of csv-button if dark mode is chosen
 | ||||
|                     var background = $('body').css( "background-color"); | ||||
| 
 | ||||
|                     if (background != ('rgb(255, 255, 255)')) { | ||||
|                         $(".buttons-csv").css("color", "white"); | ||||
|                     } | ||||
|                 } | ||||
|             }); | ||||
|         } | ||||
|     </script> | ||||
| 	<script src="<?php echo base_url(); ?>assets/js/sections/accumulatedstatistics.js"></script> | ||||
| <?php } ?>
 | ||||
| 
 | ||||
| <?php if ($this->uri->segment(1) == "timeplotter") { ?>
 | ||||
|  |  | |||
|  | @ -0,0 +1,130 @@ | |||
| function accumulatePlot(form) { | ||||
| 	$(".ld-ext-right").addClass('running'); | ||||
| 	$(".ld-ext-right").prop('disabled', true); | ||||
| 
 | ||||
| 	// using this to change color of legend and label according to background color
 | ||||
| 	var background = $('body').css( "background-color"); | ||||
| 	var color = 'grey'; | ||||
| 	if (background != ('rgb(255, 255, 255)')) { | ||||
| 		color = 'white'; | ||||
| 	} | ||||
| 
 | ||||
| 	var award = form.awardradio.value; | ||||
| 	var mode = form.mode.value; | ||||
| 	var period = form.periodradio.value; | ||||
| 	$.ajax({ | ||||
| 		url: base_url+'index.php/accumulated/get_accumulated_data', | ||||
| 		type: 'post', | ||||
| 		data: {'Band': form.band.value, 'Award': award, 'Mode': mode, 'Period': period}, | ||||
| 		success: function(data) { | ||||
| 			// used for switching award text in the table and the chart
 | ||||
| 			switch(award) { | ||||
| 				case 'dxcc': var awardtext = "DXCC\'s"; break; | ||||
| 				case 'was':  var awardtext = "states";break; | ||||
| 				case 'iota': var awardtext = "IOTA\'s";break; | ||||
| 				case 'waz':  var awardtext = "CQ zones"; break; | ||||
| 			} | ||||
| 
 | ||||
| 			var periodtext = 'Year'; | ||||
| 			if (period == 'month') { | ||||
| 				periodtext += ' + month'; | ||||
| 			} | ||||
| 			// removing the old chart so that it will not interfere when loading chart again
 | ||||
| 			$("#accumulateContainer").empty(); | ||||
| 			$("#accumulateContainer").append("<canvas id=\"myChartAccumulate\" width=\"400\" height=\"150\"></canvas><div id=\"accumulateTable\"></div>"); | ||||
| 
 | ||||
| 			// appending table to hold the data
 | ||||
| 			$("#accumulateTable").append('<table style="width:100%" class="accutable table table-sm table-bordered table-hover table-striped table-condensed text-center"><thead>' + | ||||
| 				'<tr>' + | ||||
| 				'<td>#</td>' + | ||||
| 				'<td>' + periodtext + '</td>' + | ||||
| 				'<td>Accumulated # of ' + awardtext + ' worked </td>'+ | ||||
| 				'</tr>' + | ||||
| 				'</thead>' + | ||||
| 				'<tbody></tbody></table>'); | ||||
| 			var labels = []; | ||||
| 			var dataDxcc = []; | ||||
| 
 | ||||
| 			var $myTable = $('.accutable'); | ||||
| 			var i = 1; | ||||
| 
 | ||||
| 			// building the rows in the table
 | ||||
| 			var rowElements = data.map(function ( row ) { | ||||
| 
 | ||||
| 				var $row = $('<tr></tr>'); | ||||
| 
 | ||||
| 				var $iterator = $('<td></td>').html(i++); | ||||
| 				var $type = $('<td></td>').html(row.year); | ||||
| 				var $content = $('<td></td>').html(row.total); | ||||
| 
 | ||||
| 				$row.append($iterator, $type, $content); | ||||
| 
 | ||||
| 				return $row; | ||||
| 			}); | ||||
| 
 | ||||
| 			// finally inserting the rows
 | ||||
| 			$myTable.append(rowElements); | ||||
| 
 | ||||
| 			$.each(data, function(){ | ||||
| 				labels.push(this.year); | ||||
| 				dataDxcc.push(this.total); | ||||
| 			}); | ||||
| 
 | ||||
| 			var ctx = document.getElementById("myChartAccumulate").getContext('2d'); | ||||
| 			var myChart = new Chart(ctx, { | ||||
| 				type: 'bar', | ||||
| 				data: { | ||||
| 					labels: labels, | ||||
| 					datasets: [{ | ||||
| 						label: 'Accumulated number of ' + awardtext + ' worked each ' + period, | ||||
| 						data: dataDxcc, | ||||
| 						backgroundColor: 'rgba(54, 162, 235, 0.2)', | ||||
| 						borderColor: 'rgba(54, 162, 235, 1)', | ||||
| 						borderWidth: 2, | ||||
| 					}] | ||||
| 				}, | ||||
| 				options: { | ||||
| 					scales: { | ||||
| 						yAxes: [{ | ||||
| 							ticks: { | ||||
| 								beginAtZero:true, | ||||
| 								fontColor: color | ||||
| 							} | ||||
| 						}], | ||||
| 						xAxes: [{ | ||||
| 							ticks: { | ||||
| 								fontColor: color | ||||
| 							} | ||||
| 						}] | ||||
| 					}, | ||||
| 					legend: { | ||||
| 						labels: { | ||||
| 							fontColor: color, | ||||
| 						} | ||||
| 					}, | ||||
| 				} | ||||
| 			}); | ||||
| 			$(".ld-ext-right").removeClass('running'); | ||||
| 			$(".ld-ext-right").prop('disabled', false); | ||||
| 			$('.accutable').DataTable({ | ||||
| 				responsive: false, | ||||
| 				ordering: false, | ||||
| 				"scrollY":        "400px", | ||||
| 				"scrollCollapse": true, | ||||
| 				"paging":         false, | ||||
| 				"scrollX": true, | ||||
| 				dom: 'Bfrtip', | ||||
| 				buttons: [ | ||||
| 					'csv' | ||||
| 				] | ||||
| 			}); | ||||
| 
 | ||||
| 			// using this to change color of csv-button if dark mode is chosen
 | ||||
| 			var background = $('body').css( "background-color"); | ||||
| 
 | ||||
| 			if (background != ('rgb(255, 255, 255)')) { | ||||
| 				$(".buttons-csv").css("color", "white"); | ||||
| 			} | ||||
| 		} | ||||
| 	}); | ||||
| } | ||||
|  | @ -0,0 +1,34 @@ | |||
| $.ajax({ | ||||
| 	url: base_url+'index.php/dayswithqso/get_days', | ||||
| 	success: function(data) { | ||||
| 		var labels = []; | ||||
| 		var dataDxcc = []; | ||||
| 		$.each(data, function(){ | ||||
| 			labels.push(this.Year); | ||||
| 			dataDxcc.push(this.Days); | ||||
| 		}); | ||||
| 		var ctx = document.getElementById("myChartDiff").getContext('2d'); | ||||
| 		var myChart = new Chart(ctx, { | ||||
| 			type: 'bar', | ||||
| 			data: { | ||||
| 				labels: labels, | ||||
| 				datasets: [{ | ||||
| 					label: 'Days with QSOs', | ||||
| 					data: dataDxcc, | ||||
| 					backgroundColor: 'rgba(54, 162, 235, 0.2)', | ||||
| 					borderColor: 'rgba(54, 162, 235, 1)', | ||||
| 					borderWidth: 2 | ||||
| 				}] | ||||
| 			}, | ||||
| 			options: { | ||||
| 				scales: { | ||||
| 					yAxes: [{ | ||||
| 						ticks: { | ||||
| 							beginAtZero:true | ||||
| 						} | ||||
| 					}] | ||||
| 				}, | ||||
| 			} | ||||
| 		}); | ||||
| 	} | ||||
| }); | ||||
							
								
								
									
										101
									
								
								assets/js/sections/distances.js
									
									
									
									
									
										普通文件
									
								
							
							
						
						
									
										101
									
								
								assets/js/sections/distances.js
									
									
									
									
									
										普通文件
									
								
							|  | @ -0,0 +1,101 @@ | |||
| $('#distplot_bands').change(function(){ | ||||
| 	var band = $("#distplot_bands option:selected").text(); | ||||
| 	if (band != "SAT") { | ||||
| 		$("#distplot_sats").prop('disabled', true); | ||||
| 	} else { | ||||
| 		$("#distplot_sats").prop('disabled', false); | ||||
| 	} | ||||
| }); | ||||
| 
 | ||||
| function distPlot(form) { | ||||
| 	$(".alert").remove(); | ||||
| 	var baseURL= "<?php echo base_url();?>"; | ||||
| 	$.ajax({ | ||||
| 		url: base_url+'index.php/distances/get_distances', | ||||
| 		type: 'post', | ||||
| 		data: {'band': form.distplot_bands.value, | ||||
| 			'sat': form.distplot_sats.value}, | ||||
| 		success: function(tmp) { | ||||
| 			if (tmp.ok == 'OK') { | ||||
| 				if (!($('#information').length > 0)) | ||||
| 					$("#distances_div").append('<div id="information"></div><div id="graphcontainer" style="height: 600px; margin: 0 auto"></div>'); | ||||
| 				var options = { | ||||
| 					chart: { | ||||
| 						type: 'column', | ||||
| 						zoomType: 'xy', | ||||
| 						renderTo: 'graphcontainer' | ||||
| 					}, | ||||
| 					title: { | ||||
| 						text: 'Distance Distribution' | ||||
| 					}, | ||||
| 					xAxis: { | ||||
| 						categories: [], | ||||
| 						crosshair: true, | ||||
| 						type: "category", | ||||
| 						min:0, | ||||
| 						max:100 | ||||
| 
 | ||||
| 					}, | ||||
| 					yAxis: { | ||||
| 						title: { | ||||
| 							text: '# QSOs' | ||||
| 						} | ||||
| 					}, | ||||
| 					navigator: { | ||||
| 						enabled: true, | ||||
| 						xAxis: { | ||||
| 							labels: { | ||||
| 								formatter: function() { | ||||
| 									return this.value * '50' + ' ' + tmp.unit; | ||||
| 								} | ||||
| 							} | ||||
| 						} | ||||
| 					}, | ||||
| 					rangeSelector: { | ||||
| 						selected: 1 | ||||
| 					}, | ||||
| 					tooltip: { | ||||
| 						formatter: function () { | ||||
| 							if(this.point) { | ||||
| 								return "Distance: " + options.xAxis.categories[this.point.x] + | ||||
| 									"<br />Callsign(s) worked (max 5 shown): " + myComments[this.point.x] + | ||||
| 									"<br />Number of QSOs: <strong>" + series.data[this.point.x] + "</strong>"; | ||||
| 							} | ||||
| 						} | ||||
| 					}, | ||||
| 					series: [] | ||||
| 				}; | ||||
| 				var myComments=[]; | ||||
| 
 | ||||
| 				var series = { | ||||
| 					data: [], | ||||
| 					showInNavigator: true | ||||
| 				}; | ||||
| 
 | ||||
| 				$.each(tmp.qsodata, function(){ | ||||
| 					myComments.push(this.calls); | ||||
| 					options.xAxis.categories.push(this.dist); | ||||
| 					series.name = 'Number of QSOs'; | ||||
| 					series.data.push(this.count); | ||||
| 
 | ||||
| 				}); | ||||
| 
 | ||||
| 				options.series.push(series); | ||||
| 
 | ||||
| 				$('#information').html(tmp.qrb.Qsoes + " contacts were plotted.<br /> Your furthest contact was with " + tmp.qrb.Callsign | ||||
| 					+ " in gridsquare "+ tmp.qrb.Grid | ||||
| 					+"; the distance was " | ||||
| 					+tmp.qrb.Distance + tmp.unit +"."); | ||||
| 
 | ||||
| 				var chart = new Highcharts.Chart(options); | ||||
| 			} | ||||
| 			else { | ||||
| 				if (($('#information').length > 0)) { | ||||
| 					$("#information").remove(); | ||||
| 					$("#graphcontainer").remove(); | ||||
| 				} | ||||
| 				$("#distances_div").append('<div class="alert alert-danger" role="alert"><a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>' + tmp.Error + '</div>'); | ||||
| 			} | ||||
| 		} | ||||
| 	}); | ||||
| } | ||||
							
								
								
									
										47
									
								
								assets/js/sections/qrzlogbook.js
									
									
									
									
									
										普通文件
									
								
							
							
						
						
									
										47
									
								
								assets/js/sections/qrzlogbook.js
									
									
									
									
									
										普通文件
									
								
							|  | @ -0,0 +1,47 @@ | |||
| function ExportQrz(station_id) { | ||||
| 	if ($(".alert").length > 0) { | ||||
| 		$(".alert").remove(); | ||||
| 	} | ||||
| 	if ($(".errormessages").length > 0) { | ||||
| 		$(".errormessages").remove(); | ||||
| 	} | ||||
| 	$(".ld-ext-right").addClass('running'); | ||||
| 	$(".ld-ext-right").prop('disabled', true); | ||||
| 
 | ||||
| 	$.ajax({ | ||||
| 		url: base_url + 'index.php/qrz/upload_station', | ||||
| 		type: 'post', | ||||
| 		data: {'station_id': station_id}, | ||||
| 		success: function (data) { | ||||
| 			$(".ld-ext-right").removeClass('running'); | ||||
| 			$(".ld-ext-right").prop('disabled', false); | ||||
| 			if (data.status == 'OK') { | ||||
| 				$.each(data.info, function(index, value){ | ||||
| 					$('#modcount'+value.station_id).html(value.modcount); | ||||
| 					$('#notcount'+value.station_id).html(value.notcount); | ||||
| 					$('#totcount'+value.station_id).html(value.totcount); | ||||
| 				}); | ||||
| 				$(".card-body").append('<div class="alert alert-success" role="alert"><a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>' + data.infomessage + '</div>'); | ||||
| 			} | ||||
| 			else { | ||||
| 				$(".card-body").append('<div class="alert alert-danger" role="alert"><a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>' + data.info + '</div>'); | ||||
| 			} | ||||
| 
 | ||||
| 			if (data.errormessages.length > 0) { | ||||
| 				$(".card-body").append('' + | ||||
| 					'<div class="errormessages"><p>\n' + | ||||
| 					'                            <button class="btn btn-danger" type="button" data-toggle="collapse" data-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample">\n' + | ||||
| 					'                                Show error messages\n' + | ||||
| 					'                            </button>\n' + | ||||
| 					'                            </p>\n' + | ||||
| 					'                            <div class="collapse" id="collapseExample">\n' + | ||||
| 					'                                <div class="card card-body"><div class="errors"></div>\n' + | ||||
| 					'                            </div>\n' + | ||||
| 					'                            </div></div>'); | ||||
| 				$.each(data.errormessages, function(index, value) { | ||||
| 					$(".errors").append('<li>' + value); | ||||
| 				}); | ||||
| 			} | ||||
| 		} | ||||
| 	}); | ||||
| } | ||||
		正在加载…
	
		在新工单中引用