First part of converting visitor map to gridmap
这个提交包含在:
父节点
9e7416afe5
当前提交
aebf53e35b
共有 6 个文件被更改,包括 124 次插入 和 86 次删除
|
|
@ -13,6 +13,7 @@ class Gridmap extends CI_Controller {
|
|||
$this->load->model('gridmap_model');
|
||||
$this->load->model('stations');
|
||||
|
||||
$data['visitor'] = false;
|
||||
$data['homegrid'] = explode(',', $this->stations->find_gridsquare());
|
||||
|
||||
$data['modes'] = $this->gridmap_model->get_worked_modes();
|
||||
|
|
|
|||
|
|
@ -115,11 +115,11 @@ class Visitor extends CI_Controller {
|
|||
|
||||
$this->load->model('dxcc');
|
||||
$dxcc = $this->dxcc->list_current();
|
||||
|
||||
|
||||
$current = $this->logbook_model->total_countries_current($logbooks_locations_array);
|
||||
|
||||
|
||||
$data['total_countries_needed'] = count($dxcc->result()) - $current;
|
||||
|
||||
|
||||
$this->load->view('visitor/layout/header', $data);
|
||||
$this->load->view('visitor/index');
|
||||
$this->load->view('visitor/layout/footer');
|
||||
|
|
@ -128,10 +128,10 @@ class Visitor extends CI_Controller {
|
|||
log_message('error', '[Visitor] XSS Attack detected on public_slug '. $public_slug);
|
||||
show_404('Unknown Public Page.');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function radio_display_component() {
|
||||
$this->load->model('cat');
|
||||
|
||||
|
|
@ -141,7 +141,7 @@ class Visitor extends CI_Controller {
|
|||
|
||||
public function map() {
|
||||
$this->load->model('logbook_model');
|
||||
|
||||
|
||||
$this->load->library('qra');
|
||||
|
||||
$slug = $this->security->xss_clean($this->uri->segment(3));
|
||||
|
|
@ -173,7 +173,7 @@ class Visitor extends CI_Controller {
|
|||
echo ",";
|
||||
}
|
||||
|
||||
if($row->COL_SAT_NAME != null) {
|
||||
if($row->COL_SAT_NAME != null) {
|
||||
echo "{\"lat\":\"".$stn_loc[0]."\",\"lng\":\"".$stn_loc[1]."\", \"html\":\"Callsign: ".$row->COL_CALL."<br />Date/Time: ".$row->COL_TIME_ON."<br />SAT: ".$row->COL_SAT_NAME."<br />Mode: ";
|
||||
echo $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE;
|
||||
echo "\",\"label\":\"".$row->COL_CALL."\"}";
|
||||
|
|
@ -190,10 +190,10 @@ class Visitor extends CI_Controller {
|
|||
if (count($grids) == 2) {
|
||||
$grid1 = $this->qra->qra2latlong(trim($grids[0]));
|
||||
$grid2 = $this->qra->qra2latlong(trim($grids[1]));
|
||||
|
||||
|
||||
$coords[]=array('lat' => $grid1[0],'lng'=> $grid1[1]);
|
||||
$coords[]=array('lat' => $grid2[0],'lng'=> $grid2[1]);
|
||||
|
||||
$coords[]=array('lat' => $grid2[0],'lng'=> $grid2[1]);
|
||||
|
||||
$stn_loc = $this->qra->get_midpoint($coords);
|
||||
}
|
||||
if (count($grids) == 4) {
|
||||
|
|
@ -201,20 +201,20 @@ class Visitor extends CI_Controller {
|
|||
$grid2 = $this->qra->qra2latlong(trim($grids[1]));
|
||||
$grid3 = $this->qra->qra2latlong(trim($grids[2]));
|
||||
$grid4 = $this->qra->qra2latlong(trim($grids[3]));
|
||||
|
||||
|
||||
$coords[]=array('lat' => $grid1[0],'lng'=> $grid1[1]);
|
||||
$coords[]=array('lat' => $grid2[0],'lng'=> $grid2[1]);
|
||||
$coords[]=array('lat' => $grid3[0],'lng'=> $grid3[1]);
|
||||
$coords[]=array('lat' => $grid4[0],'lng'=> $grid4[1]);
|
||||
|
||||
$coords[]=array('lat' => $grid2[0],'lng'=> $grid2[1]);
|
||||
$coords[]=array('lat' => $grid3[0],'lng'=> $grid3[1]);
|
||||
$coords[]=array('lat' => $grid4[0],'lng'=> $grid4[1]);
|
||||
|
||||
$stn_loc = $this->qra->get_midpoint($coords);
|
||||
}
|
||||
|
||||
if($count != 1) {
|
||||
echo ",";
|
||||
}
|
||||
|
||||
if($row->COL_SAT_NAME != null) {
|
||||
|
||||
if($row->COL_SAT_NAME != null) {
|
||||
echo "{\"lat\":\"".$stn_loc[0]."\",\"lng\":\"".$stn_loc[1]."\", \"html\":\"Callsign: ".$row->COL_CALL."<br />Date/Time: ".$row->COL_TIME_ON."<br />SAT: ".$row->COL_SAT_NAME."<br />Mode: ";
|
||||
echo $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE;
|
||||
echo "\",\"label\":\"".$row->COL_CALL."\"}";
|
||||
|
|
@ -223,9 +223,9 @@ class Visitor extends CI_Controller {
|
|||
echo $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE;
|
||||
echo "\",\"label\":\"".$row->COL_CALL."\"}";
|
||||
}
|
||||
|
||||
|
||||
$count++;
|
||||
|
||||
|
||||
} else {
|
||||
if($count != 1) {
|
||||
echo ",";
|
||||
|
|
@ -261,7 +261,7 @@ class Visitor extends CI_Controller {
|
|||
{
|
||||
// Get associated station locations for mysql queries
|
||||
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($logbook_id);
|
||||
|
||||
|
||||
if (!$logbooks_locations_array) {
|
||||
show_404('Empty Logbook');
|
||||
}
|
||||
|
|
@ -271,7 +271,7 @@ class Visitor extends CI_Controller {
|
|||
}
|
||||
}
|
||||
|
||||
$this->load->model('gridsquares_model');
|
||||
$this->load->model('gridmap_model');
|
||||
|
||||
$data['page_title'] = "Satellite Gridsquare Map";
|
||||
|
||||
|
|
@ -295,7 +295,7 @@ class Visitor extends CI_Controller {
|
|||
|
||||
|
||||
// Get Confirmed LoTW & Paper Squares (non VUCC)
|
||||
$query = $this->gridsquares_model->get_confirmed_sat_squares($logbooks_locations_array);
|
||||
$query = $this->gridmap_model->get_band_confirmed('SAT', 'All', 'false', 'true', 'false', 'All', $logbooks_locations_array);
|
||||
|
||||
|
||||
if ($query && $query->num_rows() > 0)
|
||||
|
|
@ -303,26 +303,26 @@ class Visitor extends CI_Controller {
|
|||
foreach ($query->result() as $row)
|
||||
{
|
||||
|
||||
$grid_2char_confirmed = strtoupper(substr($row->SAT_SQUARE,0,2));
|
||||
$grid_4char_confirmed = strtoupper(substr($row->SAT_SQUARE,0,4));
|
||||
$grid_2char_confirmed = strtoupper(substr($row->GRID_SQUARES,0,2));
|
||||
$grid_4char_confirmed = strtoupper(substr($row->GRID_SQUARES,0,4));
|
||||
if ($this->config->item('map_6digit_grids')) {
|
||||
$grid_6char_confirmed = strtoupper(substr($row->SAT_SQUARE,0,6));
|
||||
$grid_6char_confirmed = strtoupper(substr($row->GRID_SQUARES,0,6));
|
||||
}
|
||||
|
||||
// Check if 2 Char is in array
|
||||
if(!in_array($grid_2char_confirmed, $array_confirmed_grid_2char)){
|
||||
array_push($array_confirmed_grid_2char, $grid_2char_confirmed);
|
||||
array_push($array_confirmed_grid_2char, $grid_2char_confirmed);
|
||||
}
|
||||
|
||||
|
||||
if(!in_array($grid_4char_confirmed, $array_confirmed_grid_4char)){
|
||||
array_push($array_confirmed_grid_4char, $grid_4char_confirmed);
|
||||
array_push($array_confirmed_grid_4char, $grid_4char_confirmed);
|
||||
}
|
||||
|
||||
|
||||
if ($this->config->item('map_6digit_grids')) {
|
||||
if(!in_array($grid_6char_confirmed, $array_confirmed_grid_6char)){
|
||||
array_push($array_confirmed_grid_6char, $grid_6char_confirmed);
|
||||
array_push($array_confirmed_grid_6char, $grid_6char_confirmed);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -331,33 +331,33 @@ class Visitor extends CI_Controller {
|
|||
}
|
||||
|
||||
// Get worked squares
|
||||
$query = $this->gridsquares_model->get_worked_sat_squares($logbooks_locations_array);
|
||||
$query = $this->gridmap_model->get_band('SAT', 'All', 'false', 'true', 'false', 'All', $logbooks_locations_array);
|
||||
|
||||
if ($query && $query->num_rows() > 0)
|
||||
{
|
||||
foreach ($query->result() as $row)
|
||||
{
|
||||
|
||||
$grid_two = strtoupper(substr($row->SAT_SQUARE,0,2));
|
||||
$grid_four = strtoupper(substr($row->SAT_SQUARE,0,4));
|
||||
$grid_two = strtoupper(substr($row->GRID_SQUARES,0,2));
|
||||
$grid_four = strtoupper(substr($row->GRID_SQUARES,0,4));
|
||||
if ($this->config->item('map_6digit_grids')) {
|
||||
$grid_six = strtoupper(substr($row->SAT_SQUARE,0,6));
|
||||
$grid_six = strtoupper(substr($row->GRID_SQUARES,0,6));
|
||||
}
|
||||
|
||||
// Check if 2 Char is in array
|
||||
if(!in_array($grid_two, $array_grid_2char)){
|
||||
array_push($array_grid_2char, $grid_two);
|
||||
array_push($array_grid_2char, $grid_two);
|
||||
}
|
||||
|
||||
|
||||
if(!in_array($grid_four, $array_grid_4char)){
|
||||
array_push($array_grid_4char, $grid_four);
|
||||
array_push($array_grid_4char, $grid_four);
|
||||
}
|
||||
|
||||
|
||||
if ($this->config->item('map_6digit_grids')) {
|
||||
if(!in_array($grid_six, $array_grid_6char)){
|
||||
array_push($array_grid_6char, $grid_six);
|
||||
array_push($array_grid_6char, $grid_six);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -365,7 +365,7 @@ class Visitor extends CI_Controller {
|
|||
}
|
||||
}
|
||||
|
||||
$query_vucc = $this->gridsquares_model->get_worked_sat_vucc_squares($logbooks_locations_array);
|
||||
$query_vucc = $this->gridmap_model->get_band_worked_vucc_squares('SAT', 'All', 'false', 'true', 'false', 'All', $logbooks_locations_array);
|
||||
|
||||
if ($query && $query_vucc->num_rows() > 0)
|
||||
{
|
||||
|
|
@ -374,25 +374,25 @@ class Visitor extends CI_Controller {
|
|||
|
||||
$grids = explode(",", $row->COL_VUCC_GRIDS);
|
||||
|
||||
foreach($grids as $key) {
|
||||
foreach($grids as $key) {
|
||||
$grid_two = strtoupper(substr($key,0,2));
|
||||
$grid_four = strtoupper(substr($key,0,4));
|
||||
|
||||
// Check if 2 Char is in array
|
||||
if(!in_array($grid_two, $array_grid_2char)){
|
||||
array_push($array_grid_2char, $grid_two);
|
||||
array_push($array_grid_2char, $grid_two);
|
||||
}
|
||||
|
||||
|
||||
if(!in_array($grid_four, $array_grid_4char)){
|
||||
array_push($array_grid_4char, $grid_four);
|
||||
array_push($array_grid_4char, $grid_four);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Confirmed Squares
|
||||
$query_vucc = $this->gridsquares_model->get_confirmed_sat_vucc_squares($logbooks_locations_array);
|
||||
$query_vucc = $this->gridmap_model->get_band_confirmed_vucc_squares('SAT', 'All', 'false', 'true', 'false', 'All', $logbooks_locations_array);
|
||||
|
||||
if ($query && $query_vucc->num_rows() > 0)
|
||||
{
|
||||
|
|
@ -401,18 +401,18 @@ class Visitor extends CI_Controller {
|
|||
|
||||
$grids = explode(",", $row->COL_VUCC_GRIDS);
|
||||
|
||||
foreach($grids as $key) {
|
||||
foreach($grids as $key) {
|
||||
$grid_2char_confirmed = strtoupper(substr($key,0,2));
|
||||
$grid_4char_confirmed = strtoupper(substr($key,0,4));
|
||||
|
||||
// Check if 2 Char is in array
|
||||
if(!in_array($grid_2char_confirmed, $array_confirmed_grid_2char)){
|
||||
array_push($array_confirmed_grid_2char, $grid_2char_confirmed);
|
||||
array_push($array_confirmed_grid_2char, $grid_2char_confirmed);
|
||||
}
|
||||
|
||||
|
||||
if(!in_array($grid_4char_confirmed, $array_confirmed_grid_4char)){
|
||||
array_push($array_confirmed_grid_4char, $grid_4char_confirmed);
|
||||
array_push($array_confirmed_grid_4char, $grid_4char_confirmed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -439,9 +439,19 @@ class Visitor extends CI_Controller {
|
|||
$data['grid_4char'] = js_array($array_grid_4char);
|
||||
$data['grid_6char'] = js_array($array_grid_6char);
|
||||
|
||||
$data['homegrid'] = 'JO31OL';
|
||||
$data['layer'] = $this->optionslib->get_option('option_map_tile_server');
|
||||
$data['attribution'] = $this->optionslib->get_option('option_map_tile_server_copyright');
|
||||
|
||||
$data['gridsquares_gridsquares'] = lang('gridsquares_gridsquares');
|
||||
$data['gridsquares_gridsquares_confirmed'] = lang('gridsquares_gridsquares_confirmed');
|
||||
$data['gridsquares_gridsquares_not_confirmed'] = lang('gridsquares_gridsquares_not_confirmed');
|
||||
$data['gridsquares_gridsquares_total_worked'] = lang('gridsquares_gridsquares_total_worked');
|
||||
|
||||
$data['visitor'] = true;
|
||||
|
||||
$this->load->view('visitor/layout/header', $data);
|
||||
$this->load->view('gridsquares/index');
|
||||
$this->load->view('gridmap/index', $data);
|
||||
$this->load->view('visitor/layout/footer');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,10 +2,12 @@
|
|||
|
||||
class Gridmap_model extends CI_Model {
|
||||
|
||||
function get_band_confirmed($band, $mode, $qsl, $lotw, $eqsl, $sat) {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
function get_band_confirmed($band, $mode, $qsl, $lotw, $eqsl, $sat, $logbooks_locations_array = NULL) {
|
||||
if ($logbooks_locations_array == NULL) {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
}
|
||||
|
||||
if (!$logbooks_locations_array) {
|
||||
return null;
|
||||
|
|
@ -40,10 +42,12 @@ class Gridmap_model extends CI_Model {
|
|||
return $this->db->query($sql);
|
||||
}
|
||||
|
||||
function get_band($band, $mode, $qsl, $lotw, $eqsl, $sat) {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
function get_band($band, $mode, $qsl, $lotw, $eqsl, $sat, $logbooks_locations_array = NULL) {
|
||||
if ($logbooks_locations_array == NULL) {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
}
|
||||
|
||||
if (!$logbooks_locations_array) {
|
||||
return null;
|
||||
|
|
@ -76,10 +80,12 @@ class Gridmap_model extends CI_Model {
|
|||
return $this->db->query($sql);
|
||||
}
|
||||
|
||||
function get_band_worked_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $sat) {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
function get_band_worked_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $sat, $logbooks_locations_array = NULL) {
|
||||
if ($logbooks_locations_array == NULL) {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
}
|
||||
|
||||
if (!$logbooks_locations_array) {
|
||||
return null;
|
||||
|
|
@ -112,10 +118,12 @@ class Gridmap_model extends CI_Model {
|
|||
return $this->db->query($sql);
|
||||
}
|
||||
|
||||
function get_band_confirmed_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $sat) {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
function get_band_confirmed_vucc_squares($band, $mode, $qsl, $lotw, $eqsl, $sat, $logbooks_locations_array = NULL) {
|
||||
if ($logbooks_locations_array == NULL) {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
}
|
||||
|
||||
if (!$logbooks_locations_array) {
|
||||
return null;
|
||||
|
|
@ -223,4 +231,4 @@ class Gridmap_model extends CI_Model {
|
|||
|
||||
return $results;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@
|
|||
|
||||
<h2><?php echo $page_title; ?></h2>
|
||||
|
||||
<?php if ($visitor == false) { ?>
|
||||
<form class="d-flex align-items-center">
|
||||
<label class="my-1 me-2" for="band"><?php echo lang('gridsquares_band'); ?></label>
|
||||
<select class="form-select my-1 me-sm-2 w-auto" id="band">
|
||||
|
|
@ -111,6 +112,7 @@
|
|||
<button id="plot" type="button" name="plot" class="btn btn-primary me-1 ld-ext-right ld-ext-right-plot" onclick="gridPlot(this.form)"><?php echo lang('gridsquares_button_plot'); ?><div class="ld ld-ring ld-spin"></div></button>
|
||||
<button id="clear" type="button" name="clear" class="btn btn-primary me-1 ld-ext-right ld-ext-right-clear" onclick="clearMarkers()"><?php echo lang('gridsquares_button_clear_markers'); ?><div class="ld ld-ring ld-spin"></div></button>
|
||||
</form>
|
||||
<?php } ?>
|
||||
|
||||
<?php if($this->session->flashdata('message')) { ?>
|
||||
<!-- Display Message -->
|
||||
|
|
@ -135,16 +137,22 @@
|
|||
<div class="cohidden"><?php echo lang('gen_hamradio_bearing')?>: </div>
|
||||
<div class="cohidden col-auto text-success fw-bold" id="bearing"></div>
|
||||
</div>
|
||||
<script>var gridsquaremap = true;
|
||||
<script>
|
||||
var gridsquaremap = true;
|
||||
var type = "worked";
|
||||
<?php if ($visitor == true) { ?>
|
||||
var visitor = true;
|
||||
<?php } else { ?>
|
||||
var visitor = false;
|
||||
<?php } ?>
|
||||
<?php
|
||||
echo 'var jslayer ="' . $layer .'";';
|
||||
echo "var jslayer = \"" . $layer ."\";\n";
|
||||
echo "var jsattribution ='" . $attribution . "';";
|
||||
echo "var homegrid ='" . strtoupper($homegrid[0]) . "';";
|
||||
echo "var homegrid = \"" . strtoupper($homegrid[0]) . "\";\n";
|
||||
|
||||
echo 'var gridsquares_gridsquares = "' . $gridsquares_gridsquares . '";';
|
||||
echo 'var gridsquares_gridsquares_confirmed = "' . $gridsquares_gridsquares_confirmed . '";';
|
||||
echo 'var gridsquares_gridsquares_not_confirmed = "' . $gridsquares_gridsquares_not_confirmed . '";';
|
||||
echo 'var gridsquares_gridsquares_total_worked = "' . $gridsquares_gridsquares_total_worked . '";';
|
||||
echo "var gridsquares_gridsquares = \"" . $gridsquares_gridsquares . "\";\n";
|
||||
echo "var gridsquares_gridsquares_confirmed = \"" . $gridsquares_gridsquares_confirmed . "\";\n";
|
||||
echo "var gridsquares_gridsquares_not_confirmed = \"" . $gridsquares_gridsquares_not_confirmed . "\";\n";
|
||||
echo "var gridsquares_gridsquares_total_worked = \"" . $gridsquares_gridsquares_total_worked . "\";\n";
|
||||
?>
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -105,14 +105,14 @@
|
|||
|
||||
if (grid_four_confirmed_count > 0) {
|
||||
var span = document.getElementById('confirmed_grids');
|
||||
span.innerText = span.textContent = '('+grid_four_confirmed_count+' grid squares) ';
|
||||
//span.innerText = span.textContent = '('+grid_four_confirmed_count+' grid squares) ';
|
||||
}
|
||||
if ((grid_four_count-grid_four_confirmed_count) > 0) {
|
||||
var span = document.getElementById('worked_grids');
|
||||
span.innerText = span.textContent = '('+(grid_four_count-grid_four_confirmed_count)+' grid squares) ';
|
||||
//span.innerText = span.textContent = '('+(grid_four_count-grid_four_confirmed_count)+' grid squares) ';
|
||||
}
|
||||
var span = document.getElementById('sum_grids');
|
||||
span.innerText = span.textContent = ' Total Count: '+grid_four_count+' grid squares';
|
||||
//span.innerText = span.textContent = ' Total Count: '+grid_four_count+' grid squares';
|
||||
|
||||
var maidenhead = L.maidenhead().addTo(map);
|
||||
|
||||
|
|
@ -201,6 +201,7 @@
|
|||
<?php } ?>
|
||||
<?php } ?>
|
||||
</script>
|
||||
<script type="text/javascript" src="<?php echo base_url();?>assets/js/sections/gridmap.js?"></script>
|
||||
<?php if ($this->CI->public_search_enabled($slug) || $this->session->userdata('user_type') >= 2) { ?>
|
||||
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/datatables.min.js"></script>
|
||||
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/dataTables.buttons.min.js"></script>
|
||||
|
|
|
|||
|
|
@ -8,16 +8,18 @@ $('#band').change(function(){
|
|||
});
|
||||
|
||||
var map;
|
||||
var grid_two = '';
|
||||
var grid_four = '';
|
||||
var grid_six = '';
|
||||
var grid_two_confirmed = '';
|
||||
var grid_four_confirmed = '';
|
||||
var grid_six_confirmed = '';
|
||||
if (typeof(visitor) !== 'undefined' && visitor != true) {
|
||||
var grid_two = '';
|
||||
var grid_four = '';
|
||||
var grid_six = '';
|
||||
var grid_two_confirmed = '';
|
||||
var grid_four_confirmed = '';
|
||||
var grid_six_confirmed = '';
|
||||
}
|
||||
|
||||
function gridPlot(form) {
|
||||
function gridPlot(form, visitor) {
|
||||
$(".ld-ext-right-plot").addClass('running');
|
||||
$(".ld-ext-right-plot").prop('disabled', true);
|
||||
$(".ld-ext-right-plot").prop('disabled', true);
|
||||
$('#plot').prop("disabled", true);
|
||||
// If map is already initialized
|
||||
var container = L.DomUtil.get('gridsquare_map');
|
||||
|
|
@ -36,6 +38,7 @@ function gridPlot(form) {
|
|||
ajax_url = site_url + '/gridmap/getGridsjs';
|
||||
}
|
||||
|
||||
if (visitor != true) {
|
||||
$.ajax({
|
||||
url: ajax_url,
|
||||
type: 'post',
|
||||
|
|
@ -52,12 +55,24 @@ function gridPlot(form) {
|
|||
$(".ld-ext-right-plot").removeClass('running');
|
||||
$(".ld-ext-right-plot").prop('disabled', false);
|
||||
$('#plot').prop("disabled", false);
|
||||
grid_two = data.grid_2char;
|
||||
grid_two = data.grid_2char;
|
||||
grid_four = data.grid_4char;
|
||||
grid_six = data.grid_6char;
|
||||
grid_two_confirmed = data.grid_2char_confirmed;
|
||||
grid_four_confirmed = data.grid_4char_confirmed;
|
||||
grid_six_confirmed = data.grid_6char_confirmed;
|
||||
plot(grid_two, grid_four, grid_six, grid_two_confirmed, grid_four_confirmed, grid_six_confirmed);
|
||||
|
||||
},
|
||||
error: function (data) {
|
||||
},
|
||||
});
|
||||
} else {
|
||||
plot(grid_two, grid_four, grid_six, grid_two_confirmed, grid_four_confirmed, grid_six_confirmed);
|
||||
};
|
||||
}
|
||||
|
||||
function plot(grid_two, grid_four, grid_six, grid_two_confirmed, grid_four_confirmed, grid_six_confirmed) {
|
||||
var layer = L.tileLayer(jslayer, {
|
||||
maxZoom: 12,
|
||||
attribution: jsattribution,
|
||||
|
|
@ -100,11 +115,6 @@ function gridPlot(form) {
|
|||
var maidenhead = L.maidenhead().addTo(map);
|
||||
map.on('mousemove', onMapMove);
|
||||
map.on('click', onMapClick);
|
||||
|
||||
},
|
||||
error: function (data) {
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function spawnGridsquareModal(loc_4char) {
|
||||
|
|
@ -174,5 +184,5 @@ function clearMarkers() {
|
|||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
gridPlot(this.form);
|
||||
gridPlot(this.form, visitor);
|
||||
})
|
||||
|
|
|
|||
正在加载…
在新工单中引用