Example #1
0
/**
 * Print the Geo Mashup location editor HTML for an object.
 *
 * Goals for this interface are to make it usable for any kind of locatable
 * object, to be usable without javascript, functional on the front end or admin, 
 * and eventually adaptable to editing multiple locations for an object.
 *
 * It's assumed this will go inside an existing form for editing the object, 
 * such as the WordPress admin post edit form.
 *
 * @since 1.2
 * @see geo-mashup-ui-managers.php
 * @see geo-mashup-location-editor.js
 * @uses edit-form.css
 * @access public
 *
 * @param string $object_name The type of object, e.g. 'post', 'user', etc.
 * @param string $object_id The ID of the object being edited.
 * @param string $ui_manager Optionally the name of UI Manager class to use for AJAX operations.
 */
function geo_mashup_edit_form($object_name, $object_id, $ui_manager = '')
{
    global $geo_mashup_options;
    $help_class = 'geo-mashup-js';
    $add_input_style = 'style="display:none;"';
    $update_input_style = $delete_input_style = '';
    $coordinate_string = '';
    // Load any existing location for the object
    $location = GeoMashupDB::get_object_location($object_name, $object_id);
    if (empty($location)) {
        $location = GeoMashupDB::blank_object_location();
        $help_class = '';
        $add_input_style = '';
        $update_input_style = $delete_input_style = 'style="display:none;"';
    } else {
        $coordinate_string = $location->lat . ',' . $location->lng;
    }
    $post_location_name = $location->saved_name;
    $kml_url = '';
    // Set a Geo date default when needed & possible
    $date_missing = empty($location->geo_date) || '0000-00-00 00:00:00' == $location->geo_date;
    if ('post' == $object_name) {
        if ($date_missing) {
            // Geo date defaults to post date
            $post = get_post($object_id);
            $location->geo_date = $post->post_date;
            if (!empty($location->id)) {
                GeoMashupDB::set_object_location($object_name, $object_id, $location->id, false, $location->geo_date);
            }
        }
        // For posts, look for a KML attachment
        $kml_urls = GeoMashup::get_kml_attachment_urls($object_id);
        if (count($kml_urls) > 0) {
            $kml_url = array_pop($kml_urls);
        }
    } else {
        if ('user' == $object_name && $date_missing) {
            // Geo date defaults to registration date
            $user = get_userdata($object_id);
            $location->geo_date = $user->user_registered;
            if (!empty($location->id)) {
                GeoMashupDB::set_object_location($object_name, $object_id, $location->id, false, $location->geo_date);
            }
        } else {
            if ('comment' == $object_name && $date_missing) {
                // Geo date defaults to comment date
                $comment = get_comment($object_id);
                $location->geo_date = $comment->comment_date;
                if (!empty($location->id)) {
                    GeoMashupDB::set_object_location($object_name, $object_id, $location->id, false, $location->geo_date);
                }
            }
        }
    }
    if (empty($location->geo_date)) {
        $location_datetime = mktime();
    } else {
        $location_datetime = strtotime($location->geo_date);
    }
    $location_date = date('M j, Y', $location_datetime);
    $location_hour = date('G', $location_datetime);
    $location_minute = date('i', $location_datetime);
    // Load saved locations
    $saved_locations = GeoMashupDB::get_saved_locations();
    $saved_location_options = array();
    if (!empty($saved_locations)) {
        foreach ($saved_locations as $saved_location) {
            $escaped_name = str_replace(array("\r\n", "\r", "\n"), '', $saved_location->saved_name);
            if ($saved_location->id != $location->id) {
                $selected = '';
            } else {
                $selected = ' selected="selected"';
            }
            $saved_location_options[] = '<option value="' . esc_attr($saved_location->id . '|' . $saved_location->lat . '|' . $saved_location->lng . '|' . $saved_location->address) . '"' . $selected . '>' . esc_html($escaped_name) . '</option>';
        }
    }
    $saved_location_options = implode('', $saved_location_options);
    $nonce = wp_create_nonce('geo-mashup-edit');
    $static_maps_base_url = 'http://maps.google.com/maps/api/staticmap?sensor=false&amp;key=' . $geo_mashup_options->get('overall', 'google_key');
    ?>
	<div id="geo_mashup_location_editor">
	<div id="geo_mashup_ajax_message" class="geo-mashup-js ui-state-highlight"></div>
	<input id="geo_mashup_nonce" name="geo_mashup_nonce" type="hidden" value="<?php 
    echo $nonce;
    ?>
" />
	<input id="geo_mashup_changed" name="geo_mashup_changed" type="hidden" value="" />
	<?php 
    ob_start();
    ?>
	<table id="geo-mashup-location-table">
		<thead class="ui-widget-header">
		<tr>
			<th><?php 
    _e('Address', 'GeoMashup');
    ?>
</th>
			<th><?php 
    _e('Saved Name', 'GeoMashup');
    ?>
</th>
			<th><?php 
    _e('Geo Date', 'GeoMashup');
    ?>
</th>
		</tr>
		</thead>
		<tbody class="ui-widget-content">
		<tr id="geo_mashup_display" class="geo-mashup-display-row">
			<td class="geo-mashup-info">
				<div class="geo-mashup-address"><?php 
    echo esc_html($location->address);
    ?>
</div>
				<div class="geo-mashup-coordinates"><?php 
    echo esc_attr($coordinate_string);
    ?>
</div>
			</td>
			<td id="geo_mashup_saved_name_ui">
				<input id="geo_mashup_location_name" name="geo_mashup_location_name" size="50" type="text" value="<?php 
    echo esc_attr($post_location_name);
    ?>
" />
			</td>
			<td id="geo_mashup_date_ui">
				<input id="geo_mashup_date" name="geo_mashup_date" type="text" size="20" value="<?php 
    echo esc_attr($location_date);
    ?>
" /><br />
				@
				<input id="geo_mashup_hour" name="geo_mashup_hour" type="text" size="2" maxlength="2" value="<?php 
    echo esc_attr($location_hour);
    ?>
" />
				:
				<input id="geo_mashup_minute" name="geo_mashup_minute" type="text" size="2" maxlength="2" value="<?php 
    echo esc_attr($location_minute);
    ?>
" />
			</td>
			<td id="geo_mashup_ajax_buttons">
			</td>

		</tr>
		</tbody>
	</table>
	<?php 
    $location_table_html = ob_get_clean();
    ?>
	<?php 
    ob_start();
    ?>
	<div id="geo_mashup_map" class="geo-mashup-js">
		<?php 
    _e('Loading Google map. Check Geo Mashup options if the map fails to load.', 'GeoMashup');
    ?>
	</div>
	<?php 
    if (!empty($location->id)) {
        ?>
	<noscript>
		<div id="geo_mashup_static_map">
			<img src="<?php 
        echo $static_maps_base_url;
        ?>
&amp;size=400x300&amp;zoom=4&amp;markers=size:small|color:green|<?php 
        echo esc_attr($location->lat . ',' . $location->lng);
        ?>
" 
				alt="<?php 
        _e('Location Map Image', 'GeoMashup');
        ?>
" />
		</div>
	</noscript>
	<?php 
    }
    ?>
	<?php 
    $map_html = ob_get_clean();
    ?>
	<?php 
    ob_start();
    ?>
	<label for="geo_mashup_search"><?php 
    _e('Find a new location:', 'GeoMashup');
    ?>
	<input	id="geo_mashup_search" name="geo_mashup_search" type="text" size="35" />
	</label>

	<?php 
    _e('or select from', 'GeoMashup');
    ?>
 
	<select id="geo_mashup_select" name="geo_mashup_select"> 
		<option value=""><?php 
    _e('[Saved Locations]', 'GeoMashup');
    ?>
</option>
		<?php 
    echo $saved_location_options;
    ?>
	</select>
	<?php 
    $search_html = ob_get_clean();
    ?>

	<?php 
    echo empty($location->id) ? $search_html . $map_html . $location_table_html : $location_table_html . $map_html . $search_html;
    ?>

	<input id="geo_mashup_ui_manager" name="geo_mashup_ui_manager" type="hidden" value="<?php 
    echo $ui_manager;
    ?>
" />
	<input id="geo_mashup_object_id" name="geo_mashup_object_id" type="hidden" value="<?php 
    echo $object_id;
    ?>
" />
	<input id="geo_mashup_no_js" name="geo_mashup_no_js" type="hidden" value="true" />
	<input id="geo_mashup_location_id" name="geo_mashup_location_id" type="hidden" value="<?php 
    echo esc_attr($location->id);
    ?>
" />
	<input id="geo_mashup_location" name="geo_mashup_location" type="hidden" value="<?php 
    echo esc_attr($coordinate_string);
    ?>
" />
	<input id="geo_mashup_geoname" name="geo_mashup_geoname" type="hidden" value="<?php 
    echo esc_attr($location->geoname);
    ?>
" />
	<input id="geo_mashup_address" name="geo_mashup_address" type="hidden" value="<?php 
    echo esc_attr($location->address);
    ?>
" />
	<input id="geo_mashup_postal_code" name="geo_mashup_postal_code" type="hidden" value="<?php 
    echo esc_attr($location->postal_code);
    ?>
" />
	<input id="geo_mashup_country_code" name="geo_mashup_country_code" type="hidden" value="<?php 
    echo esc_attr($location->country_code);
    ?>
" />
	<input id="geo_mashup_admin_code" name="geo_mashup_admin_code" type="hidden" value="<?php 
    echo esc_attr($location->admin_code);
    ?>
" />
	<input id="geo_mashup_admin_name" name="geo_mashup_admin_name" type="hidden" value="" />
	<input id="geo_mashup_kml_url" name="geo_mashup_kml_url" type="hidden" value="<?php 
    echo $kml_url;
    ?>
" />
	<input id="geo_mashup_sub_admin_code" name="geo_mashup_sub_admin_code" type="hidden" value="<?php 
    echo esc_attr($location->sub_admin_code);
    ?>
" />
	<input id="geo_mashup_sub_admin_name" name="geo_mashup_sub_admin_name" type="hidden" value="" />
	<input id="geo_mashup_locality_name" name="geo_mashup_locality_name" type="hidden" value="<?php 
    echo esc_attr($location->locality_name);
    ?>
" />
	<div id="geo_mashup_submit" class="submit">
		<input id="geo_mashup_add_location" name="geo_mashup_add_location" type="submit" <?php 
    echo $add_input_style;
    ?>
 value="<?php 
    _e('Add Location', 'GeoMashup');
    ?>
" />
		<input id="geo_mashup_delete_location" name="geo_mashup_delete_location" type="submit" <?php 
    echo $delete_input_style;
    ?>
 value="<?php 
    _e('Delete', 'GeoMashup');
    ?>
" />
		<input id="geo_mashup_update_location" name="geo_mashup_update_location" type="submit" <?php 
    echo $update_input_style;
    ?>
 value="<?php 
    _e('Save', 'GeoMashup');
    ?>
" />
	</div>
	<div id="geo-mashup-inline-help-link-wrap" class="geo-mashup-js">
		<a href="#geo-mashup-inline-help" id="geo-mashup-inline-help-link"><?php 
    _e('help', 'GeoMashup');
    ?>
<span class="ui-icon ui-icon-triangle-1-s"></span></a>
	</div>
	<div id="geo-mashup-inline-help" class="<?php 
    echo $help_class;
    ?>
 ui-widget-content">
		<p><?php 
    _e('<em>Saved Name</em> is an optional name you may use to add entries to the Saved Locations menu.', 'GeoMashup');
    ?>
</p>
		<p><?php 
    _e('<em>Geo Date</em> associates a date (most formats work) and time with a location. Leave the default value if uncertain.', 'GeoMashup');
    ?>
</p>
		<div class="geo-mashup-js">
			<p><?php 
    _e('Put a green pin at a new location. There are many ways to do it:', 'GeoMashup');
    ?>
</p>
			<ul>
				<li><?php 
    _e('Search for a location name.', 'GeoMashup');
    ?>
</li>
				<li><?php 
    _e('For multiple search results, mouse over pins to see location names, and click a result pin to select that location.', 'GeoMashup');
    ?>
</li>
				<li><?php 
    _e('Search for a decimal latitude and longitude separated by a comma, like <em>40.123,-105.456</em>. Seven decimal places are stored. Negative latitude is used for the southern hemisphere, and negative longitude for the western hemisphere.', 'GeoMashup');
    ?>
</li> 
				<li><?php 
    _e('Search for a street address, like <em>123 main st, anytown, acity</em>.', 'GeoMashup');
    ?>
</li>
				<li><?php 
    _e('Click on the location. Zoom in if necessary so you can refine the location by dragging it or clicking a new location.', 'GeoMashup');
    ?>
</li>
			</ul>
			<p><?php 
    _e('To execute a search, type search text into the Find Location box and hit the enter key. If you type a name next to "Save As", the location will be saved under that name and added to the Saved Locations dropdown list.', 'GeoMashup');
    ?>
</p>
			<p><?php 
    _e('To remove the location (green pin), clear the search box and hit the enter key.', 'GeoMashup');
    ?>
</p>
			<p><?php 
    _e('When you are satisfied with the location, save or update.', 'GeoMashup');
    ?>
</p>
		</div>
		<noscript>
			<div>
				<p><?php 
    _e('To add or update location choose a saved location, or find a new location using one of these formats:', 'GeoMashup');
    ?>
</p>
				<ul>
					<li><?php 
    _e('A place name like <em>Yellowstone National Park</em>', 'GeoMashup');
    ?>
</li>
					<li><?php 
    _e('A decimal latitude and longitude, like <em>40.123,-105.456</em>.', 'GeoMashup');
    ?>
</li> 
					<li><?php 
    _e('A full or partial street address, like <em>123 main st, anytown, acity 12345 USA</em>.', 'GeoMashup');
    ?>
</li>
				</ul>
				<p><?php 
    _e('When you save or update, the closest match available will be saved as the location.', 'GeoMashup');
    ?>
</p>
			</div>
		</noscript>

	</div>
	</div><!-- id="geo_mashup_location_editor" -->
<?php 
}
        /**
         * Code for hacking form output
         * 
         * @access public
         * @return String
         */
        function formHack($args, $options)
        {
            extract($args);
            $output = "";
            if (class_exists('GeoMashupDB')) {
                global $geo_mashup_options;
                /* latest version: 1.2beta1x */
                if ($geo_mashup_options->get('overall', 'google_key')) {
                    $link_url = get_bloginfo('wpurl') . '/wp-content/plugins/geo-mashup';
                    $output = '
                  <style type="text/css"> #geo_mashup_map div { margin:0; } </style>
                  <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=' . $geo_mashup_options->get('overall', 'google_key') . '" type="text/javascript"></script>
                  <script src="' . $link_url . '/geo-mashup-admin.js" type="text/javascript"></script>
                  <script src="' . $link_url . '/JSONscriptRequest.js" type="text/javascript"></script>';
                    $output .= '
                  <?php               
                  $location =  GeoMashupDB::blank_location( );
                  $post_location_name = $location->saved_name;

                  if(isset($geo_mashup_location)) {
                        list($lat,$lng) = split(\',\',$geo_mashup_location);
                        $current_location = array( );
                        $current_location[\'lat\'] = trim( $lat );
                        $current_location[\'lng\'] = trim( $lng );
                        $current_location[\'saved_name\'] = $geo_mashup_location_name;
                        $current_location[\'geoname\'] = $geo_mashup_geoname;
                        $current_location[\'address\'] = $geo_mashup_address;
                        $current_location[\'postal_code\'] = $geo_mashup_postal_code;
                        $current_location[\'country_code\'] = $geo_mashup_country_code;
                        $current_location[\'admin_code\'] = $geo_mashup_admin_code;
                        $current_location[\'admin_name\'] = $geo_mashup_admin_name;
                        $current_location[\'sub_admin_code\'] = $geo_mashup_sub_admin_code;
                        $current_location[\'sub_admin_name\'] = $geo_mashup_sub_admin_name;
                        $current_location[\'locality_name\'] = $geo_mashup_locality_name;
                        $location = (object) $current_location;
                  } ?>';
                    $kml_url = '';
                    $saved_locations = GeoMashupDB::get_saved_locations();
                    $locations_json = '{';
                    /* don't need */
                    $locations_json .= '}';
                    $output .= '
                  <img id="geo_mashup_status_icon" src="' . $link_url . '/images/idle_icon.gif" style="float:right" />
                  <label for="geo_mashup_search">' . __('Find location:', 'GeoMashup') . '
                  <input id="geo_mashup_search" 
                         name="geo_mashup_search" 
                         type="text" 
                         size="35" 
                         value="<?php echo $geo_mashup_search; ?>"
                         onfocus="this.select(); GeoMashupAdmin.map.checkResize();"
                         onkeypress="return GeoMashupAdmin.searchKey(event, this.value)" />
                   </label>
                   <select id="geo_mashup_select" name="geo_mashup_select" onchange="GeoMashupAdmin.onSelectChange(this);" style="display:none;">
                        <option>' . __('[Saved Locations]', 'GeoMashup') . '</option>
                   </select>
                   <a href="#" onclick="document.getElementById(\'geo_mashup_inline_help\').style.display=\'block\'; return false;">' . __('Help', 'GeoMashup') . '</a>
                   <div id="geo_mashup_inline_help" style="padding:5px; border:2px solid blue; background-color:#ffc; display:none;">
                       <p>' . __('Put a green pin at the location for this post.', 'tdomf') . ' ' . __('There are many ways to do it:', 'tdomf') . '
                       <ul>
                        <li>' . __('Search for a location name.', 'tdomf') . '</li>
                        <li>' . __('For multiple search results, mouse over pins to see location names, and click a result pin to select that location.', 'tdomf') . '</li>
                        <li>' . __('Search for a decimal latitude and longitude, like <em>40.123,-105.456</em>.', 'tdomf') . '</li> 
                        <li>' . __('Search for a street address, like <em>123 main st, anytown, acity</em>.', 'tdomf') . '</li>
                        <li>' . __('Click on the location. Zoom in if necessary so you can refine the location by dragging it or clicking a new location.', 'tdomf') . '</li>
                       </ul>
                       ' . __('To execute a search, type search text into the Find Location box and hit the enter key.', 'tdomf') . '</p>
                       <p>' . __('To remove the location (green pin) for a post, clear the search box and hit the enter key.', 'tdomf') . '</p>
                       <p><a href="#" onclick="document.getElementById(\'geo_mashup_inline_help\').style.display=\'none\'; return false;">' . __('Close', 'tdomf') . '</a>
                   </div>
                   <div id="geo_mashup_map" style="width:400px;height:300px;">
                       ' . __('Loading Google map. Check Geo Mashup options if the map fails to load.', 'tdomf') . '
                   </div>
                   <script type="text/javascript">
                    //<![CDATA[
                    GeoMashupAdmin.registerMap(document.getElementById("geo_mashup_map"),
                            {"link_url":"' . $link_url . '",
                             "post_lat":"<?php echo $location->lat; ?>",
                             "post_lng":"<?php echo $location->lng; ?>",
                             "post_location_name":"<?php echo $post_location_name; ?>",
                             "saved_locations":' . $locations_json . ',
                             "kml_url":"' . $kml_url . '",
                             "status_icon":document.getElementById("geo_mashup_status_icon")});
                     // ]]>
                   </script>
                   <label for="geo_mashup_location_name" style="display:none;">' . __('Save As:', 'GeoMashup') . '
                        <input id="geo_mashup_location_name" name="geo_mashup_location_name" type="text" maxlength="50" size="45" style="display:none;"/>
                   </label>
                   <input id="geo_mashup_location" name="geo_mashup_location" type="hidden" value="<?php echo $location->lat; ?>,<?php echo $location->lng; ?>" />
                   <input id="geo_mashup_location_id" name="geo_mashup_location_id" type="hidden" value="<?php echo $location->id; ?>" />
                   <input id="geo_mashup_geoname" name="geo_mashup_geoname" type="hidden" value="<?php echo $location->geoname; ?>" />
                   <input id="geo_mashup_address" name="geo_mashup_address" type="hidden" value="<?php echo $location->address; ?>" />
                   <input id="geo_mashup_postal_code" name="geo_mashup_postal_code" type="hidden" value="<?php echo $location->postal_code; ?>" />
                   <input id="geo_mashup_country_code" name="geo_mashup_country_code" type="hidden" value="<?php echo $location->country_code; ?>" />
                   <input id="geo_mashup_admin_code" name="geo_mashup_admin_code" type="hidden" value="<?php echo $location->admin_code; ?>" />
                   <input id="geo_mashup_admin_name" name="geo_mashup_admin_name" type="hidden" value="<?php echo $location->admin_name; ?>" />
                   <input id="geo_mashup_sub_admin_code" name="geo_mashup_sub_admin_code" type="hidden" value="<?php echo $location->sub_admin_code; ?>" />
                   <input id="geo_mashup_sub_admin_name" name="geo_mashup_sub_admin_name" type="hidden" value="<?php echo $location->sub_admin_name; ?>" />
                   <input id="geo_mashup_locality_name" name="geo_mashup_locality_name" type="hidden" value="<?php echo $location->locality_name; ?>" />
                   <input id="geo_mashup_changed" name="geo_mashup_changed" type="hidden" value="" />';
                } else {
                    $output = __("<p>You must configure Geo Mashup before you can use it in TDO-Mini-Forms</p>", "tdomf");
                }
            } else {
                /* old version: 1.1.2.0 */
                $geomashupOptions = get_settings('geo_mashup_options');
                if (!is_array($geomashupOptions)) {
                    $geomashupOption = GeoMashup::default_options();
                }
                if ($geomashupOptions['google_key']) {
                    $link_url = get_bloginfo('wpurl') . '/wp-content/plugins/geo-mashup';
                    $output = '
                    <style type="text/css"> #geo_mashup_map div { margin:0; } </style>
                    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=' . $geomashupOptions['google_key'] . '" type="text/javascript"></script>
                    <script src="' . $link_url . '/geo-mashup-admin.js" type="text/javascript"></script>
                    <script src="' . $link_url . '/JSONscriptRequest.js" type="text/javascript"></script>';
                    if (!isset($geo_mashup_search)) {
                        $geo_mashup_search = "";
                    }
                    $output .= '<?php 
                   $post_lat = \'\';
                   $post_lng = \'\';
                   if(!isset($geo_mashup_location)) {
                       $geo_locations = get_settings(\'geo_locations\');
                       list($post_lat,$post_lng) = split(\',\',$geo_locations[\'default\']);
                   } else {
                       list($post_lat,$post_lng) = split(\',\',$geo_mashup_location);
                   }
                ?>';
                    $post_location_name = '';
                    $kml_url = '';
                    # We'll generate this once for the form hacker...
                    $locations_json = '{';
                    if (is_array($geo_locations)) {
                        $comma = '';
                        foreach ($geo_locations as $name => $latlng) {
                            list($lat, $lng) = split(',', $latlng);
                            $escaped_name = addslashes(str_replace(array("\r\n", "\r", "\n"), '', $name));
                            if ($lat == $post_lat && $lng == $post_lng) {
                                $post_location_name = $escaped_name;
                            }
                            $locations_json .= $comma . '"' . addslashes($name) . '":{"name":"' . $escaped_name . '","lat":"' . $lat . '","lng":"' . $lng . '"}';
                            $comma = ',';
                        }
                    }
                    $locations_json .= '}';
                    $output .= '
                <img id="geo_mashup_status_icon" src="' . $link_url . '/images/idle_icon.gif" style="float:right" />
                <label for="geo_mashup_search">' . __('Find location:', 'tdomf') . '
                <input id="geo_mashup_search" 
                    name="geo_mashup_search" 
                    type="text" 
                    size="35" 
                    value="<?php echo $geo_mashup_search; ?>"
                    onfocus="this.select(); GeoMashupAdmin.map.checkResize();"
                    onkeypress="return GeoMashupAdmin.searchKey(event, this.value);" />
                </label>
                <select id="geo_mashup_select" name="geo_mashup_select" onchange="GeoMashupAdmin.onSelectChange(this); " style="display:none;" >
                    <option>' . __('[Saved Locations]', 'GeoMashup') . '</option>
                </select>            
                <a href="#" onclick="document.getElementById(\'geo_mashup_inline_help\').style.display=\'block\'; return false;">' . __('help', 'tdomf') . '</a>
                <div id="geo_mashup_inline_help" style="padding:5px; border:2px solid blue; background-color:#ffc; display:none;">
                    <p>' . __('Put a green pin at the location for this post.', 'tdomf') . ' ' . __('There are many ways to do it:', 'tdomf') . '
                    <ul>
                        <li>' . __('Search for a location name.', 'tdomf') . '</li>
                        <li>' . __('For multiple search results, mouse over pins to see location names, and click a result pin to select that location.', 'tdomf') . '</li>
                        <li>' . __('Search for a decimal latitude and longitude, like <em>40.123,-105.456</em>.', 'tdomf') . '</li> 
                        <li>' . __('Search for a street address, like <em>123 main st, anytown, acity</em>.', 'tdomf') . '</li>
                        <li>' . __('Click on the location. Zoom in if necessary so you can refine the location by dragging it or clicking a new location.', 'tdomf') . '</li>
                    </ul>
                    ' . __('To execute a search, type search text into the Find Location box and hit the enter key.', 'tdomf') . '</p>
                    <p>' . __('To remove the location (green pin) for a post, clear the search box and hit the enter key.', 'tdomf') . '</p>
                    <p><a href="#" onclick="document.getElementById(\'geo_mashup_inline_help\').style.display=\'none\'; return false;">' . __('close', 'tdomf') . '</a>
                </div>
                <div id="geo_mashup_map" style="width:400px;height:300px;" class="clear">
                    ' . __('Loading Google map. Check Geo Mashup options if the map fails to load.', 'tdomf') . '
                </div>
                <script type="text/javascript">//<![CDATA[
                    GeoMashupAdmin.registerMap(document.getElementById("geo_mashup_map"),
                        {"link_url":"' . $link_url . '",
                        "post_lat":"<?php echo $post_lat; ?>",
                        "post_lng":"<?php echo $post_lng; ?>",
                        "post_location_name":"' . $post_location_name . '",
                        "saved_locations":' . $locations_json . ',
                        "kml_url":"' . $kml_url . '",
                        "status_icon":document.getElementById("geo_mashup_status_icon")});
                // ]]>
                </script>
                <label for="geo_mashup_location_name" style="display:none;">' . __('Save As:', 'tdomf') . '
                    <input id="geo_mashup_location_name" name="geo_mashup_location_name" type="text" size="45" style="display:none;" />
                </label>
                <input id="geo_mashup_location" name="geo_mashup_location" type="hidden" value="<?php echo $post_lat; ?>,<?php echo $post_lng; ?>" />';
                } else {
                    $output = __("<p>You must configure Geo Mashup before you can use it in TDO-Mini-Forms</p>", "tdomf");
                }
            }
            return $output;
        }