[DOK autocomplete] Added DOK autocomplete in the QSO entry area
这个提交包含在:
		
							父节点
							
								
									dc7545729f
								
							
						
					
					
						当前提交
						7f80984db0
					
				
					共有  3 个文件被更改,包括 1149 次插入 和 0 次删除
				
			
		|  | @ -276,4 +276,36 @@ class QSO extends CI_Controller { | |||
|         header('Content-Type: application/json'); | ||||
|         echo json_encode($json); | ||||
|     } | ||||
| 
 | ||||
|     /* | ||||
| 	 * Function is used for autocompletion of DOK in the QSO entry form | ||||
| 	 */ | ||||
|     public function get_dok() { | ||||
|         $json = []; | ||||
| 
 | ||||
|         if(!empty($this->input->get("query"))) { | ||||
|             $query = isset($_GET['query']) ? $_GET['query'] : FALSE; | ||||
|             $sota = strtoupper($query); | ||||
| 
 | ||||
|             $file = 'assets/json/dok.txt'; | ||||
| 
 | ||||
|             if (is_readable($file)) { | ||||
|                 $lines = file($file, FILE_IGNORE_NEW_LINES); | ||||
|                 $input = preg_quote($sota, '~'); | ||||
|                 $reg = '~^'. $input .'(.*)$~'; | ||||
|                 $result = preg_grep($reg, $lines); | ||||
|                 $json = []; | ||||
|                 $i = 0; | ||||
|                 foreach ($result as &$value) { | ||||
|                     // Limit to 100 as to not slowdown browser too much
 | ||||
|                     if (count($json) <= 100) { | ||||
|                         $json[] = ["name"=>$value]; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         header('Content-Type: application/json'); | ||||
|         echo json_encode($json); | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -351,6 +351,34 @@ $( document ).ready(function() { | |||
|         } | ||||
|     }); | ||||
| 
 | ||||
|     $('#darc_dok').selectize({ | ||||
|         maxItems: 1, | ||||
|         closeAfterSelect: true, | ||||
|         loadThrottle: 250, | ||||
|         valueField: 'name', | ||||
|         labelField: 'name', | ||||
|         searchField: 'name', | ||||
|         options: [], | ||||
|         create: false, | ||||
|         load: function(query, callback) { | ||||
|             if (!query) return callback();  // Only trigger if 3 or more characters are entered
 | ||||
|             $.ajax({ | ||||
|                 url: baseURL+'index.php/qso/get_dok', | ||||
|                 type: 'GET', | ||||
|                 dataType: 'json', | ||||
|                 data: { | ||||
|                     query: query, | ||||
|                 }, | ||||
|                 error: function() { | ||||
|                     callback(); | ||||
|                 }, | ||||
|                 success: function(res) { | ||||
|                     callback(res); | ||||
|                 } | ||||
|             }); | ||||
|         } | ||||
|     }); | ||||
| 
 | ||||
|   /* | ||||
|     Populate the Satellite Names Field on the QSO Panel | ||||
|   */ | ||||
|  |  | |||
							
								
								
									
										1089
									
								
								assets/json/dok.txt
									
									
									
									
									
										普通文件
									
								
							
							
						
						
									
										1089
									
								
								assets/json/dok.txt
									
									
									
									
									
										普通文件
									
								
							
										
											
												文件差异内容过多而无法显示
												加载差异
											
										
									
								
							
		正在加载…
	
		在新工单中引用