当前提交
51688fb552
共有 14 个文件被更改,包括 298 次插入 和 3 次删除
|
|
@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE;
|
|||
| be upgraded / downgraded to.
|
||||
|
|
||||
*/
|
||||
$config['migration_version'] = 128;
|
||||
$config['migration_version'] = 129;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -129,6 +129,12 @@ class Logbooks extends CI_Controller {
|
|||
$this->load->view('logbooks/components/publicSlugInputValidation', $data);
|
||||
}
|
||||
|
||||
public function save_publicsearch() {
|
||||
$this->load->model('logbooks_model');
|
||||
$returndata = $this->logbooks_model->save_public_search($this->input->post('public_search'), $this->input->post('logbook_id'));
|
||||
echo "<div class=\"alert alert-success\" role=\"alert\">Public Search Setttings Saved</div>";
|
||||
}
|
||||
|
||||
public function save_publicslug() {
|
||||
$this->load->model('logbooks_model');
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,9 @@ class Visitor extends CI_Controller {
|
|||
elseif($method == "satellites") {
|
||||
$this->satellites($method);
|
||||
}
|
||||
elseif($method == "search") {
|
||||
$this->search($method);
|
||||
}
|
||||
else {
|
||||
$this->index($method);
|
||||
}
|
||||
|
|
@ -452,4 +455,34 @@ class Visitor extends CI_Controller {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function public_search_enabled($slug) {
|
||||
$this->load->model('Logbooks_model');
|
||||
$logbook_id = $this->Logbooks_model->public_slug_exists_logbook_id($slug);
|
||||
if ($this->Logbooks_model->public_search_enabled($logbook_id) == 1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function search() {
|
||||
$callsign = $this->security->xss_clean($this->input->post('callsign'));
|
||||
$public_slug = $this->security->xss_clean($this->input->post('public_slug'));
|
||||
$this->load->model('publicsearch');
|
||||
$result = $this->publicsearch->search($public_slug, $callsign);
|
||||
$data['callsign'] = $callsign;
|
||||
$data['slug'] = $public_slug;
|
||||
if (!empty($result) && $result->num_rows() > 0) {
|
||||
$data['results'] = $result;
|
||||
$this->load->view('visitor/layout/header', $data);
|
||||
$this->load->view('public_search/result.php', $data);
|
||||
$this->load->view('visitor/layout/footer');
|
||||
} else {
|
||||
$this->load->view('visitor/layout/header', $data);
|
||||
$this->load->view('public_search/empty.php', $data);
|
||||
$this->load->view('visitor/layout/footer');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
/*
|
||||
* This adds an option to enable public search per logbook
|
||||
*/
|
||||
|
||||
class Migration_add_public_search_option extends CI_Migration {
|
||||
|
||||
public function up()
|
||||
{
|
||||
if (!$this->db->field_exists('public_search', 'station_logbooks')) {
|
||||
$fields = array(
|
||||
'public_search integer DEFAULT 0 AFTER public_slug',
|
||||
);
|
||||
|
||||
$this->dbforge->add_column('station_logbooks', $fields);
|
||||
}
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
if ($this->db->field_exists('public_search', 'logbooks')) {
|
||||
$this->dbforge->drop_column('logbooks', 'public_search');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -210,6 +210,16 @@ class Logbooks_model extends CI_Model {
|
|||
}
|
||||
}
|
||||
|
||||
function save_public_search($public_search, $logbook_id) {
|
||||
$data = array(
|
||||
'public_search' => xss_clean($public_search),
|
||||
);
|
||||
|
||||
$this->db->where('user_id', $this->session->userdata('user_id'));
|
||||
$this->db->where('logbook_id', xss_clean($logbook_id));
|
||||
$this->db->update('station_logbooks', $data);
|
||||
}
|
||||
|
||||
function save_public_slug($public_slug, $logbook_id) {
|
||||
$data = array(
|
||||
'public_slug' => xss_clean($public_slug),
|
||||
|
|
@ -322,5 +332,14 @@ class Logbooks_model extends CI_Model {
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
function public_search_enabled($logbook_id) {
|
||||
$this->db->select('public_search');
|
||||
$this->db->where('logbook_id', $logbook_id);
|
||||
|
||||
$query = $this->db->get('station_logbooks');
|
||||
|
||||
return $query->result_array()[0]['public_search'];
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
class Publicsearch extends CI_Model {
|
||||
|
||||
function search($slug, $callsign) {
|
||||
if ($this->public_search_enabled($slug)) {
|
||||
$userid = $this->get_userid_for_slug($slug);
|
||||
$this->db->where('COL_CALL', $callsign);
|
||||
$this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id');
|
||||
$this->db->join('lotw_users', 'lotw_users.callsign = '.$this->config->item('table_name').'.col_call', 'left outer');
|
||||
$this->db->where('station_profile.user_id', $userid);
|
||||
$this->db->order_by('COL_TIME_ON', 'DESC');
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
return $query;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function get_userid_for_slug($slug) {
|
||||
$this->db->select('user_id');
|
||||
$this->db->where('public_slug', $slug);
|
||||
$query = $this->db->get('station_logbooks');
|
||||
return $query->result_array()[0]['user_id'];
|
||||
}
|
||||
|
||||
function public_search_enabled($slug) {
|
||||
$this->db->select('public_search');
|
||||
$this->db->where('public_slug', $slug);
|
||||
$query = $this->db->get('station_logbooks');
|
||||
if ($query->result_array()[0]['public_search'] == 1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -68,6 +68,18 @@
|
|||
Visit Public Page <a href="<?php echo site_url('visitor'); ?>/<?php echo $station_logbook_details->public_slug; ?>" target="_blank"><?php echo site_url('visitor'); ?>/<?php echo $station_logbook_details->public_slug; ?></a>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<form style="display: inline;">
|
||||
<input type="hidden" name="logbook_id" value="<?php echo $station_logbook_details->logbook_id; ?>">
|
||||
<p>Enabling public search function offers a search input box on the public logbook page accessed via public slug. Search only covers this logbook.</p>
|
||||
<label for="public_search">Public search enabled</label>
|
||||
<select class="custom-select" id="public_search" name="public_search" hx-post="<?php echo site_url('logbooks/save_publicsearch/'); ?>" hx-target="#publicSearchForm" hx-trigger="change">
|
||||
<option value="1" <?php if ($station_logbook_details->public_search == 1) { echo " selected =\"selected\""; } ?>><?php echo lang('general_word_yes'); ?></option>
|
||||
<option value="0" <?php if ($station_logbook_details->public_search == 0) { echo " selected =\"selected\""; } ?>><?php echo lang('general_word_no'); ?></option>
|
||||
</select>
|
||||
</form>
|
||||
<p>
|
||||
<div id="publicSearchForm">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
<th scope="col">Edit</th>
|
||||
<th scope="col">Delete</th>
|
||||
<th scope="col">Link</th>
|
||||
<th scope="col">Public Search</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
|
@ -65,6 +66,13 @@
|
|||
<a target="_blank" href="<?php echo site_url('visitor')."/".$row->public_slug; ?>" class="btn btn-outline-primary btn-sm" ><i class="fas fa-globe" title="View Public Page for <?php echo $row->logbook_name;?> Logbook"></i> </a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php if ($row->public_search == 1) {
|
||||
echo "<span class=\"badge badge-success\">Enabled</span>";
|
||||
} else {
|
||||
echo "<span class=\"badge badge-dark\">Disabled</span>";
|
||||
} ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
<div class="container publicsearch">
|
||||
<h1>Results <small class="text-muted">Searching for <?php echo str_replace("0","Ø",strtoupper($callsign)); ?></small></h1>
|
||||
<div class="alert alert-danger" role="alert"><a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>Nothing found!</div>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
<div class="container publicsearch">
|
||||
<h1>Results <small class="text-muted">Searching for <?php echo str_replace("0","Ø",strtoupper($callsign)); ?></small></h1>
|
||||
<div class="card text-center">
|
||||
<div class="card-body">
|
||||
<?php
|
||||
|
||||
if ($results) { ?>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table style="width:100%" id="publicsearchtable" class="publicsearchtable table table-sm table-striped table-hover">
|
||||
<thead>
|
||||
<tr class="titles">
|
||||
<th><?php echo lang('general_word_date'); ?></th>
|
||||
<th><?php echo lang('gen_hamradio_call'); ?></th>
|
||||
<th><?php echo lang('gen_hamradio_mode'); ?></th>
|
||||
<th><?php echo lang('gen_hamradio_band'); ?></th>
|
||||
<th>Station Callsign</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<?php $i = 0;
|
||||
foreach ($results->result() as $row) {
|
||||
echo '<tr class="tr'.($i & 1).'">'; ?>
|
||||
<td><?php $timestamp = strtotime($row->COL_TIME_ON); echo date($this->config->item('qso_date_format'), $timestamp); ?></td>
|
||||
<td>
|
||||
<?php echo str_replace("0","Ø",strtoupper($row->COL_CALL)); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $row->COL_SUBMODE==null ? $row->COL_MODE : $row->COL_SUBMODE; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php if($row->COL_SAT_NAME != null) { echo $row->COL_SAT_NAME; } else { echo strtolower($row->COL_BAND); } ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $row->station_callsign; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php $i++; } ?>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (isset($this->pagination)){ ?>
|
||||
<?php
|
||||
$config['full_tag_open'] = '<ul class="pagination">';
|
||||
$config['full_tag_close'] = '</ul>';
|
||||
$config['attributes'] = ['class' => 'page-link'];
|
||||
$config['first_link'] = false;
|
||||
$config['last_link'] = false;
|
||||
$config['first_tag_open'] = '<li class="page-item">';
|
||||
$config['first_tag_close'] = '</li>';
|
||||
$config['prev_link'] = '«';
|
||||
$config['prev_tag_open'] = '<li class="page-item">';
|
||||
$config['prev_tag_close'] = '</li>';
|
||||
$config['next_link'] = '»';
|
||||
$config['next_tag_open'] = '<li class="page-item">';
|
||||
$config['next_tag_close'] = '</li>';
|
||||
$config['last_tag_open'] = '<li class="page-item">';
|
||||
$config['last_tag_close'] = '</li>';
|
||||
$config['cur_tag_open'] = '<li class="page-item active"><a href="#" class="page-link">';
|
||||
$config['cur_tag_close'] = '<span class="sr-only">(current)</span></a></li>';
|
||||
$config['num_tag_open'] = '<li class="page-item">';
|
||||
$config['num_tag_close'] = '</li>';
|
||||
$this->pagination->initialize($config);
|
||||
?>
|
||||
|
||||
<?php echo $this->pagination->create_links(); ?>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -50,7 +50,7 @@ function echoQrbCalcLink($mygrid, $grid, $vucc) {
|
|||
<!-- Map -->
|
||||
<div id="map" style="width: 100%; height: 350px"></div>
|
||||
|
||||
<div style="padding-top: 0px; margin-top: 5px;" class="container dashboard">
|
||||
<div id="container" style="padding-top: 0px; margin-top: 5px;" class="container dashboard">
|
||||
|
||||
<!-- Log Data -->
|
||||
<div class="row logdata">
|
||||
|
|
@ -231,3 +231,5 @@ function echoQrbCalcLink($mygrid, $grid, $vucc) {
|
|||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="partial_view"></div>
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@
|
|||
<?php } else { ?>
|
||||
var grid = "No";
|
||||
<?php } ?>
|
||||
console.log("lets go");
|
||||
initmap(grid);
|
||||
|
||||
});
|
||||
|
|
@ -199,5 +198,58 @@
|
|||
<?php } ?>
|
||||
<?php } ?>
|
||||
</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>
|
||||
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/moment.min.js"></script>
|
||||
<script type="text/javascript" src="<?php echo base_url(); ?>assets/js/datetime-moment.js"></script>
|
||||
<script>
|
||||
<?php switch($this->config->item('qso_date_format')) {
|
||||
case 'd/m/y': $usethisformat = 'D/MM/YY';break;
|
||||
case 'd/m/Y': $usethisformat = 'D/MM/YYYY';break;
|
||||
case 'm/d/y': $usethisformat = 'MM/D/YY';break;
|
||||
case 'm/d/Y': $usethisformat = 'MM/D/YYYY';break;
|
||||
case 'd.m.Y': $usethisformat = 'D.MM.YYYY';break;
|
||||
case 'y/m/d': $usethisformat = 'YY/MM/D';break;
|
||||
case 'Y-m-d': $usethisformat = 'YYYY-MM-D';break;
|
||||
case 'M d, Y': $usethisformat = 'MMM D, YYYY';break;
|
||||
case 'M d, y': $usethisformat = 'MMM D, YY';break;
|
||||
default: $usethisformat = 'YYYY-MM-D';
|
||||
} ?>
|
||||
|
||||
$.fn.dataTable.moment('<?php echo $usethisformat ?>');
|
||||
$.fn.dataTable.ext.buttons.clear = {
|
||||
className: 'buttons-clear',
|
||||
action: function ( e, dt, node, config ) {
|
||||
dt.search('').draw();
|
||||
}
|
||||
};
|
||||
$('#publicsearchtable').DataTable({
|
||||
"pageLength": 25,
|
||||
responsive: false,
|
||||
ordering: true,
|
||||
"scrollY": "500px",
|
||||
"scrollCollapse": true,
|
||||
"paging": false,
|
||||
"scrollX": true,
|
||||
"order": [ 0, 'desc' ],
|
||||
dom: 'Bfrtip',
|
||||
buttons: [
|
||||
{
|
||||
extend: 'csv'
|
||||
},
|
||||
{
|
||||
extend: 'clear',
|
||||
text: 'Clear'
|
||||
}
|
||||
]
|
||||
});
|
||||
// change color of csv-button if dark mode is chosen
|
||||
if (isDarkModeTheme()) {
|
||||
$('[class*="buttons"]').css("color", "white");
|
||||
}
|
||||
</script>
|
||||
<?php } ?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -71,6 +71,18 @@
|
|||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
|
||||
<div style="paddling-left: 0.5rem; padding-right: 0.5rem"></div>
|
||||
<?php if (!empty($slug)) {
|
||||
$this->CI =& get_instance();
|
||||
if ($this->CI->public_search_enabled($slug) || $this->session->userdata('user_type') >= 2) { ?>
|
||||
<form method="post" action="<?php echo site_url('visitor/search'); ?>" class="form-inline">
|
||||
<input class="form-control mr-sm-2" id="callsign" type="search" name="callsign" placeholder="<?php echo lang('menu_search_text'); ?>" style="text-transform: uppercase;" aria-label="Search">
|
||||
<input type="hidden" name="public_slug" value="<?php echo $slug; ?>">
|
||||
<button class="btn btn-outline-success my-2 my-sm-0" type="submit"><i class="fas fa-search"></i> <?php echo lang('menu_search_button'); ?></button>
|
||||
</form>
|
||||
<?php }
|
||||
} ?>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
|
|
|||
|
|
@ -42,6 +42,11 @@ thead > tr > td {
|
|||
padding-top: 15px;
|
||||
}
|
||||
|
||||
.publicsearch {
|
||||
padding-top: 15px;
|
||||
max-width: 540px;
|
||||
}
|
||||
|
||||
.search {
|
||||
padding-top: 15px;
|
||||
}
|
||||
|
|
|
|||
正在加载…
在新工单中引用