<%-- Copyright (C) 2004-2008 by Autodesk, Inc. This library is free software; you can redistribute it and/or modify it under the terms of version 2.1 of the GNU Lesser General Public License as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA --%> <%@ Page language="c#" %> <%@ Import Namespace="System" %> <%@ Import Namespace="System.IO" %> <%@ Import Namespace="System.Collections" %> <%@ Import Namespace="System.Collections.Specialized" %> <%@ Import Namespace="System.Web" %> <%@ Import Namespace="System.Globalization" %> <%@ Import Namespace="System.Xml" %> <%@ Import Namespace="OSGeo.MapGuide" %> <% Response.Charset = "utf-8"; try { // Initialize web tier with the site configuration file. InitializeWebTier(); //fetch the parameters for this request // GetRequestParameters(); // Connect to the site and get a resource service instance // MgUserInformation userInfo = new MgUserInformation(); userInfo.SetMgSessionId(sessionId); MgSiteConnection site = new MgSiteConnection(); site.Open(userInfo); MgResourceService resourceSrvc = (MgResourceService)site.CreateService(MgServiceType.ResourceService); //Load the map runtime state. // MgMap map = new MgMap(); map.Open(resourceSrvc, mapName); int updateType = -1; ArrayList tree = BuildLayerTree(map); if(summary) { updateType = 0; // return only the layer structure, that is mainly groups/layers/layer-ids. Do not parse layer definitions. // BuildClientSideTree(tree, null, "null", false, "layerData", resourceSrvc, null); } else { Hashtable layerMap = null; if(layerCount == 0) updateType = 1; else { updateType = 2; layerMap = BuildLayerMap(map); } BuildClientSideTree(tree, null, "null", true, "layerData", resourceSrvc, layerMap); } //load html template code and format it // String templ = LoadTemplate(Request, "../viewerfiles/legendupdate.templ"); String[] vals = { updateType.ToString(NumberFormatInfo.InvariantInfo), output, GetSurroundVirtualPath(Request) + "legend.aspx"}; String outputString = Substitute(templ, vals); Response.Write(Substitute(templ, vals)); } catch(MgException mge) { Response.Write(mge.GetMessage()); Response.Write("
"); Response.Write(mge.GetDetails()); } %>