I’ve recently had a chance to write a Google Maps control for EPiServer, it’s still somewhat buggy and I’m still considering how to release it since it still contains some java script that is potentially GPL infected and I would not like to contaminate someone’s code with it. I may end up rewriting it to some extent or make it more server side so that it’s completely ASP based.
We’ve started working on the rewrite of our site internally in a few CMS’es basically creating an internal competition on which of the engines/teams can do the best the easiest and the fastest site. I can say honestly, EPiServer has been a blast! Virtually any control we’ve decided to place there was almost completely effortless. The controls that are delivered (with sample usage on the demo site) just seem to cover everything. Well, almost everything. There is no map creation component as far as I can tell.
I’ve been wanting to write this control for quite a while and since I deployed a wiki for my family and started filling it in. I had a really nice experience with this Google Map extension to the MediaWiki. I wanted us to have the same on our site. And in the mean time we’ve started running into some limitations that required us to write some plugins for the editor’s site of the CMS. Striking two birds with one stone, here comes the Google Maps for EpiServer.
Anyone familiar with EpiServer knows that the CMS allows you to define the content on any given page through a set of properties defined for its page type. There is a handful of those, and each of them comes with a specific editor. Some of them even come with so called DOPE (Dynamic-on-page-editing). This feature is really so cool that by itself it’s probably one of the driving selling factor. I wanted it all!
To deliver it you need to inherit a property, (in my case I decided to go with a LongString as I can easily go over the 255 char limit if the user woudl decide to have more than a couple of flagpoints on his/her map) and define its editors.
I’ve found out that the property can be easily integrated with the CMS (virtually without any user intervention) by means of attributes/reflection. So here we go:
DisplayName = “GoogleMapData”, Description = “Google Map”)]
public class GoogleMapProperty : EPiServer.Core.PropertyLongString
Yay! one line of code and my class is a property and will show up in the system as one of the available data formats. Now how cool is that!?
The cool part of it is that now as it’s a property, it’s even easier to integrate it with the page.
<%@ Page language=”c#” Codebehind=”GoogleMapsPage.aspx.cs”
<%@ Register TagPrefix=”EPiServer”
Namespace=”EPiServer.WebControls” Assembly=”EPiServer” %>
<EPiServer:Property ID=”MyGoogleMap” runat=”server”
That’s it! The CodeFile is practically empty, except for the autogenerated part. The property instance knows by itself that is should pull the data from the page property defined in “PropertyName”!
The control supports all 3 modes:
– View Mode – obviously:
– Edit mode – can’t do without it:
– DOPE mode – this is probably the coolest thing in the whole deal:
This entry (Permalink) was posted on Friday, March 23rd, 2007 at 4:10 pm and is filed under .Net Framework, ASP.NET, C#, EPiServer, Web applications. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response , or trackback from your own site.