Index: views/nicemap.views.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/nicemap/views/nicemap.views.inc,v retrieving revision 1.1.2.3 diff -u -p -r1.1.2.3 nicemap.views.inc --- views/nicemap.views.inc 31 Mar 2009 19:55:13 -0000 1.1.2.3 +++ views/nicemap.views.inc 9 Apr 2009 21:23:36 -0000 @@ -1,5 +1,5 @@ t('Displays content on a WMS map.'), 'handler' => 'nicemap_views_plugin', 'theme' => 'views_view_nicemap_map', - 'theme file' => 'nicemap_views.theme.inc', 'theme path' => drupal_get_path('module', 'nicemap') .'/views', 'path' => drupal_get_path('module', 'nicemap') .'/views', 'uses fields' => TRUE, @@ -64,3 +63,53 @@ function nicemap_views_handlers() { ), ); } + +/** + * Theme preprocess for nicemap view style. + */ +function nicemap_preprocess_views_view_nicemap_map(&$vars) { + $view = $vars['view']; + $options = $view->style_plugin->options; + $points = $view->style_plugin->map_points($vars['rows']); + + $map = nicemap_cache(variable_get('nicemap_wms_url', '')); + + $map_options = array( + 'width' => $options['width'], + 'height' => $options['height'], + 'js' => TRUE, + 'show_list' => $options['show_list'] + ); + + $map_options['bgcolor'] = $options['bgcolor']; + + // This seems like it shouldn't need to be set before doing map process(), + // it should just be passed as an argument. Will need more looking. + $map->bounds = array( + 'miny' => $options['miny'], + 'maxy' => $options['maxy'], + 'minx' => $options['minx'], + 'maxx' => $options['maxx'], + ); + + if ($options['custom']) { + /* + * If you checked 'custom', we need to sort & determine + * enabled layers quickly here. Otherwise it'll be done by + * the nicemap_map object itself. + */ + $options['layers'] = array_filter($options['layers']); + asort($options['weights']); + foreach($options['weights'] as $l => $w) { + if (isset($options['layers'][$l])) { + $map_options['layers'][] = $l; + $map_options['styles'][] = $options['styles'][$l]; + } + } + } + + $vars['map'] = theme('nicemap_map', $points, + $map, + $map_options + ); +} Index: views/nicemap_views.theme.inc =================================================================== RCS file: views/nicemap_views.theme.inc diff -N views/nicemap_views.theme.inc --- views/nicemap_views.theme.inc 11 Feb 2009 18:49:15 -0000 1.1.2.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,57 +0,0 @@ -style_plugin->options; - $points = $view->style_plugin->map_points($vars['rows']); - - $map = nicemap_cache(variable_get('nicemap_wms_url', '')); - - $map_options = array( - 'width' => $options['width'], - 'height' => $options['height'], - 'js' => TRUE); - - $map_options['bgcolor'] = $options['bgcolor']; - - // This seems like it shouldn't need to be set before doing map process(), - // it should just be passed as an argument. Will need more looking. - $map->bounds = array( - 'miny' => $options['miny'], - 'maxy' => $options['maxy'], - 'minx' => $options['minx'], - 'maxx' => $options['maxx'], - ); - - if ($options['custom']) { - /* - * If you checked 'custom', we need to sort & determine - * enabled layers quickly here. Otherwise it'll be done by - * the nicemap_map object itself. - */ - $options['layers'] = array_filter($options['layers']); - asort($options['weights']); - foreach($options['weights'] as $l => $w) { - if (isset($options['layers'][$l])) { - $map_options['layers'][] = $l; - $map_options['styles'][] = $options['styles'][$l]; - } - } - } - - $vars['map'] = theme('nicemap_map', $points, - $map, - $map_options - ); -}