Changeset 22703 for trunk/admin


Ignore:
Timestamp:
May 16, 2013, 10:46:21 PM (11 years ago)
Author:
rvelices
Message:

feature 2885: Add geoip info in the stats / history page - fixes and add a location map image

Location:
trunk/admin/themes/default
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/themes/default/js/jquery.geoip.js

    r22683 r22703  
    1010                        if (cache) {
    1111                                cache = JSON.parse(cache);
    12                                 for (var ip in cache) {
    13                                         var data = cache[ip];
     12                                for (var key in cache) {
     13                                        var data = cache[key];
    1414                                        if ( (new Date()).getTime() - data.reqTime > 36 * 3600000)
    15                                                 delete cache[ip];
     15                                                delete cache[key];
    1616                                }
    1717                                GeoIp.cache = cache;
     
    3232                                dataType: "jsonp",
    3333                                cache: true,
     34                                timeout: 5000,
    3435                                success: function(data) {
    3536                                        data.reqTime = (new Date()).getTime();
     
    4849
    4950                                error: function() {
    50                                         var data = {ip:ip, fullName:"", reqTime: (new Date()).getTime()};
     51                                        var data = {ip:ip, reqTime: (new Date()).getTime()};
    5152
    5253                                        GeoIp.cache[ip] = data;
  • trunk/admin/themes/default/template/history.tpl

    r22683 r22703  
    139139
    140140{footer_script}{literal}
     141jQuery(document).ready( function(){
    141142jQuery(".IP").one( "mouseenter", function(){
    142143        var that = $(this);
     
    148149        GeoIp.get( that.text(), function(data) {
    149150                if (!data.fullName) return;
     151                var content = data.fullName;
     152                if (data.latitude && data.region_name) {
     153                        content += "<br><img width=300 height=220 src=\"http://maps.googleapis.com/maps/api/staticmap?sensor=false&size=300x220&zoom=6"
     154                                + "&markers=size:tiny%7C" + data.latitude + "," + data.longitude
     155                                + "\">";
     156                }
    150157                that.tipTip( {
    151                         content: data.fullName
     158                        content: content,
     159                        maxWidth: 320
    152160                        }       );
    153161                if (that.data("isOver"))
     
    155163        });
    156164} );
     165});
    157166{/literal}{/footer_script}
Note: See TracChangeset for help on using the changeset viewer.