Skip to content

Commit

Permalink
Merge pull request #38 from exodus4d/develop
Browse files Browse the repository at this point in the history
v0.0.11
  • Loading branch information
exodus4d committed Sep 29, 2015
2 parents 5387564 + bab37a0 commit 2e98c98
Show file tree
Hide file tree
Showing 40 changed files with 92 additions and 46 deletions.
2 changes: 2 additions & 0 deletions .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ RewriteEngine On

# HTTP to HTTPS ----------------------------------------------------------------
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$
RewriteCond %{HTTP_HOST} !=localhost

# First rewrite to HTTPS:
Expand All @@ -13,6 +14,7 @@ RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Now, rewrite any request to the wrong domain to use www.
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTP_HOST} !=localhost
RewriteCond %{HTTP_HOST} !^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]


Expand Down
4 changes: 3 additions & 1 deletion app/main/controller/api/map.php
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,9 @@ public function updateData($f3){
// format map Data for return
$return->mapData = self::getFormattedMapData($maps);

$f3->set($cacheKey, $return, $responseTTL);
if(count($return->mapData) > 0){
$f3->set($cacheKey, $return, $responseTTL);
}
}else{
// get from cache
$return = $f3->get($cacheKey);
Expand Down
12 changes: 7 additions & 5 deletions app/main/model/alliancemodel.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,18 @@ public function getMaps(){

$this->filter('mapAlliances',
['active = ?', 1],
[
'limit' => $f3->get('PATHFINDER.MAX_MAPS_ALLIANCE'),
'order' => 'created'
]
['order' => 'created']
);

if($this->mapAlliances){
$mapCount = 0;
foreach($this->mapAlliances as $mapAlliance){
if($mapAlliance->mapId->isActive()){
if(
$mapAlliance->mapId->isActive() &&
$mapCount < $f3->get('PATHFINDER.MAX_MAPS_ALLIANCE')
){
$maps[] = $mapAlliance->mapId;
$mapCount++;
}
}
}
Expand Down
15 changes: 8 additions & 7 deletions app/main/model/corporationmodel.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class CorporationModel extends BasicModel {

protected $fieldConf = [
'corporationCharacters' => [
'has-many' => ['Model\CharacterModel', 'allianceId']
'has-many' => ['Model\CharacterModel', 'corporationId']
],
'mapCorporations' => [
'has-many' => ['Model\CorporationMapModel', 'corporationId']
Expand All @@ -32,7 +32,6 @@ public function getData(){
$cooperationData->name = $this->name;
$cooperationData->sharing = $this->sharing;


return $cooperationData;
}

Expand All @@ -47,16 +46,18 @@ public function getMaps(){

$this->filter('mapCorporations',
['active = ?', 1],
[
'limit' => $f3->get('PATHFINDER.MAX_MAPS_CORPORATION'),
'order' => 'created'
]
['order' => 'created']
);

if($this->mapCorporations){
$mapCount = 0;
foreach($this->mapCorporations as $mapCorporation){
if($mapCorporation->mapId->isActive()){
if(
$mapCorporation->mapId->isActive() &&
$mapCount < $f3->get('PATHFINDER.MAX_MAPS_CORPORATION')
){
$maps[] = $mapCorporation->mapId;
$mapCount++;
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions app/main/model/mapmodel.php
Original file line number Diff line number Diff line change
Expand Up @@ -420,14 +420,16 @@ private function getCharactersData(){

if(is_null($charactersData)){
$charactersData = [];

$characters = $this->getCharacters();

foreach($characters as $character){
$charactersData[] = $character->getData(true);
}

$this->updateCacheData($charactersData, 'CHARACTERS', 10);
// cache active characters (if found)
if(!empty($charactersData)){
$this->updateCacheData($charactersData, 'CHARACTERS', 10);
}
}

return $charactersData;
Expand Down
12 changes: 7 additions & 5 deletions app/main/model/usermodel.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,17 +186,19 @@ public function getMaps(){
$this->filter(
'userMaps',
['active = ?', 1],
[
'limit' => $f3->get('PATHFINDER.MAX_MAPS_PRIVATE'),
'order' => 'created'
]
['order' => 'created']
);

$maps = [];
if($this->userMaps){
$mapCountPrivate = 0;
foreach($this->userMaps as $userMap){
if($userMap->mapId->isActive()){
if(
$userMap->mapId->isActive() &&
$mapCountPrivate < $f3->get('PATHFINDER.MAX_MAPS_PRIVATE')
){
$maps[] = $userMap->mapId;
$mapCountPrivate++;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/pathfinder.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[PATHFINDER]
NAME = "PATHFINDER"
; installed version (used for CSS/JS cache busting)
VERSION = "v0.0.10"
VERSION = "v0.0.11"
; contact information (DO NOT CHANGE)
CONTACT = "https://github.com/exodus4d"
; source code (DO NOT CHANGE)
Expand Down
3 changes: 2 additions & 1 deletion js/app/config/signature_type.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ define([], function() {
4: 'Ordinary Perimeter Reservoir', //*
5: 'Bountiful Frontier Reservoir', //*
6: 'Instrumental Core Reservoir', //*
7: 'Vital Core Reservoir' //*
7: 'Vital Core Reservoir', //*
8: 'Minor Perimeter Reservoir' //*
},
5: { // Wormhole
1: 'D792 - HS',
Expand Down
68 changes: 51 additions & 17 deletions js/app/map/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ define([
var activeInstances = {};

// active connections per map (cache object)
var activeConnections = {};
var connectionCache = {};

// characterID => systemIds are cached temporary where the active user character is in
// if a character switches/add system, establish connection with "previous" system
Expand Down Expand Up @@ -337,6 +337,7 @@ define([

if(show === 'destroy'){
system.tooltip( show );
system.removeAttr('data-original-title');
}else if(show === 'hide'){
system.tooltip( show );
} else if(show === 'toggle'){
Expand Down Expand Up @@ -371,6 +372,7 @@ define([
options.html = true;
options.animation = true;
options.template = template;
options.viewport = system.parent('.' + config.mapClass);

system.attr('title', options.title);

Expand Down Expand Up @@ -784,7 +786,30 @@ define([
};

/**
* get a connection object from "cache" (this requires the "activeConnections" cache to be actual!
* update local connection cache
* @param mapId
* @param connection
*/
var updateConnectionCache = function(mapId, connection){

if(
mapId > 0 &&
connection
){
var connectionId = parseInt( connection.getParameter('connectionId') );

if(connectionId > 0){
connectionCache[mapId][connectionId] = connection;
}else{
console.error('updateConnectionCache', 'connectionId missing');
}
}else{
console.error('updateConnectionCache', 'missing data');
}
};

/**
* get a connection object from "cache" (this requires the "connectionCache" cache to be actual!
* @param mapId
* @param connectionId
* @returns {*}
Expand All @@ -794,10 +819,10 @@ define([
var connection = null;

if(
activeConnections[mapId] &&
activeConnections[mapId][connectionId]
connectionCache[mapId] &&
connectionCache[mapId][connectionId]
){
connection = activeConnections[mapId][connectionId];
connection = connectionCache[mapId][connectionId];
}

return connection;
Expand Down Expand Up @@ -1253,11 +1278,18 @@ define([
url: Init.path.saveConnection,
data: requestData,
dataType: 'json',
context: connection
//context: connection
context: {
connection: connection,
mapId: mapId
}
}).done(function(newConnectionData){

// update connection data e.g. "scope" has auto detected
updateConnection(this, connectionData, newConnectionData);
connection = updateConnection(this.connection, connectionData, newConnectionData);

// new connection should be cached immediately!
updateConnectionCache(this.mapId, connection);

// connection scope
var scope = Util.getScopeInfoForConnection(newConnectionData.scope, 'label');
Expand Down Expand Up @@ -1349,6 +1381,7 @@ define([
* @param connection
* @param connectionData
* @param newConnectionData
* @returns {*}
*/
var updateConnection = function(connection, connectionData, newConnectionData){

Expand Down Expand Up @@ -1409,6 +1442,8 @@ define([

// set update date
connection.setParameter('updated', newConnectionData.updated);

return connection;
};

/**
Expand Down Expand Up @@ -2912,7 +2947,6 @@ define([

var mapElement = map.getContainer();


// get map tracking toggle value
// if "false" -> new systems/connections will not automatically added
var mapTracking = $('#' + config.headMapTrackingId).is(':checked');
Expand Down Expand Up @@ -3011,8 +3045,6 @@ define([

}



// cache current location
activeSystemCache = system;
}
Expand All @@ -3023,7 +3055,7 @@ define([

// current user was not found on any map system -> add new system to map where the user is in ----------------
// this is restricted to IGB-usage! CharacterLog data is always set through the IGB
// ->this prevent adding the same system multiple times, if a user if online with the IGB AND OOG
// ->this prevent adding the same system multiple times, if a user is online with IGB AND OOG
if(
CCP.isInGameBrowser() === true &&
currentUserOnMap === false &&
Expand All @@ -3032,7 +3064,6 @@ define([
){

// add new system to the map

var requestData = {
systemData: {
systemId: currentCharacterLog.system.id
Expand Down Expand Up @@ -3139,8 +3170,8 @@ define([
var connections = map.getAllConnections();
var connectionsFormatted = [];

// clear connections cache
activeConnections[mapConfig.id] = {};
// new connections cache
var updatedConnectionCache = {};

// format connections
for(var j = 0; j < connections.length; j++){
Expand All @@ -3157,14 +3188,17 @@ define([

var connectionData = getDataByConnection(tempConnection);

// add to cache
activeConnections[mapConfig.id][connectionData.id] = tempConnection;

if(addConnectionData){
connectionsFormatted.push( connectionData );
}

// add to cache
updatedConnectionCache[connectionData.id] = tempConnection;
}

// overwrite connection cache
connectionCache[mapConfig.id] = updatedConnectionCache;

data.connections = connectionsFormatted;

mapData.data = data;
Expand Down
1 change: 0 additions & 1 deletion public/js/v0.0.10/app/landingpage.js.map

This file was deleted.

1 change: 0 additions & 1 deletion public/js/v0.0.10/app/mappage.js.map

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions public/js/v0.0.11/app/landingpage.js.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions public/js/v0.0.11/app/mappage.js.map

Large diffs are not rendered by default.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 2e98c98

Please sign in to comment.