Changeset 7b68139 for src/webapp
- Timestamp:
- Apr 23, 2017, 5:41:30 PM (10 years ago)
- Branches:
- debian/bullseye, debian/jessie
- Children:
- 12afe34
- Parents:
- e9ed726 (diff), 19ac332 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - git-author:
- Joachim Langenbach <joachim.langenbach@…> (04/23/17 17:40:44)
- git-committer:
- Joachim Langenbach <joachim.langenbach@…> (04/23/17 17:41:30)
- Location:
- src/webapp
- Files:
-
- 4 edited
-
webclient/javascript/main.js (modified) (2 diffs)
-
webservice/inc/Config.php (modified) (4 diffs)
-
webservice/index.php (modified) (3 diffs)
-
webservice/tileserver.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/webapp/webclient/javascript/main.js
re9ed726 r7b68139 28 28 29 29 function displayDataSet(data){ 30 if(!Array.isArray(data)){ 31 console.log("No data array returned!"); 32 return; 33 } 30 34 if(!("lastvalid" in data)){ 31 35 console.log("No last valid values given!"); … … 118 122 $(document).ready(function() { 119 123 displayDataGet(); 120 setInterval(displayDataGet, 5000);124 setInterval(displayDataGet, 15000); 121 125 122 126 $.getJSON("../webservice/tileserver.php?/map.json", mapSetup); -
src/webapp/webservice/inc/Config.php
re9ed726 r7b68139 35 35 36 36 public function databaseFile(){ 37 return $this->dataDirectory() ." log-webservice.rrd";37 return $this->dataDirectory() ."gnuboat.rrd"; 38 38 } 39 39 40 40 public function shutdownRequestFile(){ 41 41 if(array_key_exists("shutdownfile", $this->_config)) … … 43 43 return "/var/spool/gnuboat/shutdown.request"; 44 44 } 45 45 46 46 public function dataDirectory(){ 47 47 if(array_key_exists("datadirectory", $this->_config)) … … 49 49 return __DIR__ ."/../data/"; 50 50 } 51 51 52 52 private static function addTrailingSlash($path){ 53 53 $length = strlen($path); … … 57 57 return $path; 58 58 } 59 59 60 60 private $_config; 61 61 } -
src/webapp/webservice/index.php
re9ed726 r7b68139 16 16 along with this program. If not, see <http://www.gnu.org/licenses/>. 17 17 */ 18 19 xdebug_start_trace(); 18 20 19 21 require_once(__DIR__ ."/inc/Config.php"); … … 63 65 $lastTime = -1; 64 66 $keys = array_keys($data); 65 if(count($keys) < 0 ){ 67 $keyTimeframes = $keys[0]; 68 $itemCount = count($keys); 69 if($itemCount < 0 ){ 66 70 error_log("No keys in fetched rrd data from ". $dbFile); 67 71 echo json_encode(""); 68 72 exit; 69 73 } 74 $timeframesCount = count($data[$keyTimeframes]); 70 75 if($debug > 0){ 71 echo "<p>Variables: ". count($keys) ."; Timeframes: ". count($data[$keys[0]])."</p>\n";76 echo "<p>Variables: ". $itemCount ."; Timeframes: ". $timeframesCount ."</p>\n"; 72 77 } 73 for($i = 0; $i < count($data[$keys[0]]); $i++){ 74 $time = array_keys($data[$keys[0]])[$i]; 78 $keysTimeframes = array_keys($data[$keyTimeframes]); 79 for($i = 0; $i < $timeframesCount; $i++){ 80 $time = $keysTimeframes[$i]; 75 81 $allValid = true; 76 82 $tmp = array(); … … 175 181 } 176 182 183 xdebug_stop_trace(); 184 177 185 ?> -
src/webapp/webservice/tileserver.php
re9ed726 r7b68139 294 294 $this->db = new PDO('sqlite:' . $tileset, '', '', array(PDO::ATTR_PERSISTENT => true)); 295 295 } catch (Exception $exc) { 296 e cho $exc->getTraceAsString();296 error_log($exc->getTraceAsString()); 297 297 die; 298 298 } … … 300 300 if (!isset($this->db)) { 301 301 header('Content-type: text/plain'); 302 e cho 'Incorrect tileset name: ' . $tileset;302 error_log('Incorrect tileset name: ' . $tileset); 303 303 die; 304 304 } … … 401 401 } else { 402 402 header('HTTP/1.1 404 Not Found'); 403 e cho 'Server: Unknown or not specified dataset "' . $tileset . '"';403 error_log('Server: Unknown or not specified dataset "' . $tileset . '"'); 404 404 die; 405 405 }
Note:
See TracChangeset
for help on using the changeset viewer.
