mobileViewer

mobileViewer.initialize(options)

The mobileViewer namespace contains all the classes in the framework, and also provides numerous global utility methods to handle functions such as session creation, loading of scripts, dynamic creation of HTML elements, and dispatch of AJAX requests.

Methods

The method: mobileViewer.initialize(options) should be called before using the classes within the framework.

Supported options are as follows:

mgURL

The URL to the Infrastructure Map Server map agent, for example: '../mapagent/mapagent.fcgi'

googleAPIKey

The API key to be used to load the Google Maps API in order to include Google base layers in the map.

yahooAPIKey

The API key to be used to load the Yahoo Maps API in order to include Yahoo base layers in the map.

bingAPI

A boolean value used to indicate if the bing API should be loaded. No special key is required.

onComplete

A callback method to be invoked once initialization is complete.

For an example of the usage of this method, look at the initializeMobileViewer() method in the index.html page in the framework.

Returns the localized string corresponding to the specified key value. Strings are stored in the localized folder in files that use the JSON format. This format allows them to be loaded directly into JavaScript without the need for custom file parsing.

Dispatches an AJAX request using the OpenLayers.Ajax.Request class. This class automatically adds an exception handler to the request, and will add the base framework URL to requests that are specified without an 'http://' prefix.

For more information about supported options, see the class documentation for the OpenLayers.Ajax.Request class at http://www.openlayers.org

A convenience method similar to to mobileViewer.ajaxRequest() that automatically send the request to the Infrastructure Map Server map agent URL.

Returns the URL parameter corresponding to the specified key in the request made to load the mobileViewer main page.

Converts the specified XML string to JSON format. It does this by invoking a PHP script, the response from which is passed to the provided callback method.

Utility method to add an HTML element of the specified type to the specified container element. E.g. to add a new div to the mapContainer div, you could use the following:
var newDiv =
mobileViewer.addElement(document.getElementById('mapContainer'),
'div');

Adds text content to the specified HTML container element. For MSIE, it sets the innerText value, for other browsers, it sets the innerHTML value.

Adds a listener to the specified element for the specified event name, causing the callback to be invoked when the event fires. Some browsers support the addEventListener method, others support attachEvent, and this method will determine which one to use.

Removes an event listener previously added with mobileViewer.addEventListener.

Displays the specified HTML content in a popup window at the bottom of the screen. The title bar will show the specified title. The owner parameter is used to track which object is responsible for the popup panel.

Closes the currently displayed popup panel. If the optional owner property is specified, the panel will be closes only if the specified owner matches the panel owner. If it is null, the panel will be closed regardless of its owner.

Displays a message in a box on the screen. If the optional duration parameter is specified (a value in milliseconds) then the message will automatically be hidden after that time.

Closes a popup message. Especially useful if popupMessage was called with no duration specified.