Ignore:
Timestamp:
Oct 9, 2012, 9:33:42 PM (12 years ago)
Author:
rvelices
Message:

rv_gmaps:

  • removed earth icon from index pages
  • map icon text localized (for themes without icons)
  • minor javascript changes for maps api v3.9
  • code optimization
File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/rv_gmaps/trunk/map_data.php

    r17468 r18578  
    3131$where_sql = rvm_bounds_to_sql( $page['box'] );
    3232
    33 $img_fields = ' i.id,i.representative_ext,i.name,i.comment,i.path,i.lat,i.lon';
     33$img_fields = ' i.id,i.representative_ext,i.name,i.comment,i.file,i.path,i.lat,i.lon';
    3434
    3535$was_flat = @$page['flat'];
     
    7979$out='';
    8080function rvo($s) {
    81   global $out; $out.=$s;
     81  //global $out; $out.=$s;
     82        echo $s;
    8283}
    8384
    8485function rvf() {
    85   global $out; echo $out; $out='';
    86   ob_flush();
     86  //global $out; echo $out; $out=''; ob_flush();
    8787}
    8888
    8989$start_output = get_moment();
    9090
    91 rvo( '{' );
    9291
    93 rvo( "\ntitle:".jsgm_str( strip_tags(trigger_event('render_element_description', $page['title']) ) ) );
    94 rvo( ",\n" );
     92rvo( "{\ntitle:".jsgm_str( strip_tags(trigger_event('render_element_description', $page['title']) ) ) );
    9593
    96 rvo( "page_url:".jsgm_str( duplicate_index_url( array('start'=>0) ) ) );
    97 rvo( ",\n" );
     94rvo( ",\npage_url:".jsgm_str( duplicate_index_url( array('start'=>0) ) ) );
    9895
    99 rvo( "blowup_url:".jsgm_str( rvm_duplicate_blowup_url( array('start'=>0) ) ) );
    100 rvo( ",\n" );
     96rvo( ",\nblowup_url:".jsgm_str( rvm_duplicate_blowup_url( array('start'=>0) ) ) );
    10197
    102 rvo( "kml_url:".jsgm_str( rvm_duplicate_kml_index_url( array('start'=>0, 'flat'=>1) ) ) );
    103 rvo( ",\n" );
     98rvo( ",\nkml_url:".jsgm_str( rvm_duplicate_kml_index_url( array('start'=>0, 'flat'=>1) ) ) );
    10499
    105 rvo( "nb_items:".count($page['items']) );
    106 rvo( ",\n" );
     100rvo( ",\nnb_items:".count($page['items']) );
    107101
    108 rvo( "bounds:" );
     102rvo( ",\nbounds:" );
    109103if ( isset($cm) )
    110104  rvo( jsgm_bounds( $cm->bounds ) );
    111105else
    112106  rvo( "null" );
    113 rvo( ",\n" );
    114107
     108rvo( ",\n\nnb_clusters:".count($clusters) );
    115109
    116 rvo( "\nnb_clusters:".count($clusters) );
    117 rvo( "," );
    118 
    119 rvo( "\nimage_clusters:[\n" );
     110rvo( ",\nimage_clusters:[\n" );
    120111$i=0;
    121112$thumb_params = ImageStdParams::get_by_type(IMG_THUMB);
     113$page_url_model = duplicate_picture_url(
     114                array(
     115                        'image_id' => 123456789,
     116                        'image_file' => 'dummy_file.txt',
     117                        'flat' => 1,
     118                ),
     119                array('start')
     120        );
     121
    122122foreach( $clusters as $c )
    123123{
    124124  if ($i) rvo( ",\n\n" );
    125   rvo( "{" );
    126   rvo( 'position:'. jsgm_position( bounds_center($c->bounds) ) );
    127   rvo( ",\n" );
    128   rvo( 'bounds:'. jsgm_bounds( $c->bounds ) );
    129   rvo( ",\n" );
    130   rvo( 'nb_items:'.count($c->items) );
     125  rvo( '{position:'. jsgm_position( bounds_center($c->bounds) ) );
     126  rvo( ",\nbounds:". jsgm_bounds( $c->bounds ) );
     127  rvo( ",\nnb_items:".count($c->items) );
    131128  rvo( ",\n" );
    132129
    133130  rvo( 'blowup_url:"'.rvm_duplicate_blowup_url(array('box'=>$c->bounds), array('start') ). '"' );
    134   rvo( ",\n" );
    135131
    136132  $max_per_cluster = rvm_get_config_var('nb_images_per_marker',20);
     
    139135    $c->items = array_slice($c->items, 0, $max_per_cluster);
    140136  }
    141   rvo( 'items:[' );
     137  rvo( ",\nitems:[" );
    142138  for ($j=0; $j<count($c->items); $j++)
    143139  {
    144140    $img = $page['items'] [ $c->items[$j] ];
    145     $img['file'] = basename( $img['path'] );
    146141
    147     $params = array(
    148         'image_id' => $img['id'],
    149         'image_file' => $img['file'],
    150         'flat' => 1,
    151       );
    152     $page_url = duplicate_picture_url($params, array('start') );
     142                $page_url = str_replace(array('123456789','dummy_file'), array($img['id'], get_filename_wo_extension($img['file'])), $page_url_model);
    153143
    154144    if ($j) rvo( "," );
    155     rvo( "{" );
    156     rvo( "tn:".jsgm_str( DerivativeImage::url( $thumb_params,$img ) ) );
     145    rvo( "{tn:".jsgm_str( DerivativeImage::url( $thumb_params,$img ) ) );
    157146    rvo( ",name:".jsgm_str( render_element_name($img) ) );
    158147    rvo( ",comment:".jsgm_str( render_element_description($img) ) );
     
    160149    rvo( "}" );
    161150  }
    162   rvo( ']' );
    163   rvo( "\n" );
    164   rvo( "}" );
     151  rvo( "]\n}" );
    165152  rvf();
    166153  $i++;
Note: See TracChangeset for help on using the changeset viewer.