<?php
// $Id$

// Atomic Ant Simplemap module
// Julian Thompson 2009
// julian@atomicant.co.uk
// www.atomicant.co.uk

/**
 * @file
 * Provides infrequently used pages for simplemap.
 */

function _simplemap_help($path, $arg) {
  $output = '';
  switch ($path) {
    case 'admin/build/block':
      $output = '<p>' . t('Use the <a href="@url">add map block page</a> to create a customizable map block. You will then be able to configure your map block before adding it.', array('@url' => url('admin/build/block/add-map-block'))) . '</p>';
      if (module_exists('help')) {
        $output .= theme('more_help_link', url('admin/help/simplemap'));
      }
    break;

    case 'admin/build/block/configure':
    case 'admin/build/block/add-map-block':
      if (module_exists('help')) {
        $output = '<p>' . t('To learn more about configuring map blocks, see <a href="@url">simplemap&apos;s detailed help</a>.', array('@url' => url('admin/help/simplemap'))) . '</p>';
      }
    break;

    case 'admin/help#simplemap':
      drupal_add_css(drupal_get_path('module', 'simplemap') .'/css/simplemap.admin.css'); 
      $output =
        '<p></p>'
      . '<h3>' . t('Configuring Simplemap') . '</h3>'
      . '<p>' . t('To use simplemap you will need a google maps api key which you can set on the <a href="@url">simplemap configuration page</a>. If you have installed the gmaps module simplemap will use this key instead and the configuration options will not be shown.', array('@url' => url('admin/settings/simplemap'))) . '</p>'
      . '<h3>' . t('Adding map blocks') . '</h3>'
      . '<p>' . t('To add new map blocks, use the "Add map block" tab (or button) on the <a href="@url">administer blocks page</a>. You will then be able to configure your map block before adding it.', array('@url' => url('admin/build/block'))) . '</p>'
      . '<h3>' . t('Configuring map blocks') . '</h3>'
      . '<p>' . t('When adding or configuring a map block, several configuration options are available:') . '</p>'
      . '<dl>'
      . '<dt><strong>' . t('Block title') . '</strong></dt>'
      . '<dd>' . t('The title of this block as displayed to the viewer. Use &lt;none&gt; to hide the title.  If unset the Location title will be used.').'</p></dd>'
      . '<dt><strong>' . t('Location title') . '</strong></dt>'
      . '<dd>' . t('The location title is used in the block administration screen and as the blocks title if Block Title is unset.') . '</dd>'
      . '<dt><strong>' . t('Map') . '</strong></dt>'
      . '<dd>' . t('The map center and zoom level will be pretty much what you get in your end map depending on the sizes configured in your style sheets.  Drag the map to move around. Click to add a marker.  Double click to zoom.  Markers can be configured/deleted by clicking directly on a marker.') . '</dd>'
      . '<dt><strong>' . t('Map Center Address') . '</strong></dt>'
      . '<dd>' . t('Type an address for the center of the map. This is only used to help you locate a position on the map.  Just type an address and the map will be updated automatically.') . '</dd>'
      . '<dt><strong>' . t('Markers') . '</strong></dt>'
      . '<dd>' . t('Markers may be updated by clicking them or their position changed by dragging the marker.  A marker can be deleted by clicking on the delete or edit links.  If no details are specified the marker will not have an info window.  If only one marker is added then this marker will be open by default.') . '</dd>'
      . '<dt><strong>' . t('Map Center Latitude (Advanced)') . '</strong></dt>'
      . '<dd>' . t('The map center latitude can be set or viewed here.  Just edit the value and the map will update automatically.') . '</dd>'
      . '<dt><strong>' . t('Map Center Longitude (Advanced)') . '</strong></dt>'
      . '<dd>' . t('The map center latitude can be set or viewed here.  Just edit the value and the map will update automatically.') . '</dd>'
      . '<dt><strong>' . t('Available Map Types (Advanced)') . '</strong></dt>'
      . '<dd>' . t('Choose the types of maps that the viewer can access. Note you can\'t remove the currently active type.') . '</dd>'
      . '</dl>'
      . '<h3>' . t('Styling map blocks') . '</h3>'
      . '<p>' . t('Themers can use the simplemapid and mapcanvas class to size and scale the map and change the border settings.') . '</p>'
      . '<dl>'
      . '<dt>' . theme('placeholder', 'Info window') . '</dt>'
      . '<dd>' . t('A %div wrapped around the info window title and content allows styling of info window content.  The class of all info windows is "markercontent".  Titles have the class "locationtitle" and content "locationcontent".  Individual cases per map can be styled using appropriately nested styles. An individual info window can be accessed using the id "MAPID-marker-MARKERINDEX"', array('%div' => '<div>')) . '</dd>'
      . '</dl>'
      . '<dl>'
      . '<dt>' . theme('placeholder', 'Markers') . '</dt>'
      . '<dd>'
      . '<p>' . t('Markers can be styled by creating a "simplemap.markers" file within the active theme folder.  This can contain sections \'default\', \'MAPID-default\' and \'MAPID-markerID\'.  You can see a list of the marker ids within the map block edit page.  Please save the map before referring to id\'s as markers may be reindexed on save. An EXAMPLE configuration could look like :') . '</p>'
      . '<p class="simplemapcodeblock">[default]<br/>image-path=images/simplemap1-marker.png<br/><span class="optional">image-width=67</span><br/><span class="optional">image-height=99</span><br/><span class="optional">shadow-path=images/simplemap1-markershadow.png</span><br/><span class="optional">shadow-width=101</span><br/><span class="optional">shadow-height=99</span><br/><span class="optional">iconanchor-x=32</span><br/><span class="optional">iconanchor-y=99</span><br/><span class="optional">infoanchor-x=5</span><br/><span class="optional">infoanchor-y=1</span><br/><br/>[simplemap1-default]<br/>image-path=images/simplemap1-car.png<br/><span class="optional">image-width=67</span><br/><span class="optional">image-height=99</span><br/><span class="optional">shadow-path=images/simplemap1-carshadow.png</span><br/><span class="optional">shadow-width=101</span><br/><span class="optional">shadow-height=99</span><br/><span class="optional">iconanchor-x=32</span><br/><span class="optional">iconanchor-y=99</span><br/><span class="optional">infoanchor-x=5</span><br/><span class="optional">infoanchor-y=1</span><br/><br/>[simplemap1-marker2]<br/>image-path=images/simplemap1-bus.png<br/><span class="optional">image-width=67</span><br/><span class="optional">image-height=99</span><br/><span class="optional">shadow-path=images/simplemap1-busshadow.png</span><br/><span class="optional">shadow-width=101</span><br/><span class="optional">shadow-height=99</span><br/><span class="optional">iconanchor-x=32</span><br/><span class="optional">iconanchor-y=99</span><br/><span class="optional">infoanchor-x=5</span><br/><span class="optional">infoanchor-y=1</span><br/></p>'
      . '<p>Grey values are optional but recommended.  Image sizes will be calculated if not provided - which will add a tiny overhead. An example simplemap.markers is included in the simplemap module under \'example files\'</p>'
      . '<h4>image-path</h4>'
      . '<p>The path to the marker image relative to the theme</p>'
      . '<h4>image-width <em>and</em> image-height</h4>'
      . '<p>The widths and heights of the marker image respectfully.</p>' 
      . '<h4>shadow-path</h4>'
      . '<p>The path to the marker shadow image relative to the theme</p>'
      . '<h4>shadow-width <em>and</em> shadow-height</h4>'
      . '<p>The widths and heights of the marker shadow image respectfully.</p>'  
      . '<h4>iconanchor-x <em>and</em> iconanchor-y</h4>'
      . '<p>Where the anchor point of the marker is. Relative to the top left corner of the image.</p>'      
      . '<h4>infoanchor-x <em>and</em> infoanchor-y</h4>'
      . '<p>Where the info window should be anchored to the marker. Relative to the top left corner of the image.</p>'
      . '</dd>'
      . '</dl>'
      . '<p>Simplemap was written by Julian Thompson from <a href="http://www.atomicant.co.uk" target="_blank">Atomic Ant Limited</a></p>';
    break;
  }
  return $output;
}
