Changeset 12204


Ignore:
Timestamp:
Sep 23, 2011, 10:44:08 PM (13 years ago)
Author:
grum
Message:

fix bugs
bug:2346 - Preview / next arrow do not work with [gmaps] tag in description
bug:2063 - Incompatibility with slideshow mode

Location:
extensions/GMaps
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • extensions/GMaps/gmaps_pip.class.inc.php

    r10551 r12204  
    8888
    8989    add_event_handler('loc_begin_index', array(&$this, 'displayCategoryPageMap'));
    90     add_event_handler('loc_begin_picture', array(&$this, 'displayPicturePageMap'), EVENT_HANDLER_PRIORITY_NEUTRAL+5);
     90    if(!isset($_GET['slideshow'])) add_event_handler('loc_begin_picture', array(&$this, 'displayPicturePageMap'), EVENT_HANDLER_PRIORITY_NEUTRAL+5);
    9191    add_event_handler('amd_jpegMD_loaded', array(&$this, 'preparePictureMaps'));
    9292    add_event_handler('loc_end_page_header', array(&$this->css2, 'applyCSS'));
     
    314314</script>", false);
    315315
     316          GPCCore::addHeaderJS('gmaps.infoWindow', GMAPS_PATH.'js/gmapsInfoWindow'.GPCCore::getMinified().'.js', array('jquery'));
     317          GPCCore::addHeaderJS('gmaps.category', GMAPS_PATH.'js/gmapsCategory'.GPCCore::getMinified().'.js', array('jquery', 'gmaps.infoWindow'));
    316318        }
    317 
    318319      }
    319320    }
  • extensions/GMaps/gmaps_version.inc.php

    r10915 r12204  
    1515  if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    1616
    17   define('GMAPS_VERSION',  '1.3.1');
    18   define('GMAPS_VERSION2', '01.03.01');
     17  define('GMAPS_VERSION',  '1.3.2');
     18  define('GMAPS_VERSION2', '01.03.02');
    1919  define('GMAPS_GPC_NEEDED', '3.5.1');
    2020  define('GMAPS_AMD_NEEDED', '0.6.0'); //advanced metadata plugin is needed
  • extensions/GMaps/js/gmapsCategory.js

    r10551 r12204  
    22 * -----------------------------------------------------------------------------
    33 * file: gmapsCategory.js
    4  * file version: 1.2.1
    5  * date: 2011-04-21
     4 * file version: 1.2.2
     5 * date: 2011-09-23
    66 */
    77
    8 var markerImgProp = [
    9   null,
    10   { w:32, h:32, x:15, y:31 }, // s01
    11   { w:32, h:32, x:15, y:31 }, // s02
    12   { w:32, h:32, x:10, y:31 }, // s03
    13   { w:30, h:40, x:4, y:39 } // s04
    14 ];
    15 
    16 
    17 
    18 /**
    19  * create the map
    20  *
    21  * @param Object properties : map properties
    22  * @param Integer gmapsIndex : index in the map list
    23  */
    24 function createMap(properties, gmapsIndex)
     8 var gmapsCM=null,
     9     gmapsMM=null;
     10
     11function categoryMaps()
    2512{
    26   var map = new google.maps.Map($("#"+properties.id).get(0),
    27     {
    28       backgroundColor:'#ffffff',
    29       mapTypeId: properties.mapType,
    30       zoom: properties.zoomLevel,
    31       center: gmaps.bounds.getCenter(),
    32       navigationControl: (properties.navigationControl==-1)?false:true,
    33       scrollwheel: (properties.navigationControl==-1)?false:true,
    34       scaleControl: (properties.scaleControl=='n')?false:true,
    35       streetViewControl: (properties.streetViewControl=='n')?false:true,
    36       mapTypeControl:(properties.mapTypeControl==-1)?false:true,
    37       mapTypeControlOptions:
    38         {
    39           style:properties.mapTypeControl
     13  var markerImgProp = [
     14        null,
     15        { w:32, h:32, x:15, y:31 }, // s01
     16        { w:32, h:32, x:15, y:31 }, // s02
     17        { w:32, h:32, x:10, y:31 }, // s03
     18        { w:30, h:40, x:4, y:39 } // s04
     19      ],
     20      previousThumb={width:-1, height:-1};
     21
     22
     23
     24  /**
     25   * create the map
     26   *
     27   * @param Object properties : map properties
     28   * @param Integer gmapsIndex : index in the map list
     29   */
     30  this.createMap = function(properties, gmapsIndex)
     31  {
     32    var map = new google.maps.Map($("#"+properties.id).get(0),
     33      {
     34        backgroundColor:'#ffffff',
     35        mapTypeId: properties.mapType,
     36        zoom: properties.zoomLevel,
     37        center: gmaps.bounds.getCenter(),
     38        navigationControl: (properties.navigationControl==-1)?false:true,
     39        scrollwheel: (properties.navigationControl==-1)?false:true,
     40        scaleControl: (properties.scaleControl=='n')?false:true,
     41        streetViewControl: (properties.streetViewControl=='n')?false:true,
     42        mapTypeControl:(properties.mapTypeControl==-1)?false:true,
     43        mapTypeControlOptions:
     44          {
     45            style:properties.mapTypeControl
     46          },
     47        markerTitle:''
     48      }
     49    );
     50
     51    if(properties.kmlFileUrl!='')
     52    {
     53      kmlFile = new google.maps.KmlLayer(properties.kmlFileUrl,
     54        {
     55          preserveViewport:true
     56        }
     57      );
     58      kmlFile.setMap(map);
     59    }
     60    else
     61    {
     62      kmlFile=null;
     63    }
     64
     65    re=/^mS(\d\d)_.*/i;
     66    iM=re.exec(properties.markerImg);
     67    if(iM!=null) iM=new Number(iM[1]);
     68
     69    if(iM!=null)
     70    {
     71      map.markerImg = new google.maps.MarkerImage('plugins/GMaps/img/'+properties.markerImg,
     72          new google.maps.Size(markerImgProp[iM].w, markerImgProp[iM].h),
     73          new google.maps.Point(0,0),
     74          new google.maps.Point(markerImgProp[iM].x, markerImgProp[iM].y));
     75    }
     76    else
     77    {
     78      map.markerImg = null;
     79    }
     80
     81    map.kmlFile=kmlFile;
     82    map.markers=new Array();
     83    map.gmapsIndex=gmapsIndex;
     84    map.viewportInitialized=false;
     85    map.callId=0;
     86    properties.gMap=map;
     87  }
     88
     89  /**
     90   * load markers from the server
     91   *
     92   * @param Map map : the map
     93   */
     94  this.loadMarkers = function(map)
     95  {
     96    var __this=this;
     97    map.callId++;
     98
     99    datas={
     100      requestId:gmaps.requestId,
     101      callId:map.callId,
     102      bounds:{
     103          north:map.getBounds().getNorthEast().lat(),
     104          east:map.getBounds().getNorthEast().lng(),
     105          south:map.getBounds().getSouthWest().lat(),
     106          west:map.getBounds().getSouthWest().lng()
    40107        },
    41       markerTitle:''
    42     }
    43   );
    44 
    45   if(properties.kmlFileUrl!='')
    46   {
    47     kmlFile = new google.maps.KmlLayer(properties.kmlFileUrl,
    48       {
    49         preserveViewport:true
     108      width:$(map.getDiv()).width(),
     109      height:$(map.getDiv()).height(),
     110      distanceTreshold:20,
     111      loadIndex:map.gmapsIndex,
     112    };
     113
     114
     115    $('#gmapsLoading').css('display', 'inline-block');
     116    $('#gmapsNbPhotos').html('');
     117
     118    $.ajax(
     119      {
     120        type: "POST",
     121        url: "plugins/GMaps/gmaps_ajax.php",
     122        async: true,
     123        data: { ajaxfct:"public.maps.getMarkers", datas:datas },
     124        success:
     125          function(msg)
     126          {
     127            tmp=$.parseJSON(msg);
     128            if(gmaps.maps[tmp.loadIndex].gMap.callId==tmp.callId)
     129            {
     130              tmp.markers.sort(compareMarkers);
     131              __this.applyMarkers(gmaps.maps[tmp.loadIndex].gMap, tmp.markers);
     132              $('#gmapsLoading').css('display', 'none');
     133              $('#gmapsNbPhotos').html('['+tmp.datas.nbPhotos+']');
     134            }
     135          }
    50136      }
    51137    );
    52     kmlFile.setMap(map);
    53   }
    54   else
    55   {
    56     kmlFile=null;
    57   }
    58 
    59   re=/^mS(\d\d)_.*/i;
    60   iM=re.exec(properties.markerImg);
    61   if(iM!=null) iM=new Number(iM[1]);
    62 
    63   if(iM!=null)
    64   {
    65     map.markerImg = new google.maps.MarkerImage('plugins/GMaps/img/'+properties.markerImg,
    66         new google.maps.Size(markerImgProp[iM].w, markerImgProp[iM].h),
    67         new google.maps.Point(0,0),
    68         new google.maps.Point(markerImgProp[iM].x, markerImgProp[iM].y));
    69   }
    70   else
    71   {
    72     map.markerImg = null;
    73   }
    74 
    75   map.kmlFile=kmlFile;
    76   map.markers=new Array();
    77   map.gmapsIndex=gmapsIndex;
    78   map.viewportInitialized=false;
    79   map.callId=0;
    80   properties.gMap=map;
     138  }
     139
     140  /**
     141   * apply markers to map
     142   *
     143   * @param Map map : the google map object
     144   * @param Array markers : array of markers properties
     145   *                        each marker is an object with properties :
     146   *                          latitude, longitude, nbImg
     147   */
     148  this.applyMarkers = function(map, markers)
     149  {
     150    var __this=this;
     151
     152    /*
     153     * deleting markers from the map only if they are not in the new list
     154     */
     155    if(map.markers.length>0)
     156    {
     157      var i=0;
     158      while(i<map.markers.length)
     159      {
     160        newListIndex=this.markerInList(map.markers[i].uId, markers);
     161        if(newListIndex==-1)
     162        {
     163          map.markers[i].marker.setMap(null);
     164          map.markers.splice(i, 1);
     165        }
     166        else
     167        {
     168          markers.splice(newListIndex,1);
     169          i++;
     170        }
     171      }
     172    }
     173
     174    /*
     175     * add new markers on the map
     176     */
     177    for(var i=0;i<markers.length;i++)
     178    {
     179      var marker = new google.maps.Marker(
     180        {
     181          position:new google.maps.LatLng(markers[i].lat, markers[i].lng),
     182          map: map,
     183          title:markers[i].nbImgTxt
     184        }
     185      );
     186
     187      if(map.markerImg!=null) marker.setIcon(map.markerImg);
     188
     189      marker.info=markers[i];
     190      marker.info.displayed=0;
     191
     192      map.markers.push(
     193        {
     194          marker:marker,
     195          uId:markers[i].uId
     196        }
     197      );
     198
     199      google.maps.event.addListener(
     200        marker,
     201        'click',
     202        function ()
     203        {
     204          __this.displayWindowInfo(this);
     205        }
     206      );
     207
     208      for(var index=0;index<marker.info.imgTn.length;index++)
     209      {
     210        switch(marker.info.imgTn[index].charAt(0))
     211        {
     212          case 'G':
     213            marker.info.imgTn[index]='./galleries/'+marker.info.imgTn[index].substr(1);
     214            break;
     215          case 'U':
     216            marker.info.imgTn[index]='./upload/'+marker.info.imgTn[index].substr(1);
     217            break;
     218        }
     219      }
     220    }
     221  }
     222
     223  var compareMarkers=function(m1,m2)
     224  {
     225    if(m1.uId<m2.uId)
     226    {
     227      return(-1);
     228    }
     229    else if(m1.uId<m2.uId)
     230    {
     231      return(1);
     232    }
     233    return(0);
     234  }
     235
     236  this.markerInList = function(uniqueId, markerList)
     237  {
     238    for(var i=0;i<markerList.length;i++)
     239    {
     240      if(markerList[i].uId==uniqueId) return(i)
     241    }
     242    return(-1);
     243  }
     244
     245  /**
     246   * display the infowindow
     247   *
     248   * @param Marker marker : the marker
     249   */
     250  this.displayWindowInfo = function(marker)
     251  {
     252    var __this=this;
     253
     254    if(gmapsMM!=null && gmapsMM instanceof markupMaps) gmapsMM.closePictureInfo();
     255
     256    previousThumb.width=-1;
     257    previousThumb.width=-1;
     258
     259    gmaps.currentMarker=marker;
     260    gmaps.currentInfo=marker.info;
     261    gmaps.infoWindow.close();
     262    gmaps.infoWindow.setContent($('#iGMapsInfoWindowContent').clone().each(renameId).get(0));
     263    gmaps.infoWindow.open(marker.map, marker);
     264    $('#ciWALeft, #ciWARight').unbind('click');
     265    $('#ciWARight').bind('click', function(event) { __this.displayPictureNext(); } );
     266    $('#ciWALeft').bind('click', function(event) { __this.displayPicturePrev(); } );
     267    this.displayPictureInfo(gmaps.currentInfo.displayed);
     268  }
     269  var renameId = function(i, e)
     270  {
     271    if(e.id!='') e.id='c'+e.id;
     272    $(e).children().each(renameId);
     273  }
     274
     275
     276  this.closePictureInfo = function ()
     277  {
     278    gmaps.currentMarker=null;
     279    gmaps.currentInfo=null;
     280    gmaps.infoWindow.setContent('');
     281    gmaps.infoWindow.close();
     282    $('#ciGMIWC_img').unbind('click');
     283    $('#ciWALeft, #ciWARight').unbind('click');
     284  }
     285
     286  /**
     287   *
     288   */
     289  this.displayPictureInfo = function(index)
     290  {
     291    var __index=index,
     292        __this=this;
     293
     294    gmaps.currentInfo.displayed=index;
     295    if(gmaps.currentInfo.imgName[index]=='')
     296    {
     297      $('#ciGMIWC_title').html('&nbsp;');
     298    }
     299    else
     300    {
     301      $('#ciGMIWC_title').html(gmaps.currentInfo.imgName[index]);
     302    }
     303    $('#ciGMIWC_img')
     304      .attr('src', gmaps.currentInfo.imgTn[index])
     305      .bind('load',
     306        function (event)
     307          {
     308            /*
     309             * this methods works but there's a terrible flick...
     310             * wait to find another solution... :-/
     311             * (and need to be implemented for the markupMaps object too
     312             *
     313            if(previousThumb.width!=-1)
     314            {
     315              if(previousThumb.width!=event.target.width || previousThumb.height!=event.target.height)
     316              {
     317                __this.displayWindowInfo(gmaps.currentMarker);
     318                return(false);
     319              }
     320            }
     321            else
     322            {
     323              previousThumb.width=event.target.width;
     324              previousThumb.height=event.target.height;
     325            }
     326            */
     327          }
     328      );
     329
     330    $('#ciGMIWC_img').unbind('click');
     331
     332    if(gmaps.currentInfo.imgCatsUrl[index].length==1)
     333    {
     334      $('#ciGMIWC_img').bind('click',
     335        function ()
     336        {
     337          window.location=gmaps.currentInfo.imgCatsUrl[gmaps.currentInfo.displayed][0];
     338        }
     339      );
     340    }
     341    else
     342    {
     343      $('#ciGMIWC_showcatList').html('');
     344      for(var i=0;i<gmaps.currentInfo.imgCatsUrl[index].length;i++)
     345      {
     346        $('#ciGMIWC_showcatList')
     347          .append('<li><a href="'+gmaps.currentInfo.imgCatsUrl[index][i]+'">'+gmaps.currentInfo.imgCatsNames[index][i]+'</a></li>');
     348      }
     349      $('#ciGMIWC_img, #ciGMIWC_showcat')
     350        .bind('mouseenter', function () { $('#ciGMIWC_showcat').css('display', 'block'); } )
     351        .bind('mouseleave', function () { $('#ciGMIWC_showcat').css('display', 'none'); } );
     352    }
     353
     354    if(gmaps.currentInfo.nbImg>1)
     355    {
     356      $('#ciGMIWC_picnum').html((index+1)+'/'+gmaps.currentInfo.nbImgTxt);
     357      $('#ciWALeft, #ciWARight').css('display', 'inline-block');
     358    }
     359    else
     360    {
     361      $('#ciGMIWC_picnum').html(gmaps.currentInfo.nbImgTxt);
     362      $('#ciWALeft, #ciWARight').css('display', 'none');
     363    }
     364  }
     365
     366  /**
     367   *
     368   */
     369  this.displayPicturePrev = function()
     370  {
     371    gmaps.currentInfo.displayed--;
     372    if(gmaps.currentInfo.displayed<0) gmaps.currentInfo.displayed=gmaps.currentInfo.nbImg-1;
     373    this.displayPictureInfo(gmaps.currentInfo.displayed);
     374  }
     375
     376  /**
     377   *
     378   */
     379  this.displayPictureNext = function()
     380  {
     381    gmaps.currentInfo.displayed++;
     382    if(gmaps.currentInfo.displayed>=gmaps.currentInfo.nbImg) gmaps.currentInfo.displayed=0;
     383    this.displayPictureInfo(gmaps.currentInfo.displayed);
     384  }
     385
     386
     387  /**
     388   * check if zoomLevel
     389   */
     390  this.fitToBounds = function(bounds, mapIndex)
     391  {
     392    gmaps.maps[mapIndex].gMap.fitBounds(bounds);
     393
     394    if(gmaps.maps[mapIndex].zoomLevelMaxActivated &&
     395       gmaps.maps[mapIndex].gMap.getZoom() > gmaps.maps[mapIndex].zoomLevel)
     396    {
     397      gmaps.maps[mapIndex].gMap.setZoom(gmaps.maps[mapIndex].zoomLevel);
     398    }
     399  }
     400
     401  this.initializeMapViewport = function(mode, mapIndex)
     402  {
     403    var __this=this;
     404
     405    if(mapIndex>-1 &&
     406       ($('#'+gmaps.maps[mapIndex].id+'Content').dialog('isOpen') && mode=='loaded' || mode=='open') &&
     407       (gmaps.maps[mapIndex].gMap.viewportInitialized==false)
     408      )
     409    {
     410      /*
     411       * if the container is not visible when map are built, they are
     412       * not initialized correctly
     413       *
     414       * when dialog is opened for the first time, proceed to map
     415       * finalization :
     416       *  - resize
     417       *  - center the map
     418       *  - add handlers on events 'dragend' and 'zoom_change'
     419       *    allowing to reload markers according to the new viewport
     420       */
     421      google.maps.event.trigger(gmaps.maps[mapIndex].gMap, 'resize');
     422
     423      // reduce copyright size... ^_^
     424      $('#'+gmaps.maps[mapIndex].id+' span, #'+gmaps.maps[mapIndex].id+' a').css('font-size', '55.0%');
     425
     426
     427      if(gmaps.geolocated)
     428      {
     429        if(gmaps.maps[mapIndex].fitToBounds)
     430        {
     431          this.fitToBounds(gmaps.bounds, mapIndex);
     432        }
     433        else
     434        {
     435          gmaps.maps[mapIndex].gMap.setCenter(gmaps.bounds.getCenter());
     436        }
     437      }
     438      else
     439      {
     440        this.fitToBounds(gmaps.maps[mapIndex].gMap.kmlFile.getDefaultViewport(), mapIndex);
     441      }
     442
     443      google.maps.event.addListener(
     444        gmaps.maps[mapIndex].gMap,
     445        'dragend',
     446        function()
     447        {
     448          __this.loadMarkers(this);
     449          $('#gmapsBoundMap').css('display', 'inline');
     450          $('#gmapsBoundKml').css('display', 'inline');
     451        }
     452      );
     453
     454      google.maps.event.addListener(
     455        gmaps.maps[mapIndex].gMap,
     456        'zoom_changed',
     457        function()
     458        {
     459          __this.loadMarkers(this);
     460          gmaps.infoWindow.close();
     461          $('#gmapsBoundMap').css('display', 'inline');
     462          $('#gmapsBoundKml').css('display', 'inline');
     463        }
     464      );
     465
     466      gmaps.maps[mapIndex].gMap.viewportInitialized=true;
     467      this.loadMarkers(gmaps.maps[mapIndex].gMap);
     468    }
     469
     470
     471  }
    81472}
    82473
    83 /**
    84  * load markers from the server
    85  *
    86  * @param Map map : the map
    87  */
    88 function loadMarkers(map)
    89 {
    90   map.callId++;
    91 
    92   datas={
    93     requestId:gmaps.requestId,
    94     callId:map.callId,
    95     bounds:{
    96         north:map.getBounds().getNorthEast().lat(),
    97         east:map.getBounds().getNorthEast().lng(),
    98         south:map.getBounds().getSouthWest().lat(),
    99         west:map.getBounds().getSouthWest().lng()
    100       },
    101     width:$(map.getDiv()).width(),
    102     height:$(map.getDiv()).height(),
    103     distanceTreshold:20,
    104     loadIndex:map.gmapsIndex,
    105   };
    106 
    107 
    108   $('#gmapsLoading').css('display', 'inline-block');
    109   $('#gmapsNbPhotos').html('');
    110 
    111   $.ajax(
    112     {
    113       type: "POST",
    114       url: "plugins/GMaps/gmaps_ajax.php",
    115       async: true,
    116       data: { ajaxfct:"public.maps.getMarkers", datas:datas },
    117       success:
    118         function(msg)
    119         {
    120           tmp=$.parseJSON(msg);
    121           if(gmaps.maps[tmp.loadIndex].gMap.callId==tmp.callId)
    122           {
    123             tmp.markers.sort(compareMarkers);
    124             applyMarkers(gmaps.maps[tmp.loadIndex].gMap, tmp.markers);
    125             $('#gmapsLoading').css('display', 'none');
    126             $('#gmapsNbPhotos').html('['+tmp.datas.nbPhotos+']');
    127           }
    128         }
    129     }
    130   );
    131 }
    132 
    133 /**
    134  * apply markers to map
    135  *
    136  * @param Map map : the google map object
    137  * @param Array markers : array of markers properties
    138  *                        each marker is an object with properties :
    139  *                          latitude, longitude, nbImg
    140  */
    141 function applyMarkers(map, markers)
    142 {
    143   /*
    144    * deleting markers from the map only if they are not in the new list
    145    */
    146   if(map.markers.length>0)
    147   {
    148     var i=0;
    149     while(i<map.markers.length)
    150     {
    151       newListIndex=markerInList(map.markers[i].uId, markers);
    152       if(newListIndex==-1)
    153       {
    154         map.markers[i].marker.setMap(null);
    155         map.markers.splice(i, 1);
    156       }
    157       else
    158       {
    159         markers.splice(newListIndex,1);
    160         i++;
    161       }
    162     }
    163   }
    164 
    165   /*
    166    * add new markers on the map
    167    */
    168   for(var i=0;i<markers.length;i++)
    169   {
    170     var marker = new google.maps.Marker(
    171       {
    172         position:new google.maps.LatLng(markers[i].lat, markers[i].lng),
    173         map: map,
    174         title:markers[i].nbImgTxt
    175       }
    176     );
    177 
    178     if(map.markerImg!=null) marker.setIcon(map.markerImg);
    179 
    180     marker.info=markers[i];
    181     marker.info.displayed=0;
    182 
    183     map.markers.push(
    184       {
    185         marker:marker,
    186         uId:markers[i].uId
    187       }
    188     );
    189 
    190     google.maps.event.addListener(
    191       marker,
    192       'click',
    193       function ()
    194       {
    195         displayWindowInfo(this);
    196       }
    197     );
    198 
    199     for(var index=0;index<marker.info.imgTn.length;index++)
    200     {
    201       switch(marker.info.imgTn[index].charAt(0))
    202       {
    203         case 'G':
    204           marker.info.imgTn[index]='./galleries/'+marker.info.imgTn[index].substr(1);
    205           break;
    206         case 'U':
    207           marker.info.imgTn[index]='./upload/'+marker.info.imgTn[index].substr(1);
    208           break;
    209       }
    210     }
    211   }
    212 }
    213 
    214 function compareMarkers(m1,m2)
    215 {
    216   if(m1.uId<m2.uId)
    217   {
    218     return(-1);
    219   }
    220   else if(m1.uId<m2.uId)
    221   {
    222     return(1);
    223   }
    224   return(0);
    225 }
    226 
    227 function markerInList(uniqueId, markerList)
    228 {
    229   for(var i=0;i<markerList.length;i++)
    230   {
    231     if(markerList[i].uId==uniqueId) return(i)
    232   }
    233   return(-1);
    234 }
    235 
    236 /**
    237  * display the infowindow
    238  *
    239  * @param Marker marker : the marker
    240  */
    241 function displayWindowInfo(marker)
    242 {
    243   gmaps.currentInfo=marker.info;
    244   gmaps.infoWindow.close();
    245   gmaps.infoWindow.setContent($('#iGMapsInfoWindowContent').clone().each(renameId).get(0));
    246   gmaps.infoWindow.open(marker.map, marker);
    247   displayPictureInfo(gmaps.currentInfo.displayed);
    248 }
    249 function renameId(i, e)
    250 {
    251   if(e.id!='') e.id='c'+e.id;
    252   $(e).children().each(renameId);
    253 }
    254 
    255 
    256 /**
    257  *
    258  */
    259 function displayPictureInfo(index)
    260 {
    261   gmaps.currentInfo.displayed=index;
    262   if(gmaps.currentInfo.imgName[index]=='')
    263   {
    264     $('#ciGMIWC_title').html('&nbsp;');
    265   }
    266   else
    267   {
    268     $('#ciGMIWC_title').html(gmaps.currentInfo.imgName[index]);
    269   }
    270   $('#ciGMIWC_img').attr('src', gmaps.currentInfo.imgTn[index]);
    271 
    272   $('#ciGMIWC_img').unbind();
    273   if(gmaps.currentInfo.imgCatsUrl[index].length==1)
    274   {
    275     $('#ciGMIWC_img').bind('click',
    276       function ()
    277       {
    278         window.location=gmaps.currentInfo.imgCatsUrl[gmaps.currentInfo.displayed][0];
    279       }
    280     );
    281   }
    282   else
    283   {
    284     $('#ciGMIWC_showcatList').html('');
    285     for(var i=0;i<gmaps.currentInfo.imgCatsUrl[index].length;i++)
    286     {
    287       $('#ciGMIWC_showcatList')
    288         .append('<li><a href="'+gmaps.currentInfo.imgCatsUrl[index][i]+'">'+gmaps.currentInfo.imgCatsNames[index][i]+'</a></li>');
    289     }
    290     $('#ciGMIWC_img, #ciGMIWC_showcat')
    291       .bind('mouseenter', function () { $('#ciGMIWC_showcat').css('display', 'block'); } )
    292       .bind('mouseleave', function () { $('#ciGMIWC_showcat').css('display', 'none'); } );
    293   }
    294 
    295   if(gmaps.currentInfo.nbImg>1)
    296   {
    297     $('#ciGMIWC_picnum').html((index+1)+'/'+gmaps.currentInfo.nbImgTxt);
    298     $('#ciWALeft, #ciWARight').css('display', 'inline-block');
    299   }
    300   else
    301   {
    302     $('#ciGMIWC_picnum').html(gmaps.currentInfo.nbImgTxt);
    303     $('#ciWALeft, #ciWARight').css('display', 'none');
    304   }
    305 }
    306 
    307 /**
    308  *
    309  */
    310 function displayPicturePrev()
    311 {
    312   gmaps.currentInfo.displayed--;
    313   if(gmaps.currentInfo.displayed<0) gmaps.currentInfo.displayed=gmaps.currentInfo.nbImg-1;
    314   displayPictureInfo(gmaps.currentInfo.displayed);
    315 }
    316 
    317 /**
    318  *
    319  */
    320 function displayPictureNext()
    321 {
    322   gmaps.currentInfo.displayed++;
    323   if(gmaps.currentInfo.displayed>=gmaps.currentInfo.nbImg) gmaps.currentInfo.displayed=0;
    324   displayPictureInfo(gmaps.currentInfo.displayed);
    325 }
    326 
    327 
    328 /**
    329  * check if zoomLevel
    330  */
    331 function fitToBounds(bounds, mapIndex)
    332 {
    333   gmaps.maps[mapIndex].gMap.fitBounds(bounds);
    334 
    335   if(gmaps.maps[mapIndex].zoomLevelMaxActivated &&
    336      gmaps.maps[mapIndex].gMap.getZoom() > gmaps.maps[mapIndex].zoomLevel)
    337   {
    338     gmaps.maps[mapIndex].gMap.setZoom(gmaps.maps[mapIndex].zoomLevel);
    339   }
    340 }
    341 
    342 function initializeMapViewport(mode, mapIndex)
    343 {
    344   if(mapIndex>-1 &&
    345      ($('#'+gmaps.maps[mapIndex].id+'Content').dialog('isOpen') && mode=='loaded' || mode=='open') &&
    346      (gmaps.maps[mapIndex].gMap.viewportInitialized==false)
    347     )
    348   {
    349     /*
    350      * if the container is not visible when map are built, they are
    351      * not initialized correctly
    352      *
    353      * when dialog is opened for the first time, proceed to map
    354      * finalization :
    355      *  - resize
    356      *  - center the map
    357      *  - add handlers on events 'dragend' and 'zoom_change'
    358      *    allowing to reload markers according to the new viewport
    359      */
    360     google.maps.event.trigger(gmaps.maps[mapIndex].gMap, 'resize');
    361 
    362     // reduce copyright size... ^_^
    363     $('#'+gmaps.maps[mapIndex].id+' span, #'+gmaps.maps[mapIndex].id+' a').css('font-size', '55.0%');
    364 
    365 
    366     if(gmaps.geolocated)
    367     {
    368       if(gmaps.maps[mapIndex].fitToBounds)
    369       {
    370         fitToBounds(gmaps.bounds, mapIndex);
    371       }
    372       else
    373       {
    374         gmaps.maps[mapIndex].gMap.setCenter(gmaps.bounds.getCenter());
    375       }
    376     }
    377     else
    378     {
    379       fitToBounds(gmaps.maps[mapIndex].gMap.kmlFile.getDefaultViewport(), mapIndex);
    380     }
    381 
    382     google.maps.event.addListener(
    383       gmaps.maps[mapIndex].gMap,
    384       'dragend',
    385       function()
    386       {
    387         loadMarkers(this);
    388         $('#gmapsBoundMap').css('display', 'inline');
    389         $('#gmapsBoundKml').css('display', 'inline');
    390       }
    391     );
    392 
    393     google.maps.event.addListener(
    394       gmaps.maps[mapIndex].gMap,
    395       'zoom_changed',
    396       function()
    397       {
    398         loadMarkers(this);
    399         gmaps.infoWindow.close();
    400         $('#gmapsBoundMap').css('display', 'inline');
    401         $('#gmapsBoundKml').css('display', 'inline');
    402       }
    403     );
    404 
    405     gmaps.maps[mapIndex].gMap.viewportInitialized=true;
    406     loadMarkers(gmaps.maps[mapIndex].gMap);
    407   }
    408 
    409 
    410 }
    411 
    412 
    413 $(window).load(function ()
    414   {
     474
     475
     476$(window).load(
     477  function ()
     478  {
     479    gmapsCM=new categoryMaps();
     480
    415481    // all maps have the same initials bounds
     482    initInfoWindow();
     483
    416484    gmaps.currentInfo=null;
     485    gmaps.currentMarker=null;
    417486
    418487    gmaps.bounds = new google.maps.LatLngBounds(
     
    428497       //$('body').append($('#iGMapsInfoWindowContent'));
    429498       gmaps.infoWindow.setContent('');
    430        $('#ciGMIWC_img').unbind();
     499       $('#ciGMIWC_img').unbind('click');
    431500     }
    432501    );
     
    435504    {
    436505      // prepare google map maps
    437       createMap(gmaps.maps[i], i);
     506      gmapsCM.createMap(gmaps.maps[i], i);
    438507
    439508      // if size map depends from windows size, apply new dimensions to map
     
    476545                      for(var i=0;i<gmaps.maps.length;i++)
    477546                      {
    478                         initializeMapViewport('loaded', i);
     547                        gmapsCM.initializeMapViewport('loaded', i);
    479548                        //initializeMapViewport('open', $(this).data('index'));
    480549                      }
     
    489558      {
    490559        $('div.gmapsPopup div.ui-dialog-titlebar')
    491         .append('<a href="#" id="gmapsBoundMap" style="display:none;" onclick="fitToBounds(gmaps.bounds, '+i+'); $(this).css(\'display\', \'none\').blur(); return(false);">'+
    492                 '<span>&there4;</span></a>');
    493         $('#gmapsBoundMap').attr('title', gmaps.lang.boundmap);
     560        .append('<a href="#" id="gmapsBoundMap" style="display:none;"><span>&there4;</span></a>');
     561        $('#gmapsBoundMap').attr('title', gmaps.lang.boundmap).bind('click', i, function(event) { gmapsCM.fitToBounds(gmaps.bounds, event.data); $(this).css('display', 'none').blur(); return(false); } );
    494562      }
    495563
     
    497565      {
    498566        $('div.gmapsPopup div.ui-dialog-titlebar')
    499           .append('<a href="#" id="gmapsBoundKml" onclick="fitToBounds(gmaps.maps['+i+'].gMap.kmlFile.getDefaultViewport(), '+i+'); $(this).css(\'display\', \'none\').blur(); return(false);">'+
    500                   '<span>&sim;</span></a>');
    501         $('#gmapsBoundKml').attr('title', gmaps.lang.boundkml);
     567          .append('<a href="#" id="gmapsBoundKml"><span>&sim;</span></a>');
     568        $('#gmapsBoundKml').attr('title', gmaps.lang.boundkml).bind('click', i, function(event) { gmapsCM.fitToBounds(gmaps.maps[event.data].gMap.kmlFile.getDefaultViewport(), event.data); $(this).css('display', 'none').blur(); return(false); } );
    502569      }
    503570
     
    513580  }
    514581);
    515 
    516 
  • extensions/GMaps/js/gmapsCategory.min.js

    r10551 r12204  
    1 /* file: gmapsCategory.js - v1.2.1 | minified on 2011/04/21 with http://jscompress.com/ */
    2 var markerImgProp=[null,{w:32,h:32,x:15,y:31},{w:32,h:32,x:15,y:31},{w:32,h:32,x:10,y:31},{w:30,h:40,x:4,y:39}];function createMap(properties,gmapsIndex)
    3 {var map=new google.maps.Map($("#"+properties.id).get(0),{backgroundColor:'#ffffff',mapTypeId:properties.mapType,zoom:properties.zoomLevel,center:gmaps.bounds.getCenter(),navigationControl:(properties.navigationControl==-1)?false:true,scrollwheel:(properties.navigationControl==-1)?false:true,scaleControl:(properties.scaleControl=='n')?false:true,streetViewControl:(properties.streetViewControl=='n')?false:true,mapTypeControl:(properties.mapTypeControl==-1)?false:true,mapTypeControlOptions:{style:properties.mapTypeControl},markerTitle:''});if(properties.kmlFileUrl!='')
    4 {kmlFile=new google.maps.KmlLayer(properties.kmlFileUrl,{preserveViewport:true});kmlFile.setMap(map);}
    5 else
    6 {kmlFile=null;}
    7 re=/^mS(\d\d)_.*/i;iM=re.exec(properties.markerImg);if(iM!=null)iM=new Number(iM[1]);if(iM!=null)
    8 {map.markerImg=new google.maps.MarkerImage('plugins/GMaps/img/'+properties.markerImg,new google.maps.Size(markerImgProp[iM].w,markerImgProp[iM].h),new google.maps.Point(0,0),new google.maps.Point(markerImgProp[iM].x,markerImgProp[iM].y));}
    9 else
    10 {map.markerImg=null;}
    11 map.kmlFile=kmlFile;map.markers=new Array();map.gmapsIndex=gmapsIndex;map.viewportInitialized=false;map.callId=0;properties.gMap=map;}
    12 function loadMarkers(map)
    13 {map.callId++;datas={requestId:gmaps.requestId,callId:map.callId,bounds:{north:map.getBounds().getNorthEast().lat(),east:map.getBounds().getNorthEast().lng(),south:map.getBounds().getSouthWest().lat(),west:map.getBounds().getSouthWest().lng()},width:$(map.getDiv()).width(),height:$(map.getDiv()).height(),distanceTreshold:20,loadIndex:map.gmapsIndex,};$('#gmapsLoading').css('display','inline-block');$('#gmapsNbPhotos').html('');$.ajax({type:"POST",url:"plugins/GMaps/gmaps_ajax.php",async:true,data:{ajaxfct:"public.maps.getMarkers",datas:datas},success:function(msg)
    14 {tmp=$.parseJSON(msg);if(gmaps.maps[tmp.loadIndex].gMap.callId==tmp.callId)
    15 {tmp.markers.sort(compareMarkers);applyMarkers(gmaps.maps[tmp.loadIndex].gMap,tmp.markers);$('#gmapsLoading').css('display','none');$('#gmapsNbPhotos').html('['+tmp.datas.nbPhotos+']');}}});}
    16 function applyMarkers(map,markers)
    17 {if(map.markers.length>0)
    18 {var i=0;while(i<map.markers.length)
    19 {newListIndex=markerInList(map.markers[i].uId,markers);if(newListIndex==-1)
    20 {map.markers[i].marker.setMap(null);map.markers.splice(i,1);}
    21 else
    22 {markers.splice(newListIndex,1);i++;}}}
    23 for(var i=0;i<markers.length;i++)
    24 {var marker=new google.maps.Marker({position:new google.maps.LatLng(markers[i].lat,markers[i].lng),map:map,title:markers[i].nbImgTxt});if(map.markerImg!=null)marker.setIcon(map.markerImg);marker.info=markers[i];marker.info.displayed=0;map.markers.push({marker:marker,uId:markers[i].uId});google.maps.event.addListener(marker,'click',function()
    25 {displayWindowInfo(this);});for(var index=0;index<marker.info.imgTn.length;index++)
    26 {switch(marker.info.imgTn[index].charAt(0))
    27 {case'G':marker.info.imgTn[index]='./galleries/'+marker.info.imgTn[index].substr(1);break;case'U':marker.info.imgTn[index]='./upload/'+marker.info.imgTn[index].substr(1);break;}}}}
    28 function compareMarkers(m1,m2)
    29 {if(m1.uId<m2.uId)
    30 {return(-1);}
    31 else if(m1.uId<m2.uId)
    32 {return(1);}
    33 return(0);}
    34 function markerInList(uniqueId,markerList)
    35 {for(var i=0;i<markerList.length;i++)
    36 {if(markerList[i].uId==uniqueId)return(i)}
    37 return(-1);}
    38 function displayWindowInfo(marker)
    39 {gmaps.currentInfo=marker.info;gmaps.infoWindow.close();gmaps.infoWindow.setContent($('#iGMapsInfoWindowContent').clone().each(renameId).get(0));gmaps.infoWindow.open(marker.map,marker);displayPictureInfo(gmaps.currentInfo.displayed);}
    40 function renameId(i,e)
    41 {if(e.id!='')e.id='c'+e.id;$(e).children().each(renameId);}
    42 function displayPictureInfo(index)
    43 {gmaps.currentInfo.displayed=index;if(gmaps.currentInfo.imgName[index]=='')
    44 {$('#ciGMIWC_title').html(' ');}
    45 else
    46 {$('#ciGMIWC_title').html(gmaps.currentInfo.imgName[index]);}
    47 $('#ciGMIWC_img').attr('src',gmaps.currentInfo.imgTn[index]);$('#ciGMIWC_img').unbind();if(gmaps.currentInfo.imgCatsUrl[index].length==1)
    48 {$('#ciGMIWC_img').bind('click',function()
    49 {window.location=gmaps.currentInfo.imgCatsUrl[gmaps.currentInfo.displayed][0];});}
    50 else
    51 {$('#ciGMIWC_showcatList').html('');for(var i=0;i<gmaps.currentInfo.imgCatsUrl[index].length;i++)
    52 {$('#ciGMIWC_showcatList').append('<li><a href="'+gmaps.currentInfo.imgCatsUrl[index][i]+'">'+gmaps.currentInfo.imgCatsNames[index][i]+'</a></li>');}
    53 $('#ciGMIWC_img, #ciGMIWC_showcat').bind('mouseenter',function(){$('#ciGMIWC_showcat').css('display','block');}).bind('mouseleave',function(){$('#ciGMIWC_showcat').css('display','none');});}
    54 if(gmaps.currentInfo.nbImg>1)
    55 {$('#ciGMIWC_picnum').html((index+1)+'/'+gmaps.currentInfo.nbImgTxt);$('#ciWALeft, #ciWARight').css('display','inline-block');}
    56 else
    57 {$('#ciGMIWC_picnum').html(gmaps.currentInfo.nbImgTxt);$('#ciWALeft, #ciWARight').css('display','none');}}
    58 function displayPicturePrev()
    59 {gmaps.currentInfo.displayed--;if(gmaps.currentInfo.displayed<0)gmaps.currentInfo.displayed=gmaps.currentInfo.nbImg-1;displayPictureInfo(gmaps.currentInfo.displayed);}
    60 function displayPictureNext()
    61 {gmaps.currentInfo.displayed++;if(gmaps.currentInfo.displayed>=gmaps.currentInfo.nbImg)gmaps.currentInfo.displayed=0;displayPictureInfo(gmaps.currentInfo.displayed);}
    62 function fitToBounds(bounds,mapIndex)
    63 {gmaps.maps[mapIndex].gMap.fitBounds(bounds);if(gmaps.maps[mapIndex].zoomLevelMaxActivated&&gmaps.maps[mapIndex].gMap.getZoom()>gmaps.maps[mapIndex].zoomLevel)
    64 {gmaps.maps[mapIndex].gMap.setZoom(gmaps.maps[mapIndex].zoomLevel);}}
    65 function initializeMapViewport(mode,mapIndex)
    66 {if(mapIndex>-1&&($('#'+gmaps.maps[mapIndex].id+'Content').dialog('isOpen')&&mode=='loaded'||mode=='open')&&(gmaps.maps[mapIndex].gMap.viewportInitialized==false))
    67 {google.maps.event.trigger(gmaps.maps[mapIndex].gMap,'resize');$('#'+gmaps.maps[mapIndex].id+' span, #'+gmaps.maps[mapIndex].id+' a').css('font-size','55.0%');if(gmaps.geolocated)
    68 {if(gmaps.maps[mapIndex].fitToBounds)
    69 {fitToBounds(gmaps.bounds,mapIndex);}
    70 else
    71 {gmaps.maps[mapIndex].gMap.setCenter(gmaps.bounds.getCenter());}}
    72 else
    73 {fitToBounds(gmaps.maps[mapIndex].gMap.kmlFile.getDefaultViewport(),mapIndex);}
    74 google.maps.event.addListener(gmaps.maps[mapIndex].gMap,'dragend',function()
    75 {loadMarkers(this);$('#gmapsBoundMap').css('display','inline');$('#gmapsBoundKml').css('display','inline');});google.maps.event.addListener(gmaps.maps[mapIndex].gMap,'zoom_changed',function()
    76 {loadMarkers(this);gmaps.infoWindow.close();$('#gmapsBoundMap').css('display','inline');$('#gmapsBoundKml').css('display','inline');});gmaps.maps[mapIndex].gMap.viewportInitialized=true;loadMarkers(gmaps.maps[mapIndex].gMap);}}
    77 $(window).load(function()
    78 {gmaps.currentInfo=null;gmaps.bounds=new google.maps.LatLngBounds(new google.maps.LatLng(gmaps.bounds.south,gmaps.bounds.west),new google.maps.LatLng(gmaps.bounds.north,gmaps.bounds.east));gmaps.infoWindow=new google.maps.InfoWindow();google.maps.event.addListener(gmaps.infoWindow,'closeclick',function(){gmaps.infoWindow.setContent('');$('#ciGMIWC_img').unbind();});for(var i=0;i<gmaps.maps.length;i++)
    79 {createMap(gmaps.maps[i],i);if(gmaps.maps[i].sizeMode=='A')
    80 {$('#'+gmaps.maps[i].id).css({width:($(window).width()*gmaps.popupAutomaticSize)+'px',height:($(window).height()*gmaps.popupAutomaticSize)+'px'});}
    81 $('#'+gmaps.maps[i].id+'Content').dialog({autoOpen:false,width:$('#'+gmaps.maps[i].id).width(),height:'auto',modal:true,closeText:'X',dialogClass:'gmapsPopup',title:gmaps.maps[i].title,open:function()
    82 {$.ajax({type:"POST",url:"plugins/GMaps/gmaps_ajax.php",async:true,data:{ajaxfct:"public.maps.init",category:gmaps.categoryId,mapId:'n'},success:function(msg)
    83 {gmaps.requestId=msg;for(var i=0;i<gmaps.maps.length;i++)
    84 {initializeMapViewport('loaded',i);}}});}}).data('index',i);if(gmaps.geolocated)
    85 {$('div.gmapsPopup div.ui-dialog-titlebar').append('<a href="#" id="gmapsBoundMap" style="display:none;" onclick="fitToBounds(gmaps.bounds, '+i+'); $(this).css(\'display\', \'none\').blur(); return(false);">'+'<span>∴</span></a>');$('#gmapsBoundMap').attr('title',gmaps.lang.boundmap);}
    86 if(gmaps.maps[i].gMap.kmlFile!=null)
    87 {$('div.gmapsPopup div.ui-dialog-titlebar').append('<a href="#" id="gmapsBoundKml" onclick="fitToBounds(gmaps.maps['+i+'].gMap.kmlFile.getDefaultViewport(), '+i+'); $(this).css(\'display\', \'none\').blur(); return(false);">'+'<span>∼</span></a>');$('#gmapsBoundKml').attr('title',gmaps.lang.boundkml);}
    88 $('div.gmapsPopup div.ui-dialog-titlebar').append('<span id="gmapsLoading" style="display:none;"><img src="./plugins/GrumPluginClasses/icons/processing.gif"><span>'+gmaps.lang.loading+'</span></span>');$('#ui-dialog-title-iGMapsIconContent').append('<span id="gmapsNbPhotos"></span>');}});
     1/* file: gmapsCategory.js - v1.2.2 | minified on 2011/09/23 with http://jscompress.com/ */
     2function categoryMaps(){var a=[null,{w:32,h:32,x:15,y:31},{w:32,h:32,x:15,y:31},{w:32,h:32,x:10,y:31},{w:30,h:40,x:4,y:39}],b={width:-1,height:-1};this.createMap=function(b,c){var d=new google.maps.Map($("#"+b.id).get(0),{backgroundColor:"#ffffff",mapTypeId:b.mapType,zoom:b.zoomLevel,center:gmaps.bounds.getCenter(),navigationControl:b.navigationControl==-1?false:true,scrollwheel:b.navigationControl==-1?false:true,scaleControl:b.scaleControl=="n"?false:true,streetViewControl:b.streetViewControl=="n"?false:true,mapTypeControl:b.mapTypeControl==-1?false:true,mapTypeControlOptions:{style:b.mapTypeControl},markerTitle:""});if(b.kmlFileUrl!=""){kmlFile=new google.maps.KmlLayer(b.kmlFileUrl,{preserveViewport:true});kmlFile.setMap(d)}else{kmlFile=null}re=/^mS(\d\d)_.*/i;iM=re.exec(b.markerImg);if(iM!=null)iM=new Number(iM[1]);if(iM!=null){d.markerImg=new google.maps.MarkerImage("plugins/GMaps/img/"+b.markerImg,new google.maps.Size(a[iM].w,a[iM].h),new google.maps.Point(0,0),new google.maps.Point(a[iM].x,a[iM].y))}else{d.markerImg=null}d.kmlFile=kmlFile;d.markers=new Array;d.gmapsIndex=c;d.viewportInitialized=false;d.callId=0;b.gMap=d};this.loadMarkers=function(a){var b=this;a.callId++;datas={requestId:gmaps.requestId,callId:a.callId,bounds:{north:a.getBounds().getNorthEast().lat(),east:a.getBounds().getNorthEast().lng(),south:a.getBounds().getSouthWest().lat(),west:a.getBounds().getSouthWest().lng()},width:$(a.getDiv()).width(),height:$(a.getDiv()).height(),distanceTreshold:20,loadIndex:a.gmapsIndex};$("#gmapsLoading").css("display","inline-block");$("#gmapsNbPhotos").html("");$.ajax({type:"POST",url:"plugins/GMaps/gmaps_ajax.php",async:true,data:{ajaxfct:"public.maps.getMarkers",datas:datas},success:function(a){tmp=$.parseJSON(a);if(gmaps.maps[tmp.loadIndex].gMap.callId==tmp.callId){tmp.markers.sort(c);b.applyMarkers(gmaps.maps[tmp.loadIndex].gMap,tmp.markers);$("#gmapsLoading").css("display","none");$("#gmapsNbPhotos").html("["+tmp.datas.nbPhotos+"]")}}})};this.applyMarkers=function(a,b){var c=this;if(a.markers.length>0){var d=0;while(d<a.markers.length){newListIndex=this.markerInList(a.markers[d].uId,b);if(newListIndex==-1){a.markers[d].marker.setMap(null);a.markers.splice(d,1)}else{b.splice(newListIndex,1);d++}}}for(var d=0;d<b.length;d++){var e=new google.maps.Marker({position:new google.maps.LatLng(b[d].lat,b[d].lng),map:a,title:b[d].nbImgTxt});if(a.markerImg!=null)e.setIcon(a.markerImg);e.info=b[d];e.info.displayed=0;a.markers.push({marker:e,uId:b[d].uId});google.maps.event.addListener(e,"click",function(){c.displayWindowInfo(this)});for(var f=0;f<e.info.imgTn.length;f++){switch(e.info.imgTn[f].charAt(0)){case"G":e.info.imgTn[f]="./galleries/"+e.info.imgTn[f].substr(1);break;case"U":e.info.imgTn[f]="./upload/"+e.info.imgTn[f].substr(1);break}}}};var c=function(a,b){if(a.uId<b.uId){return-1}else if(a.uId<b.uId){return 1}return 0};this.markerInList=function(a,b){for(var c=0;c<b.length;c++){if(b[c].uId==a)return c}return-1};this.displayWindowInfo=function(a){var c=this;if(gmapsMM!=null&&gmapsMM instanceof markupMaps)gmapsMM.closePictureInfo();b.width=-1;b.width=-1;gmaps.currentMarker=a;gmaps.currentInfo=a.info;gmaps.infoWindow.close();gmaps.infoWindow.setContent($("#iGMapsInfoWindowContent").clone().each(d).get(0));gmaps.infoWindow.open(a.map,a);$("#ciWALeft, #ciWARight").unbind("click");$("#ciWARight").bind("click",function(a){c.displayPictureNext()});$("#ciWALeft").bind("click",function(a){c.displayPicturePrev()});this.displayPictureInfo(gmaps.currentInfo.displayed)};var d=function(a,b){if(b.id!="")b.id="c"+b.id;$(b).children().each(d)};this.closePictureInfo=function(){gmaps.currentMarker=null;gmaps.currentInfo=null;gmaps.infoWindow.setContent("");gmaps.infoWindow.close();$("#ciGMIWC_img").unbind("click");$("#ciWALeft, #ciWARight").unbind("click")};this.displayPictureInfo=function(a){var b=a,c=this;gmaps.currentInfo.displayed=a;if(gmaps.currentInfo.imgName[a]==""){$("#ciGMIWC_title").html(" ")}else{$("#ciGMIWC_title").html(gmaps.currentInfo.imgName[a])}$("#ciGMIWC_img").attr("src",gmaps.currentInfo.imgTn[a]).bind("load",function(a){});$("#ciGMIWC_img").unbind("click");if(gmaps.currentInfo.imgCatsUrl[a].length==1){$("#ciGMIWC_img").bind("click",function(){window.location=gmaps.currentInfo.imgCatsUrl[gmaps.currentInfo.displayed][0]})}else{$("#ciGMIWC_showcatList").html("");for(var d=0;d<gmaps.currentInfo.imgCatsUrl[a].length;d++){$("#ciGMIWC_showcatList").append('<li><a href="'+gmaps.currentInfo.imgCatsUrl[a][d]+'">'+gmaps.currentInfo.imgCatsNames[a][d]+"</a></li>")}$("#ciGMIWC_img, #ciGMIWC_showcat").bind("mouseenter",function(){$("#ciGMIWC_showcat").css("display","block")}).bind("mouseleave",function(){$("#ciGMIWC_showcat").css("display","none")})}if(gmaps.currentInfo.nbImg>1){$("#ciGMIWC_picnum").html(a+1+"/"+gmaps.currentInfo.nbImgTxt);$("#ciWALeft, #ciWARight").css("display","inline-block")}else{$("#ciGMIWC_picnum").html(gmaps.currentInfo.nbImgTxt);$("#ciWALeft, #ciWARight").css("display","none")}};this.displayPicturePrev=function(){gmaps.currentInfo.displayed--;if(gmaps.currentInfo.displayed<0)gmaps.currentInfo.displayed=gmaps.currentInfo.nbImg-1;this.displayPictureInfo(gmaps.currentInfo.displayed)};this.displayPictureNext=function(){gmaps.currentInfo.displayed++;if(gmaps.currentInfo.displayed>=gmaps.currentInfo.nbImg)gmaps.currentInfo.displayed=0;this.displayPictureInfo(gmaps.currentInfo.displayed)};this.fitToBounds=function(a,b){gmaps.maps[b].gMap.fitBounds(a);if(gmaps.maps[b].zoomLevelMaxActivated&&gmaps.maps[b].gMap.getZoom()>gmaps.maps[b].zoomLevel){gmaps.maps[b].gMap.setZoom(gmaps.maps[b].zoomLevel)}};this.initializeMapViewport=function(a,b){var c=this;if(b>-1&&($("#"+gmaps.maps[b].id+"Content").dialog("isOpen")&&a=="loaded"||a=="open")&&gmaps.maps[b].gMap.viewportInitialized==false){google.maps.event.trigger(gmaps.maps[b].gMap,"resize");$("#"+gmaps.maps[b].id+" span, #"+gmaps.maps[b].id+" a").css("font-size","55.0%");if(gmaps.geolocated){if(gmaps.maps[b].fitToBounds){this.fitToBounds(gmaps.bounds,b)}else{gmaps.maps[b].gMap.setCenter(gmaps.bounds.getCenter())}}else{this.fitToBounds(gmaps.maps[b].gMap.kmlFile.getDefaultViewport(),b)}google.maps.event.addListener(gmaps.maps[b].gMap,"dragend",function(){c.loadMarkers(this);$("#gmapsBoundMap").css("display","inline");$("#gmapsBoundKml").css("display","inline")});google.maps.event.addListener(gmaps.maps[b].gMap,"zoom_changed",function(){c.loadMarkers(this);gmaps.infoWindow.close();$("#gmapsBoundMap").css("display","inline");$("#gmapsBoundKml").css("display","inline")});gmaps.maps[b].gMap.viewportInitialized=true;this.loadMarkers(gmaps.maps[b].gMap)}}}var gmapsCM=null,gmapsMM=null;$(window).load(function(){gmapsCM=new categoryMaps;initInfoWindow();gmaps.currentInfo=null;gmaps.currentMarker=null;gmaps.bounds=new google.maps.LatLngBounds(new google.maps.LatLng(gmaps.bounds.south,gmaps.bounds.west),new google.maps.LatLng(gmaps.bounds.north,gmaps.bounds.east));gmaps.infoWindow=new google.maps.InfoWindow;google.maps.event.addListener(gmaps.infoWindow,"closeclick",function(){gmaps.infoWindow.setContent("");$("#ciGMIWC_img").unbind("click")});for(var a=0;a<gmaps.maps.length;a++){gmapsCM.createMap(gmaps.maps[a],a);if(gmaps.maps[a].sizeMode=="A"){$("#"+gmaps.maps[a].id).css({width:$(window).width()*gmaps.popupAutomaticSize+"px",height:$(window).height()*gmaps.popupAutomaticSize+"px"})}$("#"+gmaps.maps[a].id+"Content").dialog({autoOpen:false,width:$("#"+gmaps.maps[a].id).width(),height:"auto",modal:true,closeText:"X",dialogClass:"gmapsPopup",title:gmaps.maps[a].title,open:function(){$.ajax({type:"POST",url:"plugins/GMaps/gmaps_ajax.php",async:true,data:{ajaxfct:"public.maps.init",category:gmaps.categoryId,mapId:"n"},success:function(a){gmaps.requestId=a;for(var b=0;b<gmaps.maps.length;b++){gmapsCM.initializeMapViewport("loaded",b)}}})}}).data("index",a);if(gmaps.geolocated){$("div.gmapsPopup div.ui-dialog-titlebar").append('<a href="#" id="gmapsBoundMap" style="display:none;"><span>∴</span></a>');$("#gmapsBoundMap").attr("title",gmaps.lang.boundmap).bind("click",a,function(a){gmapsCM.fitToBounds(gmaps.bounds,a.data);$(this).css("display","none").blur();return false})}if(gmaps.maps[a].gMap.kmlFile!=null){$("div.gmapsPopup div.ui-dialog-titlebar").append('<a href="#" id="gmapsBoundKml"><span>∼</span></a>');$("#gmapsBoundKml").attr("title",gmaps.lang.boundkml).bind("click",a,function(a){gmapsCM.fitToBounds(gmaps.maps[a.data].gMap.kmlFile.getDefaultViewport(),a.data);$(this).css("display","none").blur();return false})}$("div.gmapsPopup div.ui-dialog-titlebar").append('<span id="gmapsLoading" style="display:none;"><img src="./plugins/GrumPluginClasses/icons/processing.gif"><span>'+gmaps.lang.loading+"</span></span>");$("#ui-dialog-title-iGMapsIconContent").append('<span id="gmapsNbPhotos"></span>')}})
  • extensions/GMaps/js/gmapsMarkup.js

    r10551 r12204  
    22 * -----------------------------------------------------------------------------
    33 * file: gmapsMarkup.js
    4  * file version: 1.1.1
    5  * date: 2011-04-13
     4 * file version: 1.1.2
     5 * date: 2011-09-23
    66 */
    77
    8 var markerImgProp = [
     8
     9 var gmapsCM=null,
     10     gmapsMM=null;
     11
     12function markupMaps()
     13{
     14  var markerImgProp = [
    915      null,
    1016      { w:32, h:32, x:15, y:31 }, // s01
     
    1420    ];
    1521
    16 
    17 function markupMaps()
    18 {
    1922  /**
    2023   * create the map
     
    9497      if(properties.fitToBounds)
    9598      {
    96         fitToBounds(map.bounds, gmapsIndex);
     99        this.fitToBounds(map.bounds, gmapsIndex);
    97100      }
    98101      else
     
    104107    if(properties.markerVisible)
    105108    {
    106       loadMarkers(map);
     109      this.loadMarkers(map);
    107110    }
    108111    else
    109112    {
    110       initializeMapViewport(gmapsIndex);
     113      this.initializeMapViewport(gmapsIndex);
    111114    }
    112115  };
     
    117120   * @param Map map : the map
    118121   */
    119   var loadMarkers = function(map)
    120   {
     122  this.loadMarkers = function(map)
     123  {
     124    var __this=this;
     125
    121126    if(map.getBounds()==null) return(false);
    122127    map.callId++;
     
    150155            {
    151156              tmp.markers.sort(compareMarkers);
    152               applyMarkers(gmapsMarkup.maps[tmp.loadIndex].gMap, tmp.markers);
    153               initializeMapViewport(tmp.loadIndex);
     157              __this.applyMarkers(gmapsMarkup.maps[tmp.loadIndex].gMap, tmp.markers);
     158              __this.initializeMapViewport(tmp.loadIndex);
    154159            }
    155160          }
     
    166171   *                          latitude, longitude, nbImg
    167172   */
    168   var applyMarkers = function(map, markers)
     173  this.applyMarkers = function(map, markers)
    169174  {
    170175    if(map==null) return(false);
     
    178183      while(i<map.markers.length)
    179184      {
    180         newListIndex=markerInList(map.markers[i].uId, markers);
     185        newListIndex=this.markerInList(map.markers[i].uId, markers);
    181186        if(newListIndex==-1)
    182187        {
     
    197202    for(var i=0;i<markers.length;i++)
    198203    {
    199       var marker = new google.maps.Marker(
    200         {
    201           position:new google.maps.LatLng(markers[i].lat, markers[i].lng),
    202           map: map,
    203           title:markers[i].nbImgTxt
    204         }
    205       );
     204      var __this=this,
     205          marker = new google.maps.Marker(
     206            {
     207              position:new google.maps.LatLng(markers[i].lat, markers[i].lng),
     208              map: map,
     209              title:markers[i].nbImgTxt
     210            }
     211          );
    206212
    207213      if(map.markerImg!=null) marker.setIcon(map.markerImg);
     
    224230          function ()
    225231          {
    226             displayWindowInfo(this);
     232            __this.displayWindowInfo(this);
    227233          }
    228234        );
     
    257263  };
    258264
    259   var markerInList=function(uniqueId, markerList)
     265  this.markerInList=function(uniqueId, markerList)
    260266  {
    261267    for(var i=0;i<markerList.length;i++)
     
    271277   * @param Marker marker : the marker
    272278   */
    273   var displayWindowInfo=function(marker)
    274   {
     279  this.displayWindowInfo=function(marker)
     280  {
     281    if(gmapsCM && gmapsCM instanceof categoryMaps) gmapsCM.closePictureInfo();
     282
    275283    gmapsMarkup.currentInfo=marker.info;
    276284    gmapsMarkup.infoWindow.close();
    277285    gmapsMarkup.infoWindow.setContent($('#iGMapsInfoWindowContent').clone().each(renameId).get(0));
    278286    gmapsMarkup.infoWindow.open(marker.map, marker);
    279     displayPictureInfo(gmapsMarkup.currentInfo.displayed);
     287    $('#ciWALeft, #ciWARight').unbind('click');
     288    $('#ciWARight').bind('click', function(event) { __this.displayPictureNext(); } );
     289    $('#ciWALeft').bind('click', function(event) { __this.displayPicturePrev(); } );
     290    this.displayPictureInfo(gmapsMarkup.currentInfo.displayed);
    280291  };
    281292  var renameId=function(i, e)
     
    286297
    287298
    288   /**
    289    *
    290    */
    291   var displayPictureInfo=function(index)
    292   {
     299  this.closePictureInfo = function ()
     300  {
     301    gmapsMarkup.currentInfo=null;
     302    gmapsMarkup.infoWindow.setContent('');
     303    gmapsMarkup.infoWindow.close();
     304    $('#ciWALeft, #ciWARight').unbind('click');
     305  }
     306
     307  /**
     308   *
     309   */
     310  this.displayPictureInfo=function(index)
     311  {
     312    var __this=this;
     313
     314    $('#ciWALeft,#ciWARight').unbind('click');
     315    $('#ciWARight').bind('click',
     316      function(event)
     317      {
     318        __this.displayPictureNext();
     319      }
     320    );
     321    $('#ciWALeft').bind('click',
     322      function(event)
     323      {
     324        __this.displayPicturePrev();
     325      }
     326    );
     327
    293328    gmapsMarkup.currentInfo.displayed=index;
    294329    if(gmapsMarkup.currentInfo.imgName[index]=='')
     
    344379    gmapsMarkup.currentInfo.displayed--;
    345380    if(gmapsMarkup.currentInfo.displayed<0) gmapsMarkup.currentInfo.displayed=gmapsMarkup.currentInfo.nbImg-1;
    346     displayPictureInfo(gmapsMarkup.currentInfo.displayed);
     381    this.displayPictureInfo(gmapsMarkup.currentInfo.displayed);
    347382  };
    348383
     
    354389    gmapsMarkup.currentInfo.displayed++;
    355390    if(gmapsMarkup.currentInfo.displayed>=gmapsMarkup.currentInfo.nbImg) gmapsMarkup.currentInfo.displayed=0;
    356     displayPictureInfo(gmapsMarkup.currentInfo.displayed);
     391    this.displayPictureInfo(gmapsMarkup.currentInfo.displayed);
    357392  };
    358393
     
    361396   * check if zoomLevel
    362397   */
    363   var fitToBounds=function(bounds, mapIndex)
     398  this.fitToBounds=function(bounds, mapIndex)
    364399  {
    365400    gmapsMarkup.maps[mapIndex].gMap.fitBounds(bounds);
     
    372407  };
    373408
    374   var initializeMapViewport=function(mapIndex)
    375   {
     409  this.initializeMapViewport=function(mapIndex)
     410  {
     411    var __this=this;
     412
    376413    if(mapIndex>-1 && !gmapsMarkup.maps[mapIndex].gMap.initialized)
    377414    {
     
    386423          function()
    387424          {
    388             loadMarkers(this);
     425            __this.loadMarkers(this);
    389426          }
    390427        );
     
    395432          function()
    396433          {
    397             loadMarkers(this);
     434            __this.loadMarkers(this);
    398435            gmapsMarkup.infoWindow.close();
    399436          }
     
    409446          function()
    410447          {
    411             fitToBounds(gmapsMarkup.maps[mapIndex].gMap.kmlFile.getDefaultViewport(), mapIndex);
     448            __this.fitToBounds(gmapsMarkup.maps[mapIndex].gMap.kmlFile.getDefaultViewport(), mapIndex);
    412449          }
    413450        );
     
    422459
    423460
    424 $(window).load(function ()
    425   {
    426     var mm=new markupMaps();
     461$(window).load(
     462  function ()
     463  {
     464    gmapsMM=new markupMaps();
    427465
    428466    // all maps have the same initials bounds
     
    434472     'closeclick',
    435473     function () {
    436        //$('body').append($('#iGMapsInfoWindowContent'));
    437474       gmapsMarkup.infoWindow.setContent('');
    438475       $('#ciGMIWC_img').unbind();
     
    465502              );
    466503
    467               mm.createMap(gmapsMarkup.maps[i], i);
     504              gmapsMM.createMap(gmapsMarkup.maps[i], i);
    468505            }
    469506          }
    470507      }
    471508    );
    472 
    473 
    474     if($('#iGMapsInfoWindow').length==0)
    475     {
    476       $('body').append($('<div/>',
    477                         {
    478                           id:'iGMapsInfoWindow',
    479                           css:{display:'none'},
    480                         }
    481                       ).append($('<div/>',
    482                                   {
    483                                     id:'iGMapsInfoWindowContent'
    484                                   }
    485                                 ).append($('<div/>',
    486                                             {
    487                                               id:'iGMIWC_title',
    488                                               html:'(title)'
    489                                             }
    490                                           )
    491                                         ).append($('<table/>',
    492                                                     {
    493                                                       id:'iGMIWC_thumb'
    494                                                     }
    495                                                   ).append($('<tr/>')
    496                                                             .append($('<td/>',
    497                                                                       {
    498                                                                         css:{width:'28px'}
    499                                                                       }
    500                                                                      ).append($('<div id="iWALeft" onclick="mm.displayPicturePrev();"/>')
    501                                                                              )
    502                                                                    )
    503                                                             .append($('<td/>').append($('<img/>',
    504                                                                                           {
    505                                                                                             id:'iGMIWC_img',
    506                                                                                             src:''
    507                                                                                           }
    508                                                                                         )
    509                                                                                       )
    510                                                                    )
    511                                                             .append($('<td/>',
    512                                                                       {
    513                                                                         css:{width:'28px'}
    514                                                                       }
    515                                                                     ).append($('<div id="iWARight" onclick="mm.displayPictureNext();">')
    516                                                                             )
    517                                                                   )
    518                                                           )
    519                                                 )
    520                                        .append($('<div/>',
    521                                                   {
    522                                                     id:'iGMIWC_picnum',
    523                                                     html:'0/0 photo'
    524                                                   }
    525                                                 )
    526                                               )
    527                                        .append($('<div/>',
    528                                                   {
    529                                                     id:'iGMIWC_showcat',
    530                                                     css:{display:'none'}
    531                                                   }
    532                                                 ).append($('<span/>',
    533                                                             {
    534                                                               html:'gmaps_i_show_this_picture_in'
    535                                                             }
    536                                                           )
    537                                                         )
    538                                                   .append($('<ul/>',
    539                                                             {
    540                                                               id:'iGMIWC_showcatList'
    541                                                             }
    542                                                           )
    543                                                         )
    544                                               )
    545                               )
    546                     );
    547     }
    548 
    549509  }
    550510);
  • extensions/GMaps/js/gmapsMarkup.min.js

    r10551 r12204  
    1 /* file: gmapsMarkup.js - v1.1.1 | minified on 2011/04/13 with http://jscompress.com/ */
    2 var markerImgProp=[null,{w:32,h:32,x:15,y:31},{w:32,h:32,x:15,y:31},{w:32,h:32,x:10,y:31},{w:30,h:40,x:4,y:39}];function markupMaps()
    3 {this.createMap=function(properties,gmapsIndex)
    4 {var bounds=new google.maps.LatLngBounds(new google.maps.LatLng(properties.mapBounds.south,properties.mapBounds.west),new google.maps.LatLng(properties.mapBounds.north,properties.mapBounds.east)),map=new google.maps.Map($("#"+properties.id).get(0),{backgroundColor:'#ffffff',mapTypeId:properties.mapType,zoom:properties.zoomLevel,center:bounds.getCenter(),navigationControl:(properties.navigationControl==-1)?false:true,scrollwheel:(properties.navigationControl==-1)?false:true,scaleControl:(properties.scaleControl=='n')?false:true,streetViewControl:(properties.streetViewControl=='n')?false:true,mapTypeControl:(properties.mapTypeControl==-1)?false:true,mapTypeControlOptions:{style:properties.mapTypeControl},markerTitle:''});if(properties.kmlFileUrl!='')
    5 {kmlFile=new google.maps.KmlLayer(properties.kmlFileUrl,{preserveViewport:true});kmlFile.setMap(map);}
    6 else
    7 {kmlFile=null;}
    8 re=/^mS(\d\d)_.*/i;iM=re.exec(properties.markerImg);if(iM!=null)iM=new Number(iM[1]);if(iM!=null)
    9 {map.markerImg=new google.maps.MarkerImage('plugins/GMaps/img/'+properties.markerImg,new google.maps.Size(markerImgProp[iM].w,markerImgProp[iM].h),new google.maps.Point(0,0),new google.maps.Point(markerImgProp[iM].x,markerImgProp[iM].y));}
    10 else
    11 {map.markerImg=null;}
    12 map.bounds=bounds;map.kmlFile=kmlFile;map.markers=new Array();map.gmapsIndex=gmapsIndex;map.width=properties.width;map.height=properties.height;map.callId=0;map.allowBubble=properties.allowBubble;map.initialized=false;properties.gMap=map;if(properties.geolocated)
    13 {if(properties.fitToBounds)
    14 {fitToBounds(map.bounds,gmapsIndex);}
    15 else
    16 {map.setCenter(map.bounds.getCenter());}}
    17 if(properties.markerVisible)
    18 {loadMarkers(map);}
    19 else
    20 {initializeMapViewport(gmapsIndex);}};var loadMarkers=function(map)
    21 {if(map.getBounds()==null)return(false);map.callId++;datas={requestId:gmapsMarkup.requestId,callId:map.callId,bounds:{north:map.getBounds().getNorthEast().lat(),east:map.getBounds().getNorthEast().lng(),south:map.getBounds().getSouthWest().lat(),west:map.getBounds().getSouthWest().lng()},width:map.width,height:map.height,distanceTreshold:20,loadIndex:map.gmapsIndex};$.ajax({type:"POST",url:"plugins/GMaps/gmaps_ajax.php",async:true,data:{ajaxfct:"public.maps.getMarkers",datas:datas},success:function(msg)
    22 {tmp=$.parseJSON(msg);if(gmapsMarkup.maps[tmp.loadIndex].gMap.callId==tmp.callId)
    23 {tmp.markers.sort(compareMarkers);applyMarkers(gmapsMarkup.maps[tmp.loadIndex].gMap,tmp.markers);initializeMapViewport(tmp.loadIndex);}}});};var applyMarkers=function(map,markers)
    24 {if(map==null)return(false);if(map.markers.length>0)
    25 {var i=0;while(i<map.markers.length)
    26 {newListIndex=markerInList(map.markers[i].uId,markers);if(newListIndex==-1)
    27 {map.markers[i].marker.setMap(null);map.markers.splice(i,1);}
    28 else
    29 {markers.splice(newListIndex,1);i++;}}}
    30 for(var i=0;i<markers.length;i++)
    31 {var marker=new google.maps.Marker({position:new google.maps.LatLng(markers[i].lat,markers[i].lng),map:map,title:markers[i].nbImgTxt});if(map.markerImg!=null)marker.setIcon(map.markerImg);marker.info=markers[i];marker.info.displayed=0;map.markers.push({marker:marker,uId:markers[i].uId});if(map.allowBubble)
    32 {google.maps.event.addListener(marker,'click',function()
    33 {displayWindowInfo(this);});}
    34 for(var index=0;index<marker.info.imgTn.length;index++)
    35 {switch(marker.info.imgTn[index].charAt(0))
    36 {case'G':marker.info.imgTn[index]='./galleries/'+marker.info.imgTn[index].substr(1);break;case'U':marker.info.imgTn[index]='./upload/'+marker.info.imgTn[index].substr(1);break;}}}};var compareMarkers=function(m1,m2)
    37 {if(m1.uId<m2.uId)
    38 {return(-1);}
    39 else if(m1.uId<m2.uId)
    40 {return(1);}
    41 return(0);};var markerInList=function(uniqueId,markerList)
    42 {for(var i=0;i<markerList.length;i++)
    43 {if(markerList[i].uId==uniqueId)return(i)}
    44 return(-1);};var displayWindowInfo=function(marker)
    45 {gmapsMarkup.currentInfo=marker.info;gmapsMarkup.infoWindow.close();gmapsMarkup.infoWindow.setContent($('#iGMapsInfoWindowContent').clone().each(renameId).get(0));gmapsMarkup.infoWindow.open(marker.map,marker);displayPictureInfo(gmapsMarkup.currentInfo.displayed);};var renameId=function(i,e)
    46 {if(e.id!='')e.id='c'+e.id;$(e).children().each(renameId);};var displayPictureInfo=function(index)
    47 {gmapsMarkup.currentInfo.displayed=index;if(gmapsMarkup.currentInfo.imgName[index]=='')
    48 {$('#ciGMIWC_title').html(' ');}
    49 else
    50 {$('#ciGMIWC_title').html(gmapsMarkup.currentInfo.imgName[index]);}
    51 $('#ciGMIWC_img').attr('src',gmapsMarkup.currentInfo.imgTn[index]);$('#ciGMIWC_img').unbind();if(gmapsMarkup.currentInfo.imgCatsUrl[index].length==1)
    52 {$('#ciGMIWC_img').bind('click',function()
    53 {window.location=gmapsMarkup.currentInfo.imgCatsUrl[gmapsMarkup.currentInfo.displayed][0];});}
    54 else
    55 {$('#ciGMIWC_showcatList').html('');for(var i=0;i<gmapsMarkup.currentInfo.imgCatsUrl[index].length;i++)
    56 {$('#ciGMIWC_showcatList').append('<li><a href="'+gmapsMarkup.currentInfo.imgCatsUrl[index][i]+'">'+gmapsMarkup.currentInfo.imgCatsNames[index][i]+'</a></li>');}
    57 $('#ciGMIWC_img, #ciGMIWC_showcat').bind('mouseenter',function(){$('#ciGMIWC_showcat').css('display','block');}).bind('mouseleave',function(){$('#ciGMIWC_showcat').css('display','none');});}
    58 if(gmapsMarkup.currentInfo.nbImg>1)
    59 {$('#ciGMIWC_picnum').html((index+1)+'/'+gmapsMarkup.currentInfo.nbImgTxt);$('#ciWALeft, #ciWARight').css('display','inline-block');}
    60 else
    61 {$('#ciGMIWC_picnum').html(gmapsMarkup.currentInfo.nbImgTxt);$('#ciWALeft, #ciWARight').css('display','none');}};this.displayPicturePrev=function()
    62 {gmapsMarkup.currentInfo.displayed--;if(gmapsMarkup.currentInfo.displayed<0)gmapsMarkup.currentInfo.displayed=gmapsMarkup.currentInfo.nbImg-1;displayPictureInfo(gmapsMarkup.currentInfo.displayed);};this.displayPictureNext=function()
    63 {gmapsMarkup.currentInfo.displayed++;if(gmapsMarkup.currentInfo.displayed>=gmapsMarkup.currentInfo.nbImg)gmapsMarkup.currentInfo.displayed=0;displayPictureInfo(gmapsMarkup.currentInfo.displayed);};var fitToBounds=function(bounds,mapIndex)
    64 {gmapsMarkup.maps[mapIndex].gMap.fitBounds(bounds);if(gmapsMarkup.maps[mapIndex].zoomLevelMaxActivated&&gmapsMarkup.maps[mapIndex].gMap.getZoom()>gmapsMarkup.maps[mapIndex].zoomLevel)
    65 {gmapsMarkup.maps[mapIndex].gMap.setZoom(gmapsMarkup.maps[mapIndex].zoomLevel);}};var initializeMapViewport=function(mapIndex)
    66 {if(mapIndex>-1&&!gmapsMarkup.maps[mapIndex].gMap.initialized)
    67 {$('#'+gmapsMarkup.maps[mapIndex].id+' span, #'+gmapsMarkup.maps[mapIndex].id+' a').css('font-size','55.0%');if(gmapsMarkup.maps[mapIndex].markerVisible)
    68 {google.maps.event.addListener(gmapsMarkup.maps[mapIndex].gMap,'dragend',function()
    69 {loadMarkers(this);});google.maps.event.addListener(gmapsMarkup.maps[mapIndex].gMap,'zoom_changed',function()
    70 {loadMarkers(this);gmapsMarkup.infoWindow.close();});}
    71 if(gmapsMarkup.maps[mapIndex].kmlZoom&&gmapsMarkup.maps[mapIndex].gMap.kmlFile!=null)
    72 {google.maps.event.addListenerOnce(gmapsMarkup.maps[mapIndex].gMap.kmlFile,'defaultviewport_changed',function()
    73 {fitToBounds(gmapsMarkup.maps[mapIndex].gMap.kmlFile.getDefaultViewport(),mapIndex);});}
    74 gmapsMarkup.maps[mapIndex].gMap.initialized=true;}};}
    75 $(window).load(function()
    76 {var mm=new markupMaps();gmapsMarkup.currentInfo=null;gmapsMarkup.infoWindow=new google.maps.InfoWindow();google.maps.event.addListener(gmapsMarkup.infoWindow,'closeclick',function(){gmapsMarkup.infoWindow.setContent('');$('#ciGMIWC_img').unbind();});$.ajax({type:"POST",url:"plugins/GMaps/gmaps_ajax.php",async:true,data:{ajaxfct:"public.maps.init",category:gmapsMarkup.categoryId,mapId:'y'},success:function(msg)
    77 {gmapsMarkup.requestId=msg;for(var i=0;i<gmapsMarkup.maps.length;i++)
    78 {$('#'+gmapsMarkup.maps[i].id).css({width:gmapsMarkup.maps[i].width+'px',height:gmapsMarkup.maps[i].height+'px'});mm.createMap(gmapsMarkup.maps[i],i);}}});if($('#iGMapsInfoWindow').length==0)
    79 {$('body').append($('<div/>',{id:'iGMapsInfoWindow',css:{display:'none'},}).append($('<div/>',{id:'iGMapsInfoWindowContent'}).append($('<div/>',{id:'iGMIWC_title',html:'(title)'})).append($('<table/>',{id:'iGMIWC_thumb'}).append($('<tr/>').append($('<td/>',{css:{width:'28px'}}).append($('<div id="iWALeft" onclick="mm.displayPicturePrev();"/>'))).append($('<td/>').append($('<img/>',{id:'iGMIWC_img',src:''}))).append($('<td/>',{css:{width:'28px'}}).append($('<div id="iWARight" onclick="mm.displayPictureNext();">'))))).append($('<div/>',{id:'iGMIWC_picnum',html:'0/0 photo'})).append($('<div/>',{id:'iGMIWC_showcat',css:{display:'none'}}).append($('<span/>',{html:'gmaps_i_show_this_picture_in'})).append($('<ul/>',{id:'iGMIWC_showcatList'})))));}});
     1/* file: gmapsMarkup.js - v1.1.2 | minified on 2011/09/23 with http://jscompress.com/ */
     2function markupMaps(){var a=[null,{w:32,h:32,x:15,y:31},{w:32,h:32,x:15,y:31},{w:32,h:32,x:10,y:31},{w:30,h:40,x:4,y:39}];this.createMap=function(b,c){var d=new google.maps.LatLngBounds(new google.maps.LatLng(b.mapBounds.south,b.mapBounds.west),new google.maps.LatLng(b.mapBounds.north,b.mapBounds.east)),e=new google.maps.Map($("#"+b.id).get(0),{backgroundColor:"#ffffff",mapTypeId:b.mapType,zoom:b.zoomLevel,center:d.getCenter(),navigationControl:b.navigationControl==-1?false:true,scrollwheel:b.navigationControl==-1?false:true,scaleControl:b.scaleControl=="n"?false:true,streetViewControl:b.streetViewControl=="n"?false:true,mapTypeControl:b.mapTypeControl==-1?false:true,mapTypeControlOptions:{style:b.mapTypeControl},markerTitle:""});if(b.kmlFileUrl!=""){kmlFile=new google.maps.KmlLayer(b.kmlFileUrl,{preserveViewport:true});kmlFile.setMap(e)}else{kmlFile=null}re=/^mS(\d\d)_.*/i;iM=re.exec(b.markerImg);if(iM!=null)iM=new Number(iM[1]);if(iM!=null){e.markerImg=new google.maps.MarkerImage("plugins/GMaps/img/"+b.markerImg,new google.maps.Size(a[iM].w,a[iM].h),new google.maps.Point(0,0),new google.maps.Point(a[iM].x,a[iM].y))}else{e.markerImg=null}e.bounds=d;e.kmlFile=kmlFile;e.markers=new Array;e.gmapsIndex=c;e.width=b.width;e.height=b.height;e.callId=0;e.allowBubble=b.allowBubble;e.initialized=false;b.gMap=e;if(b.geolocated){if(b.fitToBounds){this.fitToBounds(e.bounds,c)}else{e.setCenter(e.bounds.getCenter())}}if(b.markerVisible){this.loadMarkers(e)}else{this.initializeMapViewport(c)}};this.loadMarkers=function(a){var c=this;if(a.getBounds()==null)return false;a.callId++;datas={requestId:gmapsMarkup.requestId,callId:a.callId,bounds:{north:a.getBounds().getNorthEast().lat(),east:a.getBounds().getNorthEast().lng(),south:a.getBounds().getSouthWest().lat(),west:a.getBounds().getSouthWest().lng()},width:a.width,height:a.height,distanceTreshold:20,loadIndex:a.gmapsIndex};$.ajax({type:"POST",url:"plugins/GMaps/gmaps_ajax.php",async:true,data:{ajaxfct:"public.maps.getMarkers",datas:datas},success:function(a){tmp=$.parseJSON(a);if(gmapsMarkup.maps[tmp.loadIndex].gMap.callId==tmp.callId){tmp.markers.sort(b);c.applyMarkers(gmapsMarkup.maps[tmp.loadIndex].gMap,tmp.markers);c.initializeMapViewport(tmp.loadIndex)}}})};this.applyMarkers=function(a,b){if(a==null)return false;if(a.markers.length>0){var c=0;while(c<a.markers.length){newListIndex=this.markerInList(a.markers[c].uId,b);if(newListIndex==-1){a.markers[c].marker.setMap(null);a.markers.splice(c,1)}else{b.splice(newListIndex,1);c++}}}for(var c=0;c<b.length;c++){var d=this,e=new google.maps.Marker({position:new google.maps.LatLng(b[c].lat,b[c].lng),map:a,title:b[c].nbImgTxt});if(a.markerImg!=null)e.setIcon(a.markerImg);e.info=b[c];e.info.displayed=0;a.markers.push({marker:e,uId:b[c].uId});if(a.allowBubble){google.maps.event.addListener(e,"click",function(){d.displayWindowInfo(this)})}for(var f=0;f<e.info.imgTn.length;f++){switch(e.info.imgTn[f].charAt(0)){case"G":e.info.imgTn[f]="./galleries/"+e.info.imgTn[f].substr(1);break;case"U":e.info.imgTn[f]="./upload/"+e.info.imgTn[f].substr(1);break}}}};var b=function(a,b){if(a.uId<b.uId){return-1}else if(a.uId<b.uId){return 1}return 0};this.markerInList=function(a,b){for(var c=0;c<b.length;c++){if(b[c].uId==a)return c}return-1};this.displayWindowInfo=function(a){if(gmapsCM&&gmapsCM instanceof categoryMaps)gmapsCM.closePictureInfo();gmapsMarkup.currentInfo=a.info;gmapsMarkup.infoWindow.close();gmapsMarkup.infoWindow.setContent($("#iGMapsInfoWindowContent").clone().each(c).get(0));gmapsMarkup.infoWindow.open(a.map,a);$("#ciWALeft, #ciWARight").unbind("click");$("#ciWARight").bind("click",function(a){__this.displayPictureNext()});$("#ciWALeft").bind("click",function(a){__this.displayPicturePrev()});this.displayPictureInfo(gmapsMarkup.currentInfo.displayed)};var c=function(a,b){if(b.id!="")b.id="c"+b.id;$(b).children().each(c)};this.closePictureInfo=function(){gmapsMarkup.currentInfo=null;gmapsMarkup.infoWindow.setContent("");gmapsMarkup.infoWindow.close();$("#ciWALeft, #ciWARight").unbind("click")};this.displayPictureInfo=function(a){var b=this;$("#ciWALeft,#ciWARight").unbind("click");$("#ciWARight").bind("click",function(a){b.displayPictureNext()});$("#ciWALeft").bind("click",function(a){b.displayPicturePrev()});gmapsMarkup.currentInfo.displayed=a;if(gmapsMarkup.currentInfo.imgName[a]==""){$("#ciGMIWC_title").html(" ")}else{$("#ciGMIWC_title").html(gmapsMarkup.currentInfo.imgName[a])}$("#ciGMIWC_img").attr("src",gmapsMarkup.currentInfo.imgTn[a]);$("#ciGMIWC_img").unbind();if(gmapsMarkup.currentInfo.imgCatsUrl[a].length==1){$("#ciGMIWC_img").bind("click",function(){window.location=gmapsMarkup.currentInfo.imgCatsUrl[gmapsMarkup.currentInfo.displayed][0]})}else{$("#ciGMIWC_showcatList").html("");for(var c=0;c<gmapsMarkup.currentInfo.imgCatsUrl[a].length;c++){$("#ciGMIWC_showcatList").append('<li><a href="'+gmapsMarkup.currentInfo.imgCatsUrl[a][c]+'">'+gmapsMarkup.currentInfo.imgCatsNames[a][c]+"</a></li>")}$("#ciGMIWC_img, #ciGMIWC_showcat").bind("mouseenter",function(){$("#ciGMIWC_showcat").css("display","block")}).bind("mouseleave",function(){$("#ciGMIWC_showcat").css("display","none")})}if(gmapsMarkup.currentInfo.nbImg>1){$("#ciGMIWC_picnum").html(a+1+"/"+gmapsMarkup.currentInfo.nbImgTxt);$("#ciWALeft, #ciWARight").css("display","inline-block")}else{$("#ciGMIWC_picnum").html(gmapsMarkup.currentInfo.nbImgTxt);$("#ciWALeft, #ciWARight").css("display","none")}};this.displayPicturePrev=function(){gmapsMarkup.currentInfo.displayed--;if(gmapsMarkup.currentInfo.displayed<0)gmapsMarkup.currentInfo.displayed=gmapsMarkup.currentInfo.nbImg-1;this.displayPictureInfo(gmapsMarkup.currentInfo.displayed)};this.displayPictureNext=function(){gmapsMarkup.currentInfo.displayed++;if(gmapsMarkup.currentInfo.displayed>=gmapsMarkup.currentInfo.nbImg)gmapsMarkup.currentInfo.displayed=0;this.displayPictureInfo(gmapsMarkup.currentInfo.displayed)};this.fitToBounds=function(a,b){gmapsMarkup.maps[b].gMap.fitBounds(a);if(gmapsMarkup.maps[b].zoomLevelMaxActivated&&gmapsMarkup.maps[b].gMap.getZoom()>gmapsMarkup.maps[b].zoomLevel){gmapsMarkup.maps[b].gMap.setZoom(gmapsMarkup.maps[b].zoomLevel)}};this.initializeMapViewport=function(a){var b=this;if(a>-1&&!gmapsMarkup.maps[a].gMap.initialized){$("#"+gmapsMarkup.maps[a].id+" span, #"+gmapsMarkup.maps[a].id+" a").css("font-size","55.0%");if(gmapsMarkup.maps[a].markerVisible){google.maps.event.addListener(gmapsMarkup.maps[a].gMap,"dragend",function(){b.loadMarkers(this)});google.maps.event.addListener(gmapsMarkup.maps[a].gMap,"zoom_changed",function(){b.loadMarkers(this);gmapsMarkup.infoWindow.close()})}if(gmapsMarkup.maps[a].kmlZoom&&gmapsMarkup.maps[a].gMap.kmlFile!=null){google.maps.event.addListenerOnce(gmapsMarkup.maps[a].gMap.kmlFile,"defaultviewport_changed",function(){b.fitToBounds(gmapsMarkup.maps[a].gMap.kmlFile.getDefaultViewport(),a)})}gmapsMarkup.maps[a].gMap.initialized=true}}}var gmapsCM=null,gmapsMM=null;$(window).load(function(){gmapsMM=new markupMaps;gmapsMarkup.currentInfo=null;gmapsMarkup.infoWindow=new google.maps.InfoWindow;google.maps.event.addListener(gmapsMarkup.infoWindow,"closeclick",function(){gmapsMarkup.infoWindow.setContent("");$("#ciGMIWC_img").unbind()});$.ajax({type:"POST",url:"plugins/GMaps/gmaps_ajax.php",async:true,data:{ajaxfct:"public.maps.init",category:gmapsMarkup.categoryId,mapId:"y"},success:function(a){gmapsMarkup.requestId=a;for(var b=0;b<gmapsMarkup.maps.length;b++){$("#"+gmapsMarkup.maps[b].id).css({width:gmapsMarkup.maps[b].width+"px",height:gmapsMarkup.maps[b].height+"px"});gmapsMM.createMap(gmapsMarkup.maps[b],b)}}})})
  • extensions/GMaps/language/it_IT/index.php

    r11529 r12204  
    11<?php
    22// +-----------------------------------------------------------------------+
    3 // | Piwigo - a PHP based photo gallery                                    |
     3// | PhpWebGallery - a PHP based picture gallery                           |
     4// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
     5// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
    46// +-----------------------------------------------------------------------+
    5 // | Copyright(C) 2008-2011 Piwigo Team                  http://piwigo.org |
    6 // | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
    7 // | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
     7// | file          : $Id: index.php 1912 2007-03-16 06:30:07Z rub $
     8// | last update   : $Date: 2007-03-16 07:30:07 +0100 (ven, 16 mar 2007) $
     9// | last modifier : $Author: rub $
     10// | revision      : $Revision: 1912 $
    811// +-----------------------------------------------------------------------+
    912// | This program is free software; you can redistribute it and/or modify  |
  • extensions/GMaps/main.inc.php

    r10915 r12204  
    22/*
    33Plugin Name: GMaps
    4 Version: 1.3.0
     4Version: 1.3.1
    55Description: Display and manage (google) maps
    6 Plugin URI: http://phpwebgallery.net/ext/extension_view.php?eid=454
     6Plugin URI: http://piwigo.org/ext/extension_view.php?eid=454
    77Author: grum@piwigo.org
    88Author URI: http://photos.grum.fr
     
    101101|         |            |   . Impossible to upload kml file
    102102|         |            |
     103| 1.3.2   | 2011-09-22 | * mantis bug:2063
     104|         |            |   . Incompatibility with slideshow mode
     105|         |            |
     106|         |            | * mantis bug:2346
     107|         |            |   . Preview / next arrow do not work with [gmaps] tag
     108|         |            |     in description
     109|         |            |
     110|         |            |
    103111|         |            |
    104112|         |            |
  • extensions/GMaps/templates/gmaps_category.tpl

    r10551 r12204  
    33{combine_script id="jquery.ui.dialog" path="themes/default/js/ui/minified/jquery.ui.dialog.min.js"}
    44{combine_script id="maps.google.com/api" path="http://maps.google.com/maps/api/js?sensor=false"}
    5 {combine_script id="gmaps.category" path="plugins/GMaps/js/gmapsCategory.min.js" require="jquery.ui"}
    65
    76{foreach from=$maps item=map}
     
    1110{/foreach}
    1211
    13 
    14 <div id='iGMapsInfoWindow' style='display:none;'>
    15   <div id='iGMapsInfoWindowContent'>
    16     <div id='iGMIWC_title'>Titre de la photo</div>
    17 
    18     <table id='iGMIWC_thumb'>
    19       <tr>
    20         <td style='width:28px;'><div id='iWALeft' onclick='displayPicturePrev();'></div></td>
    21         <td>
    22           <img id='iGMIWC_img' src=''>
    23         </td>
    24         <td style='width:28px;'><div id='iWARight' onclick='displayPictureNext();'></div></td>
    25       </tr>
    26     </table>
    27 
    28     <div id='iGMIWC_picnum'>0/0 photo</div>
    29 
    30     <div id='iGMIWC_showcat' style='display:none;'>
    31       <span>{'gmaps_i_show_this_picture_in'|@translate}</span>
    32       <ul id='iGMIWC_showcatList'>
    33       </ul>
    34     </div>
    35   </div>
    36 </div>
Note: See TracChangeset for help on using the changeset viewer.