GITHUB and instructions

Maybe something has been changed since GITHUB were made in 2010 by Morten Wulff
and it's NOT online anymore on GITHUB

Technic, instructions and files

At the moment it's Drupal 6. Modules Gmap and Location are used. Also custom module called toilet_map.modul. And mobile_feed.module which is especially for getting data from online map updated at once for Android and iPhone apps. But what make this so great and special are these javascript-files FindToiletMap.js and init_v3.js in Google Maps API v3.

There is a LOT more info in this GoogleDoc for the interested. :-)

The site is made up of two major components: A Drupal site for handling data entry and a custom map for displaying the information.

This page only covers the configuration of the Drupal site.

# Data collection

The site uses a custom content type to collect data on public toilets. Users can get access to create and manage data for a specific geographic region.

## The basics

The "toilet" content type uses basic CCK fields to capture data such as toilet type, available facilities, etc. Custom content types are used to make it possible to add images and information on hours of operation.

A single taxonomy "Kommune" (municipality) is used to group toilets. When used in conjunction with the Forced term module, this makes it possible to ensure that all toilets created by a specific municipality are tagged with the correct taxonomy term. The taxonomy is used to provide simple filtering on the map display.

Go to Administer > Content management > Content types to take a closer look at how the individual fields have been configured.

## Location

All location information is handled by the Location module. It provides a custom CCK field type which makes it possible to either enter an address or specific coordinates when creating a new toilet node.

If the user enters a latitude and longitude, those values are stored on the node. If the user only enters an address, the module will use the Google geocoder API to figure out the coordinates for the address. Go to Administer > Site configuration > Location > Geocoding options to modify the accuracy settings for the geocoder.

In addition to the Location module, the GMap module is used to provide a map view when adding or editing a toilet node. This lets the user choose a location by clicking directly on the map. This can behavior can be modified by changing the general settings for the Location module at Administer > Site configuration > Location. The size, default zoom level, and other settings for the map can be modified at Administer > Site configuration > GMap.

# Data display

The data entered by the users can be displayed on a map (the main interface), as custom XML feeds, or in sortable table view in the backend.

## Map

The data for the custom map widget is provided by the following views:

* **toilet_node** provides information on a specific toilet
* **toilet_term** provides information on all toilets in a specific region
* **toilet_proximity** provides information on all toilets within a given radius of a point

When the user changes the filter settings in the main map view, the code in FindToiletMap.js calls one of the following callbacks to retrieve information for display on the map:

* **/xml/node/[nid]**
* **/xml/term/[tid]**
* **/xml/proximity/[coords_radius]/[type]/[limit]**

For a full description of the various options, refer to the feeds page on the demo site:

The *toilet_proximity* view uses some of the handlers provided by the Location module to make proximity searches possible. The following handlers are used:

* **Location proximity argument** The argument handler accepts input on the form [latitude],[longitude]_[distance]. The distance part is optional. It can be configured to use either kilometers or miles as the unit and to use either circular or rectangular proximity. This is the handler that receives coordinates from the map widget.
* **Location distance field** The field handler is used to display the distance of each toilet from the location given in the argument. It uses custom PHP code grab the latitude and longitude from the argument.
* **Location distance sort** The sort handler is used to sort the nodes in the view so that the nodes close to the location given in the argument are shown before nodes further away.

## Feeds

In addition to the feeds used by the map widget, the view *toilet_all* makes it possible to get information on all toilets in the database at once.

All the basic views are configured with two displays: One for creating output in XML format (using the "Views bonus" module) and one for creating output in RSS format. The view *toilet_feeds* provides an overview of all feeds related to a specific region.

## Administration

To make administration easier for the users providing data for the site, the view *toilet_overview* provides a table of all content owned by the current user (i.e. the account used by Københavns Kommune will only be able to see toilets in Copenhagen in the table).

# Rules

All views except *toilet_overview* are cached to improve performance. To make sure that the cache doesn't contain stale data, the Rules and Rules actions modules are used to clear the views cache when content is added or edited. You can edit the rules at Administer > Rules > Triggered rules.

Currently only the caches for the views used by the map widget are cleared.

In addition to clearing cache, the custom rules are used to modify the node title and populate the "field_nid" field.

# Features

To make it possible to manage the code using a version control system, all views and the most important settings have been exported to code using the Features module.

Most of the files in the "toilet_map" module have been generated by Features. They contain exported views, user permissions, content types, etc. They are not meant to be modified manually!

