Dashboard > blojsom > ... > Available Plugins > IP to Country Plugin
  blojsom Log In   View a printable version of the current page.  
  IP to Country Plugin
Added by David Czarnecki, last edited by David Czarnecki on Jan 17, 2006  (view change)
Labels: 
(None)

Availability

The IP to Country plugin can be downloaded from the blojsom plugins download page.

Overview

Adds country information to each blog entry's comment, based on the IP address metadata of the comment. This plugin uses the CSV data from IP-to-Country.

Screenshot

Changelog

v0.2 (03-09-2005): Improved country information retrieval by checking only unique IP addresses. Improved file access by reading the file once per request, instead of per comment.

v0.1 (13-06-2005): Initial release. Requires Blojsom 2.17 or later.

Other Downloads

IpToCountry CSV Data: iptocountry-csv-08062005.zip (last updated on 08 Jun 2005). You can download the latest file from IP-to-Country web site.

IpToCountry Flag Images: iptocountry-flag.zip. You can also download this file from GeoIP.

Build

IP-to-Country plugin uses Ant to build the source.

ant jar-pkg

Installation

Place the iptocountryplugin-version.jar in your WEB-INF/lib directory.

In your global /WEB-INF/plugin.properties file, add the following line:

iptocountry=com.mbledug.blojsom.plugin.iptocountry.IpToCountryPlugin

Add "iptocountry" to one of the flavor-based plugin chains. These plugin chains can be found in the individual user's plugin.properties file. You can place it anywhere within the chain, however I recommend placing iptocountry plugin near the end of the plugin chain. For example:

html.blojsom-plugin-chain=..., iptocountry

Unzip the CSV data and place it under /WEB-INF/. By default, the Ip-to-Country plugin expects the CSV data file in [blojsom-installation-directory] + [blojsom-configuration-base-directory] + "ip-to-country.csv". Change the location accordingly if you have modified your blojsom.properties file.

You can override this default location by specifying the plugin-iptocountry initialization parameter for BlojsomServlet in /WEB-INF/web.xml.

<init-param>
  <param-name>plugin-iptocountry</param-name>
  <param-value>/full/path/to/ip-to-country.csv</param-value>
</init-param>

Unzip the flag images file and place the images under "/images" directory. You can use a different location and change the img src value specified in your comments template file.

Usage

In your comments template (e.g. asual-comments.vm), add the following code.

#if ($entryComment.getMetaData().get("blojsom-plugin-iptocountry"))
  #set ($ipToCountry = $entryComment.getMetaData().get("blojsom-plugin-iptocountry"))
  from <img src="$BLOJSOM_BLOG.getBlogBaseURL()/images/flag/${ipToCountry.countryCode.toLowerCase()}.gif" alt="$ipToCountry.countryName"/>
  ($ipToCountry.countryName)
#end

Site running on a free Atlassian Confluence Open Source Project License granted to blojsom. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.4 Build:#809 Jun 12, 2007) - Bug/feature request - Contact Administrators