Extension:UserLocalization

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual
Crystal Clear action run.png
UserLocalization

Release status: experimental

Implementation Parser function, User activity
Description Allows to display the home and editing locations of WikiUsers
Author(s) Christian Willmes (cwillmestalk)
Latest version 0.1
License GPL
Download http://svn.christian-willmes.de/usermap
Hooks used
ArticleSaveComplete

Translate the UserLocalization extension if it is available at translatewiki.net

Check usage and version matrix; code metrics

Introduction[edit | edit source]

The UserLocalization MediaWiki Extension (ULE) provides tags to integrate [OpenLayers] maps with information about the spatial location of the contributing users of a MediaWiki installation.

The UsereLocalization Extension provides four different maps:

  • The UserHomeMap: A map for each User for showing his home location on his 'User:Username' page.
  • The Usermap: A map of all wiki user home locations.
  • The UserEditLocationMap: A map of the Locations from where a User edited a wiki article.
  • The ArticleEditLocationMap: A map of the locations from whre an wiki article was edited.

System Overview[edit | edit source]

The users of the Wiki providing their home location (Coordinates and if they want also the adress) with the 'ulMap' tag syntax as described below. This information for each user get stored in a PostGIS enabled PostgresSQL data table. The Extension also implemnts a wiki save hook. This can be seen as an event, which is triggered each time an article of the wiki gets saved. From this hook the IP adress from the editing user is looked up for its geo coordinates with the service of [hostip.info], this geo information connected to the articlename and the editing user is stored in a second PostGIS enabled Postgres database table.

The application uses the following third party software e.g. services:

Installation[edit | edit source]

Download and unpack the Extension[edit | edit source]

  • Download the extension code from [here].
  • Unpack the compressed Folder to your MediaWiki Extension folder (i.e. <path to your mediawiki>/extensions).

Setting up the Database[edit | edit source]

To run the UserLocalization Extension you need to have access to a PostgreSQL Database with PostGIS extension installed.

  • In the 'ulDB.php' file in the UserLocalization Folder edit the Database access information.
#Database connection information
$server = "<host>";
$db = "<dbname>";
$user = "<user>";
$pass = "<password>";
  • create a new database or add the following two tables to an exsisting database in your PostGIS enabled PostgreSQL server.
-- Table: editlocation

-- DROP TABLE editlocation;

CREATE TABLE editlocation
(
  uname character varying(30),
  article character varying(50),
  "timestamp" character varying(11),
  ip character varying(16),
  city character varying(25),
  country character varying(25),
  "location" geometry
)
-- Table: users

-- DROP TABLE users;

CREATE TABLE users
(
  uname character varying(30),
  rname character varying(30),
  locationname character varying(50),
  "location" geometry
)

The easiest way to do this, is to copy/paste these two SQL's into the SQL-Query Tool from pgAdmin or phppgAdmin. If you don't have access to either of this two tools, you can copy the SQL's to an textfile each and named it for instance 'users.sql'. and 'editlocation.sql' and run the following command from your servers command line.

psql -f users.sql <dbname>

psql -f editlocation.sql <dbname>

Edit LocalSettings.php[edit | edit source]

  1. Include the following line into the LocalSettings.php of your MediaWiki installation:
include_once('extensions/UserLocalization/userLocalization.php');

Showing a Map[edit | edit source]

A Map is shown by including a pre defined (parser) tag into a wiki page. These tags have a given syntax for the parametes which are given to the map render functions described below. The parameters for width, height and zoom are optional, if not given, a standart value is set.

UserHomeMap: Map of a users home location[edit | edit source]

This map can only be included on the Users User:Username page in the MediaWiki. Because from this tag the UserLocalization system gets the home location (Lat/Lon) of the user. Because of that this map should only included once per User in a MediaWiki Installation. Additionaly the system gets the Usernam string from the Title of the Wiki page in particular the string after the 'User:' namespace.

To include the map use the following syntax:

{{#ulMap Longitude|Latitude|Adress|Real Name|width|height|zoom}}

Example:

{{#ulMap: 6.9|50.941|Cologne, Germany|Christian Willmes|400px|250px|4}}

UserMap: Map of the home locations of the Wiki users[edit | edit source]

This map shows the home locations of all users, which includet the 'ulMap' tag on their user page.

{{#ulUserMap: width|height|zoom}}

Example:

{{#ulUserMap: 890px|460px|2}}

UserEditLocationMap: Map of the users edit locations[edit | edit source]

This map shows the locations from where a user has edited wiki artikles. For each location the number of edits and the edited articles are shown in the marker popup.

{{#ulUserEditLocation: User|width|height|zoom}}

Example:

{{#ulUserEditLocation: Christian|400px|300px|3}}

ArticleEditLocationMap: Map of the edit locations of an article[edit | edit source]

This map shows the locations from where users have edited the given wiki article.

{{#ulArticleEditLocation: Article|width|height|zoom}}

Example:

{{#ulArticleEditLocation: UserLocalization_Documentation|600px|350px|2}}