MidCOM svn: r16446 - in trunk/midcom/org.routamc.positioning: . config

rambo midcom-commits at lists.midgard-project.org
Fri May 23 12:13:34 CEST 2008


Author: rambo
Date: Fri May 23 12:13:34 2008
New Revision: 16446
URL: http://trac.midgard-project.org/software/changeset/16446

Log:
forward port r16445

Modified:
   trunk/midcom/org.routamc.positioning/config/config.inc
   trunk/midcom/org.routamc.positioning/map.php

Modified: trunk/midcom/org.routamc.positioning/config/config.inc
==============================================================================
--- trunk/midcom/org.routamc.positioning/config/config.inc	(original)
+++ trunk/midcom/org.routamc.positioning/config/config.inc	Fri May 23 12:13:34 2008
@@ -7,6 +7,30 @@
 'smslib_password' => null,
 'smslib_from' => null,
 
+/** 
+ * array of arguments acceptable for call_user_func() to be called just before map is shown
+ *
+ * The callback is passed single argument, an array with first key being reference to the map object
+ * (we cannot use direct referencing with call_user_func)
+ *
+ * Example function:
+ * function add_place_x($args)
+ * {
+ *     $map =& $args[0];
+ *     if (strpos($map->id, 'chooser_widget_map'))
+ *     {
+ *         // Don't add to DM2 location widget map
+ *         return;
+ *     }
+ *     $marker = array
+ *     (
+ *         ...
+ *     );
+ *     $map->add_marker($marker);
+ * }
+ */
+'map_onshow_callbacks' => null, 
+
 'plazes_developer_key' => '4c637b4469bc11d13e73aa18a55ff6e6',
 
 // By default we use OpenLayers with OpenStreetMap as this doesn't require API key

Modified: trunk/midcom/org.routamc.positioning/map.php
==============================================================================
--- trunk/midcom/org.routamc.positioning/map.php	(original)
+++ trunk/midcom/org.routamc.positioning/map.php	Fri May 23 12:13:34 2008
@@ -228,6 +228,17 @@
      */
     function show($width = 300, $height = 200, $zoom_level = null, $echo_output = true)
     {
+        $callbacks = $this->_config->get('map_onshow_callbacks');
+        if (is_array($callbacks))
+        {
+            $callback_args = array(&$this);
+            foreach ($callbacks as $callback)
+            {
+                call_user_func($callback, $callback_args);
+            }
+            unset($callback, $callback_args);
+        }
+        unset($callbacks);
         $html = '';
         $script = '';
                 


More information about the midcom-commits mailing list