- added new map scopes to map dialog, which affect system (jump) trackintg

- moved system (jump) tracking from client (js) to backend (php)
- improved system (jump) tracking performance (reduced update timings by 40%)
- improved map data caching
- updated jQuery custom content scroller 3.0.9 -> 3.1.13
- updated "manual dialog" content
- increased "manual dialog"
This commit is contained in:
Exodus4D
2016-06-12 13:30:39 +02:00
parent c18f682a5a
commit 2a73bb3018
33 changed files with 676 additions and 364 deletions

View File

@@ -17,6 +17,10 @@ use Model;
*/
class Map extends Controller\AccessController {
// cache keys
const CACHE_KEY_MAP_DATA = 'CACHED.MAP_DATA.%s';
const CACHE_KEY_USER_DATA = 'CACHED.USER_DATA.%s_%s';
/**
* event handler
* @param \Base $f3
@@ -27,6 +31,37 @@ class Map extends Controller\AccessController {
parent::beforeroute($f3);
}
/**
* get map data cache key
* @param Model\CharacterModel $character
* @return string
*/
protected function getMapDataCacheKey(Model\CharacterModel $character){
return sprintf(self::CACHE_KEY_MAP_DATA, 'CHAR_' . $character->_id);
}
/**
* clear map data caching
* -> cache timings are short, this will just increase update performance on map changes
* @param Model\CharacterModel $character
*/
protected function clearMapDataCache(Model\CharacterModel $character){
$cacheKey = $this->getMapDataCacheKey($character);
if($this->getF3()->exists($cacheKey)){
$this->getF3()->clear($cacheKey);
}
}
/**
* get user data cache key
* @param int $mapId
* @param int $systemId
* @return string
*/
protected function getUserDataCacheKey($mapId, $systemId = 0){
return sprintf(self::CACHE_KEY_USER_DATA, 'MAP_' . $mapId, 'SYS_' . $systemId);
}
/**
* Get all required static config data for program initialization
* @param \Base $f3
@@ -42,10 +77,10 @@ class Map extends Controller\AccessController {
$return = (object) [];
$return->error = [];
// static program data ------------------------------------------------
// static program data ----------------------------------------------------------------------------------------
$return->timer = $f3->get('PATHFINDER.TIMER');
// get all available map types ----------------------------------------
// get all available map types --------------------------------------------------------------------------------
$mapType = Model\BasicModel::getNew('MapTypeModel');
$rows = $mapType->find('active = 1', null, $expireTimeSQL);
@@ -62,7 +97,7 @@ class Map extends Controller\AccessController {
}
$return->mapTypes = $mapTypeData;
// get all available map scopes ---------------------------------------
// get all available map scopes -------------------------------------------------------------------------------
$mapScope = Model\BasicModel::getNew('MapScopeModel');
$rows = $mapScope->find('active = 1', null, $expireTimeSQL);
$mapScopeData = [];
@@ -75,7 +110,7 @@ class Map extends Controller\AccessController {
}
$return->mapScopes = $mapScopeData;
// get all available system status ------------------------------------
// get all available system status ----------------------------------------------------------------------------
$systemStatus = Model\BasicModel::getNew('SystemStatusModel');
$rows = $systemStatus->find('active = 1', null, $expireTimeSQL);
$systemScopeData = [];
@@ -89,7 +124,7 @@ class Map extends Controller\AccessController {
}
$return->systemStatus = $systemScopeData;
// get all available system types -------------------------------------
// get all available system types -----------------------------------------------------------------------------
$systemType = Model\BasicModel::getNew('SystemTypeModel');
$rows = $systemType->find('active = 1', null, $expireTimeSQL);
$systemTypeData = [];
@@ -102,7 +137,7 @@ class Map extends Controller\AccessController {
}
$return->systemType = $systemTypeData;
// get available connection scopes ------------------------------------
// get available connection scopes ----------------------------------------------------------------------------
$connectionScope = Model\BasicModel::getNew('ConnectionScopeModel');
$rows = $connectionScope->find('active = 1', null, $expireTimeSQL);
$connectionScopeData = [];
@@ -116,7 +151,7 @@ class Map extends Controller\AccessController {
}
$return->connectionScopes = $connectionScopeData;
// get available character status -------------------------------------
// get available character status -----------------------------------------------------------------------------
$characterStatus = Model\BasicModel::getNew('CharacterStatusModel');
$rows = $characterStatus->find('active = 1', null, $expireTimeSQL);
$characterStatusData = [];
@@ -130,7 +165,7 @@ class Map extends Controller\AccessController {
}
$return->characterStatus = $characterStatusData;
// get max number of shared entities per map --------------------------
// get max number of shared entities per map ------------------------------------------------------------------
$maxSharedCount = [
'character' => $f3->get('PATHFINDER.MAX_SHARED_CHARACTER'),
'corporation' => $f3->get('PATHFINDER.MAX_SHARED_CORPORATION'),
@@ -138,12 +173,12 @@ class Map extends Controller\AccessController {
];
$return->maxSharedCount = $maxSharedCount;
// get program routes -------------------------------------------------
// get program routes -----------------------------------------------------------------------------------------
$return->routes = [
'ssoLogin' => $this->getF3()->alias( 'sso', ['action' => 'requestAuthorization'] )
];
// get SSO error messages that should be shown immediately ------------
// get SSO error messages that should be shown immediately ----------------------------------------------------
// -> e.g. errors while character switch from previous HTTP requests
if( $f3->exists(Controller\Ccp\Sso::SESSION_KEY_SSO_ERROR) ){
$ssoError = (object) [];
@@ -493,15 +528,14 @@ class Map extends Controller\AccessController {
$return->error = [];
if($activeCharacter){
$cacheKey = 'user_map_data_' . $activeCharacter->_id;
$cacheKey = $this->getMapDataCacheKey($activeCharacter);
// if there is any system/connection change data submitted -> save new data
if(
!empty($mapData) ||
!$f3->exists($cacheKey)
){
// get current map data ========================================================
// get current map data ===============================================================================
$maps = $activeCharacter->getMaps();
// loop all submitted map data that should be saved
@@ -527,12 +561,12 @@ class Map extends Controller\AccessController {
count($connections) > 0
){
// map changes expected =============================================
// map changes expected =======================================================================
// loop current user maps and check for changes
foreach($maps as $map){
// update system data -----------------------------------------------
// update system data ---------------------------------------------------------------------
foreach($systems as $i => $systemData){
// check if current system belongs to the current map
@@ -561,7 +595,7 @@ class Map extends Controller\AccessController {
}
}
// update connection data -------------------------------------------
// update connection data -----------------------------------------------------------------
foreach($connections as $i => $connectionData){
// check if the current connection belongs to the current map
@@ -645,61 +679,61 @@ class Map extends Controller\AccessController {
public function updateUserData(\Base $f3){
$return = (object) [];
$return->error = [];
$activeCharacter = $this->getCharacter(0);
if($activeCharacter){
if( !empty($f3->get('POST.mapIds')) ){
$mapIds = (array)$f3->get('POST.mapIds');
// check if data for specific system is requested
$systemData = (array)$f3->get('POST.systemData');
// update current location
// -> suppress temporary timeout errors
$activeCharacter = $activeCharacter->updateLog(['suppressTimeoutErrors' => true]);
// if data is requested extend the cache key in order to get new data
$requestSystemData = (object) [];
$requestSystemData->mapId = isset($systemData['mapId']) ? (int) $systemData['mapId'] : 0;
$requestSystemData->systemId = isset($systemData['systemData']['id']) ? (int) $systemData['systemData']['id'] : 0;
if( $activeCharacter = $this->getCharacter(0) ){
$postData = $f3->get('POST');
if( !empty($mapIds = (array)$postData['mapIds']) ){
// IMPORTANT for now -> just update a single map (save performance)
$mapIds = array_slice($mapIds, 0, 1);
$mapId = (int)reset($mapIds);
// get map and check map access
$map = $activeCharacter->getMap( (int)$mapId);
// the userMapData is cached per map (this must be changed if multiple maps
// will be allowed in future...
$tempId = (int)$mapIds[0];
$cacheKey = 'user_data_' . $tempId . '_' . $requestSystemData->systemId;
if( !$f3->exists($cacheKey) ){
foreach($mapIds as $mapId){
$map = $activeCharacter->getMap( (int)$mapId);
if( !is_null($map) ){
$characterMapData = (array)$postData['characterMapData'];
if( !is_null($map) ){
$return->mapUserData[] = $map->getUserData();
// check if data for specific system is requested
$systemData = (array)$postData['systemData'];
// if data is requested extend the cache key in order to get new data
$requestSystemData = (object) [];
$requestSystemData->mapId = isset($systemData['mapId']) ? (int) $systemData['mapId'] : 0;
$requestSystemData->systemId = isset($systemData['systemData']['id']) ? (int) $systemData['systemData']['id'] : 0;
// request signature data for a system if user has map access!
if( $map->id === $requestSystemData->mapId ){
$system = $map->getSystemById( $requestSystemData->systemId );
// update current location
// -> suppress temporary timeout errors
$activeCharacter = $activeCharacter->updateLog(['suppressTimeoutErrors' => true]);
if( !is_null($system) ){
// data for currently selected system
$return->system = $system->getData();
$return->system->signatures = $system->getSignaturesData();
}
}
}
// check character log (current system) and manipulate map (e.g. add new system)
if( (bool)$characterMapData['mapTracking'] ){
$map = $this->updateMapData($activeCharacter, $map);
}
// cache time (seconds) should be equal or less than request trigger time
// prevent request flooding
$responseTTL = (int)$f3->get('PATHFINDER.TIMER.UPDATE_SERVER_USER_DATA.DELAY') / 1000;
$cacheKey = $this->getUserDataCacheKey($mapId, $requestSystemData->systemId);
if( !$f3->exists($cacheKey) ){
$return->mapUserData[] = $map->getUserData();
// cache response
$f3->set($cacheKey, $return, $responseTTL);
}else{
// get from cache
// this should happen if a user has multiple program instances running
// with the same main char
$return = $f3->get($cacheKey);
// request signature data for a system if user has map access!
if( $mapId === $requestSystemData->mapId ){
$system = $map->getSystemById( $requestSystemData->systemId );
if( !is_null($system) ){
// data for currently selected system
$return->system = $system->getData();
$return->system->signatures = $system->getSignaturesData();
}
}
// cache time (seconds) should be equal or less than request trigger time
// prevent request flooding
$responseTTL = (int)$f3->get('PATHFINDER.TIMER.UPDATE_SERVER_USER_DATA.DELAY') / 1000;
// cache response
$f3->set($cacheKey, $return, $responseTTL);
}else{
// get from cache
// this should happen if a user has multiple program instances running
// with the same main char
$return = $f3->get($cacheKey);
}
}
}
@@ -714,6 +748,193 @@ class Map extends Controller\AccessController {
echo json_encode( $return );
}
/**
*
* @param Model\CharacterModel $character
* @param Model\MapModel $map
* @return Model\MapModel
*/
protected function updateMapData($character, $map){
// update "map data" cache in case of map (system/connection) changes
$clearMapDataCache = false;
if(
( $mapScope = $map->getScope() ) &&
( $mapScope->name != 'none' ) && // tracking is disabled for map
( $log = $character->getLog() )
){
// character is currently in a system
$sameSystem = false;
$sourceExists = true;
$targetExists = true;
// system coordinates
$systemOffsetX = 130;
$systemOffsetY = 0;
$systemPosX = 0;
$systemPosY = 30;
$sourceSystemId = (int)$this->getF3()->get(User::SESSION_KEY_CHARACTER_PREV_SYSTEM_ID);
$targetSystemId = (int)$log->systemId;
$sourceSystem = null;
$targetSystem = null;
// check if source and target systems are equal
// -> NO target system available
if($sourceSystemId === $targetSystemId){
// check if previous (solo) system is already on the map
$sourceSystem = $map->getSystemByCCPId($sourceSystemId);
$sameSystem = true;
}else{
// check if previous (source) system is already on the map
$sourceSystem = $map->getSystemByCCPId($sourceSystemId);
// -> check if system is already on this map
$targetSystem = $map->getSystemByCCPId( $targetSystemId );
}
// if systems don´t already exists on map -> get "blank" systems
// -> required for system type check (e.g. wormhole, k-space)
if( !$sourceSystem ){
$sourceExists = false;
$sourceSystem = $map->getNewSystem($sourceSystemId);
}else{
// system exists -> add target to the "right"
$systemPosX = $sourceSystem->posX + $systemOffsetX;
$systemPosY = $sourceSystem->posY + $systemOffsetY;
}
if(
!$sameSystem &&
!$targetSystem
){
$targetExists = false;
$targetSystem = $map->getNewSystem( $targetSystemId );
}
$addSourceSystem = false;
$addTargetSystem = false;
$addConnection = false;
switch($mapScope->name){
case 'all':
if($sameSystem){
$addSourceSystem = true;
}else{
$addSourceSystem = true;
$addTargetSystem = true;
$addConnection = true;
}
break;
case 'k-space':
if($sameSystem){
if( !$sourceSystem->isWormhole() ){
$addSourceSystem = true;
}
}elseif(
!$sourceSystem->isWormhole() ||
!$targetSystem->isWormhole()
){
$addSourceSystem = true;
$addTargetSystem = true;
$addConnection = true;
}
break;
case 'wh':
default:
if($sameSystem){
if( $sourceSystem->isWormhole() ){
$addSourceSystem = true;
}
}elseif(
$sourceSystem->isWormhole() ||
$targetSystem->isWormhole()
){
$addSourceSystem = true;
$addTargetSystem = true;
$addConnection = true;
}elseif(
!$sourceSystem->isWormhole() &&
!$targetSystem->isWormhole()
){
// check distance between systems (in jumps)
// -> if > 1 it is !very likely! a wormhole
$routeController = new Route();
$routeController->initJumpData();
$route = $routeController->findRoute($sourceSystem->name, $targetSystem->name, 1);
if( !$route['routePossible'] ){
$addSourceSystem = true;
$addTargetSystem = true;
$addConnection = true;
}
}
break;
}
// save source system -------------------------------------------------------------------------------------
if(
$addSourceSystem &&
$sourceSystem &&
!$sourceExists
){
$sourceSystem = $map->saveSystem($sourceSystem, $systemPosX, $systemPosY, $character);
// get updated maps object
if($sourceSystem){
$map = $sourceSystem->mapId;
$sourceExists = true;
$clearMapDataCache = true;
// increase system position (prevent overlapping)
$systemPosX = $sourceSystem->posX + $systemOffsetX;
$systemPosY = $sourceSystem->posY + $systemOffsetY;
}
}
// save target system -------------------------------------------------------------------------------------
if(
$addTargetSystem &&
$targetSystem &&
!$targetExists
){
$targetSystem = $map->saveSystem($targetSystem, $systemPosX, $systemPosY, $character);
// get updated maps object
if($targetSystem){
$map = $targetSystem->mapId;
$clearMapDataCache = true;
$targetExists = true;
}
}
// save connection ----------------------------------------------------------------------------------------
if(
$addConnection &&
$sourceExists &&
$targetExists &&
$sourceSystem &&
$targetSystem &&
!$map->searchConnection( $sourceSystem, $targetSystem )
){
$connection = $map->getNewConnection($sourceSystem, $targetSystem);
$connection = $map->saveConnection($connection);
// get updated maps object
if($connection){
$map = $connection->mapId;
$clearMapDataCache = true;
}
}
}
if($clearMapDataCache){
$this->clearMapDataCache($character);
}
return $map;
}
}

