当前提交
9b595b281b
共有 5 个文件被更改,包括 43 次插入 和 7 次删除
|
|
@ -44,6 +44,7 @@ class QSO extends CI_Controller {
|
|||
$this->form_validation->set_rules('start_date', 'Date', 'required');
|
||||
$this->form_validation->set_rules('start_time', 'Time', 'required');
|
||||
$this->form_validation->set_rules('callsign', 'Callsign', 'required');
|
||||
$this->form_validation->set_rules('locator', 'Locator', 'callback_check_locator');
|
||||
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
{
|
||||
|
|
@ -443,4 +444,26 @@ class QSO extends CI_Controller {
|
|||
header('Content-Type: application/json');
|
||||
echo $input;
|
||||
}
|
||||
|
||||
function check_locator($grid) {
|
||||
$grid = $this->input->post('locator');
|
||||
// Allow empty locator
|
||||
if (preg_match('/^$/', $grid)) return true;
|
||||
// Allow 6-digit locator
|
||||
if (preg_match('/^[A-Ra-r]{2}[0-9]{2}[A-Ra-r]{2}$/', $grid)) return true;
|
||||
// Allow 4-digit locator
|
||||
else if (preg_match('/^[A-Ra-r]{2}[0-9]{2}$/', $grid)) return true;
|
||||
// Allow 4-digit grid line
|
||||
else if (preg_match('/^[A-Ra-r]{2}[0-9]{2},[A-Ra-r]{2}[0-9]{2}$/', $grid)) return true;
|
||||
// Allow 4-digit grid corner
|
||||
else if (preg_match('/^[A-Ra-r]{2}[0-9]{2},[A-Ra-r]{2}[0-9]{2},[A-Ra-r]{2}[0-9]{2},[A-Ra-r]{2}[0-9]{2}$/', $grid)) return true;
|
||||
// Allow 2-digit locator
|
||||
else if (preg_match('/^[A-Ra-r]{2}$/', $grid)) return true;
|
||||
// Allow 8-digit locator
|
||||
else if (preg_match('/^[A-Ra-r]{2}[0-9]{2}[A-Ra-r]{2}[0-9]{2}$/', $grid)) return true;
|
||||
else {
|
||||
$this->form_validation->set_message('check_locator', 'Please check value for grid locator ('.strtoupper($grid).').');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ class Activators_model extends CI_Model
|
|||
|
||||
$location_list = "'".implode("','",$logbooks_locations_array)."'";
|
||||
|
||||
$sql = "SELECT DISTINCT COL_CALL AS `call`, GROUP_CONCAT(REGEXP_REPLACE(COL_VUCC_GRIDS, '([A-Z]{2}[0-9]{2})[A-Z]{2}', '$1')) AS `vucc_grids` FROM ".$this->config->item('table_name')." WHERE station_id in (" . $location_list . ")";
|
||||
$sql = "SELECT DISTINCT COL_CALL AS `call`, GROUP_CONCAT(COL_VUCC_GRIDS) AS `vucc_grids` FROM ".$this->config->item('table_name')." WHERE station_id in (" . $location_list . ")";
|
||||
if ($band != 'All') {
|
||||
if ($band == 'SAT') {
|
||||
switch ($leogeo) {
|
||||
|
|
|
|||
|
|
@ -70,17 +70,20 @@
|
|||
$vucc_grids[$line->call] = $line->vucc_grids;
|
||||
}
|
||||
}
|
||||
if ($activators_array) {
|
||||
if( $this->input->post('band') != NULL) {
|
||||
if ($activators_array) {
|
||||
|
||||
$result = write_activators($activators_array, $vucc_grids, $custom_date_format, $this->input->post('band'), $this->input->post('leogeo'));
|
||||
}
|
||||
else {
|
||||
echo '<div class="alert alert-danger" role="alert"><a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>Nothing found!</div>';
|
||||
$result = write_activators($activators_array, $vucc_grids, $custom_date_format, $this->input->post('band'), $this->input->post('leogeo'));
|
||||
}
|
||||
else {
|
||||
echo '<div class="alert alert-danger" role="alert"><a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>Nothing found!</div>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
function write_activators($activators_array, $vucc_grids, $custom_date_format, $band, $leogeo) {
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@
|
|||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="locator" class="col-sm-3 col-form-label"><?php echo $this->lang->line('gen_hamradio_locator'); ?></label>
|
||||
<label for="locator" class="col-sm-3 col-form-label"><?php echo $this->lang->line('gen_hamradio_gridsquare'); ?></label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" class="form-control form-control-sm" name="locator" id="locator" value="">
|
||||
<small id="locator_info" class="form-text text-muted"></small>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,14 @@
|
|||
$( document ).ready(function() {
|
||||
|
||||
$("#locator")
|
||||
.popover({ placement: 'top', title: 'Gridsquare Formatting', content: "Enter multiple (4-digit) grids separated with commas. For example: IO77,IO78" })
|
||||
.focus(function () {
|
||||
$('#locator').popover('show');
|
||||
})
|
||||
.blur(function () {
|
||||
$('#locator').popover('hide');
|
||||
});
|
||||
|
||||
$("#sat_name").change(function(){
|
||||
var sat = $("#sat_name").val();
|
||||
if (sat == "") {
|
||||
|
|
|
|||
正在加载…
在新工单中引用