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

Chris Claydon chris.claydon at autodesk.com
Wed Feb 11 11:23:35 EST 2009


One more thing to try...

Defining the Fusion variable outside of the functions, by adding:

var Fusion = GetFusionWindow().Fusion;

just above the line:

var mapWidgetId = 'Map';

This should hopefully define the Fusion variable in the correct scope so that it can be picked up by Fusion.Tool.Canvas.prototype.getMap at line 172. It should also allow you to remove the individual var Fusion = ... lines from all the functions.

Chris.

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 8:56 AM
To: MapGuide Users Mail List
Subject: RE: [mapguide-users] RE: Fusion javascript (phpviewersample)

Effectively, I try to launch the script in a new window. According to your remarks, I have changed in MapGuideViewerApi.js, the var "Fusion = window.top.Fusion" by" var Fusion = GetFusionWindow().Fusion" and I have added the function "GetFusionWindow()", unfornutely the same errors are observed:
Fusion is not defined
MapGuideViewerApi.js()        MapGuideViewerApi.js (line172)
Fusion.Tool.Canvas.prototype.getMap = function()

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

Regards,

Arnaud De Groof

________________________________
From: mapguide-users-bounces at lists.osgeo.org [mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Chris Claydon
Sent: mercredi 11 février 2009 16:19
To: MapGuide Users Mail List
Subject: [mapguide-users] RE: Fusion javascript (phpviewersample)

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;
    while(!curWindow.Fusion)
    {
        if(curWindow.parent && curWindow != curWindow.parent)
        {
            curWindow = curWindow.parent;
        }
        else if(curWindow.opener)
        {
            curWindow = curWindow.opener;
        }
        else
        {
            break;
        }
    }
    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)

Hi,

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)
OnApplyThemeReadyStateChange()

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

Could you help me to resolve these problems?

Thanks,

Arnaud De Groof

________________________________
E-MAIL DISCLAIMER

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.

________________________________
________________________________
E-MAIL DISCLAIMER

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/6baad64c/attachment.html


More information about the mapguide-users mailing list