Whenever you add new content types, views or settings to the site, you can go to Administer > Site building > Features and recreate the Toilet Map feature. When you recreate a feature you can select which components you want to add to or remove from the feature. When you are satisfied with the settings, you simply bump the version number and download the new version of the feature.

The Features module is mainly for use by developers to make it easier to handle configuration changes and other administrative tasks.

Further information is available in the Features handbook and the draft KIT Feature Specification:


This document details how to set up a local or hosted copy of the site.

# Requirements

Find Toilet requires the following software to run:

* Apache

You can either set up an account with a hosting provider or run the server software locally by installing MAMP, WampServer, or a similar package.

If you don't want to download Pressflow and all the required modules by hand, you must have a working installation of Drush. You can grab the latest versions from

This guide doesn't cover the installation and configuration of the required software.

# Install Drupal core and required modules

Before you can start installing Drupal, you must grab the latest copy of the findtoilet project from GitHub:

git clone git://

When you have cloned the repository, you can download all the necessary software either manually or using drush.

## Manually

First, you'll need to install Drupal core. In this case we'll be grabbing the latest version of Pressflow 6 from the following URL:

When you have downloaded Pressflow, you must extract it somewhere in the webserver's document root. Follow the installation instructions in the Pressflow package to configure the settings.php file and prepare for installation.

Next, you must install all necessary contrib modules. Use the list of modules in the findtoilet.make file as a guide to what you need to download from Get the latest Drupal 6 versions of all modules and install them in the sites/all/modules/contrib folder.

## Using drush make

If drush is available on your system, you can run the following command to install all the necessary software:

drush make findtoilet.make findtoilet

This will create a new Drupal site in a folder named "findtoilet".

## Adding custom code

Before you can start the installation process, you must add the custom code from the repository to the site. Three folders have to be added to the Drupal site:

1. Copy the "features" folder to the "sites/all/modules" folder in the Drupal site
2. Copy the "profiles/findtoilet" folder to the "profiles" folder in the Drupal site
3. Copy the "themes/subgarland" folder to the "sites/all/themes" folder in the Drupal site

## Run the installation script

Now you are ready to run the installation script. Follow the installation instructions provided in the Pressflow package, but select the "" profile. This will enable all required modules during the installation process.

When the installer finishes you must go to Administer > Site building > Features and enable the "Toilet Map" feature. This will set up the content types, views, etc. needed to display the main map and provide the various data feeds.

Finally, you must add some data to the municipality taxonomy and set up a Google Maps key for the site. Go to Administer > Site configuration > GMap to enter the API key provided by Google.

The site uses the following third party modules from

* **Administration menu** displays a nice menu at the top of the page
* **Advanced help** used by Views and other modules to display nice online help
* **Cache actions** a plugin for the Rules module which makes it possible to setup rules to clear specific caches
* **Content construction kit** used to add extra fields to the the basic nodes provided by Drupal
* **Coder** module used during development to catch coding style errors
* **CTools** utility module used by the Features module
* **Custom Links** adds custom links to nodes
* **Date** API module required by "office hours"
* **Demo** used to save database snapshots
* **Devel** various development tools
* **Diff** used by the Features module to display differences between the current configuration of a feature and the version that has been exported to code
* **External Links** add icons to external links and mailto: links
* **Features** used to export content types, variables and views to code
* **Filefield** makes it easy to add files to nodes
* **Filefield paths** makes it possible to set up custom paths for files uploaded with Filefield
* **Forced term** forces content created by a user to be tagged with a specific term from a taxonomy
* **Global redirect** makes sure that all content is only available on one URL
* **GMap** adds Google Maps integration
* **Image API** adds support for various image toolkits like GD and ImageMagick
* **Imagecache** makes it possible to scale and crop uploaded images automatically
* **Imagefield** an extension of filefield which adds previews of uploaded images
* **Link** a custom field type for CCK
* **Localization client** makes it easy to customize translated strings on the site
* **Localization update** helps keep all installed translations up to date
* **Location** adds a CCK location field and support for geocoding
* **Office hours** will be used to show operating hours
* **Pathauto** used to generate nice URLs
* **Rules** makes it possible to setup automatic actions for specific events
* **Strongarm** used by the Features module to export variables to code
* **Token** used by pathauto to generate nice URLs
* **Transliteration** removes weird characters from file names
* **Views** used to create various content overviews and feeds
* **Views bonus** makes it possible to generate XML files from views