Opened 17 years ago

Closed 16 years ago

Last modified 16 years ago

#65 closed enhancement (fixed)

mgmapresourceid URL override patch

Reported by: amorsell Owned by: madair
Priority: P3 Milestone: 1.1
Component: MapGuide Version: 1.0.6
Severity: Trivial Keywords:
Cc: Browser: All
External ID: Operating System: All
state: Committed

Description

This patch is to add functionality to pass a mapguide map resource ID via a URL parameter to Fusion and have it open that map in a given Fusion applicationDefinition.

Edit the Fusion.Lib.ApplicationDefinition.Map class in applicationDefinition.js from (around line 534):

this.resourceId = this.extension.ResourceId ? this.extension.ResourceId[0] : ; if ( !Fusion.Maps[this.type] ) {

to:

this.resourceId = this.extension.ResourceId ? this.extension.ResourceId[0] : ;

var paramMgMapResourceId = Fusion.getQueryParam('mgmapresourceid');
if (paramMgMapResourceId.length>0) {
     this.resourceId = paramMgMapResourceId;
}

if ( !Fusion.Maps[this.type] ) {

Once this patch is in place, if you pass a map resource ID at the URL, Fusion will pick that up and use it instead of the one in the appDef file. In my case, I actually removed the contents of my ResourceId tag in the MapSet definition. This can be tested by making a copy of the Sheboygan map and calling it Sheboygan_2 (make some changes to it so you can tell the difference between it and the regular Sheboygan map). Then, enter the following URL address into your browser:

http://YOURSERVER:8008/mapguide/fusion/templates/mapguide/slate/index.html?mgmapresourceid=Library://Samples/Sheboygan/Maps/Sheboygan_2.MapDefinition

Change History (4)

comment:1 by madair, 16 years ago

(In [1518]) re #65: applied to 1.1 branch, except that the param is called 'theme'

comment:2 by pagameba, 16 years ago

Resolution: fixed
state: NewCommitted
Status: newclosed

I was about to suggest the same approach as Mike, which is to pick up the resource id from the URL in the MapGuide initialization using the Fusion.getQueryParam() function.

As Mike indicated, this is now supported but you would construct the url as follows:

http://yourserver:8008/mapguide/fusion/templates/mapguide/slate/index.html?theme=Library://Samples/Sheboygan/Maps/Sheboygan_2.MapDefinition

comment:3 by jbirch, 16 years ago

Has this been applied to trunk? I can't find it...

comment:4 by madair, 16 years ago

(In [1539]) re #65: patch applied to trunk

Note: See TracTickets for help on using tickets.