Insertion of Google Maps in FCKeditor

Change your language

Introduction

This dialog allows to handle the insertion and modification of Google Maps in FCKeditor

Usage

Press the Insert GoogleMap button in the FCKeditor toolbar, and a new dialog will open allowing to configure the parameters of the map that you want to show.

Map dimensions controls Zoom dropdown Map center controls Zoom widget Map position widget

 

Map dimensions

With these inputs you can control the dimensions of the map as they will appear in your final page. You can also drag and resize the preview image that appears while you are in the editor. The default value is 400x340 px but you can control it with the FCKConfig.GoogleMaps_Width and FCKConfig.GoogleMaps_Height entries.

Map zoom

You can control this way the level of zoom of the map. You can use either the top dropdown or the embeded + and - controls in the map.

Map center

These inputs set the center of the map. You can also use the arrow buttons embeded in the map or even drag and drop the map itself. By default it will try to center the first time on your current location, but it's possible to change that behavior with the FCKConfig.GoogleMaps_CenterLat and FCKConfig.GoogleMaps_CenterLon entries

Options

Options

The second tab allows you to select the features that will be shown in the map. All the changes are visible at the moment in the map.

The only option that doesn't change anything in the map is the first one: "Load the map".
You have three options: static map, load the map on page load or wait for the user to click on a static preview.
The Static options means that only an static image will be generated in the page, no scripts will be added and several features (polygons, KML, text markers...) won't be available.
The click to load means that the user at first sees the static image, but has the option to load the full map by clicking on the image, and of course, he won't be able to inmediately move the map, zoom, etc... The advantge is that all the javascript files from Google won't be loaded, so if he isn't interested to do that kind of things with the map he won't waste his bandwith.

search

Input here the location that you want to search and if it is properly found then the map will re-center automatically and add a marker to that point. To be able to find what you want separate each item with a comma: "street, city, country"

Elements

It's possible to add some elements to the map in order to show properly the place that you want to focus: markers, polylines, polygons and a KML overlay.

elements

Markers

When you click on the "Add a marker" icon, the cursor turns into a cross and when you click on the map, a marker will be added at that point. At the same time, the window to edit the marker properties opens.

marker

The tooltip will be shown besides the marker, depending on the context it might not be obvious at first sight as it can look like any other text of the map. You can create an information window that will be opened when the marker is cliked. Just write the content in the editor shown there. The width of that window can be changed at the top.
You can select the icon shown for the marker. For the moment the list of available icons is fixed.

markers
The content of the information window can be any HTML that you like, so it shows again a FCKeditor to write that content.


This new instance of FCKeditor has a few configuration options but they are enough to customize it according to your needs.
The first two options are FCKConfig.GoogleMaps_Editor_Height and FCKConfig.GoogleMaps_Editor_Width but I would suggest not to change them: the width defaults to 100% and the height adapts itself to the current map
The next option is FCKConfig.GoogleMaps_Editor_CustomConfigurationsPath, if this setting doesn't exists, it uses the same CustomConfigurationsPath path that the main FCKeditor (note: values set directly on the main instance at creation time like "oFCKeditor.Config['AutoDetectLanguage'] = false ;" won't be used in this embedded version).
On the other hand, if is set to any string, then that value will be used as the path for the custom configurations, so if you don't want to reuse the main configuration file, you can set this value to an empty string or point to a file with the settings that you want to use.
Lastly the toolbar of the editor is controlled by the FCKConfig.GoogleMaps_Editor_ToolbarSet entry. Of course, this Toolbarset must be defined in the configuration file that will be used by the embedded editor. If you don't share the configuration file and try to define the toolbarset in the main configuration then at load time it will return an error. The default value is "Basic".

At the bottom of the mini dialog there are the buttons to remove the marker, to accept the changes or to revert back.

You can change the placement of any marker dragging it around while you are in the Elements tab

Polylines

Clicking the "Add Polyline" button turns the cursor into a big X and clicking on the map will add the new points to the polyline. When you want to end editing you can click on the last point that you have created, or click again in the "Add Polyline" button to deactivate it.

polyline
Once the line has been created, you can edit it: hovering will show a square in each corner and a ghost square in the middle of each line.
Click and drag one of the corners to move it, or one of the ghosts to create a new corner. If you just click in one corner it will be removed. When there are two points and you remove one of them the line is removed.
If you click in the rest of the line, a small window will be shown to control the color, width and opacity

edit polyline

Polygons

The "Add Area" button has a very similar behavior. Start clicking on the map to add points. Click on the first one to end the map, or double click on the last point.

polygon
When the area is created, you can change it with the main and the ghost squares, and clicking on the rest of the area will show a dialog to select the properties of the border and the fill

edit polygon

Text

You can add some text at any place in the map.

polygon
While you are editing the map in this tab, a big T will be show at the text markers so you can move or edit them, that T won't be shown in the final map.
All the text items (including the ones generated with the Markers) are wrapped in a div with class "MarkerTitle", so you can use for example a white background in order to make them stand out more easily. You can put whatever you want in your CSS, to see that efect in this dialog you can use the GoogleMaps_DialogCss setting.

This feature is based on the ELabels script provided by Mike Williams, I have simplify it a little to remove unwanted features and decrease its size.

KML data

The "Add KML reference" shows an input box to select a KML file that will be overlayed on the current map. Only one KML file is allowed in each map.

KML

You can use a KML from another website like panoramio.com in the screenshot, or you can create it with Google Earth and then upload it to your server.
Warning: If you are developing in a private server, then remember that at least the compressed kml files need to be parsed by the Google servers, so you can't use them in the map.
The window opened by the "Browse server" button is controlled with the FCKConfig.KMLBrowserURL, FCKConfig.KMLBrowserWindowWidth and FCKConfig.KMLBrowserWindowHeight settings. If they don't exist, the values are copied from the LinkBrowser configuration. If the KMLBrowserUrl is an empty string the "Browse server" button won't be available.

Additional Info

When you close the dialog, a preview will be added to your content representing the current map, it's not a full map, but a static image.

You can click to select it and drag one of the corners to resize it, but remember that the center of the map and the position of the elements won't change, so you might need to check again in the editing dialog that everything is fine. Also, the preview will be shown as a resized image, in order to get the correct preview open the dialog and close it again

preview in the editor

Polygons (or areas) and KML files aren't supported in the Static Maps, so in the preview of the editor you won't see them, and in the final page, until the full map has been loaded they won't be shown either.
The maximum dimensions on the static maps generated by Google are 640x640, so if you try to user something bigger, the map will be upscaled to your requested dimensions, and of course, the map will be shown slightly distorted.

You can add to your page as many maps as you want, the system is prepared to work with various maps at the same time.

To edit an existing map you can select it and then click again the toolbar button, or use the entry in the context menu, or even just double click it. Whatever you want.

It's possible to add several markers, polylines and polygons, but only one KML reference is supported.

Final notes

If you need some special feature for this plugin, or if you need any other kind of plugin for FCKeditor then contact me and we can discuss it: amla70 at gmail dot com

Disclaimers

FCKeditor is © FredCK.com

Google, Google Maps and the Google Maps API are all properties of Google.