View File

@@ -98,7 +98,7 @@ class System extends \Controller\AccessController {
* @return Model\SystemModel[]
* @throws \Exception
*/
protected function _getSystemModelByIds($columnIDs = [], $column = 'solarSystemID'){
public function getSystemModelByIds($columnIDs = [], $column = 'solarSystemID'){
$systemModels = [];
@@ -112,8 +112,7 @@ class System extends \Controller\AccessController {
$rows = $ccpDB->exec($query, null, 60 * 60 * 24);
// format result
$mapper = new Mapper\CcpSystemsMapper($rows);
$ccpSystemsData = $mapper->getData();
$ccpSystemsData = (new Mapper\CcpSystemsMapper($rows))->getData();
foreach($ccpSystemsData as $ccpSystemData){
/**
@@ -236,7 +235,7 @@ class System extends \Controller\AccessController {
// --> (e.g. multiple simultaneously save() calls for the same system)
if( is_null( $systemModel = $map->getSystemByCCPId($systemData['systemId']) ) ){
// system not found on map -> get static system data (CCP DB)
$systemModel = array_values( $this->_getSystemModelByIds([$systemData['systemId']]) )[0];
$systemModel = $map->getNewSystem($systemData['systemId']);
$systemModel->createdCharacterId = $activeCharacter;
}
@@ -332,7 +331,7 @@ class System extends \Controller\AccessController {
$return->systemData = $f3->get($cacheKey);
}else{
if($constellationId > 0){
$systemModels = $this->_getSystemModelByIds([$constellationId], 'constellationID');
$systemModels = $this->getSystemModelByIds([$constellationId], 'constellationID');
foreach($systemModels as $systemModel){
$return->systemData[] = $systemModel->getData();

View File

@@ -29,6 +29,7 @@ class User extends Controller\Controller{
const SESSION_KEY_CHARACTER_ID = 'SESSION.CHARACTER.ID';
const SESSION_KEY_CHARACTER_NAME = 'SESSION.CHARACTER.NAME';
const SESSION_KEY_CHARACTER_TIME = 'SESSION.CHARACTER.TIME';
const SESSION_KEY_CHARACTER_PREV_SYSTEM_ID = 'SESSION.CHARACTER.PREV_SYSTEM_ID';
const SESSION_KEY_CHARACTER_ACCESS_TOKEN = 'SESSION.CHARACTER.ACCESS_TOKEN';
const SESSION_KEY_CHARACTER_REFRESH_TOKEN = 'SESSION.CHARACTER.REFRESH_TOKEN';

View File

@@ -599,7 +599,7 @@ class Controller {
}
/**
* check weather the page is IGB trusted or not
* check whether the page is IGB trusted or not
* @return boolean
*/
static function isIGBTrusted(){

View File

@@ -78,10 +78,12 @@ abstract class BasicModel extends \DB\Cortex {
// events -----------------------------------------
$this->afterinsert(function($self){
$self->afterinsertEvent($self);
$self->clearCacheData();
});
$this->afterupdate( function($self){
$self->afterupdateEvent($self);
$self->clearCacheData();
});
@@ -317,7 +319,6 @@ abstract class BasicModel extends \DB\Cortex {
if( $f3->exists($cacheKey) ){
$f3->clear($cacheKey);
}
}
}
@@ -360,7 +361,7 @@ abstract class BasicModel extends \DB\Cortex {
}
/**
* checks weather this model is active or not
* checks whether this model is active or not
* each model should have an "active" column
* @return bool
*/
@@ -413,6 +414,24 @@ abstract class BasicModel extends \DB\Cortex {
return true;
}
/**
* Event "Hook" function
* can be overwritten
* return false will stop any further action
*/
public function afterinsertEvent(){
return true;
}
/**
* Event "Hook" function
* can be overwritten
* return false will stop any further action
*/
public function afterupdateEvent(){
return true;
}
/**
* Event "Hook" function
* can be overwritten

View File

@@ -8,6 +8,8 @@
namespace Model;
use Controller\Api\User;
use Controller\Controller;
use DB\SQL\Schema;
class CharacterLogModel extends BasicModel {
@@ -190,4 +192,34 @@ class CharacterLogModel extends BasicModel {
return $logData;
}
public function set_systemId($systemId){
if($systemId > 0){
$this->updateCharacterSessionLocation($systemId);
}
return $systemId;
}
/**
* update session data for active character
* @param int $systemId
*/
protected function updateCharacterSessionLocation($systemId){
$controller = new Controller();
$f3 = $this->getF3();
$systemId = (int)$systemId;
if(
( $activeCharacter = $controller->getCharacter() ) &&
( $activeCharacter->_id === $this->characterId->_id )
){
$prevSystemId = (int)$f3->get( User::SESSION_KEY_CHARACTER_PREV_SYSTEM_ID);
if($prevSystemId === 0){
$f3->set( User::SESSION_KEY_CHARACTER_PREV_SYSTEM_ID, $systemId);
}else{
$f3->set( User::SESSION_KEY_CHARACTER_PREV_SYSTEM_ID, (int)$this->systemId);
}
}
}
}

View File

@@ -369,7 +369,7 @@ class CharacterModel extends BasicModel {
}
if($updateLogData == false){
// ... IGB Header data not found OR character does not match current active character
// ... No IGB Header data found OR character does not match current active character
// -> try to pull data from CREST
$ssoController = new Sso();
@@ -533,12 +533,12 @@ class CharacterModel extends BasicModel {
if($this->characterMaps){
$mapCountPrivate = 0;
foreach($this->characterMaps as &$characterMap){
foreach($this->characterMaps as $characterMap){
if(
$mapCountPrivate < self::getF3()->get('PATHFINDER.MAX_MAPS_PRIVATE') &&
$characterMap->mapId->isActive()
){
$maps[] = &$characterMap->mapId;
$maps[] = $characterMap->mapId;
$mapCountPrivate++;
}
}

View File

@@ -8,6 +8,7 @@
namespace Model;
use Controller\Api\Route;
use DB\SQL\Schema;
class ConnectionModel extends BasicModel{
@@ -111,7 +112,37 @@ class ConnectionModel extends BasicModel{
}
/**
* check weather this model is valid or not
* set default connection type by search route between endpoints
*/
public function setDefaultTypeData(){
if(
is_object($this->source) &&
is_object($this->target)
){
$routeController = new Route();
$routeController->initJumpData();
$route = $routeController->findRoute($this->source->name, $this->target->name, 1);
if($route['routePossible']){
$this->scope = 'stargate';
$this->type = ['stargate'];
}else{
$this->scope = 'wh';
$this->type = ['wh_fresh'];
}
}
}
/**
* check whether this connection is a wormhole or not
* @return bool
*/
public function isWormhole(){
return ($this->scope === 'wh');
}
/**
* check whether this model is valid or not
* @return bool
*/
public function isValid(){
@@ -120,6 +151,8 @@ class ConnectionModel extends BasicModel{
// check if source/target system are not equal
// check if source/target belong to same map
if(
is_object($this->source) &&
is_object($this->target) &&
$this->source->_id === $this->target->_id ||
$this->source->mapId->_id !== $this->target->mapId->_id
){
@@ -129,6 +162,31 @@ class ConnectionModel extends BasicModel{
return $isValid;
}
/**
* Event "Hook" function
* can be overwritten
* return false will stop any further action
*/
public function beforeInsertEvent(){
// check for "default" connection type and add them if missing
if(
!$this->scope ||
!$this->type
){
$this->setDefaultTypeData();
}
return true;
}
/**
* save connection and check if obj is valid
* @return ConnectionModel|false
*/
public function save(){
return ( $this->isValid() ) ? parent::save() : false;
}
/**
* delete a connection
* @param CharacterModel $characterModel

View File

@@ -8,7 +8,7 @@
namespace Model;
use Controller\Api\User;
use Controller\Api\System;
use DB\SQL\Schema;
class MapModel extends BasicModel {
@@ -209,59 +209,80 @@ class MapModel extends BasicModel {
return $mapDataAll;
}
/**
* get blank system model pre-filled with default SDE data
* @param int $systemId
* @return SystemModel
*/
public function getNewSystem($systemId){
$systemController = new System();
$system = reset($systemController->getSystemModelByIds([$systemId]));
$system->mapId = $this->id;
return $system;
}
/**
* get blank connection model for given source/target systems
* @param SystemModel $sourceSystem
* @param SystemModel $targetSystem
* @return ConnectionModel
*/
public function getNewConnection(SystemModel $sourceSystem, SystemModel $targetSystem){
/**
* @var $connection ConnectionModel
*/
$connection = $this->rel('connections');
$connection->mapId = $this;
$connection->source = $sourceSystem;
$connection->target = $targetSystem;
return $connection;
}
/**
* search for a system by id
* @param int $id
* @return null|SystemModel
*/
public function getSystemById($id){
/**
* @var $system SystemModel
*/
$system = $this->rel('systems');
$result = $system->findone([
'active = 1 AND mapId = :mapId AND id = :id',
':mapId' => $this->id,
':id' => $id
]);
return is_object($result) ? $result : null;
}
/**
* search for a system by CCPs systemId
* @param int $systemId
* @return null|SystemModel
*/
public function getSystemByCCPId($systemId){
$system = null;
if( !empty($systems = $this->getSystems('systemId', (int)$systemId) ) ){
$system = $systems[0];
}
return $system;
}
/**
* search for a system by id
* @param int $systemId
* @return null|SystemModel
*/
public function getSystemById($systemId){
$system = null;
if( !empty($systems = $this->getSystems('id', (int)$systemId) ) ){
$system = $systems[0];
}
return $system;
/**
* @var $system SystemModel
*/
$system = $this->rel('systems');
$result = $system->findone([
'active = 1 AND mapId = :mapId AND systemId = :systemId',
':mapId' => $this->id,
':systemId' => $systemId
]);
return is_object($result) ? $result : null;
}
/**
* get either all system models in this map
* -> or get a specific system by column filter
* @param string $column
* @param string $value
* @return array|mixed
*/
public function getSystems($column = '', $value = ''){
public function getSystems(){
$systems = [];
$filterQuery = ['active = :active AND id > 0',
':active' => 1
];
// add more filter options....
if(
!empty($column) &&
!empty($value)
){
$filterQuery[0] .= ' AND ' . $column . ' = :value';
$filterQuery[':value'] = $value;
}
// orderBy x-Coordinate for smoother frontend animation (left to right)
$this->filter('systems', $filterQuery,
$this->filter('systems', ['active = 1'],
['order' => 'posX']
);
@@ -426,7 +447,7 @@ class MapModel extends BasicModel {
}
/**
* checks weather a character has access to this map or not
* checks whether a character has access to this map or not
* @param CharacterModel $characterModel
* @return bool
*/
@@ -588,7 +609,7 @@ class MapModel extends BasicModel {
}
/**
* checks weather this map is private map
* checks whether this map is private map
* @return bool
*/
public function isPrivate(){
@@ -602,7 +623,7 @@ class MapModel extends BasicModel {
}
/**
* checks weather this map is corporation map
* checks whether this map is corporation map
* @return bool
*/
public function isCorporation(){
@@ -616,7 +637,7 @@ class MapModel extends BasicModel {
}
/**
* checks weather this map is alliance map
* checks whether this map is alliance map
* @return bool
*/
public function isAlliance(){
@@ -629,6 +650,81 @@ class MapModel extends BasicModel {
return $isAlliance;
}
/**
*
* @return mixed|null
*/
public function getScope(){
$scope = null;
if( $this->scopeId->isActive() ){
$scope = $this->scopeId;
}
return $scope;
}
/**
* save a system to this map
* @param SystemModel $system
* @param int $posX
* @param int $posY
* @param null|CharacterModel $character
* @return mixed
*/
public function saveSystem( SystemModel $system, $posX = 10, $posY = 0, $character = null){
$system->mapId = $this->id;
$system->posX = $posX;
$system->posY = $posY;
$system->createdCharacterId = $character;
$system->updatedCharacterId = $character;
return $system->save();
}
/**
* search for a connection by (source -> target) system ids
* -> this also searches the revers way (target -> source)
* @param SystemModel $sourceSystem
* @param SystemModel $targetSystem
* @return ConnectionModel|null
*/
public function searchConnection(SystemModel $sourceSystem, SystemModel $targetSystem){
// check if both systems belong to this map
if(
$sourceSystem->mapId->id === $this->id &&
$targetSystem->mapId->id === $this->id
){
$this->filter('connections', [
'active = :active AND
(
(
source = :sourceId AND
target = :targetId
) OR (
source = :targetId AND
target = :sourceId
)
)',
':active' => 1,
':sourceId' => $sourceSystem->id,
':targetId' => $targetSystem->id,
], ['limit'=> 1]);
return ($this->connections) ? reset($this->connections) : null;
}else{
return null;
}
}
/**
* save new connection
* -> connection scope/type is automatically added
* @param ConnectionModel $connection
* @return false|ConnectionModel
*/
public function saveConnection(ConnectionModel $connection){
$connection->mapId = $this;
return $connection->save();
}
/**
* get all active characters (with active log)
* grouped by systems

View File

@@ -37,7 +37,19 @@ class MapScopeModel extends BasicModel{
[
'id' => 1,
'name' => 'wh',
'label' => 'w-space'
'label' => 'wormholes'
],[
'id' => 2,
'name' => 'k-space',
'label' => 'stargates'
],[
'id' => 3,
'name' => 'none',
'label' => 'none'
],[
'id' => 4,
'name' => 'all',
'label' => 'all'
]
];

View File

@@ -404,17 +404,11 @@ class SystemModel extends BasicModel {
}
/**
* checks weather this system is a wormhole
* check whether this system is a wormhole or not
* @return bool
*/
protected function isWormhole(){
$isWormhole = false;
if($this->typeId->id == 1){
$isWormhole = true;
}
return $isWormhole;
public function isWormhole(){
return ($this->typeId->id === 1);
}
/**

View File

@@ -22,36 +22,36 @@ requirejs.config({
setup: './app/setup', // initial start "setup page" view
jquery: 'lib/jquery-1.11.3.min', // v1.11.3 jQuery
bootstrap: 'lib/bootstrap.min', // v3.3.0 Bootstrap js code - http://getbootstrap.com/javascript/
bootstrap: 'lib/bootstrap.min', // v3.3.0 Bootstrap js code - http://getbootstrap.com/javascript
text: 'lib/requirejs/text', // v2.0.12 A RequireJS/AMD loader plugin for loading text resources.
mustache: 'lib/mustache.min', // v1.0.0 Javascript template engine - http://mustache.github.io/
velocity: 'lib/velocity.min', // v1.2.2 animation engine - http://julian.com/research/velocity/
mustache: 'lib/mustache.min', // v1.0.0 Javascript template engine - http://mustache.github.io
velocity: 'lib/velocity.min', // v1.2.2 animation engine - http://julian.com/research/velocity
velocityUI: 'lib/velocity.ui.min', // v5.0.4 plugin for velocity - http://julian.com/research/velocity/#uiPack
slidebars: 'lib/slidebars', // v0.10 Slidebars - side menu plugin http://plugins.adchsm.me/slidebars/
jsPlumb: 'lib/dom.jsPlumb-1.7.6', // v1.7.6 jsPlumb (Vanilla)- main map draw plugin https://jsplumbtoolkit.com/
slidebars: 'lib/slidebars', // v0.10 Slidebars - side menu plugin http://plugins.adchsm.me/slidebars
jsPlumb: 'lib/dom.jsPlumb-1.7.6', // v1.7.6 jsPlumb (Vanilla)- main map draw plugin https://jsplumbtoolkit.com
farahey: 'lib/farahey-0.5', // v0.5 jsPlumb "magnetizing" extension - https://github.com/jsplumb/farahey
customScrollbar: 'lib/jquery.mCustomScrollbar.concat.min', // v3.0.9 Custom scroll bars - http://manos.malihu.gr/
datatables: 'lib/datatables/jquery.dataTables.min', // v1.10.7 DataTables - https://datatables.net/
customScrollbar: 'lib/jquery.mCustomScrollbar.concat.min', // v3.1.3 Custom scroll bars - http://manos.malihu.gr
datatables: 'lib/datatables/jquery.dataTables.min', // v1.10.7 DataTables - https://datatables.net
//datatablesBootstrap: 'lib/datatables/dataTables.bootstrap', // DataTables - not used (bootstrap style)
datatablesResponsive: 'lib/datatables/extensions/responsive/dataTables.responsive', // v1.0.6 TableTools (PlugIn) - https://datatables.net/extensions/responsive/
datatablesResponsive: 'lib/datatables/extensions/responsive/dataTables.responsive', // v1.0.6 TableTools (PlugIn) - https://datatables.net/extensions/responsive
datatablesTableTools: 'lib/datatables/extensions/tabletools/js/dataTables.tableTools', // v2.2.3 TableTools (PlugIn) - https://datatables.net/extensions/tabletools/
datatablesTableTools: 'lib/datatables/extensions/tabletools/js/dataTables.tableTools', // v2.2.3 TableTools (PlugIn) - https://datatables.net/extensions/tabletools
xEditable: 'lib/bootstrap-editable.min', // v1.5.1 X-editable - in placed editing
morris: 'lib/morris.min', // v0.5.1 Morris.js - graphs and charts
raphael: 'lib/raphael-min', // v2.1.2 Raphaël - required for morris (dependency)
bootbox: 'lib/bootbox.min', // v4.4.0 Bootbox.js - custom dialogs - http://bootboxjs.com/
easyPieChart: 'lib/jquery.easypiechart.min', // v2.1.6 Easy Pie Chart - HTML 5 pie charts - http://rendro.github.io/easy-pie-chart/
dragToSelect: 'lib/jquery.dragToSelect', // v1.1 Drag to Select - http://andreaslagerkvist.com/jquery/drag-to-select/
bootbox: 'lib/bootbox.min', // v4.4.0 Bootbox.js - custom dialogs - http://bootboxjs.com
easyPieChart: 'lib/jquery.easypiechart.min', // v2.1.6 Easy Pie Chart - HTML 5 pie charts - http://rendro.github.io/easy-pie-chart
dragToSelect: 'lib/jquery.dragToSelect', // v1.1 Drag to Select - http://andreaslagerkvist.com/jquery/drag-to-select
hoverIntent: 'lib/jquery.hoverIntent.minified', // v1.8.0 Hover intention - http://cherne.net/brian/resources/jquery.hoverIntent.html
fullScreen: 'lib/jquery.fullscreen.min', // v0.5.0 Full screen mode - https://github.com/private-face/jquery.fullscreen
select2: 'lib/select2.min', // v4.0.0 Drop Down customization - https://select2.github.io/
select2: 'lib/select2.min', // v4.0.0 Drop Down customization - https://select2.github.io
validator: 'lib/validator.min', // v0.10.1 Validator for Bootstrap 3 - https://github.com/1000hz/bootstrap-validator
lazylinepainter: 'lib/jquery.lazylinepainter-1.5.1.min', // v1.5.1 SVG line animation plugin - http://lazylinepainter.info/
blueImpGallery: 'lib/blueimp-gallery', // v2.15.2 Image Gallery - https://github.com/blueimp/Gallery/
lazylinepainter: 'lib/jquery.lazylinepainter-1.5.1.min', // v1.5.1 SVG line animation plugin - http://lazylinepainter.info
blueImpGallery: 'lib/blueimp-gallery', // v2.15.2 Image Gallery - https://github.com/blueimp/Gallery
blueImpGalleryHelper: 'lib/blueimp-helper', // helper function for Blue Imp Gallery
blueImpGalleryBootstrap: 'lib/bootstrap-image-gallery', // v3.1.1 Bootstrap extension for Blue Imp Gallery - https://blueimp.github.io/Bootstrap-Image-Gallery/
blueImpGalleryBootstrap: 'lib/bootstrap-image-gallery', // v3.1.1 Bootstrap extension for Blue Imp Gallery - https://blueimp.github.io/Bootstrap-Image-Gallery
bootstrapConfirmation: 'lib/bootstrap-confirmation', // v1.0.1 Bootstrap extension for inline confirm dialog - https://github.com/tavicu/bs-confirmation
bootstrapToggle: 'lib/bootstrap2-toggle.min', // v2.2.0 Bootstrap Toggle (Checkbox) - http://www.bootstraptoggle.com/
bootstrapToggle: 'lib/bootstrap2-toggle.min', // v2.2.0 Bootstrap Toggle (Checkbox) - http://www.bootstraptoggle.com
lazyload: 'lib/jquery.lazyload.min', // v1.9.5 LazyLoader images - http://www.appelsiini.net/projects/lazyload
// header animation

View File

@@ -7,7 +7,7 @@ define(['jquery'], function($) {
'use strict';
/**
* checks weather the program URL is IGB trusted or not
* checks whether the program URL is IGB trusted or not
* @returns {boolean}
*/
var isTrusted = function(){

View File

@@ -30,7 +30,6 @@ define([
mapMagnetizer: false, // "Magnetizer" feature for drag&drop systems on map (optional)
mapTabContentClass: 'pf-map-tab-content', // Tab-Content element (parent element)
mapWrapperClass: 'pf-map-wrapper', // wrapper div (scrollable)
headMapTrackingId: 'pf-head-map-tracking', // id for "map tracking" toggle (checkbox)
mapClass: 'pf-map', // class for all maps
mapGridClass: 'pf-grid-small', // class for map grid snapping
@@ -82,10 +81,6 @@ define([
// active connections per map (cache object)
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
var activeSystemCache = '';
// jsPlumb config
var globalMapConfig = {
source: {
@@ -2911,7 +2906,7 @@ define([
// validate form
form.validator('validate');
// check weather the form is valid
// check whether the form is valid
var formValid = form.isValidForm();
if(formValid === false){
@@ -3075,11 +3070,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');
// container must exist! otherwise systems can not be updated
if(mapElement !== undefined){
@@ -3149,76 +3139,12 @@ define([
// set current location data for header update
headerUpdateData.currentSystemId = $(system).data('id');
headerUpdateData.currentSystemName = currentCharacterLog.system.name;
// check connection exists between new and previous systems --------o------------------------------
// e.g. a loop
if(
activeSystemCache &&
mapTracking &&
activeSystemCache.data('systemId') !== currentCharacterLog.system.id
){
// maybe a loop detected (both systems already on map -> connection missing
var connections = checkForConnection(map, activeSystemCache, system );
if(connections.length === 0){
var connectionData = {
source: activeSystemCache.data('id') ,
target: system.data('id'),
type: ['wh_fresh'] // default type.
};
var connection = drawConnection(map, connectionData);
saveConnection(connection);
}
}
// cache current location
activeSystemCache = system;
}
}
system.updateSystemUserData(map, tempUserData, currentUserIsHere);
}
// 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 is online with IGB AND OOG
if(
currentUserOnMap === false &&
currentCharacterLog &&
mapTracking
){
// add new system to the map
var requestData = {
systemData: {
systemId: currentCharacterLog.system.id
},
mapData: {
id: userData.config.id
}
};
// check if a system jump is detected previous system !== current system
// and add a connection to the previous system as well
// hint: if a user just logged on -> there is no active system cached
var sourceSystem = false;
if(
activeSystemCache &&
activeSystemCache.data('systemId') !== currentCharacterLog.system.id
){
// draw new connection
sourceSystem = activeSystemCache;
// calculate new system coordinates
requestData.systemData.position = calculateNewSystemPosition(sourceSystem);
}
mapElement.getMapOverlay('timer').startMapUpdateCounter();
saveSystem(map, requestData, sourceSystem, false);
}
// trigger document event -> update header
$(document).trigger('pf:updateHeaderMapData', headerUpdateData);
}

View File

@@ -99,6 +99,8 @@ define([
userUpdate: 0
};
var locationToggle = $('#' + Util.config.headMapTrackingId);
// ping for main map update ========================================================
var triggerMapUpdatePing = function(){
@@ -197,7 +199,10 @@ define([
var updatedUserData = {
mapIds: mapIds,
systemData: Util.getCurrentSystemData()
systemData: Util.getCurrentSystemData(),
characterMapData: {
mapTracking: (locationToggle.is(':checked') ? 1 : 0) // location tracking
}
};
Util.timeStart(logKeyServerUserData);

View File

@@ -76,7 +76,7 @@ define([
// validate form
form.validator('validate');
// check weather the form is valid
// check whether the form is valid
var formValid = form.isValidForm();
if(formValid === true){

View File

@@ -218,7 +218,7 @@ define([
}
});
// check weather the form is valid
// check whether the form is valid
var formValid = form.isValidForm();
if(formValid === true){

View File

@@ -202,7 +202,7 @@ define([
// validate form
form.validator('validate');
// check weather the form is valid
// check whether the form is valid
var formValid = form.isValidForm();
if(formValid === false){

View File

@@ -31,6 +31,9 @@ define([
formWarningContainerClass: 'pf-dialog-warning-container', // class for "warning" containers in dialogs
formInfoContainerClass: 'pf-dialog-info-container', // class for "info" containers in dialogs
// head
headMapTrackingId: 'pf-head-map-tracking', // id for "map tracking" toggle (checkbox)
settingsMessageVelocityOptions: {
duration: 180
@@ -353,7 +356,7 @@ define([
};
/**
* checks weather a bootstrap form is valid or not
* checks whether a bootstrap form is valid or not
* validation plugin does not provide a proper function for this
* @returns {boolean}
*/

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -22,36 +22,36 @@ requirejs.config({
setup: './app/setup', // initial start "setup page" view
jquery: 'lib/jquery-1.11.3.min', // v1.11.3 jQuery
bootstrap: 'lib/bootstrap.min', // v3.3.0 Bootstrap js code - http://getbootstrap.com/javascript/
bootstrap: 'lib/bootstrap.min', // v3.3.0 Bootstrap js code - http://getbootstrap.com/javascript
text: 'lib/requirejs/text', // v2.0.12 A RequireJS/AMD loader plugin for loading text resources.
mustache: 'lib/mustache.min', // v1.0.0 Javascript template engine - http://mustache.github.io/
velocity: 'lib/velocity.min', // v1.2.2 animation engine - http://julian.com/research/velocity/
mustache: 'lib/mustache.min', // v1.0.0 Javascript template engine - http://mustache.github.io
velocity: 'lib/velocity.min', // v1.2.2 animation engine - http://julian.com/research/velocity
velocityUI: 'lib/velocity.ui.min', // v5.0.4 plugin for velocity - http://julian.com/research/velocity/#uiPack
slidebars: 'lib/slidebars', // v0.10 Slidebars - side menu plugin http://plugins.adchsm.me/slidebars/
jsPlumb: 'lib/dom.jsPlumb-1.7.6', // v1.7.6 jsPlumb (Vanilla)- main map draw plugin https://jsplumbtoolkit.com/
slidebars: 'lib/slidebars', // v0.10 Slidebars - side menu plugin http://plugins.adchsm.me/slidebars
jsPlumb: 'lib/dom.jsPlumb-1.7.6', // v1.7.6 jsPlumb (Vanilla)- main map draw plugin https://jsplumbtoolkit.com
farahey: 'lib/farahey-0.5', // v0.5 jsPlumb "magnetizing" extension - https://github.com/jsplumb/farahey
customScrollbar: 'lib/jquery.mCustomScrollbar.concat.min', // v3.0.9 Custom scroll bars - http://manos.malihu.gr/
datatables: 'lib/datatables/jquery.dataTables.min', // v1.10.7 DataTables - https://datatables.net/
customScrollbar: 'lib/jquery.mCustomScrollbar.concat.min', // v3.1.3 Custom scroll bars - http://manos.malihu.gr
datatables: 'lib/datatables/jquery.dataTables.min', // v1.10.7 DataTables - https://datatables.net
//datatablesBootstrap: 'lib/datatables/dataTables.bootstrap', // DataTables - not used (bootstrap style)
datatablesResponsive: 'lib/datatables/extensions/responsive/dataTables.responsive', // v1.0.6 TableTools (PlugIn) - https://datatables.net/extensions/responsive/
datatablesResponsive: 'lib/datatables/extensions/responsive/dataTables.responsive', // v1.0.6 TableTools (PlugIn) - https://datatables.net/extensions/responsive
datatablesTableTools: 'lib/datatables/extensions/tabletools/js/dataTables.tableTools', // v2.2.3 TableTools (PlugIn) - https://datatables.net/extensions/tabletools/
datatablesTableTools: 'lib/datatables/extensions/tabletools/js/dataTables.tableTools', // v2.2.3 TableTools (PlugIn) - https://datatables.net/extensions/tabletools
xEditable: 'lib/bootstrap-editable.min', // v1.5.1 X-editable - in placed editing
morris: 'lib/morris.min', // v0.5.1 Morris.js - graphs and charts
raphael: 'lib/raphael-min', // v2.1.2 Raphaël - required for morris (dependency)
bootbox: 'lib/bootbox.min', // v4.4.0 Bootbox.js - custom dialogs - http://bootboxjs.com/
easyPieChart: 'lib/jquery.easypiechart.min', // v2.1.6 Easy Pie Chart - HTML 5 pie charts - http://rendro.github.io/easy-pie-chart/
dragToSelect: 'lib/jquery.dragToSelect', // v1.1 Drag to Select - http://andreaslagerkvist.com/jquery/drag-to-select/
bootbox: 'lib/bootbox.min', // v4.4.0 Bootbox.js - custom dialogs - http://bootboxjs.com
easyPieChart: 'lib/jquery.easypiechart.min', // v2.1.6 Easy Pie Chart - HTML 5 pie charts - http://rendro.github.io/easy-pie-chart
dragToSelect: 'lib/jquery.dragToSelect', // v1.1 Drag to Select - http://andreaslagerkvist.com/jquery/drag-to-select
hoverIntent: 'lib/jquery.hoverIntent.minified', // v1.8.0 Hover intention - http://cherne.net/brian/resources/jquery.hoverIntent.html
fullScreen: 'lib/jquery.fullscreen.min', // v0.5.0 Full screen mode - https://github.com/private-face/jquery.fullscreen
select2: 'lib/select2.min', // v4.0.0 Drop Down customization - https://select2.github.io/
select2: 'lib/select2.min', // v4.0.0 Drop Down customization - https://select2.github.io
validator: 'lib/validator.min', // v0.10.1 Validator for Bootstrap 3 - https://github.com/1000hz/bootstrap-validator
lazylinepainter: 'lib/jquery.lazylinepainter-1.5.1.min', // v1.5.1 SVG line animation plugin - http://lazylinepainter.info/
blueImpGallery: 'lib/blueimp-gallery', // v2.15.2 Image Gallery - https://github.com/blueimp/Gallery/
lazylinepainter: 'lib/jquery.lazylinepainter-1.5.1.min', // v1.5.1 SVG line animation plugin - http://lazylinepainter.info
blueImpGallery: 'lib/blueimp-gallery', // v2.15.2 Image Gallery - https://github.com/blueimp/Gallery
blueImpGalleryHelper: 'lib/blueimp-helper', // helper function for Blue Imp Gallery
blueImpGalleryBootstrap: 'lib/bootstrap-image-gallery', // v3.1.1 Bootstrap extension for Blue Imp Gallery - https://blueimp.github.io/Bootstrap-Image-Gallery/
blueImpGalleryBootstrap: 'lib/bootstrap-image-gallery', // v3.1.1 Bootstrap extension for Blue Imp Gallery - https://blueimp.github.io/Bootstrap-Image-Gallery
bootstrapConfirmation: 'lib/bootstrap-confirmation', // v1.0.1 Bootstrap extension for inline confirm dialog - https://github.com/tavicu/bs-confirmation
bootstrapToggle: 'lib/bootstrap2-toggle.min', // v2.2.0 Bootstrap Toggle (Checkbox) - http://www.bootstraptoggle.com/
bootstrapToggle: 'lib/bootstrap2-toggle.min', // v2.2.0 Bootstrap Toggle (Checkbox) - http://www.bootstraptoggle.com
lazyload: 'lib/jquery.lazyload.min', // v1.9.5 LazyLoader images - http://www.appelsiini.net/projects/lazyload
// header animation

View File

@@ -7,7 +7,7 @@ define(['jquery'], function($) {
'use strict';
/**
* checks weather the program URL is IGB trusted or not
* checks whether the program URL is IGB trusted or not
* @returns {boolean}
*/
var isTrusted = function(){

View File

@@ -30,7 +30,6 @@ define([
mapMagnetizer: false, // "Magnetizer" feature for drag&drop systems on map (optional)
mapTabContentClass: 'pf-map-tab-content', // Tab-Content element (parent element)
mapWrapperClass: 'pf-map-wrapper', // wrapper div (scrollable)
headMapTrackingId: 'pf-head-map-tracking', // id for "map tracking" toggle (checkbox)
mapClass: 'pf-map', // class for all maps
mapGridClass: 'pf-grid-small', // class for map grid snapping
@@ -82,10 +81,6 @@ define([
// active connections per map (cache object)
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
var activeSystemCache = '';
// jsPlumb config
var globalMapConfig = {
source: {
@@ -2911,7 +2906,7 @@ define([
// validate form
form.validator('validate');
// check weather the form is valid
// check whether the form is valid
var formValid = form.isValidForm();
if(formValid === false){
@@ -3075,11 +3070,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');
// container must exist! otherwise systems can not be updated
if(mapElement !== undefined){
@@ -3149,76 +3139,12 @@ define([
// set current location data for header update
headerUpdateData.currentSystemId = $(system).data('id');
headerUpdateData.currentSystemName = currentCharacterLog.system.name;
// check connection exists between new and previous systems --------o------------------------------
// e.g. a loop
if(
activeSystemCache &&
mapTracking &&
activeSystemCache.data('systemId') !== currentCharacterLog.system.id
){
// maybe a loop detected (both systems already on map -> connection missing
var connections = checkForConnection(map, activeSystemCache, system );
if(connections.length === 0){
var connectionData = {
source: activeSystemCache.data('id') ,
target: system.data('id'),
type: ['wh_fresh'] // default type.
};
var connection = drawConnection(map, connectionData);
saveConnection(connection);
}
}
// cache current location
activeSystemCache = system;
}
}
system.updateSystemUserData(map, tempUserData, currentUserIsHere);
}
// 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 is online with IGB AND OOG
if(
currentUserOnMap === false &&
currentCharacterLog &&
mapTracking
){
// add new system to the map
var requestData = {
systemData: {
systemId: currentCharacterLog.system.id
},
mapData: {
id: userData.config.id
}
};
// check if a system jump is detected previous system !== current system
// and add a connection to the previous system as well
// hint: if a user just logged on -> there is no active system cached
var sourceSystem = false;
if(
activeSystemCache &&
activeSystemCache.data('systemId') !== currentCharacterLog.system.id
){
// draw new connection
sourceSystem = activeSystemCache;
// calculate new system coordinates
requestData.systemData.position = calculateNewSystemPosition(sourceSystem);
}
mapElement.getMapOverlay('timer').startMapUpdateCounter();
saveSystem(map, requestData, sourceSystem, false);
}
// trigger document event -> update header
$(document).trigger('pf:updateHeaderMapData', headerUpdateData);
}

View File

@@ -99,6 +99,8 @@ define([
userUpdate: 0
};
var locationToggle = $('#' + Util.config.headMapTrackingId);
// ping for main map update ========================================================
var triggerMapUpdatePing = function(){
@@ -197,7 +199,10 @@ define([
var updatedUserData = {
mapIds: mapIds,
systemData: Util.getCurrentSystemData()
systemData: Util.getCurrentSystemData(),
characterMapData: {
mapTracking: (locationToggle.is(':checked') ? 1 : 0) // location tracking
}
};
Util.timeStart(logKeyServerUserData);

View File

@@ -76,7 +76,7 @@ define([
// validate form
form.validator('validate');
// check weather the form is valid
// check whether the form is valid
var formValid = form.isValidForm();
if(formValid === true){

View File

@@ -218,7 +218,7 @@ define([
}
});
// check weather the form is valid
// check whether the form is valid
var formValid = form.isValidForm();
if(formValid === true){

View File

@@ -202,7 +202,7 @@ define([
// validate form
form.validator('validate');
// check weather the form is valid
// check whether the form is valid
var formValid = form.isValidForm();
if(formValid === false){

View File

@@ -31,6 +31,9 @@ define([
formWarningContainerClass: 'pf-dialog-warning-container', // class for "warning" containers in dialogs
formInfoContainerClass: 'pf-dialog-info-container', // class for "info" containers in dialogs
// head
headMapTrackingId: 'pf-head-map-tracking', // id for "map tracking" toggle (checkbox)
settingsMessageVelocityOptions: {
duration: 180
@@ -353,7 +356,7 @@ define([
};
/**
* checks weather a bootstrap form is valid or not
* checks whether a bootstrap form is valid or not
* validation plugin does not provide a proper function for this
* @returns {boolean}
*/

File diff suppressed because one or more lines are too long

View File

@@ -17,8 +17,8 @@
<h4>Map types</h4>
<p>
<em class="pf-brand">pathfinder</em>&nbsp;&nbsp;supports 3 different types of maps. Each map contains several systems <small>(<i class="fa fa-sun-o fa-fw"></i><a href="#" data-target="#pf-manual-system">more</a>)</small>
and connections <small>(<i class="fa fa-chain fa-fw"></i><a href="#" data-target="#pf-manual-connection">more</a>)</small>. Maps are also referred to as <em>"Chain Map"</em> or <em>"Chain"</em>.
<em class="pf-brand">pathfinder</em>&nbsp;&nbsp;supports 3 different types of maps. Systems <small>(<i class="fa fa-sun-o fa-fw"></i><a href="#" data-target="#pf-manual-system">more</a>)</small>
and connections <small>(<i class="fa fa-chain fa-fw"></i><a href="#" data-target="#pf-manual-connection">more</a>)</small> can be added to them. Maps are also referred to as <em>"Chain Map"</em> or <em>"Chain"</em>:
</p>
<ul class="fa-ul">
<li><i class="fa-li fa fa-circle fa-fw pf-map-type-private"></i>private map<small> (is not visible for other pilots, unless you invite them)</small></li>
@@ -29,6 +29,26 @@
<p>
Up to 5 different maps can be used simultaneously. <span class="txt-color txt-color-blue">Alliance maps</span> require appropriate rules to be created.
</p>
<h4 id="pf-manual-scrollspy-anchor-map-scope">Map scope</h4>
<p>
Each map has a <em>"scope"</em> that affects how systems will be added automatically to it:
</p>
<ul class="list-unstyled" style=" margin-left: 10px;">
<li>wormholes -<small> (w-space systems and chain exit systems are tracked)</small></li>
<li>stargates -<small> (k-space systems and direct neighboured systems are tracked)</small></li>
<li>all -<small> (any system will be tracked)</small></li>
<li>none -<small> (system tracking is disabled)</small></li>
</ul>
<h4><i class="fa fa-location-arrow fa-fw"></i> Map tracking</h4>
<p>
If "map tracking" is <span class="txt-color txt-color-greenLight">on</span>, new systems <small>(<i class="fa fa-sun-o fa-fw"></i><a href="#" data-target="#pf-manual-system">more</a>)</small>
and connections <small>(<i class="fa fa-chain fa-fw"></i><a href="#" data-target="#pf-manual-connection">more</a>)</small>
will be automatically added to the current map <small>(<i class="fa fa-code-fork fa-fw"></i><a href="#" data-target="#pf-manual-map">more</a>)</small>.
This can only work if your current position is known by <em class="pf-brand">pathfinder</em>.<br>
The map scope <small>(<i class="fa fa-crosshairs fa-fw"></i><a href="#" data-target="#pf-manual-scrollspy-anchor-map-scope">more</a>)</small> defines which systems are affected.<br>
The connection scope <small>(<i class="fa fa-crosshairs fa-fw"></i><a href="#" data-target="#pf-manual-scrollspy-anchor-connection-scope">more</a>)</small> will be auto-detected (e.g. wormhole connection).
This is achieved by calculating the jump distance between your current system and system you came from.
</p>
<h4 id="pf-manual-scrollspy-anchor-map-contextmenu">Context menu</h4>
<p>
<kbd>right click</kbd> somewhere on the map to open the context menu.
@@ -64,24 +84,11 @@
<span style="position: absolute; line-height: 30px; margin-left: 10px;">4</span>
</div>
</div>
<p>
The <em>"Update counter"</em> starts counting backwards during map interaction. While the counter is active, no data is pushed to server.
Once the counter hits 0, all map date will be stored and active pilots will receive the map updates.<br>
There is no need for any save/edit buttons.
</p>
<h4><i class="fa fa-location-arrow fa-fw"></i> Map tracking</h4>
<p>
If "map tracking" is <span class="txt-color txt-color-greenLight">on</span>, new systems <small>(<i class="fa fa-sun-o fa-fw"></i><a href="#" data-target="#pf-manual-system">more</a>)</small>
and connections <small>(<i class="fa fa-chain fa-fw"></i><a href="#" data-target="#pf-manual-connection">more</a>)</small>
will be automatically added to the current map <small>(<i class="fa fa-code-fork fa-fw"></i><a href="#" data-target="#pf-manual-map">more</a>)</small>.
This can only work if your current position is known by <em class="pf-brand">pathfinder</em>. You have to use the <em class="pf-brand">IGB</em> for this feature.<br>
The connection scope <small>(<i class="fa fa-crosshairs fa-fw"></i><a href="#" data-target="#pf-manual-scrollspy-anchor-connection-scope">more</a>)</small> will be auto-detected and can be changed afterwards.
This is achieved by calculating the jump distance between your current system and system you came from.
</p>
<div class="clearfix"></div>
<hr class="pf-manual-scroll-break">
@@ -168,6 +175,7 @@
<li><i class="fa fa-lock fa-fw"></i> Lock this system <small><a href="#" data-target="#pf-manual-scrollspy-anchor-system-locked">more</a></small></li>
<li><i class="fa fa-users fa-fw"></i> Set "Rally Point" for this system <small><a href="#" data-target="#pf-manual-scrollspy-anchor-system-rally">more</a></small></li>
<li><i class="fa fa-tags fa-fw"></i> Changes the status of this system <small><a href="#" data-target="#pf-manual-scrollspy-anchor-system-status">more</a></small></li>
<li><i class="fa fa-reply fa-rotate-180 fa-fw"></i> Waypoint options for this system <small><a href="#" data-target="#pf-manual-scrollspy-anchor-system-waypoint">more</a></small></li>
<li><i class="fa fa-eraser fa-fw"></i> Delete this system and all connections <small><a href="#" data-target="#pf-manual-scrollspy-anchor-system-delete">more</a></small></li>
</ul>
<h4 id="pf-manual-scrollspy-anchor-system-locked"><i class="fa fa-lock fa-fw"></i> Locked system</h4>
@@ -182,6 +190,15 @@
Active pilot will be informed about new "Rally points" by a notice. Optional you can poke active pilots with "desktop push notifications"
<small>(<i class="fa fa-bullhorn fa-fw"></i><a href="#" data-target="#pf-manual-scrollspy-anchor-notification-desktop">more</a>)</small>.
</p>
<h4 id="pf-manual-scrollspy-anchor-system-waypoint"><i class="fa fa-flag-checkered fa-fw"></i> Waypoints</h4>
<p>
Waypoints can be set to systems. Waypoint options are identical to their in game options.
</p>
<ul class="list-unstyled" style=" margin-left: 10px;">
<li>set destination -<small> (clear other waypoints and set new destination)</small></li>
<li>add new [start] -<small> (add new waypoint in front of your waypoint queue)</small></li>
<li>add new [end] -<small> (add new waypoint to the end of your waypoint queue)</small></li>
</ul>
<h4 id="pf-manual-scrollspy-anchor-system-delete"><i class="fa fa-eraser fa-fw"></i> Delete system</h4>
<p>
Any system that is not "Locked" <small>(<i class="fa fa-lock fa-fw"></i><a href="#" data-target="#pf-manual-scrollspy-anchor-system-locked">more</a>)</small> can be deleted from a map.
@@ -192,7 +209,7 @@
<h2 id="pf-manual-connection"><i class="fa fa-chain fa-lg fa-fw"></i>&nbsp;&nbsp;Connection (Stargate / Wormhole)</h2>
<p>
Connections between systems are represented by solid curved lines. Any connection requires two systems that are connected. A connection can be a <em>"Stargate"</em> or <em>"Wormhole"</em>.
Connections between systems are represented by solid lines. Any connection requires two systems that are connected together.
</p>
<h4>Connect systems</h4>
<p>
@@ -324,28 +341,21 @@
The concept of map sharing is pretty complex and powerful. By default all sharing options are disabled, so there is no reason to be concerned about map security.
All map types <small>(<i class="fa fa-code-fork fa-fw"></i><a href="#" data-target="#pf-manual-map">more</a>)</small> can be temporary shared with allied entities e.g. for "<em>Joint-Ops</em>".<br>
The map type is preserved for the period of sharing (private maps can be shared with other users, corporation maps can be shared with other corporations,..).
For now you can not invite a single user to your corporation map.
Do the following steps to share your map with your friend/allied corporation/allied alliance:
</p>
<ol style=" padding-left: 20px; list-style-type: decimal;">
<li>Get in contact with your friend and convince him to temporary enable "map invite", for the type of map you are planning to share, in the "<em>Share settings</em>" dialog</li>
<li>Open the "<em>Map settings</em>" dialog on the map you are planning to share. Switch to the "<em>Settings</em>" tab and search for your friend or corporation/alliance </li>
<li>Open the "<em>Map settings</em>" dialog on the map you are planning to share. Switch to the "<em>Settings</em>" tab and search for a character name or corporation/alliance </li>
<li>If you can not find the "option" you are looking for, make sure he has enabled the "map invite" option</li>
<li>Save the "<em>Map settings</em>" with the new "share" option. Wait a few seconds until the new settings take effect</li>
<li>If you were successful, you will see a small <i class="fa fa-share-alt fa-fw"></i> icon in your map tab</li>
<li>Disable the "map invite" flag and enjoy the shared map (prevent hostiles from invite you to their maps)</li>
</ol>
<h4><i class="fa fa-info fa-fw"></i> Important information</h4>
<ul class="list-unstyled" style=" margin-left: 10px;">
<li>"<em>Private maps</em>" are shared between "Users" (not "Characters")! - Make sure looking for the correct username instead of searching for a character name.</li>
<li>
<ul class="list-unstyled" style=" margin-left: 10px;">
<li>The advantage of this concept is that a "User" can use a map with all its registered "<em>Alt-Characters</em>"</li>
</ul>
</li>
<li>For now, all corporation/alliance members have the role to change/set the "map invite" flag.
<ul style=" padding-left: 20px; list-style-type: disc;">
<li>For now, all corporation/alliance members have the right to change/set the "map invite" flag.
Make sure not to share your corp/ally maps with hostile entities, and/or remove them from the map once the Op is over. If you are paranoid, delete the shared map</li>
<li>Keep the limit of shared maps in mind. If you, your friend/corp/ally have reached the limit of shared maps, you cant start an additional shared map</li>
<li>Keep the limit of shared maps in mind. If you, your friend/corp/ally have reached the limit of shared maps, you can´t start a new shared map</li>
<li>Please be aware of the fact, that any entity that has map access, can take over map control and hijack the map by removing you/your corp/your ally from the access list</li>
<li>Check the lifetime cycle for "<em>Private maps</em>". If a map reaches the end, it will be removed for all users who have access</li>
</ul>

View File

@@ -5,7 +5,7 @@
<div class="form-group">
<label for="icon" class="col-sm-4 control-label">Icon</label>
<div class="col-sm-8">
<select style="font-family: FontAwesome" name="icon" id="icon" class="form-control" title="Map icon for identification" data-placement="top">
<select style="font-family: FontAwesome" name="icon" id="icon" class="form-control" title="Map icon" data-placement="top">
{{#icon}}
<option value="{{class}}">{{{unicode}}}</option>
{{/icon}}
@@ -29,7 +29,7 @@
<div class="form-group">
<label for="scope" class="col-sm-2 control-label">Scope</label>
<div class="col-sm-10">
<select name="scopeId" id="scope" class="form-control" title="Default scope for new connections" data-placement="top">
<select name="scopeId" id="scope" class="form-control" title="Connections that get tracked on this map" data-placement="top">
{{#scope}}
<option value="{{id}}">{{label}}</option>
{{/scope}}

View File

@@ -119,7 +119,7 @@
// map manual dialog ==========================================================
#pf-manual-scrollspy{
position: relative;
height: 500px;
height: 700px;
overflow: auto;
}