Pass the jsuri to hordemap, init the map early so at least the bootstrap
authorMichael J. Rubinsky <mrubinsk@horde.org>
Mon, 21 Jun 2010 21:24:32 +0000 (17:24 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Mon, 21 Jun 2010 21:25:29 +0000 (17:25 -0400)
file can be cached in the static js file.

kronolith/index.php
kronolith/lib/Kronolith.php

index 3d3f0ce..ed5cfe1 100644 (file)
@@ -122,17 +122,16 @@ Horde_Ajax_Imple::factory(
           'var' => 'KronolithCore.attendeesAc'))
     ->attach();
 
+if ($conf['maps']['driver']) {
+    Kronolith::initEventMap($conf['maps']);
+}
+
 Kronolith::header();
+
 echo "<body class=\"kronolithAjax\">\n";
+
 require KRONOLITH_TEMPLATES . '/index/index.inc';
 Horde::includeScriptFiles();
 Horde::outputInlineScript();
 
-/* Maps must be initialized after scripts are output, to avoid having them
- * included in the monolithic javascript file, which breaks loading the hordemap
- * dependencies. */
-if ($conf['maps']['driver']) {
-    Kronolith::initEventMap($conf['maps']);
-}
-
 echo "</body>\n</html>";
index d499c11..c6f2aab 100644 (file)
@@ -123,7 +123,8 @@ class Kronolith
                 'markerImage' => (string)Horde_Themes::img('map/marker.png', 'horde'),
                 'markerBackground' => (string)Horde_Themes::img('map/marker-shadow.png', 'horde'),
                 'useMarkerLayer' => true,
-                'language' => $language);
+                'language' => $language,
+            );
 
             foreach ($params['providers'] as $layer) {
                 switch ($layer) {
@@ -153,7 +154,7 @@ class Kronolith
                 break;
             }
         }
-
+        $params['jsuri'] = $GLOBALS['registry']->get('jsuri', 'horde') . '/hordemap/';
         Horde::addScriptFile('hordemap/map.js', 'horde');
         $js = 'HordeMap.initialize(' . Horde_Serialize::serialize($params, HORDE_SERIALIZE::JSON) . ');';
         Horde::addinlineScript($js);