- added new "EOL" timer for connections, closed #172

- some refactorings (moved map util functions from "util.js" to new "map/util.js")
This commit is contained in:
Exodus4D
2016-07-30 20:07:22 +02:00
parent 2a41293922
commit 01d4f751a1
27 changed files with 1114 additions and 896 deletions

View File

@@ -62,6 +62,10 @@ class ConnectionModel extends BasicModel{
],
'type' => [
'type' => self::DT_JSON
],
'eolUpdated' => [
'type' => Schema::DT_TIMESTAMP,
'default' => null
]
];
@@ -96,12 +100,35 @@ class ConnectionModel extends BasicModel{
'target' => $this->target->id,
'scope' => $this->scope,
'type' => $this->type,
'updated' => strtotime($this->updated)
'updated' => strtotime($this->updated),
'eolUpdated' => strtotime($this->eolUpdated)
];
return $connectionData;
}
/**
* setter for connection type
* @param $type
* @return int|number
*/
public function set_type($type){
$newTypes = (array)json_decode($type);
// set EOL timestamp
if( !in_array('wh_eol', $newTypes) ){
$this->eolUpdated = null;
}elseif(
in_array('wh_eol', $newTypes) &&
!in_array('wh_eol', $this->type)
){
// connection EOL status change
$this->touch('eolUpdated');
}
return $type;
}
/**
* check object for model access
* @param CharacterModel $characterModel

View File

@@ -1,31 +1,26 @@
define(["jquery"], function($) {
"use strict";
define([
'jquery',
'app/init',
'app/util'
], function($, Init, Util) {
'use strict';
var config = {
counterDigitSmallClass: 'pf-digit-counter-small',
counterDigitLargeClass: 'pf-digit-counter-large'
};
/**
* update element with time information
* @param element
* @param tempDate
*/
var updateDateDiff = function(element, tempDate){
var date1 = new Date();
var date2 = tempDate;
//Customise date2 for your required future time
var diff = (date1 - date2)/1000;
diff = Math.abs(Math.floor(diff));
var days = Math.floor(diff/(24*60*60));
var leftSec = diff - days * 24*60*60;
var hrs = Math.floor(leftSec/(60*60));
leftSec = leftSec - hrs * 60*60;
var min = Math.floor(leftSec/(60));
leftSec = leftSec - min * 60;
var diff = Util.getTimeDiffParts(tempDate, new Date());
var days = diff.days;
var hrs = diff.hours;
var min = diff.min;
var leftSec = diff.sec;
var value = [];
if(
@@ -54,9 +49,7 @@ define(["jquery"], function($) {
value.push('<span class="' + config.counterDigitSmallClass + '">' + leftSec + 's' + '</span>');
}
element.html(value.join(' '));
};
/**
@@ -65,9 +58,7 @@ define(["jquery"], function($) {
*/
$.fn.initTimestampCounter = function(){
return this.each(function(){
var element = $(this);
var timestamp = parseInt( element.text() );
// do not init twice
@@ -90,12 +81,7 @@ define(["jquery"], function($) {
}, 100);
element.data('interval', refreshIntervalId);
}
});
};
});

View File

@@ -276,23 +276,23 @@ define(['jquery'], function($) {
dashstyle: '0.99'
},
overlays:[
[ 'Label',
['Label',
{
label: 'frig',
cssClass: ['pf-map-connection-overlay', 'frig'].join(' ')
} ]
cssClass: ['pf-map-connection-overlay', 'frig'].join(' '),
location: 0.6
}]
]
},
preserve_mass: {
cssClass: 'pf-map-connection-preserve-mass',
overlays:[
[ 'Label',
['Label',
{
label: '<i class="fa fa-warning"></i>&nbsp;save mass',
label: '<i class="fa fa-fw fa-warning"></i>&nbsp;save mass',
cssClass: ['pf-map-connection-overlay', 'mass'].join(' '),
width:50, length:30,
location: 0.5
} ]
location: 0.6
}]
]
}
},

View File

