[mapguide-users] Two maps in the same layout
Jackie Ng
jumpinjackie at gmail.com
Thu Jan 22 20:49:27 EST 2009
Sorry, I didn't thoroughly read your original question. So I'll try again.
The main problem here is that you can't initially theme because you don't
have access to the runtime map(s) as the viewer's haven't loaded yet.
What you can do is hook on the viewer's loading process (like so:
http://trac.osgeo.org/mapguide/wiki/CodeSamples/JavaScript/AJAXViewerEventHooking)
and invoke a server-side script that does the theming passing in your map's
name (which will now be available) and any other theming parameters.
When the theming script has completed, refresh the affected viewer.
Hope that helps.
- Jackie
Rodolfo Moreno wrote:
>
> Only for completing my idea about the dynamic theming in the first time:
>
> <frame id="viewer1Frame" frameborder="no" marginwidth="0" marginheight="0"
> scrolling="no"
> src="/mapguide/mapviewernet/ajaxviewer.aspx?SESSION=<%=sessionId1%>&WEBLAYOUT=<%=webLayout%>&THEMINGTYPE=1">
>
> In this sentence you can see a parameter added called THEMINGTYPE, which
> is why I have modified the viewer files. I have not found another way of
> doing theming dynamically in the first time.
> I would like to do it without modifying the viewer files and much better
> if it is possible to do in FUSION viewer.
>
> Thanks in advance,
>
>
> Rodolfo Moreno wrote:
>>
>> Hi Mark, about your question:
>>
>> - Why would you need to modify any of the viewer files in order to have 2
>> pages in your map?
>> I have modified viewer files because I want to set a themed layer
>> dynamically in each map in the first time that my application to be
>> loaded.
>> My use case is: The theming is placed according to a preference to set by
>> the user in previous session. Thus the applicacion could show two
>> preferences on the same map(and the same layout). This is useful when you
>> want to show comparisons, for example: To compare population 1980 vs 1990
>> (like a dashboard).
>>
>> Ivan good sugestion about the iframes, it's better than frameset. However
>> I would like to do it using FUSION viewer. Is it possible?
>>
>> Thanks,
>>
>>
>> Ivan Milicevic wrote:
>>>
>>> Hi,
>>>
>>>
>>>
>>> Frameset sucks, use iframe, it's more flexibile.
>>>
>>>
>>>
>>> In C# code create two mgSession's and define two differen weblayout's.
>>>
>>>
>>>
>>> MgUserInformation userInfo = new MgUserInformation(defaultUser,
>>> defaultPassword);
>>>
>>> MgSite site = new MgSite();
>>>
>>> site.Open(userInfo);
>>>
>>> sessionId = site.CreateSession();
>>>
>>> sessionId2 = site.CreateSession();
>>>
>>> webLayout = "Library://PROJEKTI/PRIKAZI/1.WebLayout";
>>>
>>> weblayout2 = "Library://PROJEKTI/PRIKAZI/1mm.WebLayout";
>>>
>>>
>>>
>>> Here, after <body>..
>>>
>>>
>>>
>>> <div><iframe id="viewerFrame" width="100%" height="100%" frameborder="0"
>>> marginwidth="0" marginheight="0" scrolling="no"
>>> src="../mapviewernet/ajaxviewer.aspx?SESSION=<%=sessionId%>&WEBLAYOUT=<%
>>> =webLayout"%> ></iframe><div>
>>>
>>>
>>>
>>> <div><iframe id="viewerFrame2" width="100%" height="100%"
>>> frameborder="0" marginwidth="0" marginheight="0" scrolling="no"
>>> src="../mapviewernet/ajaxviewer.aspx?SESSION=<%=sessionId2%>&WEBLAYOUT=<
>>> %=webLayout2%>></iframe><div>
>>>
>>>
>>>
>>>
>>>
>>> Put iframes into div's so you can place it absolutely, moving maps,
>>> ect...
>>>
>>>
>>>
>>> The point is that you must have two mgSessionId's and two weblayout's.
>>>
>>>
>>>
>>>
>>>
>>> Hope this helps.
>>>
>>>
>>>
>>> -----Original Message-----
>>> From: mapguide-users-bounces at lists.osgeo.org
>>> [mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Mark
>>> Pendergraft
>>> Sent: Wednesday, January 21, 2009 5:15 PM
>>> To: MapGuide Users Mail List
>>> Subject: RE: [mapguide-users] Two maps in the same layout
>>>
>>>
>>>
>>> Roldolfo,
>>>
>>> Sorry I didn't look at your code. It's pretty much exactly the same as
>>>
>>> what I posted. Why would you need to modify any of the viewer files in
>>>
>>> order to have 2 pages in your map?
>>>
>>>
>>>
>>> I was able to create a 2 map page using framesets in the same manner
>>>
>>> that you did.
>>>
>>>
>>>
>>> -Mark
>>>
>>>
>>>
>>> -----Original Message-----
>>>
>>> From: mapguide-users-bounces at lists.osgeo.org
>>>
>>> [mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Mark
>>>
>>> Pendergraft
>>>
>>> Sent: Wednesday, January 21, 2009 8:10 AM
>>>
>>> To: MapGuide Users Mail List
>>>
>>> Subject: RE: [mapguide-users] Two maps in the same layout
>>>
>>>
>>>
>>> Many people have their page in a frameset. Here is an example which has
>>>
>>> two frames, 1 for a title.html page and 1 for the mapguide viewer. Here
>>>
>>> is an example of what your frameset page might look like (in VB.NET)
>>>
>>>
>>>
>>> **********************************
>>>
>>>
>>>
>>> <%@ Page Language="VB" Debug="true" %>
>>>
>>>
>>>
>>> <%@ Import Namespace="OSGeo.MapGuide" %>
>>>
>>> <!-- #Include File="UtilityFunctions.aspx" -->
>>>
>>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>>>
>>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>>>
>>>
>>>
>>> <script runat="server">
>>>
>>> Private webLayout As String = "Library://MGA/Layout/MGA Web
>>>
>>> Layout.WebLayout"
>>>
>>> Private defaultUser As String = "Anonymous"
>>>
>>> Private defaultPassword As String = ""
>>>
>>> Private SessionId As String = ""
>>>
>>> Private addRequests As String = ""
>>>
>>> Private Parameters As String = ""
>>>
>>> </script>
>>>
>>>
>>>
>>> <%
>>>
>>>
>>>
>>> Try
>>>
>>> ' Initialize a session and register a variable to hold the
>>>
>>> ' session id, then initialize the Web Extensions, connect
>>>
>>> ' to the site, and create a session.
>>>
>>>
>>>
>>> InitializeWebTier()
>>>
>>>
>>>
>>> Dim userInfo As New MgUserInformation(defaultUser,
>>>
>>> defaultPassword)
>>>
>>> Dim site As New MgSite()
>>>
>>> site.Open(userInfo)
>>>
>>> SessionId = site.CreateSession()
>>>
>>>
>>>
>>> Catch ex As Exception
>>>
>>> Response.Write(ex.Message)
>>>
>>> End Try
>>>
>>>
>>>
>>> %>
>>>
>>>
>>>
>>> <frameset rows="50,*">
>>>
>>> <frame id="titleFrame" frameborder="0" marginwidth="0"
>>>
>>> marginheight="0" scrolling="no"
>>>
>>> src="http://localhost/mapguide/mga/title.html">
>>>
>>> <frame id="viewerFrame" frameborder="0" marginwidth="0"
>>>
>>> marginheight="0" scrolling="no"
>>>
>>>
>>>
>>> src="http://localhost/mapguide/mapviewernet/ajaxviewer.aspx?SESSION=<%=s
>>>
>>> essionId%>&WEBLAYOUT=<%=webLayout%>&LOCALE=en">
>>>
>>> </frameset>
>>>
>>>
>>>
>>>
>>>
>>> ****************************
>>>
>>>
>>>
>>> This page creates a horizontal split page with two pages in it. If you
>>>
>>> adjusted frameset rows="50,*" to "frameset cols="*,*" you would get a
>>>
>>> page split in half vertically. Then change the src="" element to the
>>>
>>> two pages you want shown.
>>>
>>>
>>>
>>> Hope that clears it up a bit.
>>>
>>>
>>>
>>> -Mark Pendergraft
>>>
>>>
>>>
>>>
>>>
>>> -----Original Message-----
>>>
>>> From: mapguide-users-bounces at lists.osgeo.org
>>>
>>> [mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Rodolfo
>>>
>>> Moreno
>>>
>>> Sent: Wednesday, January 21, 2009 7:47 AM
>>>
>>> To: mapguide-users at lists.osgeo.org
>>>
>>> Subject: Re: [mapguide-users] Two maps in the same layout
>>>
>>>
>>>
>>>
>>>
>>> Hi Jackie,
>>>
>>> I don't understand what you want to tell me, could you elaborate on your
>>>
>>> idea?
>>>
>>> this the code of my beginning page
>>>
>>>
>>>
>>> <script runat="server">
>>>
>>> String webLayout =
>>>
>>> "Library://Samples/Sheboygan/Layouts/SheboyganAspTest.WebLayout";
>>>
>>>
>>>
>>> String defaultUser = "Anonymous";
>>>
>>> String defaultPassword = "";
>>>
>>>
>>>
>>> String sessionId1 = "";
>>>
>>> String sessionId2 = "";
>>>
>>> </script>
>>>
>>>
>>>
>>> <%
>>>
>>> try
>>>
>>> {
>>>
>>> // Initialize a session and register a variable to hold the
>>>
>>> // session id, then initialize the Web Extensions, connect
>>>
>>> // to the site, and create a session.
>>>
>>>
>>>
>>> InitializeWebTier();
>>>
>>>
>>>
>>> MgUserInformation userInfo = new MgUserInformation(defaultUser,
>>>
>>> defaultPassword);
>>>
>>> MgSite site = new MgSite();
>>>
>>> site.Open(userInfo);
>>>
>>> sessionId1 = site.CreateSession();
>>>
>>>
>>>
>>> site = new MgSite();
>>>
>>> site.Open(userInfo);
>>>
>>> sessionId2 = site.CreateSession();
>>>
>>> }
>>>
>>> catch (Exception e)
>>>
>>> {
>>>
>>> Response.Write(e.Message);
>>>
>>> }
>>>
>>> %>
>>>
>>>
>>>
>>> <html>
>>>
>>> <head>
>>>
>>> <title>Viewer Sample Application</title>
>>>
>>> </head>
>>>
>>> <frameset rows="30,*" frameborder="no" framespacing="0">
>>>
>>> <frame id="titleFrame" frameborder="no" marginwidth="0"
>>>
>>> marginheight="0"
>>>
>>> scrolling="no" src="title.html">
>>>
>>> <frameset cols="50%,50%">
>>>
>>> <frame id="viewer1Frame" frameborder="no" marginwidth="0"
>>>
>>> marginheight="0" scrolling="no"
>>>
>>> src="/mapguide/mapviewernet/ajaxviewer.aspx?SESSION=<%=sessionId1%>&WEBL
>>>
>>> AYOUT=<%=webLayout%>&THEMINGTYPE=1">
>>>
>>> <frame id="viewer2Frame" frameborder="no" marginwidth="0"
>>>
>>> marginheight="0" scrolling="no"
>>>
>>> src="/mapguide/mapviewernet/ajaxviewer.aspx?SESSION=<%=sessionId2%>&WEBL
>>>
>>> AYOUT=<%=webLayout%>&THEMINGTYPE=2">
>>>
>>> </frameset>
>>>
>>> </frameset>
>>>
>>> </html>
>>>
>>>
>>>
>>> thanks,
>>>
>>>
>>>
>>>
>>>
>>> Jackie Ng wrote:
>>>
>>>>
>>>
>>>> The easiest way is to have an outer frameset (or 2 outer iframes) that
>>>
>>>> points to your individual ajax viewers.
>>>
>>>>
>>>
>>>> - Jackie
>>>
>>>>
>>>
>>>>
>>>
>>>> Rodolfo Moreno wrote:
>>>
>>>>>
>>>
>>>>> I want to put two maps in the same layout and moreover each map must
>>>
>>> be
>>>
>>>>> themed in different way just after of that the application to be
>>>
>>> loaded
>>>
>>>>> (the theming must be done automatically according to a placed
>>>
>>> preference
>>>
>>>>> in the first time that the application to be loaded).
>>>
>>>>>
>>>
>>>>> I did a test application usign ajax viewer and I got it, however I
>>>
>>> have
>>>
>>>>> modified many files of the mapguide extensions (MAINFRAME.ASPX,
>>>
>>>>> FRAMESETTASKBAR.TEMPL, FRAMESETNOTASKBAR.TEMPL, MAPFRAME.ASPX,
>>>
>>>>> AJAXMAPPANE.TEMPL).
>>>
>>>>> I would like to know if it's possible to achieve it without the need
>>>
>>> of
>>>
>>>>> modifying that files?
>>>
>>>>> Also I'd like to know if it's possible to do it in FUSION viewer (I
>>>
>>>>> prefer FUSION than AJAXVIEWER).
>>>
>>>>>
>>>
>>>>> I am attaching a image of my test application.
>>>
>>>>>
>>>
>>>>> thanks in advance,
>>>
>>>>>
>>>
>>>>> http://n2.nabble.com/file/n2189508/testApp.jpg
>>>
>>>>>
>>>
>>>>
>>>
>>>>
>>>
>>>
>>>
>>>
>>>
>>> -----
>>>
>>> Rodolfo Moreno
>>>
>>> CivilEng
>>>
>>>
>>>
>>> --
>>>
>>> View this message in context:
>>>
>>> http://n2.nabble.com/Two-maps-in-the-same-layout-tp2189508p2192823.html
>>>
>>> Sent from the MapGuide Users mailing list archive at Nabble.com.
>>>
>>>
>>>
>>> _______________________________________________
>>>
>>> mapguide-users mailing list
>>>
>>> mapguide-users at lists.osgeo.org
>>>
>>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>>>
>>> _______________________________________________
>>>
>>> mapguide-users mailing list
>>>
>>> mapguide-users at lists.osgeo.org
>>>
>>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>>>
>>> _______________________________________________
>>>
>>> mapguide-users mailing list
>>>
>>> mapguide-users at lists.osgeo.org
>>>
>>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>>>
>>>
>>> _______________________________________________
>>> mapguide-users mailing list
>>> mapguide-users at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>>>
>>>
>>
>>
>
>
--
View this message in context: http://n2.nabble.com/Two-maps-in-the-same-layout-tp2189508p2201251.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
More information about the mapguide-users
mailing list