[mapguide-users] RE: parent.parent.parent.mapFrame - AJAX vsFUSION

Fraser Burgess fburgess at lakelandenergy.com
Fri Sep 18 13:49:38 EDT 2009


I uninstalled everything again (5th time today J ) but this time deleted
the temp internet files, studio and any other potential trace of an
Autodesk product on my machine.  Seems like this worked and I can only
assume it was your temp internet files suggestion that fixed it...

 

Now we'll see how much of the last few weeks learning curve I've
retained as I try to get back to where I once was... I'm hoping that the
gotopoint.aspx problem really never existed and everything broke all at
once due to some edit I made by mistake in one of the fusion files.

 

Have a great weekend,

Fraser

 

 

From: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Berdel,
Brian
Sent: Friday, September 18, 2009 1:09 PM
To: 'MapGuide Users Mail List'
Subject: RE: [mapguide-users] RE: parent.parent.parent.mapFrame - AJAX
vsFUSION

 

That is strange...Delete Temp internet files?  Unless you have the wrong
directory...

 

Brian 

 

 

From: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Fraser
Burgess
Sent: Friday, September 18, 2009 1:02 PM
To: MapGuide Users Mail List
Subject: RE: [mapguide-users] RE: parent.parent.parent.mapFrame - AJAX
vsFUSION

 

Again, many thanks for the continued help.

 

Interesting about Fusion not having a scriptFrame.. this may be possible
- as you can tell I'm not an expert.  Unfortunately I've regressed over
the last few days though and I'm not even in a position to solve that
problem.   Here's where I stand now:

 

I had all my pages working that used the GetParent() function with the
exception of gotopoint.aspx.  Somewhere in my playing I must have
screwed something up as I noticed that all the other pages that called
GetParent() function had started opening in new windows where they had
at one time worked properly.  After a day of playing around without any
success I figured that I must have really messed something up somewhere
in one of the Fusion files.  So I backed up all my code and decided I
was going to start from scratch ( I was already starting to forgot half
the stuff I had done weeks before and figured it might be a good idea to
re-learn again anyway).

 

I uninstalled mapguide entirely from my machine.  Deleted the existing
directories that were left behind after the uninstall and started with a
fresh install (restarted the machine and everything).  Strangest thing
happens when I loaded the Fusion template right after the new install -
it loads with all the googlestuff code and all my modifications to the
template.  I check IIS the virtual directories for mapguide and they all
point to the default install directory .  I check the default install
directory and there is no sign of the addGoogle code or any of the other
modifications to the template.  I didn't even back things up to this
computer, the backup resides on an entirely different machine.  When I
right click in IE and select view source, the addgoogle stuff code is
being loaded into the browser from index.html

 

Can anyone explain this behavior?

 

Thanks

Fraser

 

 

 

From: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Chris
Claydon
Sent: Friday, September 18, 2009 11:37 AM
To: MapGuide Users Mail List
Subject: RE: [mapguide-users] RE: parent.parent.parent.mapFrame - AJAX
vsFUSION

 

"The gotopoint.aspx is being held and fired from the hidden scriptFrame
in MapGuide. "

 

Correct me if I'm wrong, but I don't think the Fusion viewer has a frame
called 'scriptFrame'.

 

From: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Kenneth
Skovhede, GEOGRAF A/S
Sent: Friday, September 18, 2009 12:35 AM
To: MapGuide Users Mail List
Subject: Re: [mapguide-users] RE: parent.parent.parent.mapFrame - AJAX
vsFUSION

 

Try to put a breakpoint at the line in question, then click "Start
debugging".
Now once the page hits the line, the debugger will stop and show the
line with a highlight.
Then, go to the 4th tab on the right ("Show"), and type in "GetParent"
and press enter.
It will now show you what it thinks GetParent is (a function or null).
If it is a function, try to type "GetParent()", to see what GetParent()
returns.
If it returns null, try to type "window", and expand the "[Methods]"
item, to see what methods you have loaded/defined.

Regards, Kenneth Skovhede, GEOGRAF A/S



Fraser Burgess skrev: 

Thanks, I've done some more reading and think I understand.  But that
being said, I'm confused as to why this still isn't working.  

 

In my navigatetask.aspx is where I grab the XY and scale parameters.  

>From here I create a url pointing to gotopoint.aspx and pass in the XY
and scale paremeters to the URL.

The gotopoint.aspx is being held and fired from the hidden scriptFrame
in MapGuide.  

Gotopoint.aspx contains the onPageLoad function which calls ZoomToView.

 

So since I want the script frame to interact with the mapFrame I should
be able to start from the top frame and drill down like this:

 

function OnPageLoad()

{

    window.top.fusion.ZoomToView(<%= GetRequestParameters()["X"] %>, <%=
GetRequestParameters()["Y"] %>, <%= GetRequestParameters()["Scale"] %>,
true);

}

 

</script>

 

<body onLoad="OnPageLoad()">

 

