Merge pull request #2285 from phl0/refactorPublicSearch
这个提交包含在:
		
						当前提交
						d0e8804084
					
				
					共有  5 个文件被更改,包括 37 次插入 和 9 次删除
				
			
		|  | @ -467,12 +467,15 @@ class Visitor extends CI_Controller { | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	public function search() { | 	public function search() { | ||||||
| 		$callsign = $this->security->xss_clean($this->input->post('callsign')); | 		$callsign = trim($this->security->xss_clean($this->input->post('callsign'))); | ||||||
| 		$public_slug = $this->security->xss_clean($this->input->post('public_slug')); | 		$public_slug = $this->security->xss_clean($this->input->post('public_slug')); | ||||||
| 		$this->load->model('publicsearch'); | 		$this->load->model('publicsearch'); | ||||||
| 		$result = $this->publicsearch->search($public_slug, $callsign); | 		$data['page_title'] = "Public Search"; | ||||||
| 		$data['callsign'] = $callsign; | 		$data['callsign'] = $callsign; | ||||||
| 		$data['slug'] = $public_slug; | 		$data['slug'] = $public_slug; | ||||||
|  | 		if ($callsign != '') { | ||||||
|  | 			$result = $this->publicsearch->search($public_slug, $callsign); | ||||||
|  | 		} | ||||||
| 		if (!empty($result) && $result->num_rows() > 0) { | 		if (!empty($result) && $result->num_rows() > 0) { | ||||||
| 			$data['results'] = $result; | 			$data['results'] = $result; | ||||||
| 			$this->load->view('visitor/layout/header', $data); | 			$this->load->view('visitor/layout/header', $data); | ||||||
|  |  | ||||||
|  | @ -5,7 +5,7 @@ class Publicsearch extends CI_Model { | ||||||
| 	function search($slug, $callsign) { | 	function search($slug, $callsign) { | ||||||
| 		if ($this->public_search_enabled($slug)) { | 		if ($this->public_search_enabled($slug)) { | ||||||
| 			$userid = $this->get_userid_for_slug($slug); | 			$userid = $this->get_userid_for_slug($slug); | ||||||
| 			$this->db->where('COL_CALL', $callsign); | 			$this->db->like('COL_CALL', $callsign); | ||||||
| 			$this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); | 			$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->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->where('station_profile.user_id', $userid); | ||||||
|  |  | ||||||
|  | @ -23,7 +23,8 @@ | ||||||
| </script> | </script> | ||||||
| 
 | 
 | ||||||
|     <script type="text/javascript" src="<?php echo base_url();?>assets/js/leaflet/L.Maidenhead.js"></script> |     <script type="text/javascript" src="<?php echo base_url();?>assets/js/leaflet/L.Maidenhead.js"></script> | ||||||
|     <script id="leafembed" type="text/javascript" src="<?php echo base_url();?>assets/js/leaflet/leafembed.js" tileUrl="<?php echo $this->optionslib->get_option('map_tile_server');?>"></script>    <script type="text/javascript"> |     <script id="leafembed" type="text/javascript" src="<?php echo base_url();?>assets/js/leaflet/leafembed.js" tileUrl="<?php echo $this->optionslib->get_option('map_tile_server');?>"></script> | ||||||
|  |     <script type="text/javascript"> | ||||||
|       $(function () { |       $(function () { | ||||||
|         $('[data-toggle="tooltip"]').tooltip() |         $('[data-toggle="tooltip"]').tooltip() | ||||||
|       }); |       }); | ||||||
|  | @ -47,7 +48,9 @@ | ||||||
|             <?php } else { ?>
 |             <?php } else { ?>
 | ||||||
|               var grid = "No"; |               var grid = "No"; | ||||||
|             <?php } ?>
 |             <?php } ?>
 | ||||||
|  |             <?php if ($this->uri->segment(2) != "search" && $this->uri->segment(2) != "satellites") { ?>
 | ||||||
|             initmap(grid); |             initmap(grid); | ||||||
|  |             <?php } ?>
 | ||||||
| 
 | 
 | ||||||
|       }); |       }); | ||||||
| 
 | 
 | ||||||
|  | @ -201,6 +204,7 @@ | ||||||
|     <?php if ($this->CI->public_search_enabled($slug) || $this->session->userdata('user_type') >= 2) { ?>
 |     <?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.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/dataTables.buttons.min.js"></script> | ||||||
|  |     <script type="text/javascript" src="<?php echo base_url(); ?>assets/js/buttons.html5.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/moment.min.js"></script> | ||||||
|     <script type="text/javascript" src="<?php echo base_url(); ?>assets/js/datetime-moment.js"></script> |     <script type="text/javascript" src="<?php echo base_url(); ?>assets/js/datetime-moment.js"></script> | ||||||
|     <script> |     <script> | ||||||
|  | @ -230,13 +234,14 @@ | ||||||
|                 ordering: true, |                 ordering: true, | ||||||
|                 "scrollY":        "500px", |                 "scrollY":        "500px", | ||||||
|                 "scrollCollapse": true, |                 "scrollCollapse": true, | ||||||
|                 "paging":         false, |                 "paging":         true, | ||||||
|                 "scrollX": true, |                 "scrollX": true, | ||||||
|                 "order": [ 0, 'desc' ], |                 "order": [ 0, 'desc' ], | ||||||
|                 dom: 'Bfrtip', |                 dom: 'Bfrtip', | ||||||
|                 buttons: [ |                 buttons: [ | ||||||
|                    { |                    { | ||||||
|                       extend: 'csv' |                       extend: 'csv', | ||||||
|  |                       text: 'CSV' | ||||||
|                    }, |                    }, | ||||||
|                    { |                    { | ||||||
|                       extend: 'clear', |                       extend: 'clear', | ||||||
|  | @ -249,6 +254,22 @@ | ||||||
|                $('[class*="buttons"]').css("color", "white"); |                $('[class*="buttons"]').css("color", "white"); | ||||||
|             } |             } | ||||||
|         </script> |         </script> | ||||||
|  |         <script type="text/javascript"> | ||||||
|  |             $(function () { | ||||||
|  |                 $(document).on('shown.bs.tooltip', function (e) { | ||||||
|  |                     setTimeout(function () { | ||||||
|  |                         $(e.target).tooltip('hide'); | ||||||
|  |                     }, 3000); | ||||||
|  |                 }); | ||||||
|  |             }); | ||||||
|  |             function validateForm() { | ||||||
|  |                 let x = document.forms["searchForm"]["callsign"].value; | ||||||
|  |                 if (x.trim() == "") { | ||||||
|  |                     $('#searchcall').tooltip('show') | ||||||
|  |                     return false; | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         </script> | ||||||
|     <?php } ?>
 |     <?php } ?>
 | ||||||
| 
 | 
 | ||||||
|   </body> |   </body> | ||||||
|  |  | ||||||
|  | @ -9,6 +9,7 @@ | ||||||
|     <?php if($this->optionslib->get_theme()) { ?>
 |     <?php if($this->optionslib->get_theme()) { ?>
 | ||||||
| 		<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/<?php echo $this->optionslib->get_theme();?>/bootstrap.min.css"> | 		<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/<?php echo $this->optionslib->get_theme();?>/bootstrap.min.css"> | ||||||
| 		<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/general.css"> | 		<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/general.css"> | ||||||
|  | 		<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/visitor.css"> | ||||||
|         <link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/selectize.bootstrap4.css"/> |         <link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/selectize.bootstrap4.css"/> | ||||||
| 		<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/bootstrap-dialog.css"/> | 		<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/bootstrap-dialog.css"/> | ||||||
| 		<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/<?php echo $this->optionslib->get_theme();?>/overrides.css"> | 		<link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/<?php echo $this->optionslib->get_theme();?>/overrides.css"> | ||||||
|  | @ -76,8 +77,8 @@ | ||||||
| 		<?php if (!empty($slug)) { | 		<?php if (!empty($slug)) { | ||||||
| 			$this->CI =& get_instance(); | 			$this->CI =& get_instance(); | ||||||
| 			if ($this->CI->public_search_enabled($slug) || $this->session->userdata('user_type') >= 2) { ?>
 | 			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"> | 				<form method="post" name="searchForm" action="<?php echo site_url('visitor/search'); ?>" onsubmit="return validateForm()" 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 class="form-control mr-sm-2" id="searchcall" type="search" name="callsign" placeholder="<?php echo lang('menu_search_text'); ?>" <?php if (isset($callsign) && $callsign != '') { echo 'value="'.strtoupper($callsign).'"'; } ?> aria-label="Search" data-toogle="tooltip" data-placement="bottom" data-original-title="Please enter a callsign!">
 | ||||||
| 					<input type="hidden" name="public_slug" value="<?php echo $slug; ?>"> | 					<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>
 | 					<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> | 				</form> | ||||||
|  |  | ||||||
							
								
								
									
										3
									
								
								assets/css/visitor.css
									
									
									
									
									
										普通文件
									
								
							
							
						
						
									
										3
									
								
								assets/css/visitor.css
									
									
									
									
									
										普通文件
									
								
							|  | @ -0,0 +1,3 @@ | ||||||
|  | #searchcall:focus { | ||||||
|  |    text-transform: uppercase; | ||||||
|  | } | ||||||
		正在加载…
	
		在新工单中引用