@@ -8,13 +8,14 @@ define([
'app/util',
'app/render',
'bootbox',
'app/map/util',
'app/map/magnetizing',
'app/map/scrollbar',
'dragToSelect',
'select2',
'app/map/contextmenu',
'app/map/overlay'
], function($, Init, Util, Render, bootbox, MagnetizerWrapper) {
], function($, Init, Util, Render, bootbox, MapUtil, MagnetizerWrapper) {
'use strict';
@@ -481,9 +482,9 @@ define([
}
// get system info classes
var effectBasicClass = Util.getEffectInfoForSystem('effect', 'class');
var effectName = Util.getEffectInfoForSystem(data.effect, 'name');
var effectClass = Util.getEffectInfoForSystem(data.effect, 'class');
var effectBasicClass = MapUtil.getEffectInfoForSystem('effect', 'class');
var effectName = MapUtil.getEffectInfoForSystem(data.effect, 'name');
var effectClass = MapUtil.getEffectInfoForSystem(data.effect, 'class');
var secClass = Util.getSecurityClassForSystem(data.security);
system = $('<div>', {
@@ -965,7 +966,7 @@ define([
sourceConfig.scope = map.Defaults.Scope; // set all allowed connections for this scopes
// default connector for initial dragging a new connection
sourceConfig.connector = Util.getScopeInfoForConnection('wh', 'connectorDefinition');
sourceConfig.connector = MapUtil.getScopeInfoForConnection('wh', 'connectorDefinition');
map.makeSource(system, sourceConfig);
};
@@ -1175,50 +1176,6 @@ define([
});
};
/**
* get all connections of multiple systems
* @param map
* @param systems
* @returns {Array}
*/
var getConnections = function(map, systems){
var connections = [];
var withBackConnection = false;
$.each(systems, function(i, system){
// get connections where system is source
connections = connections.concat( map.getConnections({source: system}) );
if(withBackConnection === true){
// get connections where system is target
connections = connections.concat( map.getConnections({target: system}) );
}
});
return connections;
};
/**
* get all direct connections between two given systems
* @param map
* @param systemA
* @param systemB
* @returns {Array}
*/
var checkForConnection = function(map, systemA, systemB){
var connections = [];
connections = connections.concat( map.getConnections({scope: '*', source: systemA, target: systemB}) );
// get connections where system is target
connections = connections.concat( map.getConnections({scope: '*', source: systemB, target: systemA}) );
return connections;
};
/**
* connect two systems
* @param map
@@ -1263,7 +1220,8 @@ define([
// therefore they shoule be part of the connection not of the connector
connection.setParameters({
connectionId: connectionId,
updated: connectionData.updated
updated: connectionData.updated,
eolUpdated: connectionData.eolUpdated
});
// add connection types -----------------------------------------------------
@@ -1330,7 +1288,7 @@ define([
updateConnectionCache(this.mapId, connection);
// connection scope
var scope = Util.getScopeInfoForConnection(newConnectionData.scope, 'label');
var scope = MapUtil.getScopeInfoForConnection(newConnectionData.scope, 'label');
var title = 'New connection established';
if(connectionData.id > 0){
@@ -1462,7 +1420,7 @@ define([
addType[i].indexOf('reduced') !== -1 ||
addType[i].indexOf('critical') !== -1
){
setConnectionWHStatus(connection, addType[i]);
MapUtil.setConnectionWHStatus(connection, addType[i]);
}else if( connection.hasType(addType[i]) !== true ){
// additional types e.g. eol, frig, preserve mass
connection.addType(addType[i]);
@@ -1482,8 +1440,11 @@ define([
}
}
// set update date
connection.setParameter('updated', newConnectionData.updated);
// set update date (important for update check)
connection.setParameters({
updated: newConnectionData.updated,
eolUpdated: newConnectionData.eolUpdated
});
return connection;
};
@@ -1496,7 +1457,7 @@ define([
var setConnectionScope = function(connection, scope){
var map = connection._jsPlumb.instance;
var currentConnector = connection.getConnector();
var newConnector = Util.getScopeInfoForConnection(scope, 'connectorDefinition');
var newConnector = MapUtil.getScopeInfoForConnection(scope, 'connectorDefinition');
if(currentConnector.type !== newConnector[0]){
// connector has changed
@@ -1508,7 +1469,7 @@ define([
// set new new connection type
// if scope changed -> connection type == scope
connection.setType( getDefaultConnectionTypeByScope(scope) );
connection.setType( MapUtil.getDefaultConnectionTypeByScope(scope) );
// change scope
connection.scope = scope;
@@ -1516,73 +1477,6 @@ define([
// new observer is required after scope change
setConnectionObserver(map, connection);
}
};
/**
* get the default connection type for a scope
* e.g. for new type after scope change
* @param scope
* @returns {string}
*/
var getDefaultConnectionTypeByScope = function(scope){
var type = '';
switch(scope){
case 'wh':
type = 'wh_fresh';
break;
case 'jumpbridge':
type = 'jumpbridge';
break;
case'stargate':
type = 'stargate';
break;
}
return type;
};
/**
* set/change connection status of a wormhole
* @param connection
* @param status
*/
var setConnectionWHStatus = function(connection, status){
if(
status === 'wh_fresh' &&
connection.hasType('wh_fresh') !== true
){
connection.removeType('wh_reduced');
connection.removeType('wh_critical');
connection.addType('wh_fresh');
}else if(
status === 'wh_reduced' &&
connection.hasType('wh_reduced') !== true
){
connection.removeType('wh_fresh');
connection.removeType('wh_critical');
connection.addType('wh_reduced');
}else if(
status === 'wh_critical' &&
connection.hasType('wh_critical') !== true
){
connection.removeType('wh_fresh');
connection.removeType('wh_reduced');
connection.addType('wh_critical');
}else if(
status === 'wh_eol' &&
connection.hasType('wh_eol') !== true
){
connection.addType('wh_eol');
}else if(
status === 'wh_eol' &&
connection.hasType('wh_eol') !== true
){
connection.addType('wh_eol');
}
};
/**
@@ -2212,7 +2106,7 @@ define([
var system = $(this);
var rallyClass = Util.getInfoForSystem('rally', 'class');
var rallyClass = MapUtil.getInfoForSystem('rally', 'class');
var hideNotification = false;
if(options.hideNotification === true){
@@ -2341,7 +2235,7 @@ define([
var filterScope = action.split('_')[1];
// scope label
var filterScopeLabel = Util.getScopeInfoForMap(filterScope, 'label');
var filterScopeLabel = MapUtil.getScopeInfoForMap(filterScope, 'label');
var showScope = true;
if(
@@ -2643,7 +2537,7 @@ define([
var action = params.selectedMenu.attr('data-action');
var activeConnection = params.component;
var activeScope = activeConnection.scope;
var activeScopeName = Util.getScopeInfoForConnection( activeScope, 'label');
var activeScopeName = MapUtil.getScopeInfoForConnection( activeScope, 'label');
switch(action){
case 'delete_connection':
@@ -2671,14 +2565,14 @@ define([
var newStatus = action.split('_')[1];
mapElement.getMapOverlay('timer').startMapUpdateCounter();
setConnectionWHStatus(activeConnection, 'wh_' + newStatus);
MapUtil.setConnectionWHStatus(activeConnection, 'wh_' + newStatus);
$(activeConnection).markAsChanged();
break;
case 'scope_wh':
case 'scope_stargate':
case 'scope_jumpbridge':
var newScope = action.split('_')[1];
var newScopeName = Util.getScopeInfoForConnection( newScope, 'label');
var newScopeName = MapUtil.getScopeInfoForConnection( newScope, 'label');
bootbox.confirm('Change scope from ' + activeScopeName + ' to ' + newScopeName + '?', function(result) {
if(result){
@@ -3101,19 +2995,19 @@ define([
){
// map config -----------------------------------------------------------
var mapConfig = {};
mapConfig.id = parseInt( mapElement.data('id') );
mapConfig.name = mapElement.data('name');
mapConfig.scope = {
id: parseInt( mapElement.data('scopeId') )
mapData.config = {
id: parseInt( mapElement.data('id') ),
name: mapElement.data('name'),
scope: {
id: parseInt( mapElement.data('scopeId') )
},
icon: mapElement.data('icon'),
type: {
id: parseInt( mapElement.data('typeId') )
},
created: parseInt( mapElement.data('created') ),
updated: parseInt( mapElement.data('updated') ),
};
mapConfig.icon = mapElement.data('icon');
mapConfig.type = {
id: parseInt( mapElement.data('typeId') )
};
mapConfig.created = parseInt( mapElement.data('created') );
mapConfig.updated = parseInt( mapElement.data('updated') );
mapData.config = mapConfig;
// map data -------------------------------------------------------------
var data = {};
@@ -3172,7 +3066,7 @@ define([
}
// overwrite connection cache
connectionCache[mapConfig.id] = updatedConnectionCache;
connectionCache[mapData.config.id] = updatedConnectionCache;
data.connections = connectionsFormatted;
@@ -3253,14 +3147,8 @@ define([
// normalize connection array
connectionTypes = $.grep(connectionTypes, function(n){
if(
n.length > 0 &&
n !== 'default' // this is added by jsplumb by default -_-
){
return true;
}else{
return false;
}
// 'default' is added by jsPlumb by default -_-
return ( n.length > 0 && n !== 'default');
});
var data = {
@@ -3345,11 +3233,11 @@ define([
// set "default" connection status only for NEW connections
if(!connection.suspendedElement){
setConnectionWHStatus(connection, getDefaultConnectionTypeByScope(connection.scope) );
MapUtil.setConnectionWHStatus(connection, MapUtil.getDefaultConnectionTypeByScope(connection.scope) );
}
// prevent multiple connections between same systems
var connections = checkForConnection(newJsPlumbInstance, info.sourceId, info.targetId );
var connections = MapUtil.checkForConnection(newJsPlumbInstance, info.sourceId, info.targetId );
if(connections.length > 1){
bootbox.confirm('Connection already exists. Do you really want to add an additional one?', function(result) {
@@ -3392,6 +3280,7 @@ define([
/**
* load OR updates system map
* @param mapConfig
* @param options
*/
$.fn.loadMap = function(mapConfig, options){
@@ -3428,6 +3317,8 @@ define([
var mapElement = mapConfig.map.getContainer();
var mapOverlay = $(mapElement).getMapOverlay('info');
mapOverlay.updateOverlayIcon('systemRegion', 'show');
mapOverlay.updateOverlayIcon('systemConnectionTimer', 'show');
}
// callback function after tab switch
@@ -3543,7 +3434,10 @@ define([
};
return {
clearMapInstance: clearMapInstance
getMapInstance: getMapInstance,
clearMapInstance: clearMapInstance,
getDataByConnection: getDataByConnection
};
});

View File

@@ -23,7 +23,10 @@ define([
mapOverlayInfoClass: 'pf-map-overlay-info', // class for map overlay info e.g. map info
// system
systemHeadClass: 'pf-system-head' // class for system head
systemHeadClass: 'pf-system-head', // class for system head
// connection
connectionOverlayEolId: 'overlayEol' // connection overlay ID (jsPlumb)
};
/**
@@ -81,6 +84,57 @@ define([
mapElement.find('.' + config.systemHeadClass).tooltip('hide');
}
}
},
systemConnectionTimer: {
title: 'show EOL timer',
trigger: 'hover',
class: 'pf-map-overlay-connection-timer',
iconClass: ['fa', 'fa-fw', 'fa-clock-o'],
hoverIntent: {
over: function(e){
var mapElement = getMapFromOverlay(this);
var MapUtil = require('app/map/util');
var Map = require('app/map/map');
var map = Map.getMapInstance( mapElement.data('id') );
var connections = MapUtil.searchConnectionsByScopeAndType(map, 'wh', ['wh_eol']);
var serverDate = Util.getServerTime();
for (let connection of connections) {
var eolTimestamp = connection.getParameter('eolUpdated');
var eolDate = Util.convertTimestampToServerTime(eolTimestamp);
var diff = Util.getTimeDiffParts(eolDate, serverDate);
// format overlay label
var label = '';
if(diff.days){
label += diff.days + 'd ';
}
label += ('00' + diff.hours).slice(-2);
label += ':' + ('00' + diff.min).slice(-2);
connection.addOverlay([
'Label',
{
label: '<i class="fa fa-fw fa-clock-o"></i>&nbsp;' + label,
id: config.connectionOverlayEolId,
cssClass: ['pf-map-connection-overlay', 'eol'].join(' '),
location: 0.25
}
]);
}
},
out: function(e){
var mapElement = getMapFromOverlay(this);
var MapUtil = require('app/map/util');
var Map = require('app/map/map');
var map = Map.getMapInstance( mapElement.data('id') );
var connections = MapUtil.searchConnectionsByScopeAndType(map, 'wh', ['wh_eol']);
for (let connection of connections) {
connection.removeOverlay(config.connectionOverlayEolId);
}
}
}
}
};
@@ -299,7 +353,7 @@ define([
/**
* init all map overlays on a "parent" element
* @returns {any|JQuery|*}
* @returns {*}
*/
$.fn.initMapOverlays = function(){
return this.each(function(){
@@ -322,7 +376,7 @@ define([
var icon = $('<i>', {
class: options[prop].iconClass.concat( ['pull-right', options[prop].class] ).join(' ')
}).attr('title', options[prop].title).tooltip({
placement: 'left',
placement: 'bottom',
container: 'body',
delay: 150
});

346
js/app/map/util.js Normal file
View File

@@ -0,0 +1,346 @@
/**
* Map util functions
*/
define([
'jquery',
'app/init',
'app/util'
], function($, Init, Util) {
'use strict';
/**
* get all available map Types
* optional they can be filtered by current access level of a user
* @param {bool} filterByUser
* @returns {Array}
*/
var getMapTypes = function(filterByUser){
var mapTypes = [];
$.each(Init.mapTypes, function(prop, data){
// skip "default" type -> just for 'add' icon
if(data.label.length > 0){
var tempData = data;
tempData.name = prop;
mapTypes.push(tempData);
}
});
if(filterByUser === true){
var corporationId = Util.getCurrentUserInfo('corporationId');
var allianceId = Util.getCurrentUserInfo('allianceId');
var authorizedMapTypes = [];
// check if character data exists
if(corporationId > 0) {
authorizedMapTypes.push('corporation');
}
if(allianceId > 0){
authorizedMapTypes.push('alliance');
}
// private maps are always allowed
authorizedMapTypes.push('private');
// compare "all" map types with "authorized" types
var tempMapTypes = [];
for(var i = 0; i < mapTypes.length; i++){
for(var j = 0; j < authorizedMapTypes.length; j++){
if(mapTypes[i].name === authorizedMapTypes[j]){
tempMapTypes.push(mapTypes[i]);
break;
}
}
}
mapTypes = tempMapTypes;
}
return mapTypes;
};
/**
* get all available scopes for a map
* @returns {Array}
*/
var getMapScopes = function(){
var scopes = [];
$.each(Init.mapScopes, function(prop, data){
var tempData = data;
tempData.name = prop;
scopes.push(tempData);
});
return scopes;
};
/**
* get some scope info for a given info string
* @param {string} info
* @param {string} option
* @returns {string}
*/
var getScopeInfoForMap = function(info, option){
var scopeInfo = '';
if(Init.mapScopes.hasOwnProperty(info)){
scopeInfo = Init.mapScopes[info][option];
}
return scopeInfo;
};
/**
* get all available map icons
* @returns {Object[]}
*/
var getMapIcons = function(){
return Init.mapIcons;
};
/**
* get map info
* @param {string} mapType
* @param {string} option
* @returns {string}
*/
var getInfoForMap = function(mapType, option){
var mapInfo = '';
if(Init.mapTypes.hasOwnProperty(mapType)){
mapInfo = Init.mapTypes[mapType][option];
}
return mapInfo;
};
/**
* get some system info for a given info string (e.g. rally class)
* @param {string} info
* @param {string} option
* @returns {string}
*/
var getInfoForSystem = function(info, option){
var systemInfo = '';
if(Init.classes.systemInfo.hasOwnProperty(info)){
systemInfo = Init.classes.systemInfo[info][option];
}
return systemInfo;
};
/**
* get system type information
* @param {number} systemTypeId
* @param {string} option
* @returns {string}
*/
var getSystemTypeInfo = function(systemTypeId, option){
var systemTypeInfo = '';
$.each(Init.systemType, function(prop, data){
if(systemTypeId === data.id){
systemTypeInfo = data[option];
return;
}
});
return systemTypeInfo;
};
/**
* get some info for a given effect string
* @param effect
* @param option
* @returns {string}
*/
var getEffectInfoForSystem = function(effect, option){
var effectInfo = '';
if( Init.classes.systemEffects.hasOwnProperty(effect) ){
effectInfo = Init.classes.systemEffects[effect][option];
}
return effectInfo;
};
/**
* search connections by systems
* @param {Object} map - jsPlumb
* @param {JQuery[]} systems - system DOM elements
* @returns {Array} connections - found connection, DOM elements
*/
var searchConnectionsBySystems = function(map, systems){
var connections = [];
var withBackConnection = false;
$.each(systems, function(i, system){
// get connections where system is source
connections = connections.concat( map.getConnections({source: system}) );
if(withBackConnection === true){
// get connections where system is target
connections = connections.concat( map.getConnections({target: system}) );
}
});
return connections;
};
/**
* search connections by scope and/or type
* -> scope and target can be an array
* @param {Object} map - jsPlumb
* @param {string|string[]} scope
* @param {string|string[]} type
* @returns {Array}
*/
var searchConnectionsByScopeAndType = function(map, scope, type){
var connections = [];
var scopeArray = (scope === undefined) ? ['*'] : ((Array.isArray(scope)) ? scope : [scope]);
var typeArray = (type === undefined) ? [] : ((Array.isArray(type)) ? type : [type]);
map.select({scope: scopeArray}).each(function(connection){
if(typeArray.length > 0){
// filter by connection type as well...
for(var i = 0; i < typeArray.length; i++){
if( connection.hasType(typeArray[i]) ){
connections.push(connection);
break; // don´t add same connection multiple times
}
}
}else{
// connection type is ignored
connections.push(connection);
}
});
return connections;
};
/**
* get Connection Info by option
* @param {string} connectionTyp
* @param {string} option
* @returns {string}
*/
var getConnectionInfo = function(connectionTyp, option){
var connectionInfo = '';
if(Init.connectionTypes.hasOwnProperty(connectionTyp)){
connectionInfo = Init.connectionTypes[connectionTyp][option];
}
return connectionInfo;
};
/**
* get all direct connections between two given systems
* @param map
* @param {JQuery} systemA
* @param {JQuery} systemB
* @returns {Array}
*/
var checkForConnection = function(map, systemA, systemB){
var connections = [];
connections = connections.concat( map.getConnections({scope: '*', source: systemA, target: systemB}) );
// get connections where system is target
connections = connections.concat( map.getConnections({scope: '*', source: systemB, target: systemA}) );
return connections;
};
/**
* get the default connection type for a scope
* e.g. for new type after scope change
* @param {string} scope
* @returns {string}
*/
var getDefaultConnectionTypeByScope = function(scope){
var type = '';
switch(scope){
case 'wh':
type = 'wh_fresh';
break;
case 'jumpbridge':
type = 'jumpbridge';
break;
case'stargate':
type = 'stargate';
break;
default:
console.error('Connection scope "' + scope + '" unknown!');
}
return type;
};
/**
* set/change connection status of a wormhole
* @param {Object} connection - jsPlumb object
* @param {string} status
*/
var setConnectionWHStatus = function(connection, status){
if(
status === 'wh_fresh' &&
connection.hasType('wh_fresh') !== true
){
connection.removeType('wh_reduced');
connection.removeType('wh_critical');
connection.addType('wh_fresh');
}else if(
status === 'wh_reduced' &&
connection.hasType('wh_reduced') !== true
){
connection.removeType('wh_fresh');
connection.removeType('wh_critical');
connection.addType('wh_reduced');
}else if(
status === 'wh_critical' &&
connection.hasType('wh_critical') !== true
){
connection.removeType('wh_fresh');
connection.removeType('wh_reduced');
connection.addType('wh_critical');
}else if(
status === 'wh_eol' &&
connection.hasType('wh_eol') !== true
){
connection.addType('wh_eol');
}else if(
status === 'wh_eol' &&
connection.hasType('wh_eol') !== true
){
connection.addType('wh_eol');
}
};
/**
* get some scope info for a given info string
* @param {string} info
* @param {string} option
* @returns {string}
*/
var getScopeInfoForConnection = function(info, option){
var scopeInfo = '';
if(Init.connectionScopes.hasOwnProperty(info)){
switch(option){
case 'connectorDefinition':
// json data in DB
var temp = '{ "data": ' + Init.connectionScopes[info][option] + '}';
scopeInfo = $.parseJSON( temp).data;
break;
default:
scopeInfo = Init.connectionScopes[info][option];
break;
}
}
return scopeInfo;
};
return {
getMapTypes: getMapTypes,
getMapScopes: getMapScopes,
getScopeInfoForMap: getScopeInfoForMap,
getMapIcons: getMapIcons,
getInfoForMap: getInfoForMap,
getInfoForSystem: getInfoForSystem,
getSystemTypeInfo: getSystemTypeInfo,
getEffectInfoForSystem: getEffectInfoForSystem,
searchConnectionsBySystems: searchConnectionsBySystems,
searchConnectionsByScopeAndType: searchConnectionsByScopeAndType,
getConnectionInfo: getConnectionInfo,
checkForConnection: checkForConnection,
getDefaultConnectionTypeByScope: getDefaultConnectionTypeByScope,
setConnectionWHStatus: setConnectionWHStatus,
getScopeInfoForConnection: getScopeInfoForConnection
};
});

View File

@@ -3,6 +3,7 @@ define([
'app/init',
'app/util',
'app/map/map',
'app/map/util',
'app/counter',
'app/ui/system_info',
'app/ui/system_graph',
@@ -14,7 +15,7 @@ define([
'datatables.net-buttons-html',
'datatables.net-responsive',
'datatables.net-select'
], function($, Init, Util, Map) {
], function($, Init, Util, Map, MapUtil) {
'use strict';
@@ -650,7 +651,7 @@ define([
var tabAddOptions = {
id: 0,
type: {
classTab: Util.getInfoForMap( 'standard', 'classTab')
classTab: MapUtil.getInfoForMap( 'standard', 'classTab')
},
icon: 'fa-plus',
name: 'add',

View File

@@ -6,8 +6,9 @@ define([
'jquery',
'app/init',
'app/util',
'bootbox'
], function($, Init, Util, bootbox) {
'bootbox',
'app/map/util'
], function($, Init, Util, bootbox, MapUtil) {
'use strict';
@@ -72,7 +73,7 @@ define([
var countConnections = mapData.data.connections.length;
// map type
var mapTypes = Util.getMapTypes();
var mapTypes = MapUtil.getMapTypes();
var mapTypeName = '';
var mapTypeClass = '';
for(var i = 0; i < mapTypes.length; i++){
@@ -196,7 +197,7 @@ define([
// type
tempData.type = {
type: Util.getSystemTypeInfo(tempSystemData.type.id, 'name'),
type: MapUtil.getSystemTypeInfo(tempSystemData.type.id, 'name'),
type_sort: tempSystemData.type.id
};
@@ -237,7 +238,7 @@ define([
}
// effect
var systemEffectClass = Util.getEffectInfoForSystem(tempSystemData.effect, 'class');
var systemEffectClass = MapUtil.getEffectInfoForSystem(tempSystemData.effect, 'class');
if(systemEffectClass !== ''){
tempData.effect = {
effect: '<i class="fa fa fa-square fa-lg fa-fw ' + systemEffectClass + '"></i>',
@@ -491,7 +492,7 @@ define([
tempConData.id = tempConnectionData.id;
tempConData.scope = {
scope: Util.getScopeInfoForConnection(tempConnectionData.scope, 'label'),
scope: MapUtil.getScopeInfoForConnection(tempConnectionData.scope, 'label'),
scope_sort: tempConnectionData.scope
};
@@ -501,7 +502,7 @@ define([
// connection
var connectionClasses = [];
for(var k = 0; k < tempConnectionData.type.length; k++){
connectionClasses.push( Util.getConnectionInfo( tempConnectionData.type[k], 'cssClass') );
connectionClasses.push( MapUtil.getConnectionInfo( tempConnectionData.type[k], 'cssClass') );
}

View File

@@ -7,8 +7,9 @@ define([
'app/init',
'app/util',
'app/render',
'bootbox'
], function($, Init, Util, Render, bootbox) {
'bootbox',
'app/map/util'
], function($, Init, Util, Render, bootbox, MapUtil) {
'use strict';
var config = {
@@ -80,12 +81,12 @@ define([
}
// available map "types" for a new or existing map
var mapTypes = Util.getMapTypes(true);
var mapTypes = MapUtil.getMapTypes(true);
var data = {
scope: Util.getMapScopes(),
scope: MapUtil.getMapScopes(),
type: mapTypes,
icon: Util.getMapIcons(),
icon: MapUtil.getMapIcons(),
formErrorContainerClass: Util.config.formErrorContainerClass,
formWarningContainerClass: Util.config.formWarningContainerClass,
formInfoContainerClass: Util.config.formInfoContainerClass

View File

@@ -9,7 +9,8 @@ define([
'app/util',
'app/render',
'bootbox',
], function($, Init, Util, Render, bootbox) {
'app/map/util'
], function($, Init, Util, Render, bootbox, MapUtil) {
'use strict';
var config = {
@@ -47,8 +48,8 @@ define([
var rows = [];
// get formatted system effect name
var systemEffectName = Util.getEffectInfoForSystem(effectName, 'name');
var systemEffectClass = Util.getEffectInfoForSystem(effectName, 'class');
var systemEffectName = MapUtil.getEffectInfoForSystem(effectName, 'name');
var systemEffectClass = MapUtil.getEffectInfoForSystem(effectName, 'class');
$.each( effectData, function( areaId, areaData ) {

View File

@@ -5,8 +5,9 @@
define([
'jquery',
'app/init',
'app/util'
], function($, Init, Util) {
'app/util',
'app/map/util'
], function($, Init, Util, MapUtil) {
'use strict';
@@ -84,7 +85,7 @@ define([
var trueSec = parseFloat(item.trueSec);
var secClass = Util.getSecurityClassForSystem(item.security);
var trueSecClass = Util.getTrueSecClassForSystem( trueSec );
var effectClass = Util.getEffectInfoForSystem(item.effect, 'class');
var effectClass = MapUtil.getEffectInfoForSystem(item.effect, 'class');
// check if system is dialed
if(

View File

@@ -6,8 +6,9 @@ define([
'jquery',
'app/init',
'app/util',
'app/render'
], function($, Init, Util, Render) {
'app/render',
'app/map/util'
], function($, Init, Util, Render, MapUtil) {
'use strict';
var config = {
@@ -210,8 +211,8 @@ define([
shatteredWormholeInfo = true;
}
var effectName = Util.getEffectInfoForSystem(systemData.effect, 'name');
var effectClass = Util.getEffectInfoForSystem(systemData.effect, 'class');
var effectName = MapUtil.getEffectInfoForSystem(systemData.effect, 'name');
var effectClass = MapUtil.getEffectInfoForSystem(systemData.effect, 'class');
// systemInfo template config
var moduleConfig = {
@@ -407,7 +408,7 @@ define([
wormholePrefixClass: config.systemInfoWormholeClass,
statusInfoClass: config.systemInfoStatusLabelClass,
systemTypeName: Util.getSystemTypeInfo(systemData.type.id, 'name'),
systemTypeName: MapUtil.getSystemTypeInfo(systemData.type.id, 'name'),
systemStatusId: systemData.status.id,
systemStatusClass: Util.getStatusInfoForSystem(systemData.status.id, 'class'),
systemStatusLabel: Util.getStatusInfoForSystem(systemData.status.id, 'label'),

View File

@@ -871,6 +871,38 @@ define([
return serverDate;
};
/**
* convert timestamp to server time
* @param timestamp
* @returns {Date}
*/
var convertTimestampToServerTime = function(timestamp){
var currentTimeZoneOffsetInMinutes = new Date().getTimezoneOffset();
return new Date( (timestamp + (currentTimeZoneOffsetInMinutes * 60)) * 1000);
};
/**
* get date difference as time parts (days, hours, minutes, seconds)
* @param date1
* @param date2
* @returns {{}}
*/
var getTimeDiffParts = function(date1, date2){
var parts = {};
var diff = (date2.getTime() - date1.getTime()) / 1000;
diff = Math.abs(Math.floor(diff));
parts.days = Math.floor(diff/(24*60*60));
var leftSec = diff - parts.days * 24*60*60;
parts.hours = Math.floor(leftSec/(60*60));
leftSec = leftSec - parts.hours * 60*60;
parts.min = Math.floor(leftSec/(60));
parts.sec = leftSec - parts.min * 60;
return parts;
};
/**
* start time measurement by a unique string identifier
* @param timerName
@@ -1003,203 +1035,6 @@ define([
return mapModule;
};
/**
* get all available map icons
* @returns {*}
*/
var getMapIcons = function(){
return Init.mapIcons;
};
/**
* get all available map Types
* optional they can be filtered by current access level of a user
* @param filterByUser
* @returns {Array}
*/
var getMapTypes = function(filterByUser){
var mapTypes = [];
$.each(Init.mapTypes, function(prop, data){
// skip "default" type -> just for 'add' icon
if(data.label.length > 0){
var tempData = data;
tempData.name = prop;
mapTypes.push(tempData);
}
});
if(filterByUser === true){
var corporationId = getCurrentUserInfo('corporationId');
var allianceId = getCurrentUserInfo('allianceId');
var authorizedMapTypes = [];
// check if character data exists
if(corporationId > 0) {
authorizedMapTypes.push('corporation');
}
if(allianceId > 0){
authorizedMapTypes.push('alliance');
}
// private maps are always allowed
authorizedMapTypes.push('private');
// compare "all" map types with "authorized" types
var tempMapTypes = [];
for(var i = 0; i < mapTypes.length; i++){
for(var j = 0; j < authorizedMapTypes.length; j++){
if(mapTypes[i].name === authorizedMapTypes[j]){
tempMapTypes.push(mapTypes[i]);
break;
}
}
}
mapTypes = tempMapTypes;
}
return mapTypes;
};
/**
* get map info
* @param mapType
* @param option
* @returns {string}
*/
var getInfoForMap = function(mapType, option){
var mapInfo = '';
if(Init.mapTypes.hasOwnProperty(mapType)){
mapInfo = Init.mapTypes[mapType][option];
}
return mapInfo;
};
/**
* get all available scopes for a map
* @returns {Array}
*/
var getMapScopes = function(){
var scopes = [];
$.each(Init.mapScopes, function(prop, data){
var tempData = data;
tempData.name = prop;
scopes.push(tempData);
});
return scopes;
};
/**
* get some scope info for a given info string
* @param info
* @param option
* @returns {string}
*/
var getScopeInfoForMap = function(info, option){
var scopeInfo = '';
if(Init.mapScopes.hasOwnProperty(info)){
scopeInfo = Init.mapScopes[info][option];
}
return scopeInfo;
};
/**
* get some scope info for a given info string
* @param info
* @param option
* @returns {string}
*/
var getScopeInfoForConnection = function(info, option){
var scopeInfo = '';
if(Init.connectionScopes.hasOwnProperty(info)){
switch(option){
case 'connectorDefinition':
// json data in DB
var temp = '{ "data": ' + Init.connectionScopes[info][option] + '}';
scopeInfo = $.parseJSON( temp).data;
break;
default:
scopeInfo = Init.connectionScopes[info][option];
break;
}
}
return scopeInfo;
};
/**
* get system type information
* @returns {Array}
*/
var getSystemTypeInfo = function(systemTypeId, option){
var systemTypeInfo = '';
$.each(Init.systemType, function(prop, data){
if(systemTypeId === data.id){
systemTypeInfo = data[option];
return;
}
});
return systemTypeInfo;
};
/**
* get some system info for a given info string (e.g. rally class)
* @param info
* @param option
* @returns {string}
*/
var getInfoForSystem = function(info, option){
var systemInfo = '';
if(Init.classes.systemInfo.hasOwnProperty(info)){
systemInfo = Init.classes.systemInfo[info][option];
}
return systemInfo;
};
/**
* get some info for a given effect string
* @param effect
* @param option
* @returns {string}
*/
var getEffectInfoForSystem = function(effect, option){
var effectInfo = '';
if( Init.classes.systemEffects.hasOwnProperty(effect) ){
effectInfo = Init.classes.systemEffects[effect][option];
}
return effectInfo;
};
/**
* get system effect data by system security and system class
* if no search parameters given -> get all effect data
@@ -1208,13 +1043,10 @@ define([
* @returns {boolean}
*/
var getSystemEffectData = function(security, effect){
var data = SystemEffect;
if(security){
// look for specific data
data = false;
var areaId = getAreaIdBySecurity(security);
if(
@@ -1414,22 +1246,6 @@ define([
return statusInfo;
};
/**
* get Connection Info by option
* @param connectionTyp
* @param option
* @returns {string}
*/
var getConnectionInfo = function(connectionTyp, option){
var connectionInfo = '';
if(Init.connectionTypes.hasOwnProperty(connectionTyp)){
connectionInfo = Init.connectionTypes[connectionTyp][option];
}
return connectionInfo;
};
/**
* get signature group information
* @param option
@@ -1543,7 +1359,7 @@ define([
* 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
* @param mapUserData
*/
var setCurrentMapUserData = function(mapUserData){
Init.currentMapUserData = mapUserData;
@@ -1707,7 +1523,6 @@ define([
* @param type
*/
var setDestination = function(systemData, type){
var description = '';
switch(type){
case 'set_destination':
@@ -1895,6 +1710,8 @@ define([
showVersionInfo: showVersionInfo,
getCurrentTriggerDelay: getCurrentTriggerDelay,
getServerTime: getServerTime,
convertTimestampToServerTime: convertTimestampToServerTime,
getTimeDiffParts: getTimeDiffParts,
timeStart: timeStart,
timeStop: timeStop,
log: log,
@@ -1902,15 +1719,6 @@ define([
getLogInfo: getLogInfo,
isXHRAborted: isXHRAborted,
getMapModule: getMapModule,
getMapIcons: getMapIcons,
getMapTypes: getMapTypes,
getInfoForMap: getInfoForMap,
getMapScopes: getMapScopes,
getScopeInfoForMap: getScopeInfoForMap,
getScopeInfoForConnection: getScopeInfoForConnection,
getSystemTypeInfo: getSystemTypeInfo,
getInfoForSystem: getInfoForSystem,
getEffectInfoForSystem: getEffectInfoForSystem,
getSystemEffectData: getSystemEffectData,
getSystemEffectTable: getSystemEffectTable,
getSystemsInfoTable: getSystemsInfoTable,
@@ -1918,7 +1726,6 @@ define([
getSecurityClassForSystem: getSecurityClassForSystem,
getTrueSecClassForSystem: getTrueSecClassForSystem,
getStatusInfoForSystem: getStatusInfoForSystem,
getConnectionInfo: getConnectionInfo,
getSignatureGroupInfo: getSignatureGroupInfo,
getAllSignatureNames: getAllSignatureNames,
getSignatureTypeIdByName: getSignatureTypeIdByName,

File diff suppressed because one or more lines are too long

View File

@@ -1,31 +1,26 @@
define(["jquery"], function($) {
"use strict";
define([
'jquery',
'app/init',
'app/util'
], function($, Init, Util) {
'use strict';
var config = {
counterDigitSmallClass: 'pf-digit-counter-small',
counterDigitLargeClass: 'pf-digit-counter-large'
};
/**
* update element with time information
* @param element
* @param tempDate
*/
var updateDateDiff = function(element, tempDate){
var date1 = new Date();
var date2 = tempDate;
//Customise date2 for your required future time
var diff = (date1 - date2)/1000;
diff = Math.abs(Math.floor(diff));
var days = Math.floor(diff/(24*60*60));
var leftSec = diff - days * 24*60*60;
var hrs = Math.floor(leftSec/(60*60));
leftSec = leftSec - hrs * 60*60;
var min = Math.floor(leftSec/(60));
leftSec = leftSec - min * 60;
var diff = Util.getTimeDiffParts(tempDate, new Date());
var days = diff.days;
var hrs = diff.hours;
var min = diff.min;
var leftSec = diff.sec;
var value = [];
if(
@@ -54,9 +49,7 @@ define(["jquery"], function($) {
value.push('<span class="' + config.counterDigitSmallClass + '">' + leftSec + 's' + '</span>');
}
element.html(value.join(' '));
};
/**
@@ -65,9 +58,7 @@ define(["jquery"], function($) {
*/
$.fn.initTimestampCounter = function(){
return this.each(function(){
var element = $(this);
var timestamp = parseInt( element.text() );
// do not init twice
@@ -90,12 +81,7 @@ define(["jquery"], function($) {
}, 100);
element.data('interval', refreshIntervalId);
}
});
};
});

View File

@@ -276,23 +276,23 @@ define(['jquery'], function($) {
dashstyle: '0.99'
},
overlays:[
[ 'Label',
['Label',
{
label: 'frig',
cssClass: ['pf-map-connection-overlay', 'frig'].join(' ')
} ]
cssClass: ['pf-map-connection-overlay', 'frig'].join(' '),
location: 0.6
}]
]
},
preserve_mass: {
cssClass: 'pf-map-connection-preserve-mass',
overlays:[
[ 'Label',
['Label',
{
label: '<i class="fa fa-warning"></i>&nbsp;save mass',
label: '<i class="fa fa-fw fa-warning"></i>&nbsp;save mass',
cssClass: ['pf-map-connection-overlay', 'mass'].join(' '),
width:50, length:30,
location: 0.5
} ]
location: 0.6
}]
]
}
},

View File

@@ -8,13 +8,14 @@ define([
'app/util',
'app/render',
'bootbox',
'app/map/util',
'app/map/magnetizing',
'app/map/scrollbar',
'dragToSelect',
'select2',
'app/map/contextmenu',
'app/map/overlay'
], function($, Init, Util, Render, bootbox, MagnetizerWrapper) {
], function($, Init, Util, Render, bootbox, MapUtil, MagnetizerWrapper) {
'use strict';
@@ -481,9 +482,9 @@ define([
}
// get system info classes
var effectBasicClass = Util.getEffectInfoForSystem('effect', 'class');
var effectName = Util.getEffectInfoForSystem(data.effect, 'name');
var effectClass = Util.getEffectInfoForSystem(data.effect, 'class');
var effectBasicClass = MapUtil.getEffectInfoForSystem('effect', 'class');
var effectName = MapUtil.getEffectInfoForSystem(data.effect, 'name');
var effectClass = MapUtil.getEffectInfoForSystem(data.effect, 'class');
var secClass = Util.getSecurityClassForSystem(data.security);
system = $('<div>', {
@@ -965,7 +966,7 @@ define([
sourceConfig.scope = map.Defaults.Scope; // set all allowed connections for this scopes
// default connector for initial dragging a new connection
sourceConfig.connector = Util.getScopeInfoForConnection('wh', 'connectorDefinition');
sourceConfig.connector = MapUtil.getScopeInfoForConnection('wh', 'connectorDefinition');
map.makeSource(system, sourceConfig);
};
@@ -1175,50 +1176,6 @@ define([
});
};
/**
* get all connections of multiple systems
* @param map
* @param systems
* @returns {Array}
*/
var getConnections = function(map, systems){
var connections = [];
var withBackConnection = false;
$.each(systems, function(i, system){
// get connections where system is source
connections = connections.concat( map.getConnections({source: system}) );
if(withBackConnection === true){
// get connections where system is target
connections = connections.concat( map.getConnections({target: system}) );
}
});
return connections;
};
/**
* get all direct connections between two given systems
* @param map
* @param systemA
* @param systemB
* @returns {Array}
*/
var checkForConnection = function(map, systemA, systemB){
var connections = [];
connections = connections.concat( map.getConnections({scope: '*', source: systemA, target: systemB}) );
// get connections where system is target
connections = connections.concat( map.getConnections({scope: '*', source: systemB, target: systemA}) );
return connections;
};
/**
* connect two systems
* @param map
@@ -1263,7 +1220,8 @@ define([
// therefore they shoule be part of the connection not of the connector
connection.setParameters({
connectionId: connectionId,
updated: connectionData.updated
updated: connectionData.updated,
eolUpdated: connectionData.eolUpdated
});
// add connection types -----------------------------------------------------
@@ -1330,7 +1288,7 @@ define([
updateConnectionCache(this.mapId, connection);
// connection scope
var scope = Util.getScopeInfoForConnection(newConnectionData.scope, 'label');
var scope = MapUtil.getScopeInfoForConnection(newConnectionData.scope, 'label');
var title = 'New connection established';
if(connectionData.id > 0){
@@ -1462,7 +1420,7 @@ define([
addType[i].indexOf('reduced') !== -1 ||
addType[i].indexOf('critical') !== -1
){
setConnectionWHStatus(connection, addType[i]);
MapUtil.setConnectionWHStatus(connection, addType[i]);
}else if( connection.hasType(addType[i]) !== true ){
// additional types e.g. eol, frig, preserve mass
connection.addType(addType[i]);
@@ -1482,8 +1440,11 @@ define([
}
}
// set update date
connection.setParameter('updated', newConnectionData.updated);
// set update date (important for update check)
connection.setParameters({
updated: newConnectionData.updated,
eolUpdated: newConnectionData.eolUpdated
});
return connection;
};
@@ -1496,7 +1457,7 @@ define([
var setConnectionScope = function(connection, scope){
var map = connection._jsPlumb.instance;
var currentConnector = connection.getConnector();
var newConnector = Util.getScopeInfoForConnection(scope, 'connectorDefinition');
var newConnector = MapUtil.getScopeInfoForConnection(scope, 'connectorDefinition');
if(currentConnector.type !== newConnector[0]){
// connector has changed
@@ -1508,7 +1469,7 @@ define([
// set new new connection type
// if scope changed -> connection type == scope
connection.setType( getDefaultConnectionTypeByScope(scope) );
connection.setType( MapUtil.getDefaultConnectionTypeByScope(scope) );
// change scope
connection.scope = scope;
@@ -1516,73 +1477,6 @@ define([
// new observer is required after scope change
setConnectionObserver(map, connection);
}
};
/**
* get the default connection type for a scope
* e.g. for new type after scope change
* @param scope
* @returns {string}
*/
var getDefaultConnectionTypeByScope = function(scope){
var type = '';
switch(scope){
case 'wh':
type = 'wh_fresh';
break;
case 'jumpbridge':
type = 'jumpbridge';
break;
case'stargate':
type = 'stargate';
break;
}
return type;
};
/**
* set/change connection status of a wormhole
* @param connection
* @param status
*/
var setConnectionWHStatus = function(connection, status){
if(
status === 'wh_fresh' &&
connection.hasType('wh_fresh') !== true
){
connection.removeType('wh_reduced');
connection.removeType('wh_critical');
connection.addType('wh_fresh');
}else if(
status === 'wh_reduced' &&
connection.hasType('wh_reduced') !== true
){
connection.removeType('wh_fresh');
connection.removeType('wh_critical');
connection.addType('wh_reduced');
}else if(
status === 'wh_critical' &&
connection.hasType('wh_critical') !== true
){
connection.removeType('wh_fresh');
connection.removeType('wh_reduced');
connection.addType('wh_critical');
}else if(
status === 'wh_eol' &&
connection.hasType('wh_eol') !== true
){
connection.addType('wh_eol');
}else if(
status === 'wh_eol' &&
connection.hasType('wh_eol') !== true
){
connection.addType('wh_eol');
}
};
/**
@@ -2212,7 +2106,7 @@ define([
var system = $(this);
var rallyClass = Util.getInfoForSystem('rally', 'class');
var rallyClass = MapUtil.getInfoForSystem('rally', 'class');
var hideNotification = false;
if(options.hideNotification === true){
@@ -2341,7 +2235,7 @@ define([
var filterScope = action.split('_')[1];
// scope label
var filterScopeLabel = Util.getScopeInfoForMap(filterScope, 'label');
var filterScopeLabel = MapUtil.getScopeInfoForMap(filterScope, 'label');
var showScope = true;
if(
@@ -2643,7 +2537,7 @@ define([
var action = params.selectedMenu.attr('data-action');
var activeConnection = params.component;
var activeScope = activeConnection.scope;
var activeScopeName = Util.getScopeInfoForConnection( activeScope, 'label');
var activeScopeName = MapUtil.getScopeInfoForConnection( activeScope, 'label');
switch(action){
case 'delete_connection':
@@ -2671,14 +2565,14 @@ define([
var newStatus = action.split('_')[1];
mapElement.getMapOverlay('timer').startMapUpdateCounter();
setConnectionWHStatus(activeConnection, 'wh_' + newStatus);
MapUtil.setConnectionWHStatus(activeConnection, 'wh_' + newStatus);
$(activeConnection).markAsChanged();
break;
case 'scope_wh':
case 'scope_stargate':
case 'scope_jumpbridge':
var newScope = action.split('_')[1];
var newScopeName = Util.getScopeInfoForConnection( newScope, 'label');
var newScopeName = MapUtil.getScopeInfoForConnection( newScope, 'label');
bootbox.confirm('Change scope from ' + activeScopeName + ' to ' + newScopeName + '?', function(result) {
if(result){
@@ -3101,19 +2995,19 @@ define([
){
// map config -----------------------------------------------------------
var mapConfig = {};
mapConfig.id = parseInt( mapElement.data('id') );
mapConfig.name = mapElement.data('name');
mapConfig.scope = {
id: parseInt( mapElement.data('scopeId') )
mapData.config = {
id: parseInt( mapElement.data('id') ),
name: mapElement.data('name'),
scope: {
id: parseInt( mapElement.data('scopeId') )
},
icon: mapElement.data('icon'),
type: {
id: parseInt( mapElement.data('typeId') )
},
created: parseInt( mapElement.data('created') ),
updated: parseInt( mapElement.data('updated') ),
};
mapConfig.icon = mapElement.data('icon');
mapConfig.type = {
id: parseInt( mapElement.data('typeId') )
};
mapConfig.created = parseInt( mapElement.data('created') );
mapConfig.updated = parseInt( mapElement.data('updated') );
mapData.config = mapConfig;
// map data -------------------------------------------------------------
var data = {};
@@ -3172,7 +3066,7 @@ define([
}
// overwrite connection cache
connectionCache[mapConfig.id] = updatedConnectionCache;
connectionCache[mapData.config.id] = updatedConnectionCache;
data.connections = connectionsFormatted;
@@ -3253,14 +3147,8 @@ define([
// normalize connection array
connectionTypes = $.grep(connectionTypes, function(n){
if(
n.length > 0 &&
n !== 'default' // this is added by jsplumb by default -_-
){
return true;
}else{
return false;
}
// 'default' is added by jsPlumb by default -_-
return ( n.length > 0 && n !== 'default');
});
var data = {
@@ -3345,11 +3233,11 @@ define([
// set "default" connection status only for NEW connections
if(!connection.suspendedElement){
setConnectionWHStatus(connection, getDefaultConnectionTypeByScope(connection.scope) );
MapUtil.setConnectionWHStatus(connection, MapUtil.getDefaultConnectionTypeByScope(connection.scope) );
}
// prevent multiple connections between same systems
var connections = checkForConnection(newJsPlumbInstance, info.sourceId, info.targetId );
var connections = MapUtil.checkForConnection(newJsPlumbInstance, info.sourceId, info.targetId );
if(connections.length > 1){
bootbox.confirm('Connection already exists. Do you really want to add an additional one?', function(result) {
@@ -3392,6 +3280,7 @@ define([
/**
* load OR updates system map
* @param mapConfig
* @param options
*/
$.fn.loadMap = function(mapConfig, options){
@@ -3428,6 +3317,8 @@ define([
var mapElement = mapConfig.map.getContainer();
var mapOverlay = $(mapElement).getMapOverlay('info');
mapOverlay.updateOverlayIcon('systemRegion', 'show');
mapOverlay.updateOverlayIcon('systemConnectionTimer', 'show');
}
// callback function after tab switch
@@ -3543,7 +3434,10 @@ define([
};
return {
clearMapInstance: clearMapInstance
getMapInstance: getMapInstance,
clearMapInstance: clearMapInstance,
getDataByConnection: getDataByConnection
};
});

View File

@@ -23,7 +23,10 @@ define([
mapOverlayInfoClass: 'pf-map-overlay-info', // class for map overlay info e.g. map info
// system
systemHeadClass: 'pf-system-head' // class for system head
systemHeadClass: 'pf-system-head', // class for system head
// connection
connectionOverlayEolId: 'overlayEol' // connection overlay ID (jsPlumb)
};
/**
@@ -81,6 +84,57 @@ define([
mapElement.find('.' + config.systemHeadClass).tooltip('hide');
}
}
},
systemConnectionTimer: {
title: 'show EOL timer',
trigger: 'hover',
class: 'pf-map-overlay-connection-timer',
iconClass: ['fa', 'fa-fw', 'fa-clock-o'],
hoverIntent: {
over: function(e){
var mapElement = getMapFromOverlay(this);
var MapUtil = require('app/map/util');
var Map = require('app/map/map');
var map = Map.getMapInstance( mapElement.data('id') );
var connections = MapUtil.searchConnectionsByScopeAndType(map, 'wh', ['wh_eol']);
var serverDate = Util.getServerTime();
for (let connection of connections) {
var eolTimestamp = connection.getParameter('eolUpdated');
var eolDate = Util.convertTimestampToServerTime(eolTimestamp);
var diff = Util.getTimeDiffParts(eolDate, serverDate);
// format overlay label
var label = '';
if(diff.days){
label += diff.days + 'd ';
}
label += ('00' + diff.hours).slice(-2);
label += ':' + ('00' + diff.min).slice(-2);
connection.addOverlay([
'Label',
{
label: '<i class="fa fa-fw fa-clock-o"></i>&nbsp;' + label,
id: config.connectionOverlayEolId,
cssClass: ['pf-map-connection-overlay', 'eol'].join(' '),
location: 0.25
}
]);
}
},
out: function(e){
var mapElement = getMapFromOverlay(this);
var MapUtil = require('app/map/util');
var Map = require('app/map/map');
var map = Map.getMapInstance( mapElement.data('id') );
var connections = MapUtil.searchConnectionsByScopeAndType(map, 'wh', ['wh_eol']);
for (let connection of connections) {
connection.removeOverlay(config.connectionOverlayEolId);
}
}
}
}
};
@@ -299,7 +353,7 @@ define([
/**
* init all map overlays on a "parent" element
* @returns {any|JQuery|*}
* @returns {*}
*/
$.fn.initMapOverlays = function(){
return this.each(function(){
@@ -322,7 +376,7 @@ define([
var icon = $('<i>', {
class: options[prop].iconClass.concat( ['pull-right', options[prop].class] ).join(' ')
}).attr('title', options[prop].title).tooltip({
placement: 'left',
placement: 'bottom',
container: 'body',
delay: 150
});

View File

@@ -0,0 +1,346 @@
/**
* Map util functions
*/
define([
'jquery',
'app/init',
'app/util'
], function($, Init, Util) {
'use strict';
/**
* get all available map Types
* optional they can be filtered by current access level of a user
* @param {bool} filterByUser
* @returns {Array}
*/
var getMapTypes = function(filterByUser){
var mapTypes = [];
$.each(Init.mapTypes, function(prop, data){
// skip "default" type -> just for 'add' icon
if(data.label.length > 0){
var tempData = data;
tempData.name = prop;
mapTypes.push(tempData);
}
});
if(filterByUser === true){
var corporationId = Util.getCurrentUserInfo('corporationId');
var allianceId = Util.getCurrentUserInfo('allianceId');
var authorizedMapTypes = [];
// check if character data exists
if(corporationId > 0) {
authorizedMapTypes.push('corporation');
}
if(allianceId > 0){
authorizedMapTypes.push('alliance');
}
// private maps are always allowed
authorizedMapTypes.push('private');
// compare "all" map types with "authorized" types
var tempMapTypes = [];
for(var i = 0; i < mapTypes.length; i++){
for(var j = 0; j < authorizedMapTypes.length; j++){
if(mapTypes[i].name === authorizedMapTypes[j]){
tempMapTypes.push(mapTypes[i]);
break;
}
}
}
mapTypes = tempMapTypes;
}
return mapTypes;
};
/**
* get all available scopes for a map
* @returns {Array}
*/
var getMapScopes = function(){
var scopes = [];
$.each(Init.mapScopes, function(prop, data){
var tempData = data;
tempData.name = prop;
scopes.push(tempData);
});
return scopes;
};
/**
* get some scope info for a given info string
* @param {string} info
* @param {string} option
* @returns {string}
*/
var getScopeInfoForMap = function(info, option){
var scopeInfo = '';
if(Init.mapScopes.hasOwnProperty(info)){
scopeInfo = Init.mapScopes[info][option];
}
return scopeInfo;
};
/**
* get all available map icons
* @returns {Object[]}
*/
var getMapIcons = function(){
return Init.mapIcons;
};
/**
* get map info
* @param {string} mapType
* @param {string} option
* @returns {string}
*/
var getInfoForMap = function(mapType, option){
var mapInfo = '';
if(Init.mapTypes.hasOwnProperty(mapType)){
mapInfo = Init.mapTypes[mapType][option];
}
return mapInfo;
};
/**
* get some system info for a given info string (e.g. rally class)
* @param {string} info
* @param {string} option
* @returns {string}
*/
var getInfoForSystem = function(info, option){
var systemInfo = '';
if(Init.classes.systemInfo.hasOwnProperty(info)){
systemInfo = Init.classes.systemInfo[info][option];
}
return systemInfo;
};
/**
* get system type information
* @param {number} systemTypeId
* @param {string} option
* @returns {string}
*/
var getSystemTypeInfo = function(systemTypeId, option){
var systemTypeInfo = '';
$.each(Init.systemType, function(prop, data){
if(systemTypeId === data.id){
systemTypeInfo = data[option];
return;
}
});
return systemTypeInfo;
};
/**
* get some info for a given effect string
* @param effect
* @param option
* @returns {string}
*/
var getEffectInfoForSystem = function(effect, option){
var effectInfo = '';
if( Init.classes.systemEffects.hasOwnProperty(effect) ){
effectInfo = Init.classes.systemEffects[effect][option];
}
return effectInfo;
};
/**
* search connections by systems
* @param {Object} map - jsPlumb
* @param {JQuery[]} systems - system DOM elements
* @returns {Array} connections - found connection, DOM elements
*/
var searchConnectionsBySystems = function(map, systems){
var connections = [];
var withBackConnection = false;
$.each(systems, function(i, system){
// get connections where system is source
connections = connections.concat( map.getConnections({source: system}) );
if(withBackConnection === true){
// get connections where system is target
connections = connections.concat( map.getConnections({target: system}) );
}
});
return connections;
};
/**
* search connections by scope and/or type
* -> scope and target can be an array
* @param {Object} map - jsPlumb
* @param {string|string[]} scope
* @param {string|string[]} type
* @returns {Array}
*/
var searchConnectionsByScopeAndType = function(map, scope, type){
var connections = [];
var scopeArray = (scope === undefined) ? ['*'] : ((Array.isArray(scope)) ? scope : [scope]);
var typeArray = (type === undefined) ? [] : ((Array.isArray(type)) ? type : [type]);
map.select({scope: scopeArray}).each(function(connection){
if(typeArray.length > 0){
// filter by connection type as well...
for(var i = 0; i < typeArray.length; i++){
if( connection.hasType(typeArray[i]) ){
connections.push(connection);
break; // don´t add same connection multiple times
}
}
}else{
// connection type is ignored
connections.push(connection);
}
});
return connections;
};
/**
* get Connection Info by option
* @param {string} connectionTyp
* @param {string} option
* @returns {string}
*/
var getConnectionInfo = function(connectionTyp, option){
var connectionInfo = '';
if(Init.connectionTypes.hasOwnProperty(connectionTyp)){
connectionInfo = Init.connectionTypes[connectionTyp][option];
}
return connectionInfo;
};
/**
* get all direct connections between two given systems
* @param map
* @param {JQuery} systemA
* @param {JQuery} systemB
* @returns {Array}
*/
var checkForConnection = function(map, systemA, systemB){
var connections = [];
connections = connections.concat( map.getConnections({scope: '*', source: systemA, target: systemB}) );
// get connections where system is target
connections = connections.concat( map.getConnections({scope: '*', source: systemB, target: systemA}) );
return connections;
};
/**
* get the default connection type for a scope
* e.g. for new type after scope change
* @param {string} scope
* @returns {string}
*/
var getDefaultConnectionTypeByScope = function(scope){
var type = '';
switch(scope){
case 'wh':
type = 'wh_fresh';
break;
case 'jumpbridge':
type = 'jumpbridge';
break;
case'stargate':
type = 'stargate';
break;
default:
console.error('Connection scope "' + scope + '" unknown!');
}
return type;
};
/**
* set/change connection status of a wormhole
* @param {Object} connection - jsPlumb object
* @param {string} status
*/
var setConnectionWHStatus = function(connection, status){
if(
status === 'wh_fresh' &&
connection.hasType('wh_fresh') !== true
){
connection.removeType('wh_reduced');
connection.removeType('wh_critical');
connection.addType('wh_fresh');
}else if(
status === 'wh_reduced' &&
connection.hasType('wh_reduced') !== true
){
connection.removeType('wh_fresh');
connection.removeType('wh_critical');
connection.addType('wh_reduced');
}else if(
status === 'wh_critical' &&
connection.hasType('wh_critical') !== true
){
connection.removeType('wh_fresh');
connection.removeType('wh_reduced');
connection.addType('wh_critical');
}else if(
status === 'wh_eol' &&
connection.hasType('wh_eol') !== true
){
connection.addType('wh_eol');
}else if(
status === 'wh_eol' &&
connection.hasType('wh_eol') !== true
){
connection.addType('wh_eol');
}
};
/**
* get some scope info for a given info string
* @param {string} info
* @param {string} option
* @returns {string}
*/
var getScopeInfoForConnection = function(info, option){
var scopeInfo = '';
if(Init.connectionScopes.hasOwnProperty(info)){
switch(option){
case 'connectorDefinition':
// json data in DB
var temp = '{ "data": ' + Init.connectionScopes[info][option] + '}';
scopeInfo = $.parseJSON( temp).data;
break;
default:
scopeInfo = Init.connectionScopes[info][option];
break;
}
}
return scopeInfo;
};
return {
getMapTypes: getMapTypes,
getMapScopes: getMapScopes,
getScopeInfoForMap: getScopeInfoForMap,
getMapIcons: getMapIcons,
getInfoForMap: getInfoForMap,
getInfoForSystem: getInfoForSystem,
getSystemTypeInfo: getSystemTypeInfo,
getEffectInfoForSystem: getEffectInfoForSystem,
searchConnectionsBySystems: searchConnectionsBySystems,
searchConnectionsByScopeAndType: searchConnectionsByScopeAndType,
getConnectionInfo: getConnectionInfo,
checkForConnection: checkForConnection,
getDefaultConnectionTypeByScope: getDefaultConnectionTypeByScope,
setConnectionWHStatus: setConnectionWHStatus,
getScopeInfoForConnection: getScopeInfoForConnection
};
});

View File

@@ -3,6 +3,7 @@ define([
'app/init',
'app/util',
'app/map/map',
'app/map/util',
'app/counter',
'app/ui/system_info',
'app/ui/system_graph',
@@ -14,7 +15,7 @@ define([
'datatables.net-buttons-html',
'datatables.net-responsive',
'datatables.net-select'
], function($, Init, Util, Map) {
], function($, Init, Util, Map, MapUtil) {
'use strict';
@@ -650,7 +651,7 @@ define([
var tabAddOptions = {
id: 0,
type: {
classTab: Util.getInfoForMap( 'standard', 'classTab')
classTab: MapUtil.getInfoForMap( 'standard', 'classTab')
},
icon: 'fa-plus',
name: 'add',

View File

@@ -6,8 +6,9 @@ define([
'jquery',
'app/init',
'app/util',
'bootbox'
], function($, Init, Util, bootbox) {
'bootbox',
'app/map/util'
], function($, Init, Util, bootbox, MapUtil) {
'use strict';
@@ -72,7 +73,7 @@ define([
var countConnections = mapData.data.connections.length;
// map type
var mapTypes = Util.getMapTypes();
var mapTypes = MapUtil.getMapTypes();
var mapTypeName = '';
var mapTypeClass = '';
for(var i = 0; i < mapTypes.length; i++){
@@ -196,7 +197,7 @@ define([
// type
tempData.type = {
type: Util.getSystemTypeInfo(tempSystemData.type.id, 'name'),
type: MapUtil.getSystemTypeInfo(tempSystemData.type.id, 'name'),
type_sort: tempSystemData.type.id
};
@@ -237,7 +238,7 @@ define([
}
// effect
var systemEffectClass = Util.getEffectInfoForSystem(tempSystemData.effect, 'class');
var systemEffectClass = MapUtil.getEffectInfoForSystem(tempSystemData.effect, 'class');
if(systemEffectClass !== ''){
tempData.effect = {
effect: '<i class="fa fa fa-square fa-lg fa-fw ' + systemEffectClass + '"></i>',
@@ -491,7 +492,7 @@ define([
tempConData.id = tempConnectionData.id;
tempConData.scope = {
scope: Util.getScopeInfoForConnection(tempConnectionData.scope, 'label'),
scope: MapUtil.getScopeInfoForConnection(tempConnectionData.scope, 'label'),
scope_sort: tempConnectionData.scope
};
@@ -501,7 +502,7 @@ define([
// connection
var connectionClasses = [];
for(var k = 0; k < tempConnectionData.type.length; k++){
connectionClasses.push( Util.getConnectionInfo( tempConnectionData.type[k], 'cssClass') );
connectionClasses.push( MapUtil.getConnectionInfo( tempConnectionData.type[k], 'cssClass') );
}

View File

@@ -7,8 +7,9 @@ define([
'app/init',
'app/util',
'app/render',
'bootbox'
], function($, Init, Util, Render, bootbox) {
'bootbox',
'app/map/util'
], function($, Init, Util, Render, bootbox, MapUtil) {
'use strict';
var config = {
@@ -80,12 +81,12 @@ define([
}
// available map "types" for a new or existing map
var mapTypes = Util.getMapTypes(true);
var mapTypes = MapUtil.getMapTypes(true);
var data = {
scope: Util.getMapScopes(),
scope: MapUtil.getMapScopes(),
type: mapTypes,
icon: Util.getMapIcons(),
icon: MapUtil.getMapIcons(),
formErrorContainerClass: Util.config.formErrorContainerClass,
formWarningContainerClass: Util.config.formWarningContainerClass,
formInfoContainerClass: Util.config.formInfoContainerClass

View File

@@ -9,7 +9,8 @@ define([
'app/util',
'app/render',
'bootbox',
], function($, Init, Util, Render, bootbox) {
'app/map/util'
], function($, Init, Util, Render, bootbox, MapUtil) {
'use strict';
var config = {
@@ -47,8 +48,8 @@ define([
var rows = [];
// get formatted system effect name
var systemEffectName = Util.getEffectInfoForSystem(effectName, 'name');
var systemEffectClass = Util.getEffectInfoForSystem(effectName, 'class');
var systemEffectName = MapUtil.getEffectInfoForSystem(effectName, 'name');
var systemEffectClass = MapUtil.getEffectInfoForSystem(effectName, 'class');
$.each( effectData, function( areaId, areaData ) {

View File

@@ -5,8 +5,9 @@
define([
'jquery',
'app/init',
'app/util'
], function($, Init, Util) {
'app/util',
'app/map/util'
], function($, Init, Util, MapUtil) {
'use strict';
@@ -84,7 +85,7 @@ define([
var trueSec = parseFloat(item.trueSec);
var secClass = Util.getSecurityClassForSystem(item.security);
var trueSecClass = Util.getTrueSecClassForSystem( trueSec );
var effectClass = Util.getEffectInfoForSystem(item.effect, 'class');
var effectClass = MapUtil.getEffectInfoForSystem(item.effect, 'class');
// check if system is dialed
if(

View File

@@ -6,8 +6,9 @@ define([
'jquery',
'app/init',
'app/util',
'app/render'
], function($, Init, Util, Render) {
'app/render',
'app/map/util'
], function($, Init, Util, Render, MapUtil) {
'use strict';
var config = {
@@ -210,8 +211,8 @@ define([
shatteredWormholeInfo = true;
}
var effectName = Util.getEffectInfoForSystem(systemData.effect, 'name');
var effectClass = Util.getEffectInfoForSystem(systemData.effect, 'class');
var effectName = MapUtil.getEffectInfoForSystem(systemData.effect, 'name');
var effectClass = MapUtil.getEffectInfoForSystem(systemData.effect, 'class');
// systemInfo template config
var moduleConfig = {
@@ -407,7 +408,7 @@ define([
wormholePrefixClass: config.systemInfoWormholeClass,
statusInfoClass: config.systemInfoStatusLabelClass,
systemTypeName: Util.getSystemTypeInfo(systemData.type.id, 'name'),
systemTypeName: MapUtil.getSystemTypeInfo(systemData.type.id, 'name'),
systemStatusId: systemData.status.id,
systemStatusClass: Util.getStatusInfoForSystem(systemData.status.id, 'class'),
systemStatusLabel: Util.getStatusInfoForSystem(systemData.status.id, 'label'),

View File

@@ -871,6 +871,38 @@ define([
return serverDate;
};
/**
* convert timestamp to server time
* @param timestamp
* @returns {Date}
*/
var convertTimestampToServerTime = function(timestamp){
var currentTimeZoneOffsetInMinutes = new Date().getTimezoneOffset();
return new Date( (timestamp + (currentTimeZoneOffsetInMinutes * 60)) * 1000);
};
/**
* get date difference as time parts (days, hours, minutes, seconds)
* @param date1
* @param date2
* @returns {{}}
*/
var getTimeDiffParts = function(date1, date2){
var parts = {};
var diff = (date2.getTime() - date1.getTime()) / 1000;
diff = Math.abs(Math.floor(diff));
parts.days = Math.floor(diff/(24*60*60));
var leftSec = diff - parts.days * 24*60*60;
parts.hours = Math.floor(leftSec/(60*60));
leftSec = leftSec - parts.hours * 60*60;
parts.min = Math.floor(leftSec/(60));
parts.sec = leftSec - parts.min * 60;
return parts;
};
/**
* start time measurement by a unique string identifier
* @param timerName
@@ -1003,203 +1035,6 @@ define([
return mapModule;
};
/**
* get all available map icons
* @returns {*}
*/
var getMapIcons = function(){
return Init.mapIcons;
};
/**
* get all available map Types
* optional they can be filtered by current access level of a user
* @param filterByUser
* @returns {Array}
*/
var getMapTypes = function(filterByUser){
var mapTypes = [];
$.each(Init.mapTypes, function(prop, data){
// skip "default" type -> just for 'add' icon
if(data.label.length > 0){
var tempData = data;
tempData.name = prop;
mapTypes.push(tempData);
}
});
if(filterByUser === true){
var corporationId = getCurrentUserInfo('corporationId');
var allianceId = getCurrentUserInfo('allianceId');
var authorizedMapTypes = [];
// check if character data exists
if(corporationId > 0) {
authorizedMapTypes.push('corporation');
}
if(allianceId > 0){
authorizedMapTypes.push('alliance');
}
// private maps are always allowed
authorizedMapTypes.push('private');
// compare "all" map types with "authorized" types
var tempMapTypes = [];
for(var i = 0; i < mapTypes.length; i++){
for(var j = 0; j < authorizedMapTypes.length; j++){
if(mapTypes[i].name === authorizedMapTypes[j]){
tempMapTypes.push(mapTypes[i]);
break;
}
}
}
mapTypes = tempMapTypes;
}
return mapTypes;
};
/**
* get map info
* @param mapType
* @param option
* @returns {string}
*/
var getInfoForMap = function(mapType, option){
var mapInfo = '';
if(Init.mapTypes.hasOwnProperty(mapType)){
mapInfo = Init.mapTypes[mapType][option];
}
return mapInfo;
};
/**
* get all available scopes for a map
* @returns {Array}
*/
var getMapScopes = function(){
var scopes = [];
$.each(Init.mapScopes, function(prop, data){
var tempData = data;
tempData.name = prop;
scopes.push(tempData);
});
return scopes;
};
/**
* get some scope info for a given info string
* @param info
* @param option
* @returns {string}
*/
var getScopeInfoForMap = function(info, option){
var scopeInfo = '';
if(Init.mapScopes.hasOwnProperty(info)){
scopeInfo = Init.mapScopes[info][option];
}
return scopeInfo;
};
/**
* get some scope info for a given info string
* @param info
* @param option
* @returns {string}
*/
var getScopeInfoForConnection = function(info, option){
var scopeInfo = '';
if(Init.connectionScopes.hasOwnProperty(info)){
switch(option){
case 'connectorDefinition':
// json data in DB
var temp = '{ "data": ' + Init.connectionScopes[info][option] + '}';
scopeInfo = $.parseJSON( temp).data;
break;
default:
scopeInfo = Init.connectionScopes[info][option];
break;
}
}
return scopeInfo;
};
/**
* get system type information
* @returns {Array}
*/
var getSystemTypeInfo = function(systemTypeId, option){
var systemTypeInfo = '';
$.each(Init.systemType, function(prop, data){
if(systemTypeId === data.id){
systemTypeInfo = data[option];
return;
}
});
return systemTypeInfo;
};
/**
* get some system info for a given info string (e.g. rally class)
* @param info
* @param option
* @returns {string}
*/
var getInfoForSystem = function(info, option){
var systemInfo = '';
if(Init.classes.systemInfo.hasOwnProperty(info)){
systemInfo = Init.classes.systemInfo[info][option];
}
return systemInfo;
};
/**
* get some info for a given effect string
* @param effect
* @param option
* @returns {string}
*/
var getEffectInfoForSystem = function(effect, option){
var effectInfo = '';
if( Init.classes.systemEffects.hasOwnProperty(effect) ){
effectInfo = Init.classes.systemEffects[effect][option];
}
return effectInfo;
};
/**
* get system effect data by system security and system class
* if no search parameters given -> get all effect data
@@ -1208,13 +1043,10 @@ define([
* @returns {boolean}
*/
var getSystemEffectData = function(security, effect){
var data = SystemEffect;
if(security){
// look for specific data
data = false;
var areaId = getAreaIdBySecurity(security);
if(
@@ -1414,22 +1246,6 @@ define([
return statusInfo;
};
/**
* get Connection Info by option
* @param connectionTyp
* @param option
* @returns {string}
*/
var getConnectionInfo = function(connectionTyp, option){
var connectionInfo = '';
if(Init.connectionTypes.hasOwnProperty(connectionTyp)){
connectionInfo = Init.connectionTypes[connectionTyp][option];
}
return connectionInfo;
};
/**
* get signature group information
* @param option
@@ -1543,7 +1359,7 @@ define([
* 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
* @param mapUserData
*/
var setCurrentMapUserData = function(mapUserData){
Init.currentMapUserData = mapUserData;
@@ -1707,7 +1523,6 @@ define([
* @param type
*/
var setDestination = function(systemData, type){
var description = '';
switch(type){
case 'set_destination':
@@ -1895,6 +1710,8 @@ define([
showVersionInfo: showVersionInfo,
getCurrentTriggerDelay: getCurrentTriggerDelay,
getServerTime: getServerTime,
convertTimestampToServerTime: convertTimestampToServerTime,
getTimeDiffParts: getTimeDiffParts,
timeStart: timeStart,
timeStop: timeStop,
log: log,
@@ -1902,15 +1719,6 @@ define([
getLogInfo: getLogInfo,
isXHRAborted: isXHRAborted,
getMapModule: getMapModule,
getMapIcons: getMapIcons,
getMapTypes: getMapTypes,
getInfoForMap: getInfoForMap,
getMapScopes: getMapScopes,
getScopeInfoForMap: getScopeInfoForMap,
getScopeInfoForConnection: getScopeInfoForConnection,
getSystemTypeInfo: getSystemTypeInfo,
getInfoForSystem: getInfoForSystem,
getEffectInfoForSystem: getEffectInfoForSystem,
getSystemEffectData: getSystemEffectData,
getSystemEffectTable: getSystemEffectTable,
getSystemsInfoTable: getSystemsInfoTable,
@@ -1918,7 +1726,6 @@ define([
getSecurityClassForSystem: getSecurityClassForSystem,
getTrueSecClassForSystem: getTrueSecClassForSystem,
getStatusInfoForSystem: getStatusInfoForSystem,
getConnectionInfo: getConnectionInfo,
getSignatureGroupInfo: getSignatureGroupInfo,
getAllSignatureNames: getAllSignatureNames,
getSignatureTypeIdByName: getSignatureTypeIdByName,

View File

@@ -481,7 +481,7 @@ $mapWidth: 2500px ;
padding: 1px 4px;
font-size: 11px;
z-index: 1020;
@include border-radius(8px);
@include border-radius(6px);
@include box-shadow(0 6px 12px rgba(0,0,0,.4));
}
@@ -492,7 +492,12 @@ $mapWidth: 2500px ;
.mass{
background-color: $red-darker;
color: #eaeaea;
color: $gray-lightest;
}
.eol{
background-color: $gray;
color: $pink-dark;
}
}