Or I could also use the GetParent() function which should fire at the
first if (parent.Fusion) section as the scriptFrame should be one level
below the Fusion frame which is essentially defined as window.top.fusion
to begin with.  

 

Both these methods fire the script and open the URL passed in from
Navigate.aspx in a new IE window. I can only assume this is because the
reference to the mapFrame is invalid and somehow the URL defaults to
opening in a new window?  Do I need to reference MapGuideViewerAPI.js in
this script somewhere?? - I don't think this is the case as I didn't
need to do it for the mapFrame references.

 

-----------

 

I tried the IE8 debugger and my code (see below) fails at
GetParent().ZoomToView(605793.225947542, 5057603.85822154, 25000, true);
with the error 'undefined' is null or not an object.  I assume this
means it doesn't know what GetParent() is.

 

Any ideas?

F

 

 

<%@ Page language="c#"%>

<!-- #Include File="utilityfunctions.aspx" -->

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >

<html>

<head>

    <title>Viewer Sample Application - Goto Point</title>

    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">

    <meta http-equiv="content-script-type" content="text/javascript">

</head>

 

<!-- Emit this function and assocate it with the onLoad event for the
-->

<!-- page so that it gets executed when this page loads in the
-->

<!-- browser. The function calls the ZoomToView method on the
-->

<!-- Viewer frame forcing the Viewer to navigate to the specified
-->

<!-- point and scale.
-->

 

<script language="javascript">

 

function GetParent()

        {

            if (parent.Fusion) {

                return parent;

            } else if (parent.parent.Fusion) {

                return parent.parent;

            }

   }

 

function OnPageLoad()

{

    GetParent().ZoomToView(<%= GetRequestParameters()["X"] %>, <%=
GetRequestParameters()["Y"] %>, <%= GetRequestParameters()["Scale"] %>,
true);

}

 

</script>

 

<body onLoad="OnPageLoad()">

 

</body>

 

</html>

 

 

 

 

 

From: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Chris
Claydon
Sent: Wednesday, September 16, 2009 4:30 PM
To: MapGuide Users Mail List
Subject: RE: [mapguide-users] RE: parent.parent.parent.mapFrame - AJAX
vsFUSION

 

'parent' takes you to the frame that is the parent of the one you're
running the script in. The GetParent() method as defined below looks for
'Fusion' to be defined either in the direct parent or the parent of that
frame. If you're launching in a new window, you'll never get to a parent
that has Fusion defined. I think you need to use 'opener' instead...

 

 

 

From: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Fraser
Burgess
Sent: Wednesday, September 16, 2009 2:04 PM
To: MapGuide Users Mail List
Subject: RE: [mapguide-users] RE: parent.parent.parent.mapFrame - AJAX
vs FUSION

 

So GetParent() worked when things were called with
"parent.parent.parent.mapFrame"; however, what if I have something in
AJAX like this:

 

function OnPageLoad()

{

    parent.ZoomToView(<%= GetRequestParameters()["X"] %>, <%=
GetRequestParameters()["Y"] %>, <%= GetRequestParameters()["Scale"] %>,
true);

}

 

I then modify by adding your code below and then try:

 

function GetParent()

        {

            if (parent.Fusion) {

                return parent;

            } else if (parent.parent.Fusion) {

                return parent.parent;

            }

   }

 

function OnPageLoad()

{

    GetParent().ZoomToView(<%= GetRequestParameters()["X"] %>, <%=
GetRequestParameters()["Y"] %>, <%= GetRequestParameters()["Scale"] %>,
true);

}

 

 

This code is using the sample gotopoint.aspx file.  When I select the
link that activates this gotopoint, the URL contains the X Y and scale
http://172.16.186.38/mapguide2010/UtilityMap/gotopoint.aspx?X=632593.974
151717&Y=4989398.03115329&Scale=25000 which should be passed into this
onPageLoad() function.  However it appears that nothing is firing for
OnPageLoad - so when I click the link nothing happens, no error message
or anything.

 

Can anyone help with this problem?  Also, can anyone point me to
something that would help explain this parent.parent. syntax?  I'm not
really certain why at one point we would use parent.function() vs
parent.parent.parent.function() etc.

 

Thanks again

Fraser

 

 

From: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Berdel,
Brian
Sent: Wednesday, September 16, 2009 9:02 AM
To: MapGuide Users Mail List
Subject: [mapguide-users] RE: parent.parent.parent.mapFrame - AJAX vs
FUSION

 

If you want to add the reference to your fusion index page, add the
following to your aspx (task pane) page

 

function GetParent()

        {

            if (parent.Fusion) {

                return parent;

            } else if (parent.parent.Fusion) {

                return parent.parent;

            }

   }

 

Then you can call functions in the same way as before but substitute

 

GetParent().DigitizePoint(OnPointDigitized);

 

 

 

Brian Berdel

McMahon Associates, Inc.

p: 215.283.9444 x 260

