From d2c695ee899446f179878e746d5b65d03cb5816e Mon Sep 17 00:00:00 2001 From: rvelices Date: Tue, 14 May 2013 19:30:26 +0000 Subject: feature 2885: Add geoip info in the stats / history page git-svn-id: http://piwigo.org/svn/trunk@22664 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/themes/default/js/jquery.geoip.js | 42 +++++++++++++++++++++++++++++++ admin/themes/default/template/history.tpl | 25 ++++++++++++++---- admin/themes/default/theme.css | 9 +++++++ 3 files changed, 71 insertions(+), 5 deletions(-) create mode 100644 admin/themes/default/js/jquery.geoip.js (limited to 'admin/themes/default') diff --git a/admin/themes/default/js/jquery.geoip.js b/admin/themes/default/js/jquery.geoip.js new file mode 100644 index 000000000..fae389190 --- /dev/null +++ b/admin/themes/default/js/jquery.geoip.js @@ -0,0 +1,42 @@ + +GeoIp = { + cache: {}, + pending: {}, + + get: function(ip, callback){ + if (GeoIp.cache.hasOwnProperty(ip)) + callback(GeoIp.cache[ip]); + else if (GeoIp.pending[ip]) + GeoIp.pending[ip].push(callback); + else { + GeoIp.pending[ip] = [callback]; + jQuery.ajax( { + url: "http://freegeoip.net/json/" + ip, + dataType: "json", + success: function(data) { + var res=[]; + if (data.city) res.push(data.city); + if (data.region_name) res.push(data.region_name); + if (data.country_name) res.push(data.country_name); + data.fullName = res.join(", "); + + GeoIp.cache[ip] = data; + var callbacks = GeoIp.pending[ip]; + delete GeoIp.pending[ip]; + for (var i=0; i -

{'History'|@translate} {$TABSHEET_TITLE}

- +

{'History'|@translate} {$TABSHEET_TITLE}

@@ -83,7 +81,7 @@ - +
@@ -124,7 +122,7 @@ {$detail.DATE} {$detail.TIME} {$detail.USER} - {$detail.IP} + {$detail.IP} {$detail.IMAGE} {$detail.TYPE} {$detail.SECTION} @@ -136,3 +134,20 @@ {if !empty($navbar) }{include file='navigation_bar.tpl'|@get_extent:'navbar'}{/if} + +{combine_script id='jquery.geoip' load='async' path='admin/themes/default/js/jquery.geoip.js'} +{combine_script id='jquery.ui.tooltip' load='footer'} + +{footer_script}{literal} +jQuery(".IP").tooltip( { + items: "*", + /*show: {delay:0, effect:"show"}, + hide: {delay:50, effect:"hide"},*/ + content: function(response) { + var that = $(this); + GeoIp.get( that.text(), function(data) { + response( data.fullName ); + }); + } +}); +{/literal}{/footer_script} \ No newline at end of file diff --git a/admin/themes/default/theme.css b/admin/themes/default/theme.css index 046d56be6..3357638b5 100644 --- a/admin/themes/default/theme.css +++ b/admin/themes/default/theme.css @@ -504,6 +504,15 @@ UL.tagSelection LI { } /* jQuery tooltips */ +.ui-tooltip { + padding: 8px; + position: absolute; + z-index: 9999; + max-width: 300px; + -webkit-box-shadow: 0 0 5px #aaa; + box-shadow: 0 0 5px #aaa; +} + .cluetip-outer { position: relative; border: 1px solid #111111; -- cgit v1.2.3