Ignore:
Timestamp:
Oct 20, 2010, 10:49:29 PM (14 years ago)
Author:
grum
Message:

fix bug and implement new features
bug:1926, bug:1927, bug:1929, bug:1930, bug:1931, bug:1939, bug:1946

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/GMaps/templates/gmaps_dialog_area_choose.tpl

    r7177 r7308  
    1515{
    1616  var bounds = {
    17     north:0,
    18     south:0,
    19     east:0,
    20     west:0
    21   }
    22   var requestId = '';
    23 
    24   var dialogGMapsOptions = {
    25       id:'',
    26       eventOk:null,
    27       cBuilder:null,
    28       gMap:null,
    29     };
     17        north:0,
     18        south:0,
     19        east:0,
     20        west:0
     21      },
     22      requestId = '',
     23      callId=0,
     24      dialogGMapsOptions = {
     25        id:'',
     26        eventOk:null,
     27        cBuilder:null,
     28        gMap:null,
     29      };
    3030
    3131
     
    194194   * load markers from the server
    195195   */
    196   function loadMarkers()
    197   {
     196  var loadMarkers = function ()
     197  {
     198    callId++;
     199
    198200    datas={
    199201      requestId:requestId,
     202      callId:callId,
    200203      bounds:{
    201204          north:bounds.north,
     
    211214
    212215    $('#iDialogGMapNfo').html('<img src="./plugins/GrumPluginClasses/icons/processing.gif"><span>{/literal}{"gmaps_loading"|@translate}{literal}</span>');
    213     $('#iDialogGMapWaiting').css(
    214       {
    215         width:$('#iDialogGMapsMap').width()+'px',
    216         height:$('#iDialogGMapsMap').height()+'px',
    217         top:(1+$('#iDialogGMapsMap').position().top)+'px',
    218         left:(1+$('#iDialogGMapsMap').position().left)+'px',
    219         display:'block'
    220       }
    221     );
    222216
    223217    $.ajax(
     
    231225          {
    232226            tmp=$.parseJSON(msg);
    233             tmp.markers.sort(compareMarkers);
    234             applyMarkers(tmp.markers);
    235             $('#iDialogGMapNfo').html(tmp.datas.nbPhotos);
    236             $('#iDialogGMapWaiting').css('display', 'none');
     227            if(tmp.callId==callId)
     228            {
     229              tmp.markers.sort(compareMarkers);
     230              applyMarkers(tmp.markers);
     231              $('#iDialogGMapNfo').html(tmp.datas.nbPhotos);
     232            }
    237233          }
    238234      }
     
    257253      while(i<dialogGMapsOptions.gMap.markers.length)
    258254      {
    259         newListIndex=markerInList(dialogGMapsOptions.gMap.markers[i].uniqueId, markers);
     255        newListIndex=markerInList(dialogGMapsOptions.gMap.markers[i].uId, markers);
    260256        if(newListIndex==-1)
    261257        {
     
    290286        {
    291287          marker:marker,
    292           uniqueId:markers[i].uniqueId
     288          uId:markers[i].uId
    293289        }
    294290      );
     
    298294  function compareMarkers(m1,m2)
    299295  {
    300     if(m1.uniqueId<m2.uniqueId)
     296    if(m1.uId<m2.uId)
    301297    {
    302298      return(-1);
    303299    }
    304     else if(m1.uniqueId<m2.uniqueId)
     300    else if(m1.uId<m2.uId)
    305301    {
    306302      return(1);
     
    309305  }
    310306
    311   function markerInList(uniqueId, markerList)
     307  function markerInList(uId, markerList)
    312308  {
    313309    for(var i=0;i<markerList.length;i++)
    314310    {
    315       if(markerList[i].uniqueId==uniqueId) return(i)
     311      if(markerList[i].uId==uId) return(i)
    316312    }
    317313    return(-1);
     
    473469  <div id='iDialogGMapNfo'>&nbsp;</div>
    474470  <div id='iDialogGMapsMap' style='width:95%; height:95%;margin-left:auto;margin-right:auto;border:1px solid;'></div>
    475   <div id='iDialogGMapWaiting' style="display:none;"></div>
    476471</div>
    477472
Note: See TracChangeset for help on using the changeset viewer.