www.mcmtrans.com

 

 

From: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Chris
Claydon
Sent: Tuesday, September 15, 2009 4:43 PM
To: MapGuide Users Mail List
Subject: [mapguide-users] RE: parent.parent.parent.mapFrame - AJAX vs
FUSION

 

I think you should be able to reference the MapGuideViewerAPI.js script
from your aspx page, and then just call DigitizePoint directly without
any window.top or parent references.

 

It should also be possible to add a reference to MapGuideViewerAPI.js to
the index.html file in the Fusion template you're using, and reference
it using window.top...

 

It's been a while since I've played around with this stuff, so someone
else may be able to provide specifics...

 

From: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Fraser
Burgess
Sent: Tuesday, September 15, 2009 1:40 PM
To: MapGuide Users Mail List
Subject: [mapguide-users] parent.parent.parent.mapFrame - AJAX vs FUSION

 

Hi List,

 

I'm making steady progress with my project and learning many things
about MapGuide along the way thanks largely to the help from those on
this list - many thanks to those who have helped so far

 

>From what I can tell parent.parent.parent.mapFrame is how the map frame
is referenced from the task pane in the AJAX viewer.  I have been
reading posts about how this is referenced in Fusion and it seems the
MapGuideViewerAPI.js file has a bit of info.  Unfortunately I'm having a
bit if trouble putting the pieces together and was hoping that someone
here may steer me in the right direction.

 

In both AJAX and FUSION I'm working from the taskpane and using the
markup scripts that are part of the AJAX demo's and tutorials.

 

I assume I need to substitute either 'Fusion' or 'window.top.Fusion'
somehow for
'parent.parent.parent.mapFrame.DigitizePoint(OnPointDigitized);'. in my
script however I have yet to do this in such a way that it works.  I
keep getting 'Object doesn't support this property or method'.

 

So for example in my editmarkup.aspx code for example, I have the
following function which should be activated when I click the digitize
point button

 

            function AddPoint()

            {

                  SetDigitizeInfo(EDIT_POINT_HELP);

 
parent.parent.parent.mapFrame.DigitizePoint(OnPointDigitized);

            }

 

In Fusion this code gives an error 'parent.parent,parent.mapFrame' is
null or not an object

 

I see that in MapGuideViewerAPI.js

 

function DigitizePoint(handler) {

    if (handler) {

      var Fusion = window.top.Fusion;

      var mapWidget = Fusion.getWidgetById(mapWidgetId);

      var digitizer = new Fusion.Tool.Canvas.Point(mapWidget);

      digitizer.mouseUp = PointHandlers.prototype.mouseUp;

      Object.inheritFrom(digitizer, Fusion.Tool.Canvas.prototype, []);

      digitizer.initializeCanvas();

      var activeWidget = mapWidget.buttonSet.activeButton;

      mapWidget.buttonSet.setActiveButton(null);

      digitizer.handler = function() {

          handler.apply(null, arguments);

          activeWidget.setActive(true);

      }

      digitizer.activateCanvas();

      

      //add a listener to update the position of the features

      var mapWidget = Fusion.getWidgetById(mapWidgetId);

      mapWidget.registerForEvent(Fusion.Event.MAP_EXTENTS_CHANGED, 

        function(){

          digitizer.updatePx();

          digitizer.clearContext();

          digitizer.draw(digitizer.context);

        }

      );

    }

}

 

Thanks

Fraser

 

________________________________

Important notice to recipients:
Copies of documents that may be relied upon by you are limited to the
printed copies (also known as 'hard copies') that are signed and sealed
by the Engineer and/or Land Surveyor. Files in electronic formats, or
other types of information furnished by the Engineer and/or Land
Surveyor to you such as text, data or graphics are for your convenience
only. Any conclusions or information obtained or derived from such
electronic files will be at the user's sole risk. When transferring
documents in electronic formats, the Engineer and/or Land Surveyor makes
no representation as to long-term compatibility, usability, or
readability of the documents resulting from the use of software
application packages, operating systems or computer hardware differing
from those used by McMahon Associates, Inc. at the beginning of the
project.

 
 
 
 
 
 
 


________________________________



 
 
 
 
 
 
 
_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users
  

 

________________________________

Important notice to recipients:
Copies of documents that may be relied upon by you are limited to the
printed copies (also known as 'hard copies') that are signed and sealed
by the Engineer and/or Land Surveyor. Files in electronic formats, or
other types of information furnished by the Engineer and/or Land
Surveyor to you such as text, data or graphics are for your convenience
only. Any conclusions or information obtained or derived from such
electronic files will be at the user's sole risk. When transferring
documents in electronic formats, the Engineer and/or Land Surveyor makes
no representation as to long-term compatibility, usability, or
readability of the documents resulting from the use of software
application packages, operating systems or computer hardware differing
from those used by McMahon Associates, Inc. at the beginning of the
project.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20090918/112fc80a/attachment.html


More information about the mapguide-users mailing list