Remove deprecated empty project detection

This commit is contained in:
2021-05-24 18:49:44 +02:00
parent b6cd49db09
commit 2e93bfe7b7
3 changed files with 9 additions and 11 deletions

View File

@@ -245,8 +245,6 @@ class Spot extends Main
public function getMarkers() public function getMarkers()
{ {
$asMessages = $this->getSpotMessages(); $asMessages = $this->getSpotMessages();
$bEmptyProject = empty($this->getMedias('posted_on') + $asMessages + $this->getPosts());
$sDesc = '';
//Add medias //Add medias
if(!empty($asMessages)) { if(!empty($asMessages)) {
@@ -274,11 +272,10 @@ class Spot extends Main
$asLastUpdate = array(); $asLastUpdate = array();
$this->addTimeStamp($asLastUpdate, $this->oProject->getLastUpdate()); $this->addTimeStamp($asLastUpdate, $this->oProject->getLastUpdate());
return self::getJsonResult(true, $sDesc, array( return self::getJsonResult(true, '', array(
'messages' => $asMessages, 'messages' => $asMessages,
'maps' => $this->oProject->getMaps(), 'maps' => $this->oProject->getMaps(),
'last_update' => $asLastUpdate, 'last_update' => $asLastUpdate
'empty_project' => $bEmptyProject
)); ));
} }

View File

@@ -222,7 +222,7 @@ function initProject(sProjectCodeName, oFocusPost){
).done(function(aoMessages, aoTracks) { ).done(function(aoMessages, aoTracks) {
var asData = aoMessages[0]['data']; var asData = aoMessages[0]['data'];
setMapLayers(asData['maps']); setMapLayers(asData['maps']);
initSpotMessages(asData['messages'] || [], aoTracks[0], asData['empty_project']); initSpotMessages(asData['messages'], aoTracks[0]);
updateSettingsPanel(asData['last_update']); updateSettingsPanel(asData['last_update']);
}); });
@@ -359,7 +359,7 @@ function setMapLayers(asLayers) {
}); });
} }
function initSpotMessages(aoMessages, aoTracks, bNoFeed) { function initSpotMessages(aoMessages, aoTracks) {
//Map //Map
var oMap = L.map(self.tmp('$Map')[0], { var oMap = L.map(self.tmp('$Map')[0], {
layers: [oSpot.tmp('layers')[oSpot.lang('map_satellite')]], layers: [oSpot.tmp('layers')[oSpot.lang('map_satellite')]],
@@ -546,7 +546,7 @@ function initSpotMessages(aoMessages, aoTracks, bNoFeed) {
}).addTo(oMap)); }).addTo(oMap));
//Centering map //Centering map
var bWithFeedPanel = (!bNoFeed && !isMobile()); var iPanelWidth = isMobile()?0:parseInt(self.tmp('$Feed').outerWidth(true));
if( if(
self.vars(['project', 'mode']) == self.consts.modes.blog && self.vars(['project', 'mode']) == self.consts.modes.blog &&
aoMessages.length > 0 && aoMessages.length > 0 &&
@@ -555,9 +555,9 @@ function initSpotMessages(aoMessages, aoTracks, bNoFeed) {
//Zoom on last message //Zoom on last message
var oLastMsg = aoMessages[aoMessages.length-1]; var oLastMsg = aoMessages[aoMessages.length-1];
oMap.setView(L.latLng(oLastMsg.latitude, oLastMsg.longitude), 15); oMap.setView(L.latLng(oLastMsg.latitude, oLastMsg.longitude), 15);
oMap.panBy([(bWithFeedPanel?1:0)*self.tmp('$Feed').outerWidth(true)/2, 0]); oMap.panBy([iPanelWidth/2, 0]);
} }
else oMap.fitBounds(self.tmp('track').getBounds(), {paddingTopLeft: L.point(5, self.tmp('marker_size').height + 5), paddingBottomRight: L.point(5 + parseInt(bWithFeedPanel?self.tmp('$Feed').outerWidth(true):0), 5)}); else oMap.fitBounds(self.tmp('track').getBounds(), {paddingTopLeft: L.point(5, self.tmp('marker_size').height + 5), paddingBottomRight: L.point(5 + iPanelWidth, 5)});
//Spot Messages //Spot Messages
$.each(aoMessages, function(iKey, oMsg){ $.each(aoMessages, function(iKey, oMsg){

View File

@@ -9,7 +9,8 @@
## Getting started ## Getting started
1. Clone Git onto web server 1. Clone Git onto web server
2. Copy settings-sample.php to settings.php and populate 2. Copy settings-sample.php to settings.php and populate
3. Go to #admin and create a new project 3. Go to #admin and create a new project & feed
4. Add a GPX file named <project_codename>.gpx to /geo/
## To Do List ## To Do List
* ECMA import/export * ECMA import/export
* Reset zoom on image closing (lightbox) * Reset zoom on image closing (lightbox)