[fusion-commits] r3041 - in sandbox/cms_refactor: lib templates/mapguide
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Mon Jul 30 09:49:54 PDT 2018
Author: jng
Date: 2018-07-30 09:49:54 -0700 (Mon, 30 Jul 2018)
New Revision: 3041
Modified:
sandbox/cms_refactor/lib/fusion.js
sandbox/cms_refactor/templates/mapguide/index.php
Log:
Emit the Google maps script from the server-side PHP entry point, not from fusion init (as modern browser flag that approach as unsafe)
Modified: sandbox/cms_refactor/lib/fusion.js
===================================================================
--- sandbox/cms_refactor/lib/fusion.js 2018-07-30 15:46:51 UTC (rev 3040)
+++ sandbox/cms_refactor/lib/fusion.js 2018-07-30 16:49:54 UTC (rev 3041)
@@ -415,9 +415,6 @@
var appDefXML = xhr.responseXML.documentElement;
if (appDefXML) {
- var googleElement = appDefXML.getElementsByTagName("GoogleScript")[0];
- addElement(googleElement);
-
var bingMapKeyElement = appDefXML.getElementsByTagName("BingMapKey")[0];
if (bingMapKeyElement) {
var bingMapKey = bingMapKeyElement.textContent;
Modified: sandbox/cms_refactor/templates/mapguide/index.php
===================================================================
--- sandbox/cms_refactor/templates/mapguide/index.php 2018-07-30 15:46:51 UTC (rev 3040)
+++ sandbox/cms_refactor/templates/mapguide/index.php 2018-07-30 16:49:54 UTC (rev 3041)
@@ -46,6 +46,8 @@
$document = new DOMDocument();
$document->loadXML($content->ToString());
+ $goog = $document->getElementsByTagName("GoogleScript");
+
$root = $document->documentElement;
$json = '{"' . $root->tagName . '":' . xml2json($root) . '}';
@@ -59,7 +61,11 @@
$content = str_replace("%__LIB_BASE__%", "../../lib", $content);
$content = str_replace("%__TEMPLATE_BASE__%", "$templateName", $content);
$content = str_replace("%__FUSION_SCRIPT__%", $scriptName, $content);
- $content = str_replace("%__SCRIPTS__%", "<!-- TODO: Inject Google Maps script if required -->", $content);
+ if ($goog->length == 1) {
+ $content = str_replace("%__SCRIPTS__%", '<script type="text/javascript" src="'.$goog->item(0)->textContent.'"></script>', $content);
+ } else { //Nothing to inject
+ $content = str_replace("%__SCRIPTS__%", "", $content);
+ }
$content = str_replace("%__APPDEF_JSON__%", $json, $content);
header("Content-Type: text/html");
More information about the fusion-commits
mailing list