MapGuide RFC 23 - Fusion Integration
This page contains a change request (RFC) for the MapGuide Open Source project. More MapGuide RFCs can be found on the RFCs page.
Status
RFC Template Version | (1.0) |
Submission Date | July 24, 2007 |
Last Modified | Paul Spencer Timestamp |
Author | Paul Spencer |
RFC Status | adopted |
Implementation Status | in progress |
Proposed Milestone | 2.0 |
Assigned PSC guide(s) | |
Voting History | |
+1 | Paul, Jason, Andy, Haris, Bruce, Tom, Bob |
+0 | |
-0 | |
-1 |
Overview
This RFC updates MapGuide to incorporate DMSG's "Fusion" technology into MapGuide OS to generate applications as an alternative to the existing AJAX viewer.
Motivation
The existing AJAX viewer has limited capacity for customization, both in functionality and appearance. Modifications require changes that modify every application that runs on the same servers, and are difficult to keep synchronized with changes in the AJAX viewer between releases (bug fixes etc)
Fusion Technical Overview
The Fusion framework is a flexible, extensible templating system that provides the ability to separate application presentation from its functional components. A Fusion application template is, at its simplest, is composed of an HTML page. A Fusion application is created by loading the fusion.js library into the HTML page and initializing the Fusion object in the onload event of the page. Fusion uses a special XML document, stored as an ApplicationDefinition resource in the MapGuide OS server, to determine what functional components to create in the page. Fusion dynamically loads additional javascript files to create the necessary functionality and initialize the application.
The functional pieces of a Fusion application are called "Widgets". A widget is a single, discrete piece of functionality. In general, widgets are completely self contained and do not require any other widget to be in the application in order to function although, in practice, some widgets are not very useful without other widgets. A widget typically has some form of representation inside the application, for instance as a button or a legend. Where the widget appears in the application is controlled by the use of HTML id attributes in the application template. Widgets are designed to be created "inside" HTML containers and usually size themselves according to their container. A widget's position in an application is not constrained by the fusion framework in any way, although different widgets are designed to be contained in specific ways. For instance, the container of a Legend widget would typically be a <div> element with a CSS style that would allow the contents to be scrolled if the Legend is larger than the container while a Map's container normally hides overflow. Widgets are designed to be configurable through the ApplicationDefinition. Where a widget's functionality can be customized in some way, optional tags are available in the ApplicationDefinition to specify that customization. In general, the look and feel of a widget is customized by overriding specific CSS classes.
The Fusion framework uses the Jx library to simplify cross browser support for application UI elements such as toolbars, buttons, menus, splitter bars, tabs and more. Jx is an independent javascript library that was originally developed to support WebStudio. When the look and feel of an application is customized, often the developer is actually customizing the Jx components rather than the Fusion widgets themselves. For instance, to change the appearance of all button widgets to emulate a Windows XP style, a developer would actually provide a CSS file that overrides the default button CSS defined by Jx. Fusion widgets do not normally contain their own CSS or visual styles.
Fusion widgets are written in javascript, but have a mechanism to asynchronously invoke server-side scripts that can leverage the power of the MapGuide OS Web Extensions API to perform advanced functionality. The architecture of Fusion is designed to support any server-side scripting language but only PHP is actually implemented at this time.
A preview of an application that runs using Fusion is available at http://demo01.dmsolutions.ca/mapguide/fusion/demo. The application includes links to download Fusion and related documentation. The version of Fusion used for this preview is not the final version, so it is recommended not to do any serious development on this version.
Proposed Solution
The Fusion framework, a base set of widgets that replicate the functionality of the existing AJAX viewer, and supporting server side scripts (in PHP only) will be donated by DM Solutions Group to the MapGuide OS project. The Fusion framework is a core set of javascript classes that provide the basic framework for creating an application from an HTML template and an ApplicationDefinition.
In addition to DM Solutions Group's contribution, Autodesk is funding the development of several basic application templates that can be used as the basis for new applications.
Modifications will be made by Autodesk to MapGuide OS to enable storing the ApplicationDefinition resource in the MapGuide repository.
Implications
MapGuide OS will be modified to accept a new Resource type, ApplicationDefinition. The schema of an ApplicationDefinition is yet to be determined.
The Fusion code base will be added to the MapGuide SVN inside the www/ folder.
The launch sequence for a Fusion application will be as follows:
A new fusionviewer.php script will be added (with jsp and asp versions TBD), which will take one GET parameter, appdefn=Library://... This script will:
- authenticate (using anonymous by default)
- create session
- retrieve appdefinition
- parse template location
- redirect to template, passing session and app definition path
The javascript in the default templates will parse out the session and app definition and initialize Fusion with those parameters.
The javascript in the default templates will also provide the option of hard-coding the app definition (for copying and deploying).
The javascript in the default templates will be reponsible for creating a session with the server if one is not passed in, then initializing Fusion with the session and app definition.
License
Fusion will be contributed under an MIT license, which is compatible with the LGPL license used by MapGuide OS. Fusion has several dependencies on other libraries (prototype, scriptaculous, and Explorer Canvas which are all released under compatible licenses. The Jx library is maintained at http://www.jxlib.org and is released under an MIT license.
Funding/Resources
Supplied by DM Solutions Group and Autodesk.