@@ -21,4 +21,4 @@ deactivateMapData = Cron\MapUpdate->deactivateMapData, @hourly
|
||||
deleteMapData = Cron\MapUpdate->deleteMapData, @downtime
|
||||
|
||||
; delete character log data
|
||||
deleteLogData = Cron\CharacterUpdate->deleteLogData, @downtime
|
||||
deleteLogData = Cron\CharacterUpdate->deleteLogData, @instant
|
||||
@@ -71,16 +71,18 @@ class Route extends \Controller\AccessController {
|
||||
$this->f3->exists($cacheKeyIdArray)
|
||||
){
|
||||
// get cached values
|
||||
|
||||
$this->nameArray = $this->f3->get($cacheKeyNamedArray);
|
||||
$this->jumpArray = $this->f3->get($cacheKeyJumpArray);
|
||||
$this->idArray = $this->f3->get($cacheKeyIdArray);
|
||||
}else{
|
||||
// nothing cached
|
||||
|
||||
$pfDB = $this->getDB('PF');
|
||||
|
||||
$query = "SELECT * FROM system_neighbour";
|
||||
|
||||
$rows = $this->f3->get('DB')->exec($query, null, $this->jumpDataCacheTime);
|
||||
|
||||
$rows = $pfDB->exec($query, null, $this->jumpDataCacheTime);
|
||||
|
||||
foreach($rows as $row){
|
||||
$regionId = $row['regionId'];
|
||||
@@ -202,8 +204,8 @@ class Route extends \Controller\AccessController {
|
||||
*/
|
||||
private function setupSystemJumpTable(){
|
||||
|
||||
// switch DB
|
||||
$this->setDB('CCP');
|
||||
$pfDB = $this->getDB('PF');
|
||||
$ccpDB = $this->getDB('CCP');
|
||||
|
||||
$query = "SELECT
|
||||
map_sys.solarSystemID system_id,
|
||||
@@ -228,18 +230,17 @@ class Route extends \Controller\AccessController {
|
||||
system_neighbours IS NOT NULL
|
||||
";
|
||||
|
||||
$rows = $this->f3->get('DB')->exec($query);
|
||||
$rows = $ccpDB->exec($query);
|
||||
|
||||
if(count($rows) > 0){
|
||||
// switch DB back to pathfinder DB
|
||||
$this->setDB('PF');
|
||||
|
||||
// clear cache table
|
||||
$query = "TRUNCATE system_neighbour";
|
||||
$this->f3->get('DB')->exec($query);
|
||||
$pfDB->exec($query);
|
||||
|
||||
foreach($rows as $row){
|
||||
$this->f3->get('DB')->exec("
|
||||
$pfDB->exec("
|
||||
INSERT INTO
|
||||
system_neighbour(
|
||||
regionId,
|
||||
|
||||
@@ -99,24 +99,20 @@ class System extends \Controller\AccessController {
|
||||
|
||||
$systemModels = [];
|
||||
|
||||
// switch DB
|
||||
$this->setDB('CCP');
|
||||
$ccpDB = $this->getDB('CCP');
|
||||
|
||||
$this->whereQuery = "WHERE
|
||||
map_sys." . $column . " IN (" . implode(',', $columnIDs) . ")";
|
||||
|
||||
$query = $this->_getQuery();
|
||||
|
||||
$rows = $this->f3->get('DB')->exec($query, null, 60 * 60 * 24);
|
||||
$rows = $ccpDB->exec($query, null, 60 * 60 * 24);
|
||||
|
||||
// format result
|
||||
$mapper = new Mapper\CcpSystemsMapper($rows);
|
||||
|
||||
$ccpSystemsData = $mapper->getData();
|
||||
|
||||
// switch DB
|
||||
$this->setDB('PF');
|
||||
|
||||
foreach($ccpSystemsData as $ccpSystemData){
|
||||
$system = Model\BasicModel::getNew('SystemModel');
|
||||
$system->setData($ccpSystemData);
|
||||
@@ -132,12 +128,11 @@ class System extends \Controller\AccessController {
|
||||
*/
|
||||
public function getSystems(){
|
||||
|
||||
// switch DB
|
||||
$this->setDB('CCP');
|
||||
$ccpDB = $this->getDB('CCP');
|
||||
|
||||
$query = $this->_getQuery();
|
||||
|
||||
$rows = $this->f3->get('DB')->exec($query, null, 60 * 60 * 24);
|
||||
$rows = $ccpDB->exec($query, null, 60 * 60 * 24);
|
||||
|
||||
// format result
|
||||
$mapper = new Mapper\CcpSystemsMapper($rows);
|
||||
@@ -152,9 +147,7 @@ class System extends \Controller\AccessController {
|
||||
*/
|
||||
public function search($f3, $params){
|
||||
|
||||
// switch DB
|
||||
\DB\Database::instance();
|
||||
$this->setDB('CCP');
|
||||
$ccpDB = $this->getDB('CCP');
|
||||
|
||||
$searchToken = '';
|
||||
// check for search parameter
|
||||
@@ -167,7 +160,7 @@ class System extends \Controller\AccessController {
|
||||
|
||||
$query = $this->_getQuery();
|
||||
|
||||
$rows = $f3->get('DB')->exec($query);
|
||||
$rows = $ccpDB->exec($query);
|
||||
|
||||
// format result
|
||||
$mapper = new Mapper\CcpSystemsMapper($rows);
|
||||
|
||||
@@ -11,6 +11,7 @@ use Controller;
|
||||
use controller\MailController;
|
||||
use Model;
|
||||
use Exception;
|
||||
use DB;
|
||||
|
||||
class User extends Controller\Controller{
|
||||
|
||||
@@ -70,10 +71,12 @@ class User extends Controller\Controller{
|
||||
|
||||
// set Session login
|
||||
$dateTime = new \DateTime();
|
||||
$this->f3->set('SESSION.user.time', $dateTime->getTimestamp());
|
||||
$this->f3->set('SESSION.user.name', $user->name);
|
||||
$this->f3->set('SESSION.user.id', $user->id);
|
||||
|
||||
$this->f3->set('SESSION.user', [
|
||||
'time' => $dateTime->getTimestamp(),
|
||||
'name' => $user->name,
|
||||
'id' => $user->id
|
||||
]);
|
||||
|
||||
// save user login information
|
||||
$user->touch('lastLogin');
|
||||
@@ -144,19 +147,9 @@ class User extends Controller\Controller{
|
||||
|
||||
if($characterLog = $character->getLog()){
|
||||
$characterLog->erase();
|
||||
$characterLog->save();
|
||||
|
||||
$character->clearCacheData();
|
||||
|
||||
// delete log cache key as well
|
||||
$f3->clear('LOGGED.user.character.id_' . $characterLog->characterId->id . '.systemId');
|
||||
$f3->clear('LOGGED.user.character.id_' . $characterLog->characterId->id . '.shipId');
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -65,9 +65,10 @@ class Controller {
|
||||
/**
|
||||
* set change the DB connection
|
||||
* @param string $database
|
||||
* @return mixed|void
|
||||
*/
|
||||
protected function setDB($database = 'PF'){
|
||||
DB\Database::instance()->setDB($database);
|
||||
protected function getDB($database = 'PF'){
|
||||
return DB\Database::instance()->getDB($database);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,20 +80,72 @@ class Controller {
|
||||
protected function _getUser($ttl = 5){
|
||||
|
||||
$user = false;
|
||||
$userId = $this->f3->get('SESSION.user.id');
|
||||
|
||||
if($userId > 0){
|
||||
$userModel = Model\BasicModel::getNew('UserModel');
|
||||
$userModel->getById($userId, $ttl);
|
||||
if( $this->f3->exists('SESSION.user.id') ){
|
||||
$userId = (int)$this->f3->get('SESSION.user.id');
|
||||
|
||||
if( !$userModel->dry() ){
|
||||
$user = $userModel;
|
||||
if($userId > 0){
|
||||
$userModel = Model\BasicModel::getNew('UserModel');
|
||||
$userModel->getById($userId, $ttl);
|
||||
|
||||
if( !$userModel->dry() ){
|
||||
$user = $userModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* log the current user out
|
||||
* @param $f3
|
||||
*/
|
||||
public function logOut($f3){
|
||||
|
||||
// destroy session
|
||||
$f3->clear('SESSION');
|
||||
|
||||
if( !$f3->get('AJAX') ){
|
||||
// redirect to landing page
|
||||
$f3->reroute('@landing');
|
||||
}else{
|
||||
$return = (object) [];
|
||||
$return->reroute = self::getEnvironmentData('URL') . $f3->alias('landing');
|
||||
$return->error[] = $this->getUserLoggedOffError();
|
||||
|
||||
echo json_encode($return);
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* verifies weather a given username and password is valid
|
||||
* @param $userName
|
||||
* @param $password
|
||||
* @return Model\UserModel|null
|
||||
*/
|
||||
protected function _verifyUser($userName, $password) {
|
||||
|
||||
$validUser = null;
|
||||
|
||||
$user = Model\BasicModel::getNew('UserModel', 0);
|
||||
|
||||
$user->getByName($userName);
|
||||
|
||||
// check userName is valid
|
||||
if( !$user->dry() ){
|
||||
// check if password is valid
|
||||
$isValid = $user->verify($password);
|
||||
|
||||
if($isValid === true){
|
||||
$validUser = $user;
|
||||
}
|
||||
}
|
||||
|
||||
return $validUser;
|
||||
}
|
||||
|
||||
/**
|
||||
* check weather the page is IGB trusted or not
|
||||
* @return mixed
|
||||
@@ -152,55 +205,6 @@ class Controller {
|
||||
return $isIGB;
|
||||
}
|
||||
|
||||
/**
|
||||
* verifies weather a given username and password is valid
|
||||
* @param $userName
|
||||
* @param $password
|
||||
* @return Model\UserModel|null
|
||||
*/
|
||||
protected function _verifyUser($userName, $password) {
|
||||
|
||||
$validUser = null;
|
||||
|
||||
$user = Model\BasicModel::getNew('UserModel', 0);
|
||||
|
||||
$user->getByName($userName);
|
||||
|
||||
// check userName is valid
|
||||
if( !$user->dry() ){
|
||||
// check if password is valid
|
||||
$isValid = $user->verify($password);
|
||||
|
||||
if($isValid === true){
|
||||
$validUser = $user;
|
||||
}
|
||||
}
|
||||
|
||||
return $validUser;
|
||||
}
|
||||
|
||||
/**
|
||||
* log the current user out
|
||||
* @param $f3
|
||||
*/
|
||||
public function logOut($f3){
|
||||
|
||||
// destroy session
|
||||
$f3->clear('SESSION.user');
|
||||
$f3->sync('SESSION');
|
||||
|
||||
if( !$f3->get('AJAX') ){
|
||||
// redirect to landing page
|
||||
$f3->reroute('@landing');
|
||||
}else{
|
||||
$return = (object) [];
|
||||
$return->reroute = self::getEnvironmentData('URL') . $f3->alias('landing');
|
||||
$return->error[] = $this->getUserLoggedOffError();
|
||||
|
||||
echo json_encode($return);
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get error object is a user is not found/logged of
|
||||
@@ -238,8 +242,8 @@ class Controller {
|
||||
* @return mixed
|
||||
*/
|
||||
static function formatHiveKey($key){
|
||||
$illegalCharacters = ['-'];
|
||||
return str_replace($illegalCharacters, '', $key);
|
||||
$illegalCharacters = ['-', ' '];
|
||||
return strtolower( str_replace($illegalCharacters, '', $key) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,17 +36,14 @@ class CcpSystemsUpdate {
|
||||
*/
|
||||
private function prepareSystemLogTables(){
|
||||
|
||||
$f3 = \Base::instance();
|
||||
|
||||
// get information for all systems from CCP DB
|
||||
$systemController = new Controller\Api\System();
|
||||
$systemsData = $systemController->getSystems();
|
||||
|
||||
// switch DB back to pathfinder
|
||||
DB\Database::instance()->setDB('PF');
|
||||
$pfDB = DB\Database::instance()->getDB('PF');
|
||||
|
||||
// insert systems into each log table if not exist
|
||||
$f3->get('DB')->begin();
|
||||
$pfDB->begin();
|
||||
foreach($this->logTables as $tableName){
|
||||
|
||||
// insert systems into jump log table
|
||||
@@ -56,14 +53,14 @@ class CcpSystemsUpdate {
|
||||
foreach($systemsData as $systemData){
|
||||
// skip WH systems -> no jump data available
|
||||
if($systemData['type']['name'] == 'k-space'){
|
||||
$f3->get('DB')->exec($sqlInsertSystem, array(
|
||||
$pfDB->exec($sqlInsertSystem, array(
|
||||
':systemId' => $systemData['systemId']
|
||||
), 0, false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
$f3->get('DB')->commit();
|
||||
$pfDB->commit();
|
||||
|
||||
return $systemsData;
|
||||
}
|
||||
@@ -82,6 +79,7 @@ class CcpSystemsUpdate {
|
||||
$time_end = microtime(true);
|
||||
$execTimePrepareSystemLogTables = $time_end - $time_start;
|
||||
|
||||
$pfDB = DB\Database::instance()->getDB('PF');
|
||||
|
||||
// get current jump Data -------------------------------------------------------
|
||||
$time_start = microtime(true);
|
||||
@@ -141,7 +139,7 @@ class CcpSystemsUpdate {
|
||||
// update system log tables -----------------------------------------------------
|
||||
$time_start = microtime(true);
|
||||
// make sure last update is (at least) 1h ago
|
||||
$f3->get('DB')->begin();
|
||||
$pfDB->begin();
|
||||
|
||||
foreach($this->logTables as $key => $tableName){
|
||||
$sql = "UPDATE
|
||||
@@ -187,7 +185,7 @@ class CcpSystemsUpdate {
|
||||
$currentJumps = $jumpData[$systemData['systemId']];
|
||||
}
|
||||
|
||||
$f3->get('DB')->exec($sql, array(
|
||||
$pfDB->exec($sql, array(
|
||||
':systemId' => $systemData['systemId'],
|
||||
':value' => $currentJumps
|
||||
), 0, false);
|
||||
@@ -201,14 +199,14 @@ class CcpSystemsUpdate {
|
||||
$currentKills = $currentKillData[$key];
|
||||
}
|
||||
|
||||
$f3->get('DB')->exec($sql, array(
|
||||
$pfDB->exec($sql, array(
|
||||
':systemId' => $systemData['systemId'],
|
||||
':value' => $currentKills
|
||||
), 0, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
$f3->get('DB')->commit();
|
||||
$pfDB->commit();
|
||||
|
||||
$time_end = microtime(true);
|
||||
$execTimeUpdateTables = $time_end - $time_start;
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
namespace cron;
|
||||
use Controller;
|
||||
use DB;
|
||||
use Model;
|
||||
|
||||
|
||||
class CharacterUpdate {
|
||||
|
||||
@@ -19,10 +21,20 @@ class CharacterUpdate {
|
||||
*/
|
||||
function deleteLogData($f3){
|
||||
|
||||
DB\Database::instance()->setDB('PF');
|
||||
$characterLogModel = Model\BasicModel::getNew('CharacterLogModel');
|
||||
|
||||
$sqlDeleteCharacterLogs = "TRUNCATE TABLE character_log";
|
||||
$f3->get('DB')->exec($sqlDeleteCharacterLogs);
|
||||
// find "old" character logs
|
||||
$characterLogs = $characterLogModel->find([
|
||||
'TIMESTAMPDIFF(SECOND, updated, NOW() ) > :lifetime',
|
||||
':lifetime' => (int)$f3->get('PATHFINDER.CACHE.CHARACTER_LOG')
|
||||
]);
|
||||
|
||||
if(is_object($characterLogs)){
|
||||
foreach($characterLogs as $characterLog){
|
||||
// delete log and all cached values
|
||||
$characterLog->erase();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,7 +24,7 @@ class MapUpdate {
|
||||
*/
|
||||
function deactivateMapData($f3){
|
||||
|
||||
DB\Database::instance()->setDB('PF');
|
||||
$pfDB = DB\Database::instance()->getDB('PF');
|
||||
|
||||
$sqlDeactivateExpiredMaps = "UPDATE map SET
|
||||
active = 0
|
||||
@@ -35,8 +35,8 @@ class MapUpdate {
|
||||
|
||||
$privateMapLifetime = (int)$f3->get('PATHFINDER.MAP.PRIVATE.LIFETIME');
|
||||
|
||||
$f3->get('DB')->exec($sqlDeactivateExpiredMaps, ['lifetime' => $privateMapLifetime]);
|
||||
$deactivatedMapsCount = $f3->get('DB')->count();
|
||||
$pfDB->exec($sqlDeactivateExpiredMaps, ['lifetime' => $privateMapLifetime]);
|
||||
$deactivatedMapsCount = $pfDB->count();
|
||||
|
||||
// Log ------------------------
|
||||
$log = Controller\LogController::getLogger('cron_' . __FUNCTION__);
|
||||
@@ -50,7 +50,7 @@ class MapUpdate {
|
||||
*/
|
||||
function deleteMapData($f3){
|
||||
|
||||
DB\Database::instance()->setDB('PF');
|
||||
$pfDB = DB\Database::instance()->getDB('PF');
|
||||
|
||||
$sqlDeleteDisabledMaps = "DELETE FROM
|
||||
map
|
||||
@@ -58,9 +58,9 @@ class MapUpdate {
|
||||
map.active = 0 AND
|
||||
TIMESTAMPDIFF(DAY, map.updated, NOW() ) > :deletion_time";
|
||||
|
||||
$f3->get('DB')->exec($sqlDeleteDisabledMaps, ['deletion_time' => self::DAYS_UNTIL_MAP_DELETION]);
|
||||
$pfDB->exec($sqlDeleteDisabledMaps, ['deletion_time' => self::DAYS_UNTIL_MAP_DELETION]);
|
||||
|
||||
$deletedMapsCount = $f3->get('DB')->count();
|
||||
$deletedMapsCount = $pfDB->count();
|
||||
|
||||
// Log ------------------------
|
||||
$log = Controller\LogController::getLogger('cron_' . __FUNCTION__);
|
||||
|
||||
@@ -68,7 +68,7 @@ class CcpSystemsMapper extends \RecursiveArrayIterator {
|
||||
$iterator['security'] == 8 ||
|
||||
$iterator['security'] == 9
|
||||
){
|
||||
$trueSec = round($iterator['trueSec'], 1);
|
||||
$trueSec = round($iterator['trueSec'], 3);
|
||||
|
||||
if($trueSec <= 0){
|
||||
$security = '0.0';
|
||||
|
||||
@@ -16,17 +16,20 @@ class Database extends \Prefab {
|
||||
function __construct($database = 'PF'){
|
||||
// set database
|
||||
$this->setDB($database);
|
||||
$this->setDB($database);
|
||||
}
|
||||
|
||||
/**
|
||||
* set database
|
||||
* @param string $database
|
||||
* @return SQL
|
||||
*/
|
||||
public function setDB($database = 'PF'){
|
||||
|
||||
$f3 = \Base::instance();
|
||||
|
||||
// "Hive" Key for DB storage
|
||||
$dbHiveKey = $this->getDbHiveKey($database);
|
||||
|
||||
if($database === 'CCP'){
|
||||
// CCP DB
|
||||
$dns = Controller\Controller::getEnvironmentData('DB_CCP_DNS');
|
||||
@@ -34,33 +37,63 @@ class Database extends \Prefab {
|
||||
$user = Controller\Controller::getEnvironmentData('DB_CCP_USER');
|
||||
$password = Controller\Controller::getEnvironmentData('DB_CCP_PASS');
|
||||
}else{
|
||||
// Pathfinder DB
|
||||
// Pathfinder(PF) DB
|
||||
$dns = Controller\Controller::getEnvironmentData('DB_DNS');
|
||||
$name = Controller\Controller::getEnvironmentData('DB_NAME');
|
||||
$user = Controller\Controller::getEnvironmentData('DB_USER');
|
||||
$password = Controller\Controller::getEnvironmentData('DB_PASS');
|
||||
}
|
||||
|
||||
// check for DB switch. If current DB equal new DB -> no switch needed
|
||||
// check if DB connection already exists
|
||||
if(
|
||||
!$f3->exists('DB') ||
|
||||
$name !== $f3->get('DB')->name()
|
||||
!$f3->exists( $dbHiveKey ) ||
|
||||
$name !== $f3->get( $dbHiveKey )->name()
|
||||
){
|
||||
|
||||
$db = $this->connect($dns, $name, $user, $password);
|
||||
|
||||
$f3->set('DB', $db);
|
||||
|
||||
// set DB timezone to UTC +00:00 (eve server time)
|
||||
$f3->get('DB')->exec('SET @@session.time_zone = "+00:00";');
|
||||
$db->exec('SET @@session.time_zone = "+00:00";');
|
||||
|
||||
// disable innoDB schema (relevant vor MySql 5.5)
|
||||
// not necessary for MySql > v.5.6
|
||||
//$f3->get('DB')->exec('SET GLOBAL innodb_stats_on_metadata = OFF;');
|
||||
}
|
||||
// $db->exec('SET GLOBAL innodb_stats_on_metadata = OFF;');
|
||||
|
||||
// store DB object
|
||||
$f3->set($dbHiveKey, $db);
|
||||
|
||||
return $db;
|
||||
}else{
|
||||
return $f3->get( $dbHiveKey );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get database
|
||||
* @param string $database
|
||||
* @return mixed|void
|
||||
*/
|
||||
public function getDB($database = 'PF'){
|
||||
|
||||
$f3 = \Base::instance();
|
||||
$dbHiveKey = $this->getDbHiveKey($database);
|
||||
|
||||
if( $f3->exists( $dbHiveKey ) ){
|
||||
return $f3->get( $dbHiveKey );
|
||||
}else{
|
||||
return $this->setDB($database);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get a unique hive key for each DB connection
|
||||
* @param $database
|
||||
* @return string
|
||||
*/
|
||||
protected function getDbHiveKey($database){
|
||||
return 'DB_' . $database;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* connect to a database
|
||||
* @param $dns
|
||||
|
||||
@@ -11,10 +11,15 @@ namespace Model;
|
||||
use DB\SQL\Schema;
|
||||
use Exception;
|
||||
use Controller;
|
||||
use DB;
|
||||
|
||||
class BasicModel extends \DB\Cortex {
|
||||
|
||||
protected $db = 'DB';
|
||||
/**
|
||||
* Hive key with DB object
|
||||
* @var string
|
||||
*/
|
||||
protected $db = 'DB_PF';
|
||||
|
||||
/**
|
||||
* caching time of field schema - seconds
|
||||
@@ -231,8 +236,9 @@ class BasicModel extends \DB\Cortex {
|
||||
*/
|
||||
protected function setUpdated(){
|
||||
if($this->_id > 0){
|
||||
$f3 = self::getF3();
|
||||
$f3->get('DB')->exec(
|
||||
$pfDB = DB\Database::instance()->getDB('PF');
|
||||
|
||||
$pfDB->exec(
|
||||
["UPDATE " . $this->table . " SET updated=NOW() WHERE id=:id"],
|
||||
[
|
||||
[':id' => $this->_id]
|
||||
@@ -386,7 +392,6 @@ class BasicModel extends \DB\Cortex {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -401,7 +406,7 @@ class BasicModel extends \DB\Cortex {
|
||||
|
||||
$model = '\\' . __NAMESPACE__ . '\\' . $model;
|
||||
if(class_exists($model)){
|
||||
$class = new $model( self::getF3()->get('DB'), null, null, $ttl );
|
||||
$class = new $model( null, null, null, $ttl );
|
||||
}else{
|
||||
throw new \Exception('No model class found');
|
||||
}
|
||||
|
||||
@@ -19,6 +19,16 @@ class CharacterLogModel extends BasicModel {
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct($db = NULL, $table = NULL, $fluid = NULL, $ttl = 0){
|
||||
|
||||
parent::__construct($db, $table, $fluid, $ttl);
|
||||
|
||||
// events -----------------------------------------
|
||||
$this->beforeerase(function($self){
|
||||
$self->clearCacheData();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* get all character log data
|
||||
* @return object
|
||||
@@ -38,5 +48,19 @@ class CharacterLogModel extends BasicModel {
|
||||
return $logData;
|
||||
}
|
||||
|
||||
/**
|
||||
* see parent
|
||||
*/
|
||||
public function clearCacheData(){
|
||||
parent::clearCacheData();
|
||||
|
||||
// delete log cache key as well
|
||||
$f3 = self::getF3();
|
||||
$character = $this->characterId;
|
||||
|
||||
$character->clearCacheData();
|
||||
$f3->clear('LOGGED.user.character.id_' . $character->id);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -138,6 +138,26 @@ class SystemModel extends BasicModel {
|
||||
return $systemData;
|
||||
}
|
||||
|
||||
/**
|
||||
* setter for system security value
|
||||
* @param $trueSec
|
||||
* @return float
|
||||
*/
|
||||
public function set_trueSec($trueSec){
|
||||
|
||||
if(
|
||||
$trueSec > 0 &&
|
||||
$trueSec < 0.1
|
||||
){
|
||||
// 0.3 is still a LS -> no rounding
|
||||
$trueSec = 0.1;
|
||||
}else{
|
||||
$trueSec = round($trueSec, 1);
|
||||
}
|
||||
|
||||
return $trueSec;
|
||||
}
|
||||
|
||||
/**
|
||||
* setter validation for x coordinate
|
||||
* @param $posX
|
||||
|
||||
@@ -431,36 +431,43 @@ class UserModel extends BasicModel {
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function updateCharacterLog($ttl = 0){
|
||||
$apiController = Controller\CcpApiController::getIGBHeaderData();
|
||||
$headerData = Controller\CcpApiController::getIGBHeaderData();
|
||||
|
||||
// check if IGB Data is available
|
||||
if( !empty($apiController->values) ){
|
||||
if( !empty($headerData->values) ){
|
||||
$f3 = self::getF3();
|
||||
|
||||
// check if system has changed since the last call
|
||||
// current location is stored in session to avoid unnecessary DB calls
|
||||
$sessionCharacterKey = 'LOGGED.user.character.id_' . $apiController->values['charid'];
|
||||
// current location is stored (global) to avoid unnecessary DB calls
|
||||
$sessionCharacterKey = 'LOGGED.user.character.id_' . $headerData->values['charid'];
|
||||
|
||||
if($f3->exists($sessionCharacterKey)){
|
||||
// cache data exists
|
||||
$cacheData = $f3->get($sessionCharacterKey);
|
||||
}else{
|
||||
// new cache data
|
||||
$cacheData = [
|
||||
'systemId' => 0,
|
||||
'shipId' => 0
|
||||
];
|
||||
}
|
||||
|
||||
if(
|
||||
!$f3->exists($sessionCharacterKey) ||
|
||||
$f3->get($sessionCharacterKey . '.systemId') != $apiController->values['solarsystemid'] ||
|
||||
$f3->get($sessionCharacterKey . '.shipId') != $apiController->values['shiptypeid']
|
||||
$cacheData['systemId'] != $headerData->values['solarsystemid'] ||
|
||||
$cacheData['shipId'] != $headerData->values['shiptypeid']
|
||||
){
|
||||
|
||||
$cacheData = [
|
||||
'systemId' => $apiController->values['solarsystemid'],
|
||||
'shipId' => $apiController->values['shiptypeid']
|
||||
];
|
||||
$cacheData['systemId'] = (int)$headerData->values['solarsystemid'];
|
||||
$cacheData['shipId'] = (int)$headerData->values['shiptypeid'];
|
||||
|
||||
// character has changed system, or character just logged on
|
||||
$character = self::getNew('CharacterModel');
|
||||
$character->getById( (int)$apiController->values['charid'] );
|
||||
$character->getById( (int)$headerData->values['charid'] );
|
||||
|
||||
if( $character->dry() ){
|
||||
// this can happen if a valid user plays the game with a not registered character
|
||||
// whose API is not registered -> save new character or update character data
|
||||
$corporationId = array_key_exists('corpid', $apiController->values) ? $apiController->values['corpid'] : null;
|
||||
$allianceId = array_key_exists('allianceid', $apiController->values) ? $apiController->values['allianceid'] : null;
|
||||
$corporationId = array_key_exists('corpid', $headerData->values) ? $headerData->values['corpid'] : null;
|
||||
$allianceId = array_key_exists('allianceid', $headerData->values) ? $headerData->values['allianceid'] : null;
|
||||
|
||||
// check if corp exists
|
||||
if( !is_null($corporationId) ){
|
||||
@@ -468,7 +475,7 @@ class UserModel extends BasicModel {
|
||||
$corporation->getById( (int)$corporationId );
|
||||
if( $corporation->dry() ){
|
||||
$corporation->id = $corporationId;
|
||||
$corporation->name = $apiController->values['corpname'];
|
||||
$corporation->name = $headerData->values['corpname'];
|
||||
$corporation->save();
|
||||
}
|
||||
}
|
||||
@@ -479,13 +486,13 @@ class UserModel extends BasicModel {
|
||||
$alliance->getById( (int)$allianceId );
|
||||
if( $alliance->dry() ){
|
||||
$alliance->id = $allianceId;
|
||||
$alliance->name = $apiController->values['alliancename'];
|
||||
$alliance->name = $headerData->values['alliancename'];
|
||||
$alliance->save();
|
||||
}
|
||||
}
|
||||
|
||||
$character->id = (int) $apiController->values['charid'];
|
||||
$character->name = $apiController->values['charname'];
|
||||
$character->id = (int) $headerData->values['charid'];
|
||||
$character->name = $headerData->values['charname'];
|
||||
$character->corporationId = $corporationId;
|
||||
$character->allianceId = $allianceId;
|
||||
$character->save();
|
||||
@@ -498,11 +505,11 @@ class UserModel extends BasicModel {
|
||||
|
||||
// set character log values
|
||||
$characterLog->characterId = $character;
|
||||
$characterLog->systemId = $apiController->values['solarsystemid'];
|
||||
$characterLog->systemName = $apiController->values['solarsystemname'];
|
||||
$characterLog->shipId = $apiController->values['shiptypeid'];
|
||||
$characterLog->shipName = $apiController->values['shipname'];
|
||||
$characterLog->shipTypeName = $apiController->values['shiptypename'];
|
||||
$characterLog->systemId = (int)$headerData->values['solarsystemid'];
|
||||
$characterLog->systemName = $headerData->values['solarsystemname'];
|
||||
$characterLog->shipId = (int)$headerData->values['shiptypeid'];
|
||||
$characterLog->shipName = $headerData->values['shipname'];
|
||||
$characterLog->shipTypeName = $headerData->values['shiptypename'];
|
||||
|
||||
$characterLog->save();
|
||||
|
||||
@@ -512,7 +519,6 @@ class UserModel extends BasicModel {
|
||||
// cache character log information
|
||||
$f3->set($sessionCharacterKey, $cacheData, $ttl);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[PATHFINDER]
|
||||
NAME = "PATHFINDER"
|
||||
; installed version (used for CSS/JS cache busting)
|
||||
VERSION = "v0.0.12"
|
||||
VERSION = "v0.0.13"
|
||||
; contact information (DO NOT CHANGE)
|
||||
CONTACT = "https://github.com/exodus4d"
|
||||
; source code (DO NOT CHANGE)
|
||||
@@ -98,7 +98,7 @@ INVITE = 0
|
||||
INVITE_LIMIT = 50
|
||||
|
||||
; ======================================================================================================
|
||||
; Lifetime for map types
|
||||
; Lifetime for map types (days)
|
||||
[PATHFINDER.MAP.PRIVATE]
|
||||
LIFETIME = 2
|
||||
|
||||
@@ -111,7 +111,7 @@ LIFETIME = 99999
|
||||
[PATHFINDER.CACHE]
|
||||
|
||||
; cache character log informations in seconds. This is ignored if ship/system switch was detected
|
||||
CHARACTER_LOG = 600
|
||||
CHARACTER_LOG = 300
|
||||
|
||||
; cache time for all system data within a constellation (this will never change) 30d
|
||||
CONSTELLATION_SYSTEMS = 2592000
|
||||
|
||||
@@ -1331,14 +1331,12 @@ define([
|
||||
};
|
||||
|
||||
// prepare delete request
|
||||
|
||||
var map = connections[0]._jsPlumb.instance;
|
||||
var mapContainer = $( map.getContainer() );
|
||||
mapContainer.getMapOverlay('timer').startMapUpdateCounter();
|
||||
|
||||
|
||||
var connectionIds = [];
|
||||
// systemIds for delete request
|
||||
// connectionIds for delete request
|
||||
for(var i = 0; i < connections.length; i++){
|
||||
var connectionId = connections[i].getParameter('connectionId');
|
||||
// drag&drop a new connection does not have an id yet, if connection is not established correct
|
||||
@@ -2744,19 +2742,6 @@ define([
|
||||
}
|
||||
var defaultSystemStatus = Init.systemStatus[ tempKeys[0] ].id;
|
||||
|
||||
// dialog data -------------------------------------------------------------------------------------------------
|
||||
var data = {
|
||||
id: config.systemDialogId,
|
||||
selectClass: config.systemDialogSelectClass
|
||||
};
|
||||
|
||||
// current character log data ----------------------------------------------------------------------------------
|
||||
var currentCharacterLog = Util.getCurrentCharacterLog();
|
||||
|
||||
if(currentCharacterLog !== false){
|
||||
// set current position as "default" system to add
|
||||
data.currentSystem = currentCharacterLog.system;
|
||||
}
|
||||
|
||||
// get current map data -> disable systems that are already on it ----------------------------------------------
|
||||
var mapData = mapContainer.getMapDataFromClient({forceData: true});
|
||||
@@ -2766,6 +2751,25 @@ define([
|
||||
mapSystemIds.push( mapSystems[i].systemId );
|
||||
}
|
||||
|
||||
// dialog data -------------------------------------------------------------------------------------------------
|
||||
var data = {
|
||||
id: config.systemDialogId,
|
||||
selectClass: config.systemDialogSelectClass
|
||||
};
|
||||
|
||||
// set current position as "default" system to add -------------------------------------------------------------
|
||||
var currentCharacterLog = Util.getCurrentCharacterLog();
|
||||
|
||||
if(
|
||||
currentCharacterLog !== false &&
|
||||
mapSystemIds.indexOf( currentCharacterLog.system.id ) === -1
|
||||
){
|
||||
// current system is NOT already on this map
|
||||
// set current position as "default" system to add
|
||||
data.currentSystem = currentCharacterLog.system;
|
||||
}
|
||||
|
||||
|
||||
requirejs(['text!templates/dialog/system.html', 'mustache'], function(template, Mustache) {
|
||||
|
||||
var content = Mustache.render(template, data);
|
||||
|
||||
@@ -224,16 +224,26 @@ define([
|
||||
$(document).triggerMenuEvent('ShowSettingsDialog');
|
||||
}
|
||||
|
||||
// store current map user data (cache)
|
||||
if(data.mapUserData !== undefined){
|
||||
Util.setCurrentMapUserData(data.mapUserData);
|
||||
}
|
||||
|
||||
// start log
|
||||
Util.timeStart(logKeyClientUserData);
|
||||
|
||||
// active character data found
|
||||
mapModule.updateMapModuleData(data);
|
||||
mapModule.updateMapModuleData();
|
||||
|
||||
// log client user data update time
|
||||
duration = Util.timeStop(logKeyClientUserData);
|
||||
Util.log(logKeyClientUserData, {duration: duration, type: 'client', description:'update users'});
|
||||
|
||||
// update system info panels
|
||||
if(data.system){
|
||||
mapModule.updateSystemModuleData(data.system);
|
||||
}
|
||||
|
||||
// get the current update delay (this can change if a user is inactive)
|
||||
var mapUserUpdateDelay = Util.getCurrentTriggerDelay( logKeyServerUserData, 0 );
|
||||
|
||||
|
||||
@@ -192,11 +192,9 @@ define([
|
||||
|
||||
/**
|
||||
* updates only visible/active map module
|
||||
* @param userData
|
||||
* @returns {boolean}
|
||||
*/
|
||||
|
||||
$.fn.updateMapModuleData = function(mapModuleData){
|
||||
$.fn.updateMapModuleData = function(){
|
||||
var mapModule = $(this);
|
||||
|
||||
// get all active map elements for module
|
||||
@@ -205,47 +203,37 @@ define([
|
||||
if(mapElement !== false){
|
||||
var mapId = mapElement.data('id');
|
||||
|
||||
// get user data for each active map
|
||||
var mapUserData = null;
|
||||
|
||||
if(mapModuleData.mapUserData){
|
||||
for(var j = 0; j < mapModuleData.mapUserData.length; j++){
|
||||
|
||||
var tempMapUserData = mapModuleData.mapUserData[j];
|
||||
if(tempMapUserData.config.id === mapId){
|
||||
// map userData found
|
||||
mapUserData = tempMapUserData;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var currentMapUserData = Util.getCurrentMapUserData(mapId);
|
||||
|
||||
// update map with current user data
|
||||
if(mapUserData){
|
||||
mapElement.updateUserData(mapUserData);
|
||||
if(currentMapUserData){
|
||||
mapElement.updateUserData(currentMapUserData);
|
||||
}
|
||||
|
||||
// check if current open system is still the requested info system
|
||||
var currentSystemData = Util.getCurrentSystemData();
|
||||
|
||||
if(
|
||||
currentSystemData &&
|
||||
mapModuleData.system
|
||||
){
|
||||
if(mapModuleData.system.id === currentSystemData.systemData.id){
|
||||
// trigger system update event
|
||||
$(document).trigger('pf:updateSystemModules', [mapModuleData.system]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* update system info panels (below map)
|
||||
* @param systemData
|
||||
*/
|
||||
$.fn.updateSystemModuleData = function(systemData){
|
||||
var mapModule = $(this);
|
||||
|
||||
if(systemData){
|
||||
// check if current open system is still the requested info system
|
||||
var currentSystemData = Util.getCurrentSystemData();
|
||||
|
||||
if(currentSystemData){
|
||||
if(systemData.id === currentSystemData.systemData.id){
|
||||
// trigger system update event
|
||||
$(document).trigger('pf:updateSystemModules', [systemData]);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* load all structure elements into a TabsContent div (tab body)
|
||||
*/
|
||||
|
||||
@@ -4,27 +4,37 @@
|
||||
|
||||
define([
|
||||
'jquery',
|
||||
'app/init',
|
||||
'app/util',
|
||||
'app/ccp',
|
||||
'bootbox'
|
||||
], function($, Util, bootbox) {
|
||||
], function($, Init, Util, CCP, bootbox) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var config = {
|
||||
// global dialog
|
||||
dialogNavigationClass: 'pf-dialog-navigation-list', // class for dialog navigation bar
|
||||
dialogNavigationListItemClass: 'pf-dialog-navigation-list-item', // class for map manual li main navigation elements
|
||||
|
||||
// map info dialog
|
||||
// map info dialog/tabs
|
||||
dialogMapInfoSummaryId: 'pf-map-info-dialog-summary', // id for map "summary" container
|
||||
dialogMapInfoUsersId: 'pf-map-info-dialog-users', // id for map "user" container
|
||||
dialogMapInfoRefreshId: 'pf-map-info-dialog-refresh', // id for map "refresh" container
|
||||
|
||||
// "summary" container
|
||||
mapInfoId: 'pf-map-info', // id for map info
|
||||
mapInfoSystemsId: 'pf-map-info-systems', // id for map info systems box
|
||||
mapInfoConnectionsId: 'pf-map-info-connections', // id for map info connections box
|
||||
mapInfoUsersId: 'pf-map-info-users', // id for map info users box
|
||||
|
||||
mapInfoTableClass: 'pf-map-info-table', // class for data
|
||||
mapInfoLifetimeCounterClass: 'pf-map-info-lifetime-counter', // class for map lifetime counter
|
||||
|
||||
// dataTable
|
||||
tableImageCellClass: 'pf-table-image-cell', // class for table "image" cells
|
||||
tableImageSmallCellClass: 'pf-table-image-small-cell', // class for table "small image" cells
|
||||
tableActionCellClass: 'pf-table-action-cell', // class for table "action" cells
|
||||
tableCounterCellClass: 'pf-table-counter-cell', // cell for table "counter" cells
|
||||
tableCounterCellClass: 'pf-table-counter-cell', // class for table "counter" cells
|
||||
|
||||
systemIdPrefix: 'pf-system-', // id prefix for a system
|
||||
|
||||
@@ -428,6 +438,12 @@ define([
|
||||
tempTableElement.DataTable().rows(deleteRowElement).remove().draw();
|
||||
|
||||
Util.showNotify({title: 'System deleted', text: rowData.name, type: 'success'});
|
||||
|
||||
// refresh connection table (connections might have changed) ------------------------------
|
||||
var connectionsElement = $('#' + config.mapInfoConnectionsId);
|
||||
var mapDataNew = activeMap.getMapDataFromClient({forceData: true});
|
||||
|
||||
connectionsElement.loadConnectionInfoTable(mapDataNew);
|
||||
}
|
||||
}]);
|
||||
}
|
||||
@@ -592,6 +608,176 @@ define([
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.loadUsersInfoTable = function(mapData){
|
||||
var usersElement = $(this);
|
||||
|
||||
usersElement.empty();
|
||||
|
||||
var userTable = $('<table>', {
|
||||
class: ['compact', 'stripe', 'order-column', 'row-border', config.mapInfoTableClass].join(' ')
|
||||
});
|
||||
usersElement.append(userTable);
|
||||
|
||||
usersElement.showLoadingAnimation(config.loadingOptions);
|
||||
|
||||
// table init complete
|
||||
userTable.on( 'init.dt', function () {
|
||||
usersElement.hideLoadingAnimation();
|
||||
});
|
||||
|
||||
// users table ========================================================
|
||||
// prepare users data for dataTables
|
||||
var currentMapUserData = Util.getCurrentMapUserData( mapData.config.id );
|
||||
var usersData = [];
|
||||
|
||||
if(
|
||||
currentMapUserData &&
|
||||
currentMapUserData.data &&
|
||||
currentMapUserData.data.systems
|
||||
){
|
||||
for(var i = 0; i < currentMapUserData.data.systems.length; i++){
|
||||
var tempSystemUserData = currentMapUserData.data.systems[i];
|
||||
for(var j = 0; j < tempSystemUserData.user.length; j++){
|
||||
usersData.push( tempSystemUserData.user[j] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var userDataTable = userTable.dataTable( {
|
||||
pageLength: 20,
|
||||
paging: true,
|
||||
lengthMenu: [[5, 10, 20, 50, -1], [5, 10, 20, 50, 'All']],
|
||||
ordering: true,
|
||||
order: [ 1, 'asc' ],
|
||||
autoWidth: false,
|
||||
hover: false,
|
||||
data: usersData,
|
||||
language: {
|
||||
emptyTable: 'No active pilots',
|
||||
zeroRecords: 'No active pilots found',
|
||||
lengthMenu: 'Show _MENU_ pilots',
|
||||
info: 'Showing _START_ to _END_ of _TOTAL_ pilots'
|
||||
},
|
||||
columnDefs: [
|
||||
{
|
||||
targets: 0,
|
||||
title: '',
|
||||
width: '26px',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
className: ['text-center', config.tableImageCellClass].join(' '),
|
||||
data: 'log.ship',
|
||||
render: {
|
||||
_: function(data, type, row, meta){
|
||||
return '<img src="' + Init.url.ccpImageServer + 'Render/' + data.id + '_32.png" />';
|
||||
}
|
||||
}
|
||||
},{
|
||||
targets: 1,
|
||||
title: 'ship',
|
||||
orderable: true,
|
||||
searchable: true,
|
||||
data: 'log.ship',
|
||||
render: {
|
||||
_: 'typeName',
|
||||
sort: 'typeName'
|
||||
}
|
||||
},{
|
||||
targets: 2,
|
||||
title: '',
|
||||
width: '26px',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
className: [config.tableImageCellClass].join(' '),
|
||||
data: 'id',
|
||||
render: {
|
||||
_: function(data, type, row, meta){
|
||||
return '<img src="' + Init.url.ccpImageServer + 'Character/' + data + '_32.jpg" />';
|
||||
}
|
||||
}
|
||||
},{
|
||||
targets: 3,
|
||||
title: 'pilot',
|
||||
orderable: true,
|
||||
searchable: true,
|
||||
data: 'name'
|
||||
},{
|
||||
targets: 4,
|
||||
title: '',
|
||||
width: '26px',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
className: [config.tableImageCellClass, config.tableImageSmallCellClass].join(' '),
|
||||
data: 'corporation',
|
||||
render: {
|
||||
_: function(data, type, row, meta){
|
||||
return '<img src="' + Init.url.ccpImageServer + 'Corporation/' + data.id + '_32.png" />';
|
||||
}
|
||||
}
|
||||
},{
|
||||
targets: 5,
|
||||
title: 'corporation',
|
||||
orderable: true,
|
||||
searchable: true,
|
||||
data: 'corporation',
|
||||
render: {
|
||||
_: 'name'
|
||||
}
|
||||
},{
|
||||
targets: 6,
|
||||
title: 'system',
|
||||
orderable: true,
|
||||
searchable: true,
|
||||
data: 'log.system',
|
||||
render: {
|
||||
_: 'name',
|
||||
sort: 'name'
|
||||
}
|
||||
},{
|
||||
targets: 7,
|
||||
title: '',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
width: '26px',
|
||||
className: ['text-center', config.tableActionCellClass].join(' '),
|
||||
data: 'id',
|
||||
render: {
|
||||
_: function(data, type, row, meta){
|
||||
return '<i class="fa fa-fw fa-comment"></i>';
|
||||
}
|
||||
},
|
||||
visible: (CCP.isInGameBrowser() === true),
|
||||
createdCell: function(cell, cellData, rowData, rowIndex, colIndex) {
|
||||
$(cell).on('click', function(e) {
|
||||
CCPEVE.startConversation(cellData);
|
||||
});
|
||||
}
|
||||
},{
|
||||
targets: 8,
|
||||
title: '',
|
||||
orderable: false,
|
||||
searchable: false,
|
||||
width: '26px',
|
||||
className: ['text-center', config.tableImageCellClass, config.tableImageSmallCellClass, config.tableActionCellClass].join(' '),
|
||||
data: 'id',
|
||||
render: {
|
||||
_: function(data, type, row, meta){
|
||||
return '<img src="' + Init.url.ccpImageServer + 'Type/20070_32.png" />';
|
||||
}
|
||||
},
|
||||
visible: (CCP.isInGameBrowser() === true),
|
||||
createdCell: function(cell, cellData, rowData, rowIndex, colIndex) {
|
||||
$(cell).on('click', function(e) {
|
||||
CCPEVE.inviteToFleet(cellData);
|
||||
});
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* shows the map information modal dialog
|
||||
*/
|
||||
@@ -604,11 +790,14 @@ define([
|
||||
requirejs(['text!templates/dialog/map_info.html', 'mustache'], function(template, Mustache) {
|
||||
|
||||
var data = {
|
||||
dialogSummaryContainerId: config.dialogMapInfoSummaryId,
|
||||
dialogUsersContainerId: config.dialogMapInfoUsersId,
|
||||
dialogRefreshContainerId: config.dialogMapInfoRefreshId,
|
||||
dialogNavigationClass: config.dialogNavigationClass,
|
||||
dialogNavLiClass: config.dialogNavigationListItemClass,
|
||||
mapInfoId: config.mapInfoId,
|
||||
mapInfoSystemsId: config.mapInfoSystemsId,
|
||||
mapInfoConnectionsId: config.mapInfoConnectionsId
|
||||
mapInfoConnectionsId: config.mapInfoConnectionsId,
|
||||
mapInfoUsersId: config.mapInfoUsersId
|
||||
};
|
||||
|
||||
var content = Mustache.render(template, data);
|
||||
@@ -634,12 +823,12 @@ define([
|
||||
var mapElement = $('#' + config.mapInfoId);
|
||||
var systemsElement = $('#' + config.mapInfoSystemsId);
|
||||
var connectionsElement = $('#' + config.mapInfoConnectionsId);
|
||||
var usersElement = $('#' + config.mapInfoUsersId);
|
||||
|
||||
// set navigation button observer
|
||||
var mainNavigationLinks = $('.' + config.dialogNavigationClass).find('a');
|
||||
mainNavigationLinks.on('click', function(){
|
||||
|
||||
// set refresh button observer
|
||||
$('#' + config.dialogMapInfoRefreshId).on('click', function(){
|
||||
var menuAction = $(this).attr('data-action');
|
||||
|
||||
if(menuAction === 'refresh'){
|
||||
// get new map data
|
||||
var mapData = activeMap.getMapDataFromClient({forceData: true});
|
||||
@@ -647,6 +836,7 @@ define([
|
||||
mapElement.loadMapInfoData(mapData);
|
||||
systemsElement.loadSystemInfoTable(mapData);
|
||||
connectionsElement.loadConnectionInfoTable(mapData);
|
||||
usersElement.loadUsersInfoTable(mapData);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -658,6 +848,9 @@ define([
|
||||
|
||||
// load connection table
|
||||
connectionsElement.loadConnectionInfoTable(mapData);
|
||||
|
||||
// load users table
|
||||
usersElement.loadUsersInfoTable(mapData);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -77,6 +77,16 @@ define([
|
||||
disabled = true;
|
||||
}
|
||||
|
||||
// "fix" security level
|
||||
if(
|
||||
trueSec > 0 &&
|
||||
trueSec < 0.1
|
||||
){
|
||||
trueSec = 0.1;
|
||||
}else{
|
||||
trueSec = Math.round(trueSec * 10) / 10;
|
||||
}
|
||||
|
||||
return {
|
||||
id: systemId,
|
||||
text: item.name,
|
||||
|
||||
@@ -1317,6 +1317,48 @@ define([
|
||||
return areaId;
|
||||
};
|
||||
|
||||
/**
|
||||
* set currentMapUserData as "global" variable (count of active pilots)
|
||||
* this function should be called continuously after data change
|
||||
* to keep the data always up2data
|
||||
* @param currentMapUserData
|
||||
*/
|
||||
var setCurrentMapUserData = function(mapUserData){
|
||||
Init.currentMapUserData = mapUserData;
|
||||
|
||||
return getCurrentMapUserData();
|
||||
};
|
||||
|
||||
/**
|
||||
* get currentMapUserData from "global" variable for specific map or all maps
|
||||
* @param mapId
|
||||
* @returns {boolean}
|
||||
*/
|
||||
var getCurrentMapUserData = function(mapId){
|
||||
|
||||
var currentMapUserData = false;
|
||||
|
||||
if( mapId === parseInt(mapId, 10) ){
|
||||
// search for a specific map
|
||||
for(var i = 0; i < Init.currentMapUserData.length; i++){
|
||||
if(Init.currentMapUserData[i].config.id === mapId){
|
||||
currentMapUserData = Init.currentMapUserData[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
// get data for all maps
|
||||
currentMapUserData = Init.currentMapUserData;
|
||||
}
|
||||
|
||||
if(currentMapUserData !== false){
|
||||
// return a fresh (deep) copy of that, in case of further modifications
|
||||
currentMapUserData = $.extend(true, {}, currentMapUserData);
|
||||
}
|
||||
|
||||
return currentMapUserData;
|
||||
};
|
||||
|
||||
/**
|
||||
* set currentMapData as "global" variable
|
||||
* this function should be called continuously after data change
|
||||
@@ -1570,6 +1612,8 @@ define([
|
||||
getAllSignatureNames: getAllSignatureNames,
|
||||
getSignatureTypeIdByName: getSignatureTypeIdByName,
|
||||
getAreaIdBySecurity: getAreaIdBySecurity,
|
||||
setCurrentMapUserData: setCurrentMapUserData,
|
||||
getCurrentMapUserData: getCurrentMapUserData,
|
||||
setCurrentMapData: setCurrentMapData,
|
||||
getCurrentMapData: getCurrentMapData,
|
||||
setCurrentUserData: setCurrentUserData,
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
public/js/v0.0.13/app/landingpage.js.map
Normal file
1
public/js/v0.0.13/app/landingpage.js.map
Normal file
File diff suppressed because one or more lines are too long
33
public/js/v0.0.13/app/mappage.js
Normal file
33
public/js/v0.0.13/app/mappage.js
Normal file
File diff suppressed because one or more lines are too long
1
public/js/v0.0.13/app/mappage.js.map
Normal file
1
public/js/v0.0.13/app/mappage.js.map
Normal file
File diff suppressed because one or more lines are too long
@@ -3,12 +3,12 @@
|
||||
<nav class="navbar navbar-default" role="navigation">
|
||||
<div class="navbar-header pull-left">
|
||||
<ul class="nav navbar-nav {{dialogNavigationClass}}" role="tablist">
|
||||
<li class="{{#openTabNew}}active{{/openTabNew}}"><a role="tab" data-toggle="tab" data-name="newMap" href="#{{dialogMapCreateContainerId}}"><i class="fa fa-plus fa-lg fa-fw"></i> New map</a></li>
|
||||
<li class="{{#openTabNew}}active{{/openTabNew}}"><a role="tab" data-toggle="tab" data-name="newMap" href="#{{dialogMapCreateContainerId}}"><i class="fa fa-plus fa-fw"></i> New map</a></li>
|
||||
{{^hideEditTab}}
|
||||
<li class="{{#openTabEdit}}active{{/openTabEdit}}"><a role="tab" data-toggle="tab" data-name="editMap" href="#{{dialogMapEditContainerId}}"><i class="fa fa-edit fa-lg fa-fw"></i> Edit map</a></li>
|
||||
<li class="{{#openTabEdit}}active{{/openTabEdit}}"><a role="tab" data-toggle="tab" data-name="editMap" href="#{{dialogMapEditContainerId}}"><i class="fa fa-edit fa-fw"></i> Edit map</a></li>
|
||||
{{/hideEditTab}}
|
||||
{{^hideSettingsTab}}
|
||||
<li class="{{#openTabSettings}}active{{/openTabSettings}}"><a role="tab" data-toggle="tab" data-name="settings" href="#{{dialogMapSettingsContainerId}}"><i class="fa fa-gears fa-lg fa-fw"></i> Settings</a></li>
|
||||
<li class="{{#openTabSettings}}active{{/openTabSettings}}"><a role="tab" data-toggle="tab" data-name="settings" href="#{{dialogMapSettingsContainerId}}"><i class="fa fa-gears fa-fw"></i> Settings</a></li>
|
||||
{{/hideSettingsTab}}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -1,31 +1,62 @@
|
||||
<nav class="navbar navbar-default" role="navigation">
|
||||
<div class="container-fluid">
|
||||
<div class="navbar-header pull-left">
|
||||
<ul class="nav navbar-nav {{dialogNavigationClass}}">
|
||||
<li class="{{dialogNavLiClass}}"><a data-action="refresh" href="#"><i class="fa fa-refresh fa-lg fa-fw"></i> Refresh</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="navbar-header pull-left">
|
||||
<ul class="nav navbar-nav {{dialogNavigationClass}}" role="tablist">
|
||||
<li class="active">
|
||||
<a role="tab" data-toggle="tab" data-name="infoSummary" href="#{{dialogSummaryContainerId}}">
|
||||
<i class="fa fa-info fa-fw"></i> Info
|
||||
</a>
|
||||
</li>
|
||||
<li class="">
|
||||
<a role="tab" data-toggle="tab" data-name="infoUsers" href="#{{dialogUsersContainerId}}">
|
||||
<i class="fa fa-plane fa-fw"></i> Activity
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="navbar-header pull-right">
|
||||
<ul class="nav navbar-nav {{dialogNavigationClass}}">
|
||||
<li class="">
|
||||
<a id="{{dialogRefreshContainerId}}" data-action="refresh">
|
||||
<i class="fa fa-refresh fa-fw"></i> Refresh
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="alert alert-info fade in hidden-md hidden-lg">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><i class="fa fa-close"></i></button>
|
||||
<span class="txt-color txt-color-information">Info</span>
|
||||
<small> Your browser window is to small. Resize it to obtain more columns.</small>
|
||||
{{! "summary" tab ------------------------------------------------------ }}
|
||||
<div role="tabpanel" class="tab-pane fade in active" id="{{dialogSummaryContainerId}}">
|
||||
<div class="alert alert-info fade in hidden-md hidden-lg">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><i class="fa fa-close"></i></button>
|
||||
<span class="txt-color txt-color-information">Info</span>
|
||||
<small> Your browser window is to small. Resize it to obtain more columns.</small>
|
||||
</div>
|
||||
|
||||
<h4><i class="fa fa-code-fork fa-lg fa-fw"></i> Map</h4>
|
||||
|
||||
<div id="{{mapInfoId}}" class="pf-dynamic-area">
|
||||
</div>
|
||||
|
||||
<h4><i class="fa fa-sun-o fa-lg fa-fw"></i> Systems</h4>
|
||||
|
||||
<div id="{{mapInfoSystemsId}}" class="pf-dynamic-area">
|
||||
</div>
|
||||
|
||||
<h4><i class="fa fa-chain fa-lg fa-fw"></i> Connections</h4>
|
||||
|
||||
<div id="{{mapInfoConnectionsId}}" class="pf-dynamic-area">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{! "users" tab -------------------------------------------------------- }}
|
||||
<div role="tabpanel" class="tab-pane fade" id="{{dialogUsersContainerId}}">
|
||||
<h4><i class="fa fa-male fa-lg fa-fw"></i> Active pilots</h4>
|
||||
|
||||
<div id="{{mapInfoUsersId}}" class="pf-dynamic-area">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4><i class="fa fa-code-fork fa-lg fa-fw"></i> Map</h4>
|
||||
|
||||
<div id="{{mapInfoId}}" class="pf-dynamic-area">
|
||||
</div>
|
||||
|
||||
<h4><i class="fa fa-sun-o fa-lg fa-fw"></i> Systems</h4>
|
||||
|
||||
<div id="{{mapInfoSystemsId}}" class="pf-dynamic-area">
|
||||
</div>
|
||||
|
||||
<h4><i class="fa fa-chain fa-lg fa-fw"></i> Connections</h4>
|
||||
|
||||
<div id="{{mapInfoConnectionsId}}" class="pf-dynamic-area">
|
||||
</div>
|
||||
@@ -224,10 +224,10 @@
|
||||
<blockquote>
|
||||
<p>
|
||||
API Key(s) are required to use <em class="pf-brand">pathfinder</em>.
|
||||
Don't have one? - Create a new key with an empty 'Access Mask'.
|
||||
Don't have one? - Create a new key with an empty 'Access Mask' (0).
|
||||
</p>
|
||||
<small>Get your new/custom API Key from
|
||||
<a href="https://community.eveonline.com/support/api-key/" target="_blank">here</a>
|
||||
<a href="https://support.eveonline.com/api/Key/CreatePredefined/8/0/" target="_blank">here</a>
|
||||
and come back to this page.
|
||||
</small>
|
||||
</blockquote>
|
||||
|
||||
@@ -137,6 +137,70 @@ select:active, select:hover {
|
||||
:-ms-input-placeholder { color: $gray-light; } // Internet Explorer 10+
|
||||
::-webkit-input-placeholder { color: $gray-light; } // Safari and Chrome
|
||||
|
||||
|
||||
// global datatable styles ==========================================
|
||||
.dataTable{
|
||||
|
||||
th{
|
||||
&.pf-table-image-cell,
|
||||
&.pf-table-image-small-cell{
|
||||
// no padding for image content
|
||||
padding-left: 0 !important;
|
||||
padding-right: 0 !important;
|
||||
}
|
||||
&.sorting,
|
||||
&.sorting_asc,
|
||||
&.sorting_desc{
|
||||
// prevent overlapping of text and sort icon (if text-right align)
|
||||
padding-right: 18px !important;
|
||||
}
|
||||
}
|
||||
|
||||
// "special" column styles
|
||||
td{
|
||||
&.pf-table-action-cell{
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
&.pf-table-image-cell{
|
||||
// no padding for image content
|
||||
padding: 0 !important;
|
||||
|
||||
img{
|
||||
width: 26px; // smaller image (default 32)
|
||||
border-left: 1px solid $gray;
|
||||
border-right: 1px solid $gray;
|
||||
}
|
||||
}
|
||||
|
||||
&.pf-table-image-small-cell{
|
||||
img{
|
||||
width: 24px; // smaller image (default 32)
|
||||
// overwrite "default" border for image cells
|
||||
border-left: 1px solid transparent;
|
||||
border-right: 1px solid transparent;
|
||||
}
|
||||
}
|
||||
|
||||
&.pf-table-counter-cell{
|
||||
color: $gray-light;
|
||||
|
||||
.pf-digit-counter-small{
|
||||
width: 20px;
|
||||
display: inline-block;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.pf-digit-counter-large{
|
||||
width: 26px;
|
||||
display: inline-block;
|
||||
font-size: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// table styles =====================================================
|
||||
|
||||
// table icon toolbar
|
||||
|
||||
@@ -83,43 +83,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
// global datatable styles
|
||||
.dataTable{
|
||||
.pf-table-action-cell{
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
th{
|
||||
&.sorting,
|
||||
&.sorting_asc,
|
||||
&.sorting_desc{
|
||||
// prevent overlapping of text and sort icon (if text-right align)
|
||||
padding-right: 18px !important;
|
||||
}
|
||||
}
|
||||
|
||||
// signature timer/date counter
|
||||
td{
|
||||
|
||||
&.pf-table-counter-cell{
|
||||
color: $gray-light;
|
||||
|
||||
.pf-digit-counter-small{
|
||||
width: 20px;
|
||||
display: inline-block;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.pf-digit-counter-large{
|
||||
width: 26px;
|
||||
display: inline-block;
|
||||
font-size: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// system graph module =====================================================
|
||||
.pf-system-graph-module{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user