* #84 test data dump from CREST login * updated "credits" dialog (Google+ link) fixed login form layout * updated Cortex Data-Mapper * - #84 CREST Login (WIP) - New CREST controller - Database restructuring - improved type-casting for some controller functions - New login process - Fixed some bugs during the setup process (/setup root) - Added CREST request caching by response headers * pathfinder-84 [Feature Request] CREST Pilot Tracking, many smaller Bugfixes * pathfinder-84 [Feature Request] added develop JS files * closed #121 fixed wormhole signature type caching * closed #120 removed map-loading animation for larger maps (same behaviour as IGB) * closed #119 fixed wormhole signature id count * closed #114 Added check for already existing system when adding a new one. (fixed PDO 'duplicate entry' error) * closed #112 fixed DataTables error for missing "status" data (signature table) * closed #111 fixed convertDataToUTC(); client side date transformation * closed #109 fixed system TrueSec rounding * closed #103 fixed system updated timestamp in getData() * fixed CSS class for secStatus in Routes module * closed #121 fixed wormhole signature type caching * changed dateTime format from German to US format fixed some minor bugs in signatureTable module * closed #81 fixed "signature type" overwriting by "signature reader" update * closed #106 added new signature_types form C5/6 wormholes (gas/ore) * closed #129 fixed parameter hinting * closed #131 new "route search" algorithm, added current map systems to live search, added refresh/update functionality for each found route, added bulk route refresh function, added "meta map" route search (search on multiple maps), added route "filters" (restrict search on "stargates", "wormholes", "jumpbridges"), added route "filter" for wormholes (reduced/critical wormholes) closed #89 fixed "loop connections" on same system #84 added error messages for "invalid" CREST "Client ID" added "bootboxjs" (customized styled checkboxes/radio buttons) CSS only "Font Awesome" version upgrade 4.4.0 -> 4.61 "Bootbox.js" version upgrade 4.3.0 -> 4.4.0 fixed "system dialog" (added responsive layout) * closed #134 fixed db column type DT_INT (8 bytes) to DT_BIGINT * closed #138 added new cookie based login * closed #137 fixed javascript errors on trying to establish an "invalid" connection * - #84, #138 improved "character selection" on login page (expired cookies are deleted, character panel layout improvements) - added new "Server info panel" to the login page - added new cronjob to delete expired cookie authentication data * #138 enables character switching between characters which have same user * - PHP Framework upgrade 3.5.0 -> 3.5.1 (fixes some issues with CREST cURL caching, and SESSION management) - #138 added "cookie logout" to "logout" menu entry * - updated "feature page" with new feature descriptions and label - added some new images to the "feature gallery" - removed "beta" status from "magnetizing" feature on map menu - hide "server status" panel on "mobile" breakpoint * - #138 clear character authentication data on sold characters * closed #142 added custom "onsuspect()" session handler * #142 do not log suspect if no file is defined in pathfinder.ini * #142 added NullSec Data/Relic sites to C1/2/3 wormholes as signature option * #144 fixed "Character not found" warning * #144 fixed "Character not found" warning * closed #144 fixed broken routes panel in IGB * updated README.md for upcoming release * #147 response header validation * #149 changed comment for 'BASE' framework var * fixed map import * - added minimal SDE dump (EVE Online: Citadel) - #147 improved CREST API error logging (WIP) - improved SSO controller (removed access_token from public endpoints) * closed #154 added alliance maps to CREST API * - updated Gulp build dependencies - increased CREST timeout from 3s -> 4s - added "Accept" Headers for some CREST endpoints * cloased #147 * - closed #153 added character verification check for getAll(); Signatures Ajax endpoint * - updated README.md (added Slack developer chat information) * Bugfix frig holes (#159) * added missing frigate wormholes and fixed Q003 destination in shattered wormholes * changed C7 to 0.0 for Q003 * - fixed broken "graph" data for system * added a "failover" system for bad crest requests (HTTP status 5xx,.. ) * Red Gaint => Red Giant (#161) * closed #163 added CREST endpoint support for "waypoints" * fixed typo * closed #160 fixed tooltip container * - added new features to login page * closes #154 added alliance map support * fixed XML path for cronjobs * fixed a bug with inactive "private" maps * closes #175 added alternative environment configuration * - v1.0.0 build
869 lines
32 KiB
JavaScript
869 lines
32 KiB
JavaScript
/**
|
|
* map info dialog
|
|
*/
|
|
|
|
define([
|
|
'jquery',
|
|
'app/init',
|
|
'app/util',
|
|
'app/ccp',
|
|
'bootbox'
|
|
], function($, Init, Util, CCP, bootbox) {
|
|
|
|
'use strict';
|
|
|
|
var config = {
|
|
// global dialog
|
|
dialogNavigationClass: 'pf-dialog-navigation-list', // class for dialog navigation bar
|
|
|
|
// 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', // class for table "counter" cells
|
|
|
|
systemIdPrefix: 'pf-system-', // id prefix for a system
|
|
|
|
loadingOptions: { // config for loading overlay
|
|
icon: {
|
|
size: 'fa-2x'
|
|
}
|
|
}
|
|
};
|
|
|
|
// confirmation dialog settings (e.g. delete row)
|
|
var confirmationSettings = {
|
|
container: 'body',
|
|
placement: 'left',
|
|
btnCancelClass: 'btn btn-sm btn-default',
|
|
btnCancelLabel: 'cancel',
|
|
btnCancelIcon: 'fa fa-fw fa-ban',
|
|
btnOkClass: 'btn btn-sm btn-danger',
|
|
btnOkLabel: 'delete',
|
|
btnOkIcon: 'fa fa-fw fa-close'
|
|
};
|
|
|
|
/**
|
|
* loads the map info data into an element
|
|
* @param mapData
|
|
*/
|
|
$.fn.loadMapInfoData = function(mapData){
|
|
|
|
var mapElement = $(this);
|
|
|
|
mapElement.empty();
|
|
|
|
mapElement.showLoadingAnimation(config.loadingOptions);
|
|
|
|
var countSystems = mapData.data.systems.length;
|
|
var countConnections = mapData.data.connections.length;
|
|
|
|
// map type
|
|
var mapTypes = Util.getMapTypes();
|
|
var mapTypeName = '';
|
|
var mapTypeClass = '';
|
|
for(var i = 0; i < mapTypes.length; i++){
|
|
if(mapTypes[i].id === mapData.config.type.id){
|
|
mapTypeName = mapTypes[i].name;
|
|
mapTypeClass = mapTypes[i].class;
|
|
}
|
|
}
|
|
|
|
var dlElementLeft = $('<dl>', {
|
|
class: 'dl-horizontal',
|
|
css: {'float': 'left'}
|
|
}).append(
|
|
$('<dt>').text( 'Icon' )
|
|
).append(
|
|
$('<dd>').append(
|
|
$('<i>', {
|
|
class: ['fa', 'fa-fw', mapData.config.icon].join(' ')
|
|
})
|
|
)
|
|
).append(
|
|
$('<dt>').text( 'Name' )
|
|
).append(
|
|
$('<dd>').text( mapData.config.name )
|
|
).append(
|
|
$('<dt>').text( 'Type' )
|
|
).append(
|
|
$('<dd>', {
|
|
class: mapTypeClass
|
|
}).text( mapTypeName )
|
|
);
|
|
|
|
mapElement.append(dlElementLeft);
|
|
|
|
var dlElementRight = $('<dl>', {
|
|
class: 'dl-horizontal',
|
|
css: {'float': 'right'}
|
|
}).append(
|
|
$('<dt>').text( 'Lifetime' )
|
|
).append(
|
|
$('<dd>', {
|
|
class: config.mapInfoLifetimeCounterClass,
|
|
text: mapData.config.created
|
|
})
|
|
).append(
|
|
$('<dt>').text( 'Systems' )
|
|
).append(
|
|
$('<dd>').text( countSystems )
|
|
).append(
|
|
$('<dt>').text( 'Connections' )
|
|
).append(
|
|
$('<dd>').text( countConnections )
|
|
);
|
|
|
|
mapElement.append(dlElementRight);
|
|
|
|
// init map lifetime counter
|
|
$('.' + config.mapInfoLifetimeCounterClass).initTimestampCounter();
|
|
|
|
|
|
|
|
mapElement.hideLoadingAnimation();
|
|
|
|
};
|
|
|
|
/**
|
|
* loads the system info table into an element
|
|
* @param mapData
|
|
*/
|
|
$.fn.loadSystemInfoTable = function(mapData){
|
|
|
|
var systemsElement = $(this);
|
|
|
|
systemsElement.empty();
|
|
|
|
var systemTable = $('<table>', {
|
|
class: ['compact', 'stripe', 'order-column', 'row-border', config.mapInfoTableClass].join(' ')
|
|
});
|
|
systemsElement.append(systemTable);
|
|
|
|
systemsElement.showLoadingAnimation(config.loadingOptions);
|
|
|
|
// table init complete
|
|
systemTable.on( 'init.dt', function () {
|
|
systemsElement.hideLoadingAnimation();
|
|
|
|
// init table tooltips
|
|
var tooltipElements = systemsElement.find('[data-toggle="tooltip"]');
|
|
tooltipElements.tooltip();
|
|
});
|
|
|
|
// prepare data for dataTables
|
|
var systemsData = [];
|
|
for(var i = 0; i < mapData.data.systems.length; i++){
|
|
var tempSystemData = mapData.data.systems[i];
|
|
|
|
var tempData = {};
|
|
|
|
// system id
|
|
tempData.id = tempSystemData.id;
|
|
|
|
// current position
|
|
if(tempSystemData.currentUser === true){
|
|
tempData.position = {
|
|
position: '<i class="fa fa fa-map-marker fa-lg fa-fw"></i>',
|
|
position_sort: 1
|
|
};
|
|
}else{
|
|
tempData.position = {
|
|
position: '',
|
|
position_sort: 0
|
|
};
|
|
}
|
|
|
|
// active pilots
|
|
if(tempSystemData.userCount > 0){
|
|
tempData.userCount = tempSystemData.userCount;
|
|
}else{
|
|
tempData.userCount = '';
|
|
}
|
|
|
|
// type
|
|
tempData.type = {
|
|
type: Util.getSystemTypeInfo(tempSystemData.type.id, 'name'),
|
|
type_sort: tempSystemData.type.id
|
|
};
|
|
|
|
// security
|
|
var securityClass = Util.getSecurityClassForSystem(tempSystemData.security);
|
|
tempData.security = {
|
|
security: '<span class="' + securityClass + '">' + tempSystemData.security + '</span>',
|
|
security_sort: tempSystemData.security
|
|
};
|
|
|
|
// name
|
|
tempData.name = tempSystemData.name;
|
|
|
|
// region
|
|
tempData.region = tempSystemData.region.name;
|
|
|
|
// static
|
|
var statics = [];
|
|
for(var j = 0; j < tempSystemData.statics.length; j++){
|
|
var security = tempSystemData.statics[j].security;
|
|
var secClass = Util.getSecurityClassForSystem(security);
|
|
statics.push('<span class="' + secClass + '">' + security + '</span>');
|
|
}
|
|
tempData.static = statics.join(' ');
|
|
|
|
// status
|
|
var systemStatusClass = Util.getStatusInfoForSystem(tempSystemData.status.id, 'class');
|
|
if(systemStatusClass !== ''){
|
|
tempData.status = {
|
|
status: '<i class="fa fa fa-square-o fa-lg fa-fw ' + systemStatusClass + '"></i>',
|
|
status_sort: tempSystemData.status.id
|
|
};
|
|
}else{
|
|
tempData.status = {
|
|
status: '',
|
|
status_sort: tempSystemData.status.id
|
|
};
|
|
}
|
|
|
|
// effect
|
|
var systemEffectClass = Util.getEffectInfoForSystem(tempSystemData.effect, 'class');
|
|
if(systemEffectClass !== ''){
|
|
tempData.effect = {
|
|
effect: '<i class="fa fa fa-square fa-lg fa-fw ' + systemEffectClass + '"></i>',
|
|
effect_sort: tempSystemData.effect
|
|
};
|
|
}else{
|
|
tempData.effect = {
|
|
effect: '',
|
|
effect_sort: ''
|
|
};
|
|
}
|
|
|
|
// trueSec
|
|
var systemTrueSecClass = Util.getTrueSecClassForSystem(tempSystemData.trueSec);
|
|
if(systemTrueSecClass !== ''){
|
|
tempData.trueSec = {
|
|
trueSec: '<span class="' + systemTrueSecClass + '">' + tempSystemData.trueSec.toFixed(1) + '</span>',
|
|
trueSec_sort: tempSystemData.trueSec
|
|
};
|
|
}else{
|
|
tempData.trueSec = {
|
|
trueSec: '',
|
|
trueSec_sort: tempSystemData.trueSec
|
|
};
|
|
}
|
|
|
|
// locked
|
|
if(tempSystemData.locked === 1){
|
|
tempData.locked = {
|
|
locked: '<i class="fa fa-lock fa-lg fa-fw"></i>',
|
|
locked_sort: tempSystemData.locked
|
|
};
|
|
}else{
|
|
tempData.locked = {
|
|
locked: '',
|
|
locked_sort: 0
|
|
};
|
|
}
|
|
|
|
// updated
|
|
tempData.updated = tempSystemData.updated.updated;
|
|
|
|
// delete row
|
|
tempData.clear = '<i class="fa fa-close txt-color txt-color-redDarker"></i>';
|
|
|
|
systemsData.push(tempData);
|
|
}
|
|
|
|
var systemsDataTable = systemTable.dataTable( {
|
|
pageLength: 20,
|
|
paging: true,
|
|
lengthMenu: [[5, 10, 20, 50, -1], [5, 10, 20, 50, 'All']],
|
|
ordering: true,
|
|
order: [[ 9, 'desc' ], [ 3, 'asc' ]],
|
|
autoWidth: false,
|
|
responsive: {
|
|
breakpoints: [
|
|
{ name: 'desktop', width: Infinity },
|
|
{ name: 'tablet', width: 1200 },
|
|
{ name: 'fablet', width: 780 },
|
|
{ name: 'phone', width: 480 }
|
|
],
|
|
details: false
|
|
},
|
|
hover: false,
|
|
data: systemsData,
|
|
columnDefs: [],
|
|
language: {
|
|
emptyTable: 'Map is empty',
|
|
zeroRecords: 'No systems found',
|
|
lengthMenu: 'Show _MENU_ systems',
|
|
info: 'Showing _START_ to _END_ of _TOTAL_ systems'
|
|
},
|
|
columns: [
|
|
{
|
|
title: 'type',
|
|
width: '25px',
|
|
className: ['min-desktop'].join(' '),
|
|
data: 'type',
|
|
render: {
|
|
_: 'type',
|
|
sort: 'type_sort'
|
|
}
|
|
},{
|
|
title: '',
|
|
width: '1px',
|
|
searchable: false,
|
|
data: 'security',
|
|
render: {
|
|
_: 'security',
|
|
sort: 'security_sort'
|
|
}
|
|
},{
|
|
title: 'sec',
|
|
width: '18px',
|
|
className: ['text-center', 'min-desktop'].join(' '),
|
|
searchable: false,
|
|
data: 'trueSec',
|
|
render: {
|
|
_: 'trueSec',
|
|
sort: 'trueSec_sort'
|
|
}
|
|
},{
|
|
title: 'system',
|
|
data: 'name'
|
|
},{
|
|
title: 'region',
|
|
data: 'region'
|
|
},{
|
|
title: '<i class="fa fa-square-o fa-lg" title="system status" data-toggle="tooltip"></i>',
|
|
width: '12px',
|
|
searchable: false,
|
|
data: 'status',
|
|
render: {
|
|
_: 'status',
|
|
sort: 'status_sort'
|
|
}
|
|
},{
|
|
title: '<i class="fa fa-square fa-lg" title="system effect" data-toggle="tooltip"></i>',
|
|
width: '12px',
|
|
className: 'text-center',
|
|
searchable: false,
|
|
data: 'effect',
|
|
render: {
|
|
_: 'effect',
|
|
sort: 'effect_sort'
|
|
}
|
|
},{
|
|
title: 'static',
|
|
width: '30px',
|
|
data: 'static'
|
|
},{
|
|
title: '<i class="fa fa-map-marker fa-lg" title="your position" data-toggle="tooltip"></i>',
|
|
width: '8px',
|
|
searchable: false,
|
|
data: 'position',
|
|
render: {
|
|
_: 'position',
|
|
sort: 'position_sort'
|
|
}
|
|
},{
|
|
title: '<i class="fa fa-plane fa-lg" title="active pilots" data-toggle="tooltip"></i>',
|
|
width: '12px',
|
|
className: 'text-center',
|
|
searchable: false,
|
|
data: 'userCount'
|
|
},{
|
|
title: '<i class="fa fa-lock fa-lg" title="system locked" data-toggle="tooltip"></i>',
|
|
width: '10px',
|
|
searchable: false,
|
|
data: 'locked',
|
|
render: {
|
|
_: 'locked',
|
|
sort: 'locked_sort'
|
|
}
|
|
},{
|
|
title: 'updated',
|
|
width: '80px',
|
|
searchable: false,
|
|
className: ['text-right', config.tableCounterCellClass, 'min-desktop'].join(' '),
|
|
data: 'updated',
|
|
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
|
|
$(cell).initTimestampCounter();
|
|
|
|
// highlight cell
|
|
var diff = new Date().getTime() - cellData * 1000;
|
|
var dateDiff = new Date(diff);
|
|
if(dateDiff.getUTCDate() > 1){
|
|
$(cell).addClass('txt-color txt-color-warning');
|
|
}
|
|
}
|
|
},{
|
|
title: '',
|
|
orderable: false,
|
|
searchable: false,
|
|
width: '10px',
|
|
className: ['text-center', config.tableActionCellClass].join(' '),
|
|
data: 'clear',
|
|
createdCell: function(cell, cellData, rowData, rowIndex, colIndex) {
|
|
var tempTableElement = this;
|
|
|
|
var tempConfirmationSettings = confirmationSettings;
|
|
tempConfirmationSettings.title = 'Delete system';
|
|
tempConfirmationSettings.onConfirm = function(e, target){
|
|
var deleteRowElement = $(target).parents('tr');
|
|
|
|
var activeMap = Util.getMapModule().getActiveMap();
|
|
var systemElement = $('#' + config.systemIdPrefix + mapData.config.id + '-' + rowData.id);
|
|
|
|
if(systemElement){
|
|
// trigger system delete event
|
|
activeMap.trigger('pf:deleteSystems', [{
|
|
systems: [systemElement],
|
|
callback: function(){
|
|
// callback function after ajax "delete" success
|
|
// remove table row
|
|
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);
|
|
}
|
|
}]);
|
|
}
|
|
};
|
|
|
|
// init confirmation dialog
|
|
$(cell).confirmation(tempConfirmationSettings);
|
|
|
|
}
|
|
}
|
|
]
|
|
});
|
|
|
|
};
|
|
|
|
/**
|
|
* loads the connection info table into an element
|
|
* @param mapData
|
|
*/
|
|
$.fn.loadConnectionInfoTable = function(mapData){
|
|
var connectionsElement = $(this);
|
|
|
|
connectionsElement.empty();
|
|
|
|
var connectionTable = $('<table>', {
|
|
class: ['compact', 'stripe', 'order-column', 'row-border', config.mapInfoTableClass].join(' ')
|
|
});
|
|
connectionsElement.append(connectionTable);
|
|
|
|
connectionsElement.showLoadingAnimation(config.loadingOptions);
|
|
|
|
// table init complete
|
|
connectionTable.on( 'init.dt', function () {
|
|
connectionsElement.hideLoadingAnimation();
|
|
});
|
|
|
|
// connections table ==================================================
|
|
|
|
// prepare data for dataTables
|
|
var connectionData = [];
|
|
for(var j = 0; j < mapData.data.connections.length; j++){
|
|
var tempConnectionData = mapData.data.connections[j];
|
|
|
|
var tempConData = {};
|
|
|
|
tempConData.id = tempConnectionData.id;
|
|
|
|
tempConData.scope = {
|
|
scope: Util.getScopeInfoForConnection(tempConnectionData.scope, 'label'),
|
|
scope_sort: tempConnectionData.scope
|
|
};
|
|
|
|
// source system name
|
|
tempConData.source = tempConnectionData.sourceName;
|
|
|
|
// connection
|
|
var connectionClasses = [];
|
|
for(var k = 0; k < tempConnectionData.type.length; k++){
|
|
connectionClasses.push( Util.getConnectionInfo( tempConnectionData.type[k], 'cssClass') );
|
|
|
|
}
|
|
|
|
connectionClasses = connectionClasses.join(' ');
|
|
|
|
tempConData.connection = '<div class="pf-fake-connection ' + connectionClasses + '"></div>';
|
|
|
|
|
|
tempConData.target = tempConnectionData.targetName;
|
|
|
|
tempConData.updated = tempConnectionData.updated;
|
|
|
|
tempConData.clear = '<i class="fa fa-close txt-color txt-color-redDarker"></i>';
|
|
|
|
connectionData.push(tempConData);
|
|
}
|
|
|
|
var connectionDataTable = connectionTable.dataTable( {
|
|
pageLength: 20,
|
|
paging: true,
|
|
lengthMenu: [[5, 10, 20, 50, -1], [5, 10, 20, 50, 'All']],
|
|
ordering: true,
|
|
order: [ 0, 'desc' ],
|
|
autoWidth: false,
|
|
hover: false,
|
|
data: connectionData,
|
|
columnDefs: [],
|
|
language: {
|
|
emptyTable: 'No connections',
|
|
zeroRecords: 'No connections found',
|
|
lengthMenu: 'Show _MENU_ connections',
|
|
info: 'Showing _START_ to _END_ of _TOTAL_ connections'
|
|
},
|
|
columns: [
|
|
{
|
|
title: 'scope',
|
|
width: '50px',
|
|
orderable: true,
|
|
data: 'scope',
|
|
render: {
|
|
_: 'scope',
|
|
sort: 'scope_sort'
|
|
}
|
|
},{
|
|
title: 'source system',
|
|
data: 'source'
|
|
},{
|
|
title: 'connection',
|
|
width: '80px',
|
|
className: 'text-center',
|
|
orderable: false,
|
|
searchable: false,
|
|
data: 'connection'
|
|
}, {
|
|
title: 'target system',
|
|
data: 'target'
|
|
},{
|
|
title: 'updated',
|
|
width: '80px',
|
|
searchable: false,
|
|
className: ['text-right', config.tableCounterCellClass].join(' '),
|
|
data: 'updated',
|
|
createdCell: function(cell, cellData, rowData, rowIndex, colIndex){
|
|
$(cell).initTimestampCounter();
|
|
|
|
// highlight cell
|
|
var diff = new Date().getTime() - cellData * 1000;
|
|
var dateDiff = new Date(diff);
|
|
if(dateDiff.getUTCDate() > 1){
|
|
$(cell).addClass('txt-color txt-color-warning');
|
|
}
|
|
}
|
|
},{
|
|
title: '',
|
|
orderable: false,
|
|
searchable: false,
|
|
width: '10px',
|
|
className: ['text-center', config.tableActionCellClass].join(' '),
|
|
data: 'clear',
|
|
createdCell: function(cell, cellData, rowData, rowIndex, colIndex) {
|
|
var tempTableElement = this;
|
|
|
|
var tempConfirmationSettings = confirmationSettings;
|
|
tempConfirmationSettings.title = 'Delete connection';
|
|
tempConfirmationSettings.onConfirm = function(e, target){
|
|
var deleteRowElement = $(target).parents('tr');
|
|
|
|
// deleteSignatures(row);
|
|
var connection = $().getConnectionById(mapData.config.id, rowData.id);
|
|
|
|
$().deleteConnections([connection], function(){
|
|
// callback function after ajax "delete" success
|
|
// remove table row
|
|
tempTableElement.DataTable().rows(deleteRowElement).remove().draw();
|
|
});
|
|
};
|
|
|
|
// init confirmation dialog
|
|
$(cell).confirmation(tempConfirmationSettings);
|
|
}
|
|
}
|
|
]
|
|
});
|
|
};
|
|
|
|
$.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.typeId + '_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: 'station',
|
|
orderable: true,
|
|
searchable: true,
|
|
data: 'log.station',
|
|
render: {
|
|
_: 'name',
|
|
sort: 'name'
|
|
}
|
|
},{
|
|
targets: 8,
|
|
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: 9,
|
|
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
|
|
*/
|
|
$.fn.showMapInfoDialog = function(){
|
|
|
|
var activeMap = Util.getMapModule().getActiveMap();
|
|
var mapData = activeMap.getMapDataFromClient({forceData: true});
|
|
|
|
if(mapData !== false){
|
|
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,
|
|
mapInfoId: config.mapInfoId,
|
|
mapInfoSystemsId: config.mapInfoSystemsId,
|
|
mapInfoConnectionsId: config.mapInfoConnectionsId,
|
|
mapInfoUsersId: config.mapInfoUsersId
|
|
};
|
|
|
|
var content = Mustache.render(template, data);
|
|
|
|
var mapInfoDialog = bootbox.dialog({
|
|
title: 'Map information',
|
|
message: content,
|
|
size: 'large',
|
|
buttons: {
|
|
success: {
|
|
label: 'close',
|
|
className: 'btn-primary',
|
|
callback: function() {
|
|
$(mapInfoDialog).modal('hide');
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
mapInfoDialog.on('shown.bs.modal', function(e) {
|
|
// modal on open
|
|
|
|
var mapElement = $('#' + config.mapInfoId);
|
|
var systemsElement = $('#' + config.mapInfoSystemsId);
|
|
var connectionsElement = $('#' + config.mapInfoConnectionsId);
|
|
var usersElement = $('#' + config.mapInfoUsersId);
|
|
|
|
|
|
// 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});
|
|
|
|
mapElement.loadMapInfoData(mapData);
|
|
systemsElement.loadSystemInfoTable(mapData);
|
|
connectionsElement.loadConnectionInfoTable(mapData);
|
|
usersElement.loadUsersInfoTable(mapData);
|
|
}
|
|
});
|
|
|
|
// load map data
|
|
mapElement.loadMapInfoData(mapData);
|
|
|
|
// load system table
|
|
systemsElement.loadSystemInfoTable(mapData);
|
|
|
|
// load connection table
|
|
connectionsElement.loadConnectionInfoTable(mapData);
|
|
|
|
// load users table
|
|
usersElement.loadUsersInfoTable(mapData);
|
|
});
|
|
|
|
});
|
|
}
|
|
|
|
};
|
|
}); |