Ignore:
Timestamp:
Dec 22, 2010, 7:04:12 AM (13 years ago)
Author:
rvelices
Message:

rv_gmaps internal - prepare migration to api V3

Location:
extensions/rv_gmaps/trunk/template
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • extensions/rv_gmaps/trunk/template/data_loader.js

    r8039 r8220  
    120120        }
    121121        var digits = Math.max( getLatLonDigits(latRange,4,2), getLatLonDigits(lonRange,4,2) );
    122         /*var box = new google.maps.LatLngBounds(
    123                         new google.maps.LatLng( Math.roundN(bounds.getSouthWest().lat()-sd,digits), Math.roundN( bounds.getSouthWest().lng()-wd,digits ) ),
    124                         new google.maps.LatLng( Math.roundN(bounds.getNorthEast().lat()+nd,digits), Math.roundN( bounds.getNorthEast().lng()+ed,digits) )
    125                 );*/
    126122        var box = new google.maps.LatLngBounds( bounds.getSouthWest(), bounds.getNorthEast() );
    127123        box.extend( new google.maps.LatLng( Math.roundN(bounds.getSouthWest().lat()-sd,digits), Math.roundN( bounds.getSouthWest().lng()-wd,digits ) ) );
     
    146142        try {
    147143                google.maps.Event.trigger( this, "dataloading" );
    148                 GDownloadUrl(url, pwgBind(this, this._onDataReceived) );
     144                jQuery.ajax( {
     145                        url: url.replace('.php','x.php'),
     146                        success: pwgBind(this, this._onAjaxSuccess),
     147                        error: pwgBind(this, this._onAjaxError),
     148                        });
    149149        }
    150150        catch (e) {
     
    155155},
    156156
    157 _onDataReceived: function(data, responseCode)
     157_onAjaxSuccess: function(data, textStatus, xhr)
    158158{
    159159        var resp;
    160160        try
    161161        {
    162                 if (responseCode!=200)
    163                 {
    164                         this._previousLoadDataReq.box=null;
    165                         google.maps.Event.trigger( this, "dataloadfailed", responseCode, null );
    166                 }
    167                 else
    168                 try
    169                 {
    170                         eval('resp = ' + data);
    171                         if (resp.nb_items == undefined)
    172                                 throw new Error( "DATA DECODING ERROR" );
    173 
    174                         this._previousLoadDataReq.resultBounds = resp.bounds;
    175                         if (document.is_debug && resp.debug) google.maps.Log.write( resp.debug );
    176                         google.maps.Event.trigger( this, "dataloaded", resp );
    177                 }
    178                 catch (e)       {
    179                         this._previousLoadDataReq.box=null;
    180                         google.maps.Event.trigger( this, "dataloadfailed", responseCode, e );
    181                         var s = e.message;
    182                         s += '\n' + data.substr(0,1000);
    183                         alert( s );
    184                 }
     162                eval('resp = ' + data);
     163                if (resp.nb_items == undefined)
     164                        throw new Error( "DATA DECODING ERROR" );
     165                this._previousLoadDataReq.resultBounds = resp.bounds;
     166                if (document.is_debug && resp.debug) google.maps.Log.write( resp.debug );
     167                google.maps.Event.trigger( this, "dataloaded", resp );
     168        }
     169        catch (e)       {
     170                this._previousLoadDataReq.box=null;
     171                google.maps.Event.trigger( this, "dataloadfailed", responseCode, e );
     172                var s = e.message;
     173                s += '\n' + data.substr(0,1000);
     174                alert( s );
    185175        }
    186176        finally {
    187177                this._dataLoading = false;
    188178        }
    189 }
     179},
     180
     181_onAjaxError: function(xhr, textStatus, exc)
     182{
     183        try {
     184                google.maps.Event.trigger( this, "dataloadfailed", textStatus + xhr.status, exc );
     185        }
     186        catch (e) {
     187        }
     188        finally {
     189                this._dataLoading = false;
     190        }
     191},
    190192
    191193}
  • extensions/rv_gmaps/trunk/template/map.tpl

    r8039 r8220  
    2121<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key={$GMAPS_API_KEY}&amp;hl={$lang_info.code}" type="text/javascript"></script>
    2222
    23 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.js" type="text/javascript"></script>
     23<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script>
    2424<script type="text/javascript">jQuery.noConflict();</script>
    2525<script src="{$PLUGIN_ROOT_URL}/template/nyroModal/jquery.nyroModal-1.6.2.js" type="text/javascript"></script>
  • extensions/rv_gmaps/trunk/template/picture_map_content.tpl

    r8029 r8220  
    11{html_head}
    22<script src="http://maps.google.com/maps/api/js?sensor=false&amp;hl={$lang_info.code}" type="text/javascript"></script>
    3 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.js" type="text/javascript"></script>
     3<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script>
    44<script src="{$PLUGIN_ROOT_URL}/template/nyroModal/jquery.nyroModal-1.6.2.js" type="text/javascript"></script>
    55<link href="{$PLUGIN_ROOT_URL}/template/nyroModal/nyroModal.css" rel="stylesheet" type="text/css">
Note: See TracChangeset for help on using the changeset viewer.