Commit 724428a3 authored by Bastien Zigmann's avatar Bastien Zigmann Committed by Vincent Dubois

Changement de l'affichage des severs pour que cela soit compréhensible par tout le monde

parent 6c19af58
......@@ -44,9 +44,10 @@ class Geocropping {
*/
/** index ofserver url interpreter used*/
_app_server_interpreter_index: number = 0;
_app_server_interpreter_index: string;
/** server url interpreter list*/
_app_server_interpreter_list: string[] = ["https://overpass-api.de/api/interpreter", "https://api.openstreetmap.fr/oapi/interpreter"];
_app_server_interpreter_list: IDictionary<string> = { Mondial:
"https://overpass-api.de/api/interpreter", Français: "https://api.openstreetmap.fr/oapi/interpreter"};
/** distance of the search (meter) */
_app_distance_search: number = 20;
......@@ -166,6 +167,7 @@ class Geocropping {
this._geoJSONLayers = L.geoJSON();
// vérifier si l'utilisateur est connecté et récuppérer ses informations
this.updateUserDetails();
this._app_server_interpreter_index = Object.keys(this._app_server_interpreter_list)[0];
/**
* Attach events
......@@ -916,10 +918,11 @@ class Geocropping {
error: function (jqXHR, textStatus, errorThrown) {
console.log(errorThrown);
this.notify.AutoServerChanged();
if (this._app_server_interpreter_index === this._app_server_interpreter_list.length - 1) {
this._app_server_interpreter_index = 0;
let keys = Object.keys(this._app_server_interpreter_list);
if (this._app_server_interpreter_index === keys[keys.length - 1]) {
this._app_server_interpreter_index = keys[0];
} else {
this._app_server_interpreter_index++;
this._app_server_interpreter_index = keys[keys.indexOf(this._app_server_interpreter_index) + 1];
}
$(this).trigger('urlInterpreterUpdated', [this._app_server_interpreter_index]);
}
......
......@@ -18,7 +18,7 @@ class OauthOsm {
get _useSession() { return true }
_baseUrl = "https://geocropping.xsalto.com/auth/";
_baseUrl = "";
_devApi = false;
......@@ -39,6 +39,8 @@ class OauthOsm {
// vérifier la connection
this.getUserDetails();
this._baseUrl = window.location.href + 'auth/';
}
......
......@@ -45,13 +45,14 @@ function openRightMenu(width?: number) {
let geocropping = new Geocropping();
$(document).ready(() => {
let $geocropping = $(geocropping)
geocropping._app_server_interpreter_list.forEach(element => {
$('#urlInterpreter').append(`<option value="${element}">${element}</option>`);
});
let $geocropping = $(geocropping);
for (var key in geocropping._app_server_interpreter_list) {
$('#urlInterpreter').append(`<option value="${key}">${key}</option>`);
}
$geocropping.on('urlInterpreterUpdated', (e, index) => {
$('#urlInterpreter').val(geocropping._app_server_interpreter_list[index]);
$('#urlInterpreter').val(index);
});
$('#userAction #login').click(() => {
......@@ -79,7 +80,7 @@ $(document).ready(() => {
}).prop("checked", geocropping._osm._devApi);
$('#menu #urlInterpreter').change(function (e) {
geocropping._app_server_interpreter_index = geocropping._app_server_interpreter_list.indexOf(this.value);
geocropping._app_server_interpreter_index = this.value;
geocropping.notify.ServerChanged();
});
......
......@@ -28,9 +28,9 @@ declare class Geocropping {
_map_minZoom: number;
_map_maxZoom: number;
/** index ofserver url interpreter used*/
_app_server_interpreter_index: number;
_app_server_interpreter_index: string;
/** server url interpreter list*/
_app_server_interpreter_list: string[];
_app_server_interpreter_list: IDictionary<string>;
/** distance of the search (meter) */
_app_distance_search: number;
/** distance to hide feature (meter) */
......
<?php
require_once ('OAuth.php');
require_once ('Array2XML.php');
require_once ('OsmConsumer.php');
class Geocropping
{
......@@ -15,14 +16,15 @@ class Geocropping
function __construct($type = 'PROD')
{
global $consumer;
if ($type === 'DEV') {
// DEV
$this->authUrl = 'https://master.apis.dev.openstreetmap.org';
$this->apiUrl = 'https://master.apis.dev.openstreetmap.org';
$this->oauth_consumer_key = 'iUOtp4VHumguYofpEF77sb0KemjNQj58KXP66hyz'; // récupéré sur osm
$this->oauth_secret = 'gIe6ExiFr7DR5XYy25ozPnFUaF92ZeuRyEYVeu9s'; // récupéré sur osm
$this->oauth_consumer_key = $consumer['DEV']['key']; // récupéré sur osm
$this->oauth_secret = $consumer['DEV']['secret']; // récupéré sur osm
}
elseif ($type === 'PROD') {
......@@ -30,8 +32,8 @@ class Geocropping
$this->authUrl = 'https://www.openstreetmap.org';
$this->apiUrl = 'https://www.openstreetmap.org';
$this->oauth_consumer_key = 'QGGYLkKz7Vt2yNgkWeE6adWNpDoBMYrUcFGwO217'; // récupéré sur osm
$this->oauth_secret = 'QhY0iqyTK7hLCRfF0ygbgOPPqteWh2pR10EeoYRA'; // récupéré sur osm
$this->oauth_consumer_key = $consumer['PROD']['key']; // récupéré sur osm
$this->oauth_secret = $consumer['PROD']['secret']; // récupéré sur osm
}
......
......@@ -23,13 +23,8 @@ var Geocropping = (function () {
*/
this._map_minZoom = 14;
this._map_maxZoom = 19;
/*
* APP SETTINGS
*/
/** index ofserver url interpreter used*/
this._app_server_interpreter_index = 0;
/** server url interpreter list*/
this._app_server_interpreter_list = ["https://overpass-api.de/api/interpreter", "https://api.openstreetmap.fr/oapi/interpreter"];
this._app_server_interpreter_list = { Mondial: "https://overpass-api.de/api/interpreter", Français: "https://api.openstreetmap.fr/oapi/interpreter" };
/** distance of the search (meter) */
this._app_distance_search = 20;
/** distance to hide feature (meter) */
......@@ -97,6 +92,7 @@ var Geocropping = (function () {
this._geoJSONLayers = L.geoJSON();
// vérifier si l'utilisateur est connecté et récuppérer ses informations
this.updateUserDetails();
this._app_server_interpreter_index = Object.keys(this._app_server_interpreter_list)[0];
/**
* Attach events
*/
......@@ -795,11 +791,12 @@ var Geocropping = (function () {
error: function (jqXHR, textStatus, errorThrown) {
console.log(errorThrown);
this.notify.AutoServerChanged();
if (this._app_server_interpreter_index === this._app_server_interpreter_list.length - 1) {
this._app_server_interpreter_index = 0;
var keys = Object.keys(this._app_server_interpreter_list);
if (this._app_server_interpreter_index === keys[keys.length - 1]) {
this._app_server_interpreter_index = keys[0];
}
else {
this._app_server_interpreter_index++;
this._app_server_interpreter_index = keys[keys.indexOf(this._app_server_interpreter_index) + 1];
}
$(this).trigger('urlInterpreterUpdated', [this._app_server_interpreter_index]);
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -8,7 +8,7 @@
*/
var OauthOsm = (function () {
function OauthOsm() {
this._baseUrl = "https://geocropping.xsalto.com/auth/";
this._baseUrl = "";
this._devApi = false;
this._storage_token_key_name = "OauthOsm-key";
this._storage_token_secret_name = "OauthOsm-secret";
......@@ -21,6 +21,7 @@ var OauthOsm = (function () {
this._loadToken();
// vérifier la connection
this.getUserDetails();
this._baseUrl = window.location.href + 'auth/';
}
Object.defineProperty(OauthOsm.prototype, "_useSession", {
get: function () { return true; },
......
This diff is collapsed.
......@@ -43,11 +43,11 @@ function openRightMenu(width) {
var geocropping = new Geocropping();
$(document).ready(function () {
var $geocropping = $(geocropping);
geocropping._app_server_interpreter_list.forEach(function (element) {
$('#urlInterpreter').append("<option value=\"" + element + "\">" + element + "</option>");
});
for (var key in geocropping._app_server_interpreter_list) {
$('#urlInterpreter').append("<option value=\"" + key + "\">" + key + "</option>");
}
$geocropping.on('urlInterpreterUpdated', function (e, index) {
$('#urlInterpreter').val(geocropping._app_server_interpreter_list[index]);
$('#urlInterpreter').val(index);
});
$('#userAction #login').click(function () {
geocropping.connect();
......@@ -71,7 +71,7 @@ $(document).ready(function () {
localSave('devMode', '' + val);
}).prop("checked", geocropping._osm._devApi);
$('#menu #urlInterpreter').change(function (e) {
geocropping._app_server_interpreter_index = geocropping._app_server_interpreter_list.indexOf(this.value);
geocropping._app_server_interpreter_index = this.value;
geocropping.notify.ServerChanged();
});
var userConnected = function () {
......
This diff is collapsed.
......@@ -19,7 +19,7 @@
"password": "ohmudohDo6",
//"port": "22",
"remote_path": "/var/www/restricted/ssh/devvdubois/www/OSM/geocropping/",
"remote_path": "/var/www/restricted/ssh/devvdubois/www/OSM/geocropping-dev/",
"ignore_regexes": [
"\\.sublime-(project|workspace)", "sftp-config(-alt\\d?)?\\.json",
"sftp-settings\\.json", "/venv/", "\\.svn/", "\\.hg/", "\\.git/",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment