From 11c69d414cda52f14041595c4553f78b393457ed Mon Sep 17 00:00:00 2001 From: Serghei MIHAI Date: Tue, 21 Oct 2014 16:36:18 +0200 Subject: [PATCH 1/3] tiles url can be specified in SP params Closes #5579 --- usr/local/univnautes/sp/sp/pfconfigxml.py | 7 +++++++ usr/local/univnautes/sp/sp/views.py | 5 ++++- usr/local/www/services_captiveportal_saml_sp.php | 10 +++++++++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/usr/local/univnautes/sp/sp/pfconfigxml.py b/usr/local/univnautes/sp/sp/pfconfigxml.py index 498b7aa..ff1b0b2 100644 --- a/usr/local/univnautes/sp/sp/pfconfigxml.py +++ b/usr/local/univnautes/sp/sp/pfconfigxml.py @@ -113,6 +113,13 @@ def get_saml_cps(): cps.sort(cps, key=itemgetter('name')) return cps +def get_tilesurl(): + sp = root().find('univnautes/sp') + tilesurl = sp.find('tilesurl') + if tilesurl is not None: + tilesurl = tilesurl.text + return tilesurl + def get_sp(): sp = root().find('univnautes/sp') if sp is None: diff --git a/usr/local/univnautes/sp/sp/views.py b/usr/local/univnautes/sp/sp/views.py index 1f21fa0..51c0949 100644 --- a/usr/local/univnautes/sp/sp/views.py +++ b/usr/local/univnautes/sp/sp/views.py @@ -24,6 +24,8 @@ from django.http import HttpResponse from django.shortcuts import redirect import subprocess +from .pfconfigxml import get_tilesurl + class Homepage(TemplateView): '''Homepage View, displays a welcome message''' @@ -32,7 +34,8 @@ homepage = login_required(Homepage.as_view()) def proxymap(request, z, x, y): - url = settings.PROXYMAP_URL % { 'z': int(z), 'x': int(x), 'y': int(y) } + tiles_url = get_tilesurl() or settings.PROXYMAP_URL + url = tiles_url % { 'z': int(z), 'x': int(x), 'y': int(y) } downstream_request = urllib2.Request(url) page = urllib2.urlopen(downstream_request) return HttpResponse(page, page.info().getheader('Content-Type')) diff --git a/usr/local/www/services_captiveportal_saml_sp.php b/usr/local/www/services_captiveportal_saml_sp.php index 8537e53..30b6874 100755 --- a/usr/local/www/services_captiveportal_saml_sp.php +++ b/usr/local/www/services_captiveportal_saml_sp.php @@ -63,6 +63,7 @@ $pconfig['certref'] = $a_sp['certref']; $pconfig['defaultidps'] = base64_decode($a_sp['defaultidps']); $pconfig['geolocations'] = base64_decode($a_sp['geolocations']); $pconfig['geoinitialbounds'] = $a_sp['geoinitialbounds']; +$pconfig['tilesurl'] = $a_sp['tilesurl']; $pgtitle = array(gettext("Services"),gettext("Captive portal"), "SAML 2.0 Service provider"); $shortcut_section = "captiveportal"; @@ -89,6 +90,7 @@ if ($_POST) { $a_sp['defaultidps'] = base64_encode($pconfig['defaultidps']); $a_sp['geolocations'] = base64_encode($pconfig['geolocations']); $a_sp['geoinitialbounds'] = $pconfig['geoinitialbounds']; + $a_sp['tilesurl'] = $pconfig['tilesurl']; /* write config.xml */ write_config(); @@ -189,7 +191,13 @@ include("head.inc"); - + + + +
+ : http://maps.yourdomain.org//map/%(z)d/%(x)d/%(y)d.png + +   -- 2.1.1