9883: The family map for narrativeweb must work over https

This commit is contained in:
SNoiraud 2017-02-13 09:39:38 +01:00
parent 532928ef69
commit fe989d9ce3

View File

@ -150,6 +150,9 @@ SORT_KEY = glocale.sort_key
#------------------------------------------------
# constants
#------------------------------------------------
HTTP = "http://"
HTTPS = "https://"
GOOGLE_MAPS = 'https://maps.googleapis.com/maps/'
# javascript code for marker path
MARKER_PATH = """
@ -534,6 +537,10 @@ class BasePage:
lang = report.options['trans']
self.rlocale = report.set_locale(lang)
self._ = self.rlocale.translation.sgettext
if report.options['securesite']:
self.secure_mode = HTTPS
else:
self.secure_mode = HTTP
# Functions used when no Web Page plugin is provided
def add_instance(self, *param):
@ -2481,7 +2488,8 @@ class BasePage:
elif _type == UrlType.WEB_HOME:
if not (uri.startswith("http://") or
uri.startswith("https://")):
uri = "http://%(website)s" % {"website" : uri}
url = self.secure_mode
uri = url + "%(website)s" % {"website" : uri}
# FTP server address
elif _type == UrlType.WEB_FTP:
@ -4012,19 +4020,24 @@ class PlacePages(BasePage):
head += Html("script", type="text/javascript",
src=src_js, inline=True)
else:
url = "http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
url = self.secure_mode
url += "maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
head += Html("link", href=url, type="text/javascript",
rel="stylesheet")
src_js = "http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"
src_js = self.secure_mode
src_js += "ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"
head += Html("script", type="text/javascript",
src=src_js, inline=True)
src_js = "http://openlayers.org/en/v3.17.1/build/ol.js"
src_js = self.secure_mode
src_js += "openlayers.org/en/v3.17.1/build/ol.js"
head += Html("script", type="text/javascript",
src=src_js, inline=True)
url = "http://openlayers.org/en/v3.17.1/css/ol.css"
url = self.secure_mode
url += "openlayers.org/en/v3.17.1/css/ol.css"
head += Html("link", href=url, type="text/javascript",
rel="stylesheet")
src_js = "http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"
src_js = self.secure_mode
src_js += "maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"
head += Html("script", type="text/javascript",
src=src_js, inline=True)
@ -6600,19 +6613,24 @@ class PersonPages(BasePage):
head += Html("script", type="text/javascript",
src=src_js, inline=True)
else:
url = "http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
url = self.secure_mode
url += "maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
head += Html("link", href=url, type="text/javascript",
rel="stylesheet")
src_js = "http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"
src_js = self.secure_mode
src_js += "ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"
head += Html("script", type="text/javascript",
src=src_js, inline=True)
src_js = "http://openlayers.org/en/v3.17.1/build/ol.js"
src_js = self.secure_mode
src_js += "openlayers.org/en/v3.17.1/build/ol.js"
head += Html("script", type="text/javascript",
src=src_js, inline=True)
url = "http://openlayers.org/en/v3.17.1/css/ol.css"
url = self.secure_mode
url += "openlayers.org/en/v3.17.1/css/ol.css"
head += Html("link", href=url, type="text/javascript",
rel="stylesheet")
src_js = "http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"
src_js = self.secure_mode
src_js += "maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"
head += Html("script", type="text/javascript",
src=src_js, inline=True)
@ -8349,6 +8367,10 @@ class NavWebReport(Report):
self.bkref_dict = None
self.rel_class = None
self.tab = None
if self.options['securesite']:
self.secure_mode = HTTPS
else:
self.secure_mode = HTTP
def write_report(self):
"""
@ -9660,6 +9682,11 @@ class NavWebOptions(MenuReportOptions):
stdoptions.add_localization_option(menu, category_name)
self.__securesite = BooleanOption(_("This is a secure site (https)"),
False)
self.__securesite.set_help(_('Whether to use http:// or https://'))
addopt("securesite", self.__securesite)
def __add_report_options_2(self, menu):
"""
Continue Options on the "Report Options" tab.