[mapguide-commits] r5850 - in
trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb: . Tasks
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Tue May 24 13:58:50 EDT 2011
Author: jng
Date: 2011-05-24 10:58:50 -0700 (Tue, 24 May 2011)
New Revision: 5850
Added:
trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleGroupVisibility.aspx
trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleGroupVisibility.aspx.cs
trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleGroupVisibility.aspx.designer.cs
trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleLayerVisibility.aspx
trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleLayerVisibility.aspx.cs
trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleLayerVisibility.aspx.designer.cs
Modified:
trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/SamplesWeb.csproj
trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/AddTracksLayer.aspx
trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/Home.aspx
trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleParcelsLayer.aspx
Log:
#1676: Update the web sample with examples for toggling group/layer visibility
Modified: trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/SamplesWeb.csproj
===================================================================
--- trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/SamplesWeb.csproj 2011-05-24 17:42:07 UTC (rev 5849)
+++ trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/SamplesWeb.csproj 2011-05-24 17:58:50 UTC (rev 5850)
@@ -85,6 +85,8 @@
<Content Include="Global.asax" />
<Content Include="readme.txt" />
<Content Include="Tasks\AddTracksLayer.aspx" />
+ <Content Include="Tasks\ToggleGroupVisibility.aspx" />
+ <Content Include="Tasks\ToggleLayerVisibility.aspx" />
<Content Include="Tasks\ToggleParcelsLayer.aspx" />
<Content Include="Tasks\Home.aspx" />
<Content Include="Web.config" />
@@ -108,6 +110,20 @@
<Compile Include="Tasks\AddTracksLayer.aspx.designer.cs">
<DependentUpon>AddTracksLayer.aspx</DependentUpon>
</Compile>
+ <Compile Include="Tasks\ToggleGroupVisibility.aspx.cs">
+ <DependentUpon>ToggleGroupVisibility.aspx</DependentUpon>
+ <SubType>ASPXCodeBehind</SubType>
+ </Compile>
+ <Compile Include="Tasks\ToggleGroupVisibility.aspx.designer.cs">
+ <DependentUpon>ToggleGroupVisibility.aspx</DependentUpon>
+ </Compile>
+ <Compile Include="Tasks\ToggleLayerVisibility.aspx.cs">
+ <DependentUpon>ToggleLayerVisibility.aspx</DependentUpon>
+ <SubType>ASPXCodeBehind</SubType>
+ </Compile>
+ <Compile Include="Tasks\ToggleLayerVisibility.aspx.designer.cs">
+ <DependentUpon>ToggleLayerVisibility.aspx</DependentUpon>
+ </Compile>
<Compile Include="Tasks\ToggleParcelsLayer.aspx.cs">
<DependentUpon>ToggleParcelsLayer.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
Modified: trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/AddTracksLayer.aspx
===================================================================
--- trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/AddTracksLayer.aspx 2011-05-24 17:42:07 UTC (rev 5849)
+++ trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/AddTracksLayer.aspx 2011-05-24 17:58:50 UTC (rev 5850)
@@ -11,7 +11,7 @@
<div>
<asp:Label ID="lblMessage" runat="server"></asp:Label>
<br />
- <a href="javascript:history.go(-1)">Go back</a>
+ <a href="Home.aspx">Go back</a>
<br />
<div id="debug" runat="server">
</div>
Modified: trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/Home.aspx
===================================================================
--- trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/Home.aspx 2011-05-24 17:42:07 UTC (rev 5849)
+++ trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/Home.aspx 2011-05-24 17:58:50 UTC (rev 5850)
@@ -7,13 +7,16 @@
<title>Home</title>
<script type="text/javascript">
- function Go(url)
+ function Go(url, extraParams)
{
var map = parent.parent.GetMapFrame();
url += "?SESSION=" + map.GetSessionId();
url += "&MAPNAME=" + map.GetMapName();
+ if (extraParams)
+ url += "&" + extraParams;
+
window.location = url;
}
@@ -24,8 +27,10 @@
<p>Samples</p>
<ul>
- <li><a href="#" onclick="Go('ToggleParcelsLayer.aspx')">Toggle Parcels Layer</a></li>
- <li><a href="#" onclick="Go('AddTracksLayer.aspx')">Add Tracks Layer</a></li>
+ <li><a href="#" onclick="Go('ToggleParcelsLayer.aspx',null)">Add/Remove Parcels Layer</a></li>
+ <li><a href="#" onclick="Go('AddTracksLayer.aspx',null)">Add Tracks Layer</a></li>
+ <li><a href="#" onclick="Go('ToggleGroupVisibility.aspx','GROUPNAME=Base Map')">Toggle "Base Map" Group</a></li>
+ <li><a href="#" onclick="Go('ToggleLayerVisibility.aspx','LAYERNAME=Parcels')">Toggle "Parcels" Layer</a></li>
</ul>
</body>
</html>
Added: trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleGroupVisibility.aspx
===================================================================
--- trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleGroupVisibility.aspx (rev 0)
+++ trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleGroupVisibility.aspx 2011-05-24 17:58:50 UTC (rev 5850)
@@ -0,0 +1,21 @@
+<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ToggleGroupVisibility.aspx.cs" Inherits="SamplesWeb.Tasks.ToggleGroupVisibility" %>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" >
+<head runat="server">
+ <title>Untitled Page</title>
+</head>
+<body>
+ <form id="form1" runat="server">
+ <div>
+ <asp:Label ID="lblMessage" runat="server"></asp:Label>
+ <br />
+ <a href="Home.aspx">Go back</a>
+ <br />
+ <div id="debug" runat="server">
+ </div>
+ </div>
+ </form>
+</body>
+</html>
Added: trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleGroupVisibility.aspx.cs
===================================================================
--- trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleGroupVisibility.aspx.cs (rev 0)
+++ trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleGroupVisibility.aspx.cs 2011-05-24 17:58:50 UTC (rev 5850)
@@ -0,0 +1,53 @@
+using System;
+using System.Collections;
+using System.Configuration;
+using System.Data;
+using System.Web;
+using System.Web.Security;
+using System.Web.UI;
+using System.Web.UI.HtmlControls;
+using System.Web.UI.WebControls;
+using System.Web.UI.WebControls.WebParts;
+using OSGeo.MapGuide.MaestroAPI.Mapping;
+using OSGeo.MapGuide.MaestroAPI.Services;
+using OSGeo.MapGuide.MaestroAPI;
+
+namespace SamplesWeb.Tasks
+{
+ public partial class ToggleGroupVisibility : System.Web.UI.Page
+ {
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ string agent = ConfigurationManager.AppSettings["MapAgentUrl"];
+
+ IServerConnection conn = ConnectionProviderRegistry.CreateConnection(
+ "Maestro.Http",
+ "Url", agent,
+ "SessionId", Request.Params["SESSION"]);
+
+ IMappingService mpSvc = (IMappingService)conn.GetService((int)ServiceType.Mapping);
+ string rtMapId = "Session:" + conn.SessionID + "//" + Request.Params["MAPNAME"] + ".Map";
+
+ RuntimeMap rtMap = mpSvc.OpenMap(rtMapId);
+
+ RuntimeMapGroup group = rtMap.GetGroupByName(Request.Params["GROUPNAME"]);
+ if (group != null)
+ {
+ group.Visible = !group.Visible;
+
+ rtMap.Save(); //Always save changes after modifying
+
+ Page.ClientScript.RegisterStartupScript(
+ this.GetType(),
+ "load",
+ "<script type=\"text/javascript\"> window.onload = function() { parent.parent.Refresh(); } </script>");
+
+ lblMessage.Text = "Group (" + group.Name + ") visible: " + group.Visible;
+ }
+ else
+ {
+ lblMessage.Text = "Group (" + group.Name + ") not found!";
+ }
+ }
+ }
+}
Added: trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleGroupVisibility.aspx.designer.cs
===================================================================
--- trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleGroupVisibility.aspx.designer.cs (rev 0)
+++ trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleGroupVisibility.aspx.designer.cs 2011-05-24 17:58:50 UTC (rev 5850)
@@ -0,0 +1,43 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.4952
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace SamplesWeb.Tasks {
+
+
+ public partial class ToggleGroupVisibility {
+
+ /// <summary>
+ /// form1 control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.HtmlControls.HtmlForm form1;
+
+ /// <summary>
+ /// lblMessage control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Label lblMessage;
+
+ /// <summary>
+ /// debug control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.HtmlControls.HtmlGenericControl debug;
+ }
+}
Added: trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleLayerVisibility.aspx
===================================================================
--- trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleLayerVisibility.aspx (rev 0)
+++ trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleLayerVisibility.aspx 2011-05-24 17:58:50 UTC (rev 5850)
@@ -0,0 +1,21 @@
+<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ToggleLayerVisibility.aspx.cs" Inherits="SamplesWeb.Tasks.ToggleLayerVisibility" %>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" >
+<head runat="server">
+ <title>Untitled Page</title>
+</head>
+<body>
+ <form id="form1" runat="server">
+ <div>
+ <asp:Label ID="lblMessage" runat="server"></asp:Label>
+ <br />
+ <a href="Home.aspx">Go back</a>
+ <br />
+ <div id="debug" runat="server">
+ </div>
+ </div>
+ </form>
+</body>
+</html>
Added: trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleLayerVisibility.aspx.cs
===================================================================
--- trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleLayerVisibility.aspx.cs (rev 0)
+++ trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleLayerVisibility.aspx.cs 2011-05-24 17:58:50 UTC (rev 5850)
@@ -0,0 +1,54 @@
+using System;
+using System.Collections;
+using System.Configuration;
+using System.Data;
+using System.Web;
+using System.Web.Security;
+using System.Web.UI;
+using System.Web.UI.HtmlControls;
+using System.Web.UI.WebControls;
+using System.Web.UI.WebControls.WebParts;
+using OSGeo.MapGuide.MaestroAPI;
+using OSGeo.MapGuide.MaestroAPI.Services;
+using OSGeo.MapGuide.MaestroAPI.Mapping;
+
+namespace SamplesWeb.Tasks
+{
+ public partial class ToggleLayerVisibility : System.Web.UI.Page
+ {
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ string agent = ConfigurationManager.AppSettings["MapAgentUrl"];
+
+ IServerConnection conn = ConnectionProviderRegistry.CreateConnection(
+ "Maestro.Http",
+ "Url", agent,
+ "SessionId", Request.Params["SESSION"]);
+
+ IMappingService mpSvc = (IMappingService)conn.GetService((int)ServiceType.Mapping);
+ string rtMapId = "Session:" + conn.SessionID + "//" + Request.Params["MAPNAME"] + ".Map";
+
+ RuntimeMap rtMap = mpSvc.OpenMap(rtMapId);
+
+ RuntimeMapLayer layer = rtMap.GetLayerByName(Request.Params["LAYERNAME"]);
+ if (layer != null)
+ {
+ layer.Visible = !layer.Visible;
+
+ rtMap.Save(); //Always save changes after modifying
+
+ Page.ClientScript.RegisterStartupScript(
+ this.GetType(),
+ "load",
+ "<script type=\"text/javascript\"> window.onload = function() { parent.parent.Refresh(); } </script>");
+
+
+ lblMessage.Text = "Layer (" + layer.Name + ") visible: " + layer.Visible;
+ }
+ else
+ {
+ lblMessage.Text = "Layer (" + layer.Name + ") not found!";
+ }
+ }
+ }
+}
Added: trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleLayerVisibility.aspx.designer.cs
===================================================================
--- trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleLayerVisibility.aspx.designer.cs (rev 0)
+++ trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleLayerVisibility.aspx.designer.cs 2011-05-24 17:58:50 UTC (rev 5850)
@@ -0,0 +1,43 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.4952
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace SamplesWeb.Tasks {
+
+
+ public partial class ToggleLayerVisibility {
+
+ /// <summary>
+ /// form1 control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.HtmlControls.HtmlForm form1;
+
+ /// <summary>
+ /// lblMessage control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Label lblMessage;
+
+ /// <summary>
+ /// debug control.
+ /// </summary>
+ /// <remarks>
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ /// </remarks>
+ protected global::System.Web.UI.HtmlControls.HtmlGenericControl debug;
+ }
+}
Modified: trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleParcelsLayer.aspx
===================================================================
--- trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleParcelsLayer.aspx 2011-05-24 17:42:07 UTC (rev 5849)
+++ trunk/Tools/Maestro/SDK/SamplesWeb/SamplesWeb/Tasks/ToggleParcelsLayer.aspx 2011-05-24 17:58:50 UTC (rev 5850)
@@ -11,7 +11,7 @@
<div>
<asp:Label ID="lblMessage" runat="server"></asp:Label>
<br />
- <a href="javascript:history.go(-1)">Go back</a>
+ <a href="Home.aspx">Go back</a>
<br />
<div id="debug" runat="server">
</div>
More information about the mapguide-commits
mailing list