Merge pull request #43 from exodus4d/develop

v0.0.12
This commit is contained in:
Exodus 4D
2015-10-06 19:43:13 +02:00
50 changed files with 1237 additions and 105 deletions

View File

@@ -332,7 +332,7 @@ class Map extends \Controller\AccessController {
$responseTTL = $f3->get('PATHFINDER.TIMER.UPDATE_SERVER_MAP.DELAY') / 1000;
$mapData = (array)$f3->get('POST.mapData');
$user = $this->_getUser();
$user = $this->_getUser(0);
$return = (object) [];
$return->error = [];
@@ -342,12 +342,11 @@ class Map extends \Controller\AccessController {
$cacheKey = 'user_map_data_' . $activeCharacter->id;
// if there is any system/connection change data submitted -> clear cache
if(!empty($mapData)){
$f3->clear($cacheKey);
}
if($f3->exists($cacheKey) === false ){
// if there is any system/connection change data submitted -> save new data
if(
$f3->exists($cacheKey) === false ||
!empty($mapData)
){
// get current map data ========================================================
$maps = $user->getMaps();
@@ -377,7 +376,6 @@ class Map extends \Controller\AccessController {
// map changes expected =============================================
// loop current user maps and check for changes
foreach($maps as $map){
@@ -443,10 +441,7 @@ class Map extends \Controller\AccessController {
// format map Data for return
$return->mapData = self::getFormattedMapData($maps);
if(count($return->mapData) > 0){
$f3->set($cacheKey, $return, $responseTTL);
}
$f3->set($cacheKey, $return, $responseTTL);
}else{
// get from cache
$return = $f3->get($cacheKey);
@@ -500,7 +495,7 @@ class Map extends \Controller\AccessController {
$return = (object) [];
$return->error = [];
$user = $this->_getUser();
$user = $this->_getUser(0);
if($user){

View File

@@ -273,21 +273,34 @@ class Controller {
}
if($f3->get('AJAX')){
// error on ajax call
header('Content-type: application/json');
// error on ajax call
$errorData = [
'status' => $f3->get('ERROR.status'),
'code' => $f3->get('ERROR.code'),
'text' => $f3->get('ERROR.text')
];
$return = (object) [];
$error = (object) [];
$error->type = 'error';
$error->code = $f3->get('ERROR.code');
$error->status = $f3->get('ERROR.status');
$error->message = $f3->get('ERROR.text');
// append stack trace for greater debug level
if( $f3->get('DEBUG') === 3){
$errorData['trace'] = $f3->get('ERROR.trace');
$error->trace = $f3->get('ERROR.trace');
}
echo json_encode($errorData);
// check if error is a PDO Exception
if(strpos(strtolower( $f3->get('ERROR.text') ), 'duplicate') !== false){
preg_match_all('/\'([^\']+)\'/', $f3->get('ERROR.text'), $matches, PREG_SET_ORDER);
if(count($matches) === 2){
$error->field = $matches[1][1];
$error->message = 'Value "' . $matches[0][1] . '" already exists';
}
}
$return->error[] = $error;
echo json_encode($return);
}else{
echo $f3->get('ERROR.text');
}

View File

@@ -157,7 +157,7 @@ class UserModel extends BasicModel {
* @return array|FALSE
*/
public function getByName($name){
return $this->getByForeignKey('name', $name);
return $this->getByForeignKey('name', $name, [], 0);
}
/**
@@ -281,10 +281,11 @@ class UserModel extends BasicModel {
$userCharacter->save();
}
// set random main character
if(! $mainSet ){
$userCharacters[0]->setMain(1);
$userCharacters[0]->save();
// set first character as "main"
if( !$mainSet ){
$userCharacter = reset($userCharacters);
$userCharacter->setMain(1);
$userCharacter->save();
}
}
}
@@ -299,6 +300,8 @@ class UserModel extends BasicModel {
$this->filter('apis', ['active = ?', 1]);
// if a user has multiple API keys saved for ONE character,
// skip double characters!
$userCharacters = [];
if($this->apis){
@@ -306,14 +309,18 @@ class UserModel extends BasicModel {
while($this->apis->valid()){
$this->apis->current()->filter('userCharacters', ['active = ?', 1]);
if($this->apis->current()->userCharacters){
$this->apis->current()->userCharacters->rewind();
while($this->apis->current()->userCharacters->valid()){
$userCharacters[] = $this->apis->current()->userCharacters->current();
$tempCharacterId = $this->apis->current()->userCharacters->current()->characterId->get('id');
if( !isset($userCharacters[ $tempCharacterId ]) ){
$userCharacters[ $tempCharacterId ] = $this->apis->current()->userCharacters->current();
}
$this->apis->current()->userCharacters->next();
}
}
$this->apis->next();
}
}
@@ -347,17 +354,17 @@ class UserModel extends BasicModel {
public function getActiveUserCharacter(){
$activeUserCharacter = null;
$apiController = Controller\CcpApiController::getIGBHeaderData();
$headerData = Controller\CcpApiController::getIGBHeaderData();
// check if IGB Data is available
if( !empty($apiController->values) ){
if( !empty($headerData->values) ){
// search for the active character by IGB Header Data
$this->filter('userCharacters',
[
'active = :active AND characterId = :characterId',
':active' => 1,
':characterId' => intval($apiController->values['charid'])
':characterId' => intval($headerData->values['charid'])
],
['limit' => 1]
);

View File

@@ -1,7 +1,7 @@
[PATHFINDER]
NAME = "PATHFINDER"
; installed version (used for CSS/JS cache busting)
VERSION = "v0.0.11"
VERSION = "v0.0.12"
; contact information (DO NOT CHANGE)
CONTACT = "https://github.com/exodus4d"
; source code (DO NOT CHANGE)
@@ -92,7 +92,7 @@ STATUS = 1
MSG_DISABLED = "User registration is currently not allowed"
; use the invite system e.g. beta testing. A "registration key" is required (0=disabled, 1=enabled)
INVITE = 1
INVITE = 0
; the limit of registration keys. Increase it to hand out more keys
INVITE_LIMIT = 50
@@ -119,7 +119,7 @@ CONSTELLATION_SYSTEMS = 2592000
; ======================================================================================================
[PATHFINDER.TIMER]
; login time (minutes)
LOGGED = 120
LOGGED = 240
; double click timer (ms)
DBL_CLICK = 250

View File

@@ -162,7 +162,6 @@ gulp.task('watch', function(tag) {
/**
* Production task for deployment.
* Triggered by Maven Plugin.
* $ gulp production --tag v0.0.9
* WARNING: DO NOT REMOVE THIS TASK!!!
*/

View File

@@ -1130,6 +1130,7 @@ define([
mode: 'popup',
type: 'text',
name: 'alias',
emptytext: system.data('name'),
title: 'System alias',
placement: 'top',
onblur: 'submit',

View File

@@ -127,6 +127,9 @@ define([
$(document).setProgramStatus('online');
if(data.mapData.length === 0){
// clear all existing maps
mapModule.clearMapModule();
// no map data available -> show "new map" dialog
$(document).trigger('pf:menuShowMapSettings', {tab: 'new'});
}else{

View File

@@ -502,6 +502,29 @@ define([
return deletedTabName;
};
/**
* clear all active maps
*/
$.fn.clearMapModule = function(){
var mapModuleElement = $(this);
var tabMapElement = $('#' + config.mapTabElementId);
if(tabMapElement.length > 0){
var tabElements = mapModuleElement.getMapTabElements();
for(var i = 0; i < tabElements.length; i++){
var tabElement = $(tabElements[i]);
var mapId = tabElement.data('map-id');
if(mapId > 0){
tabMapElement.deleteTab(mapId);
}
}
}
};
/**
* load/update map module into element (all maps)
* @param mapData

View File

@@ -309,24 +309,11 @@ define([
if(jqXHR.responseText){
var errorObj = $.parseJSON(jqXHR.responseText);
if(errorObj.text !== undefined){
// DB error
if(errorObj.text.match('Duplicate')){
// duplicate DB key
var fieldName = 'name';
if(errorObj.text.match( fieldName )){
// name exist
form.showFormMessage([{type: 'error', message: 'Username already exists', field: fieldName}]);
}
fieldName = 'email';
if(errorObj.text.match( fieldName )){
// email exist
form.showFormMessage([{type: 'error', message: 'Email already exists', field: fieldName}]);
}
}
if(
errorObj.error &&
errorObj.error.length > 0
){
form.showFormMessage(errorObj.error);
}
}
}

View File

@@ -31,12 +31,12 @@ define([
}
var markup = '<div class="clearfix">';
markup += '<div class="col-sm-6 pf-select-item-anchor">' + data.text + '</div>';
markup += '<div class="col-sm-5 pf-select-item-anchor">' + data.text + '</div>';
markup += '<div class="col-sm-2 text-right ' + data.effectClass + '">';
markup += '<i class="fa fa-fw fa-square ' + hideEffectClass + '"></i>';
markup += '</div>';
markup += '<div class="col-sm-2 text-right ' + data.secClass + '">' + data.security + '</div>';
markup += '<div class="col-sm-2 text-right ' + data.trueSecClass + '">' + data.trueSec + '</div></div>';
markup += '<div class="col-sm-3 text-right ' + data.trueSecClass + '">' + data.trueSec + '</div></div>';
return markup;
}

1094
pathfinder.sql Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -224,10 +224,10 @@
<blockquote>
<p>
API Key(s) are required to use <em class="pf-brand">pathfinder</em>.
Don't have one? - Create a new key with the lowest access level possible.
Don't have one? - Create a new key with an empty 'Access Mask'.
</p>
<small>Get your new/custom API Key from
<a href="https://support.eveonline.com/api" target="_blank">here</a>
<a href="https://community.eveonline.com/support/api-key/" target="_blank">here</a>
and come back to this page.
</small>
</blockquote>
@@ -270,6 +270,11 @@
</div>
{{/userData.api}}
<div class="{{formErrorContainerClass}} alert alert-danger" style="display: none;">
<span class="txt-color txt-color-danger">Error</span>
<small> (important non-critical information)</small>
</div>
<div class="{{formWarningContainerClass}} alert alert-warning" style="display: none;">
<span class="txt-color txt-color-warning">Warning</span>
<small> (important non-critical information)</small>
@@ -291,12 +296,8 @@
</form>
</div>
</div>
</div>
</div>

View File

@@ -1,8 +1,12 @@
{{#system.alias}}
<h5 class="pull-right" data-toggle="tooltip" data-placement="top" data-container="body" title="alias">
{{system.alias}}
{{#system.alias}}
{{system.alias}}
{{/system.alias}}
{{^system.alias}}
{{system.name}}
{{/system.alias}}
</h5>
{{/system.alias}}
<h5 style="display: inline-block">

View File

@@ -132,7 +132,7 @@
<div class="row text-center">
<div class="col-sm-6 col-sm-offset-3">
<div class="col-sm-4 col-sm-offset-2" data-placement="left" title="{{@registrationStatusTitle}}">
<button type="button" class="pf-register-button btn-block btn btn-primary {{@registrationStatusButton}}" tabindex="4"><i class="fa fa-fw fa-user-plus"></i> Sign up</button>
<button type="button" class="pf-register-button btn-block btn btn-primary {{@registrationStatusButton}}" tabindex="-1"><i class="fa fa-fw fa-user-plus"></i> Sign up</button>
</div>
<div class="col-sm-4">
<button type="submit" class="pf-login-button btn-block btn btn-success" tabindex="3"><i class="fa fa-fw fa-sign-in"></i> Log in</button>

View File

@@ -95,12 +95,12 @@
}
// show add button only on last row
.pf-dialog-api-row:not(:nth-last-child(2)) .pf-dialog-clone-button{
.pf-dialog-api-row:not(:nth-last-child(3)) .pf-dialog-clone-button{
display: none;
}
// hide delete button if there is just a single api row
.pf-dialog-api-row:nth-child(2):nth-last-child(2) .pf-dialog-delete-button{
.pf-dialog-api-row:nth-child(2):nth-last-child(3) .pf-dialog-delete-button{
display: none;
}

View File

@@ -202,6 +202,11 @@ $mapWidth: 2500px ;
color: $gray-light;
display: none; // triggered by JS
}
// overwrites "xEditable" style for empty values
.editable-empty{
font-style: normal;
}
}
// ========================================================================

View File

@@ -65,7 +65,7 @@ label.checkbox.inline .toggle {
border-width: 0 1px;
}
.toggle-handle.btn-mini {
top: -1px;
top: -2px;
}
.toggle.btn { min-width: 30px; }
.toggle-on.btn { padding-right: 24px; }