Hey everybody! I just wanted to take a bit of time to write about how things have been progressing recently here at CDOT.
Bobby Richter wrote a Communications Module for Butter that is so full of epic win it can't be done justice here. The module basically facilitates communication between windows and/or iFrames via post messages.
This communtication module allowed me to rewrite the Event Editor module almost entirely. It was decided that editors should be html files, either hosted locally, or remotely on another website. The event editor module now requires you to define a default editor source. This URL will be used if no Custom Editor source has been defined for the target Track Event or for a particular type of plug-in.
Speaking of custom editors, I have provided the App developer with methods of setting custom editor sources for plug-ins. This is as easy as:
butterInstance.addCustomEditor( "http://www.LinkToEditorsource.com/editor.html", "genericPlugin" );
This way, when the trackEditor begins editor a track event with the "genericPlugin" type, it will use the custom editor you specified.
Anybody can write a custom editor so long as you implement the necessary channels of communication using the Communication module. Here's a sample of code for a custom editor I whipped up quickly for testing purposes. It doesn't relate to any Popcorn plug-ins specifically, but you could say it closely relates to the googlemaps plug-in. If you look at lines 39 to 50 you'll see I instantiate a communications client object. This object "listens" for post messages from the main App. The key message to listen for is "edittrackevent" which you'll see on line 45. The communications server set up in the event editor will fire this message to the custom editor window, along with a track event and a list of DOM targets. It's then entirely up to the imagination of the editor writer to create an interface to edit the data.
The communications server also listens for certains messages I have defined. These are: "okayclicked", "applyclicked", "deleteclicked", "cancelclicked". come to think of it, I may just drop the "clicked" because the sending of the messages don't have to be bound to mouse clicks.
Here's that Custom Editor in action (dead link) using the latest version of the event editor code. It's a simple demo really. When you click the button, the track event is passed to the event editor widow, which sets up a Google map using the data in the track event. you can move around the map, change the zoom and change the map type. When you click the button, the editor will take all the new values, wrap them up and send a message back to the editor with the new options for the track event. Notice that if you open the map again it will use the edited track event to open the new map in the exact same state you had just closed it in.