[mapguide-users] RE: Fusion javascript (phpviewersample)

Chris Claydon chris.claydon at autodesk.com
Wed Feb 11 10:18:53 EST 2009

Looking at MapGuideViewerApi.js, it tries to reference Fusion using: var Fusion = window.top.Fusion.

This *should* work provided that the script is running in the task pane, and that the top level window contains the Fusion template. If you're running the template in a frame, or if you launch the script in a popup window, it would probably fail.

You could try something like this to provide a more robust means of locating Fusion... Please let me know if this helps!

var Fusion = GetFusionWindow().Fusion;

function GetFusionWindow() {
    var curWindow = window;
        if(curWindow.parent && curWindow != curWindow.parent)
            curWindow = curWindow.parent;
        else if(curWindow.opener)
            curWindow = curWindow.opener;
    return curWindow;

From: mapguide-users-bounces at lists.osgeo.org [mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Arnaud De Groof
Sent: Wednesday, February 11, 2009 6:34 AM
To: MapGuide Users Mail List
Subject: [mapguide-users] Fusion javascript (phpviewersample)


I have migrated different applications ('theme layer' and 'query') onto fusion. The following lines of the javascript code encounter errors:
? parent.parent.Refresh();
? parent.parent.mapFrame.ZoomToView(feature.centerX, feature.centerY, scale, true);
? parent.parent.mapFrame.SetSelectionXML(TrimString(selectionXml));

For the "theme layer" application, I have referenced the "MapGuideViewerApi.js" in the script and I have changed the "parent.parent.Refresh();" by "Refresh()"  without success.
Errors referenced in firebug:
? Fusion is not defined
MapGuideViewerApi.js()        MapGuideViewerApi.js (line172)
Fusion.Tool.Canvas.prototype.getMap = function()

? Fusion is undefined
Refresh()     MapGuideViewerApi.js (line 33)

For the "query" application, I have no solution.

Could you help me to resolve these problems?


Arnaud De Groof


The present message may contain confidential and/or legally privileged information. If you are not the intended addressee and in case of a transmission error, please notify the sender immediately and destroy this E-mail. Disclosure, reproduction or distribution of this document and its possible attachments is strictly forbidden.

SPACEBEL denies all liability for incomplete, improper, inaccurate, intercepted, (partly) destroyed, lost and/or belated transmission of the current information given that unencrypted electronic transmission cannot currently be guaranteed to be secure or error free.
Upon request or in conformity with formal, contractual agreements, an originally signed hard copy will be sent to you to confirm the information contained in this E-mail.

SPACEBEL denies all liability where E-mail is used for private use.

SPACEBEL cannot be held responsible for possible viruses that might corrupt this message and/or your computer system.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20090211/684ee17b/attachment.html

More information about the mapguide-users mailing list