Changeset 18578 for extensions


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
Location:
extensions/rv_gmaps/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • extensions/rv_gmaps/trunk/changelog.txt

    r18208 r18578  
     12.4.e
     2- removed earth icon from index pages
     3- map icon text localized (for themes without icons)
     4- minor javascript changes for maps api v3.9
     5- code optimization
     6
    172.4.d
    28- edit position in batch manager unit
  • extensions/rv_gmaps/trunk/include/cluster_maker.php

    r12719 r18578  
    3030        function make_clusters($images, $maxLatPrecision, $maxLonPrecision, $maxNbMarkers)
    3131        {
     32                $this->bounds = array();
     33                foreach($images as &$img)
     34                {
     35                        $img['lat'] = floatval($img['lat']);
     36                        $img['lon'] = floatval($img['lon']);
     37                        $this->bounds = bounds_add($this->bounds, $img['lat'], $img['lon'] );
     38                }
     39                unset($img);
     40
    3241                $this->_image_map = $images;
    3342                $this->_image_ranks = array();
     
    3746                $total_iterations = 0;
    3847                $total_generations = 0;
    39 
    40                 $this->bounds = array();
    41                 foreach($images as $img)
    42                         $this->bounds = bounds_add($this->bounds, $img['lat'], $img['lon'] );
    4348
    4449                $pending_split = array( new Cluster($this->bounds, array_keys($this->_image_map) ) );
     
    6873                                }
    6974                                else
    70                                         array_push( $result, $current );
     75                                        $result[] = $current;
    7176                        }
    7277                        $pending_split = $next_level_to_split;
     
    9398                                $rlat = abs($ci['lat']-$cj['lat']) / $maxLatPrecision;
    9499                                $rlon = abs($ci['lon']-$cj['lon']) / $maxLonPrecision;
    95                                 if ( $rlat<1 && $rlon<1 
     100                                if ( $rlat<1 && $rlon<1
    96101                                                && $rlat+$rlon<1.1)
    97102                                {
     
    183188                                $clusters[$idx] = new Cluster();
    184189                        }
    185                         array_push( $clusters[$idx]->items, $id );
     190                        $clusters[$idx]->items[] = $id;
    186191                        $clusters[$idx]->bounds = bounds_add( $clusters[$idx]->bounds , $lat, $lon );
    187192                }
  • extensions/rv_gmaps/trunk/main.inc.php

    r18208 r18578  
    11<?php /*
    22Plugin Name: RV Maps&Earth
    3 Version: 2.4.d
     3Version: 2.4.e
    44Description: Extend your gallery with Google Maps and Google Earth ...
    55Plugin URI: http://piwigo.org/ext/extension_view.php?eid=122
     
    77Author URI: http://www.modusoptimus.com/
    88*/
    9 define( 'RVM_PLUGIN_VERSION', '2.4.d');
     9define( 'RVM_PLUGIN_VERSION', '2.4.e');
    1010defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
    1111
     
    8181
    8282        $map_url = rvm_duplicate_map_index_url( array(), array('start') );
    83         if ( !empty($map_url) )
    84         {
    85                 $link_title = sprintf( l10n('displays %s on a map'), strip_tags($page['title']) );
    86                 $template->concat( 'PLUGIN_INDEX_ACTIONS' , "\n<li>".sprintf(RVM_ACTION_MODEL,
    87                         $map_url, $link_title, '', 'map', 'map'
    88                         ).'</li>');
    89         }
    90 
    91         {
    92                 $kml_url = rvm_duplicate_kml_index_url( array(), array('start') );
    93                 $link_title = sprintf( l10n('opens %s in Google Earth'), strip_tags($page['title']) );
    94                 $template->concat( 'PLUGIN_INDEX_ACTIONS' , "\n<li>".sprintf(RVM_ACTION_MODEL,
    95                         $kml_url, $link_title, ' type="application/vnd.google-earth.kml+xml"', 'globe', 'earth'
    96                         ).'</li>');
    97         }
     83        $link_title = sprintf( l10n('displays %s on a map'), strip_tags($page['title']) );
     84        $template->concat( 'PLUGIN_INDEX_ACTIONS' , "\n<li>".sprintf(RVM_ACTION_MODEL,
     85                $map_url, $link_title, '', 'map', l10n('Map')
     86                ).'</li>');
    9887}
    9988
     
    114103                        $link_title = sprintf( l10n('displays %s on a map'), strip_tags($pictures['current']['name']) );
    115104                        $template->concat( 'PLUGIN_PICTURE_ACTIONS' , sprintf(RVM_ACTION_MODEL,
    116                                         $map_url, $link_title, ' target="_top"', 'map', 'map'
     105                                        $map_url, $link_title, ' target="_top"', 'map', l10n('Map')
    117106                                ));
    118107                }
  • 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++;
  • extensions/rv_gmaps/trunk/mapl.php

    r16993 r18578  
    3333  }
    3434}
     35$page['meta_robots']['noindex']=1;
    3536
    3637// deleting first "/" if displayed
  • extensions/rv_gmaps/trunk/template/data_loader.js

    r12719 r18578  
    7878       
    7979        //BEGIN BUG in maps api as of v3.7 - when map wraps horizontally more than 360 deg - the getBounds is wrong
    80         var isOver = false;
     80        /*var isOver = false;
    8181        if (bounds.getSouthWest().lng() < bounds.getNorthEast().lng())
    8282        {
     
    102102       
    103103        if (isOver)
    104                 bounds = new google.maps.LatLngBounds( new google.maps.LatLng(this._map.getBounds().getSouthWest().lat(),-180), new google.maps.LatLng(this._map.getBounds().getNorthEast().lat(), 179.99) );
     104                bounds = new google.maps.LatLngBounds( new google.maps.LatLng(this._map.getBounds().getSouthWest().lat(),-180), new google.maps.LatLng(this._map.getBounds().getNorthEast().lat(), 179.99) );*/
    105105        //END bug
    106106       
Note: See TracChangeset for help on using the changeset viewer.