[mapguide-commits] r4406 - in sandbox/rfc60/MgDev/Web/src:
DotNetUnmanagedApi/Geometry PhpMapGuideApiEnvConfig
mapviewerjava mapviewernet mapviewerphp schemareport
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Wed Dec 9 17:22:44 EST 2009
Author: uvlite
Date: 2009-12-09 17:22:44 -0500 (Wed, 09 Dec 2009)
New Revision: 4406
Modified:
sandbox/rfc60/MgDev/Web/src/DotNetUnmanagedApi/Geometry/GeometryConstants.xml
sandbox/rfc60/MgDev/Web/src/PhpMapGuideApiEnvConfig/PhpMapGuideApiEnvConfig.cpp
sandbox/rfc60/MgDev/Web/src/mapviewerjava/ajaxviewerabout.jsp
sandbox/rfc60/MgDev/Web/src/mapviewerjava/common.jsp
sandbox/rfc60/MgDev/Web/src/mapviewerjava/formframe.jsp
sandbox/rfc60/MgDev/Web/src/mapviewerjava/gettingstarted.jsp
sandbox/rfc60/MgDev/Web/src/mapviewerjava/legend.jsp
sandbox/rfc60/MgDev/Web/src/mapviewerjava/legendctrl.jsp
sandbox/rfc60/MgDev/Web/src/mapviewerjava/legendui.jsp
sandbox/rfc60/MgDev/Web/src/mapviewerjava/mainframe.jsp
sandbox/rfc60/MgDev/Web/src/mapviewerjava/printablepage.jsp
sandbox/rfc60/MgDev/Web/src/mapviewerjava/printablepageui.jsp
sandbox/rfc60/MgDev/Web/src/mapviewerjava/propertyctrl.jsp
sandbox/rfc60/MgDev/Web/src/mapviewernet/common.aspx
sandbox/rfc60/MgDev/Web/src/mapviewernet/formframe.aspx
sandbox/rfc60/MgDev/Web/src/mapviewernet/gettingstarted.aspx
sandbox/rfc60/MgDev/Web/src/mapviewernet/legend.aspx
sandbox/rfc60/MgDev/Web/src/mapviewernet/legendctrl.aspx
sandbox/rfc60/MgDev/Web/src/mapviewernet/legendui.aspx
sandbox/rfc60/MgDev/Web/src/mapviewernet/mainframe.aspx
sandbox/rfc60/MgDev/Web/src/mapviewernet/mapframe.aspx
sandbox/rfc60/MgDev/Web/src/mapviewernet/printablepage.aspx
sandbox/rfc60/MgDev/Web/src/mapviewernet/printablepageui.aspx
sandbox/rfc60/MgDev/Web/src/mapviewerphp/common.php
sandbox/rfc60/MgDev/Web/src/mapviewerphp/createlayer.php
sandbox/rfc60/MgDev/Web/src/mapviewerphp/gettingstarted.php
sandbox/rfc60/MgDev/Web/src/mapviewerphp/legend.php
sandbox/rfc60/MgDev/Web/src/mapviewerphp/mainframe.php
sandbox/rfc60/MgDev/Web/src/mapviewerphp/mapframe.php
sandbox/rfc60/MgDev/Web/src/schemareport/displayschema.php
Log:
RFC60 merged Web from trunk to sandbox
Modified: sandbox/rfc60/MgDev/Web/src/DotNetUnmanagedApi/Geometry/GeometryConstants.xml
===================================================================
--- sandbox/rfc60/MgDev/Web/src/DotNetUnmanagedApi/Geometry/GeometryConstants.xml 2009-12-09 22:21:34 UTC (rev 4405)
+++ sandbox/rfc60/MgDev/Web/src/DotNetUnmanagedApi/Geometry/GeometryConstants.xml 2009-12-09 22:22:44 UTC (rev 4406)
@@ -75,7 +75,9 @@
<Class name="MgCoordinateSystemGeodeticTransformationMethod" />
<Class name="MgCoordinateSystemGridOrientation" />
<Class name="MgCoordinateSystemGridSpecializationType" />
+ <Class name="MgCoordinateSystemMgrsGridLevel" />
<Class name="MgCoordinateSystemMgrsLetteringScheme" />
+ <Class name="MgCoordinateSystemMgrsGridSquarePosition" />
<Class name="MgCoordinateSystemProjectionCode" />
<Class name="MgCoordinateSystemProjectionFormatType" />
<Class name="MgCoordinateSystemProjectionLogicalType" />
@@ -103,7 +105,9 @@
<Header path="../../../../Common/Geometry/CoordinateSystem/CoordinateSystemGeodeticTransformationMethod.h" />
<Header path="../../../../Common/Geometry/CoordinateSystem/CoordinateSystemGridOrientation.h" />
<Header path="../../../../Common/Geometry/CoordinateSystem/CoordinateSystemGridSpecializationType.h" />
+ <Header path="../../../../Common/Geometry/CoordinateSystem/CoordinateSystemMgrsGridLevel.h" />
<Header path="../../../../Common/Geometry/CoordinateSystem/CoordinateSystemMgrsLetteringScheme.h" />
+ <Header path="../../../../Common/Geometry/CoordinateSystem/CoordinateSystemMgrsGridSquarePosition.h" />
<Header path="../../../../Common/Geometry/CoordinateSystem/CoordinateSystemProjectionCode.h" />
<Header path="../../../../Common/Geometry/CoordinateSystem/CoordinateSystemProjectionFormatType.h" />
<Header path="../../../../Common/Geometry/CoordinateSystem/CoordinateSystemProjectionLogicalType.h" />
Modified: sandbox/rfc60/MgDev/Web/src/PhpMapGuideApiEnvConfig/PhpMapGuideApiEnvConfig.cpp
===================================================================
--- sandbox/rfc60/MgDev/Web/src/PhpMapGuideApiEnvConfig/PhpMapGuideApiEnvConfig.cpp 2009-12-09 22:21:34 UTC (rev 4405)
+++ sandbox/rfc60/MgDev/Web/src/PhpMapGuideApiEnvConfig/PhpMapGuideApiEnvConfig.cpp 2009-12-09 22:22:44 UTC (rev 4406)
@@ -42,7 +42,6 @@
// Get the location of PHP
HMODULE hModule;
GetModuleHandleEx(0, L"php5ts.dll", &hModule);
- wchar_t g_phpPath[MAX_PATH];
GetModuleFileName(hModule, g_phpPath, MAX_PATH);
wcsrchr(g_phpPath, '\\')[0] = '\0';
FreeLibrary(hModule);
Modified: sandbox/rfc60/MgDev/Web/src/mapviewerjava/ajaxviewerabout.jsp
===================================================================
--- sandbox/rfc60/MgDev/Web/src/mapviewerjava/ajaxviewerabout.jsp 2009-12-09 22:21:34 UTC (rev 4405)
+++ sandbox/rfc60/MgDev/Web/src/mapviewerjava/ajaxviewerabout.jsp 2009-12-09 22:22:44 UTC (rev 4406)
@@ -79,7 +79,7 @@
}
catch(Exception ne)
{
- String msg = ne.getLocalizedMessage();
+ String msg = EscapeForHtml(ne.getLocalizedMessage());
writer = response.getWriter();
writer.write(msg);
response.setContentLength(msg.length());
Modified: sandbox/rfc60/MgDev/Web/src/mapviewerjava/common.jsp
===================================================================
--- sandbox/rfc60/MgDev/Web/src/mapviewerjava/common.jsp 2009-12-09 22:21:34 UTC (rev 4405)
+++ sandbox/rfc60/MgDev/Web/src/mapviewerjava/common.jsp 2009-12-09 22:22:44 UTC (rev 4406)
@@ -165,9 +165,9 @@
{
str = str.replaceAll("'", "'");
str = str.replaceAll("\"", """);
- str = str.replaceAll("\n", " ");
str = str.replaceAll("<", "<");
str = str.replaceAll(">", ">");
+ str = str.replaceAll("\\\\n", "<br>");
return str;
}
Modified: sandbox/rfc60/MgDev/Web/src/mapviewerjava/formframe.jsp
===================================================================
--- sandbox/rfc60/MgDev/Web/src/mapviewerjava/formframe.jsp 2009-12-09 22:21:34 UTC (rev 4405)
+++ sandbox/rfc60/MgDev/Web/src/mapviewerjava/formframe.jsp 2009-12-09 22:22:44 UTC (rev 4406)
@@ -34,7 +34,7 @@
}
catch(Exception ne)
{
- String msg = ne.getLocalizedMessage();
+ String msg = EscapeForHtml(ne.getLocalizedMessage());
writer = response.getWriter();
writer.write(msg);
response.setContentLength(msg.length());
Modified: sandbox/rfc60/MgDev/Web/src/mapviewerjava/gettingstarted.jsp
===================================================================
--- sandbox/rfc60/MgDev/Web/src/mapviewerjava/gettingstarted.jsp 2009-12-09 22:21:34 UTC (rev 4405)
+++ sandbox/rfc60/MgDev/Web/src/mapviewerjava/gettingstarted.jsp 2009-12-09 22:22:44 UTC (rev 4406)
@@ -80,10 +80,12 @@
outStream.write(fixedupHtml);
}
catch(MgException mge) {
- outStream.write(mge.GetDetails());
+ String errorMsg = EscapeForHtml(mge.GetDetails());
+ outStream.write(errorMsg);
}
catch(Exception e) {
- outStream.write(e.getMessage());
+ String errorMsg = EscapeForHtml(e.getMessage());
+ outStream.write(errorMsg);
}
%>
Modified: sandbox/rfc60/MgDev/Web/src/mapviewerjava/legend.jsp
===================================================================
--- sandbox/rfc60/MgDev/Web/src/mapviewerjava/legend.jsp 2009-12-09 22:21:34 UTC (rev 4405)
+++ sandbox/rfc60/MgDev/Web/src/mapviewerjava/legend.jsp 2009-12-09 22:22:44 UTC (rev 4406)
@@ -29,11 +29,12 @@
class TreeItem
{
- public TreeItem(String name, boolean isGroup, Object rtObject)
+ public TreeItem(String name, boolean isGroup, Object rtObject, String layerData)
{
this.name = name;
this.isGroup = isGroup;
this.rtObject = rtObject;
+ this.layerData = layerData;
if(isGroup)
this.children = new ArrayList();
else
@@ -55,6 +56,7 @@
public ArrayList children;
public String parentName;
public TreeItem parent;
+ public String layerData;
}
String mapName = "";
@@ -103,7 +105,7 @@
int updateType = -1;
- ArrayList tree = BuildLayerTree(map);
+ ArrayList tree = BuildLayerTree(map, resourceSrvc);
if(summary)
{
updateType = 0;
@@ -134,14 +136,14 @@
}
catch(MgException e)
{
- String details = e.GetDetails();
+ String details = EscapeForHtml(e.GetDetails());
writer = response.getWriter();
writer.write(details);
response.setContentLength(details.length());
}
catch(Exception ne)
{
- String msg = ne.getLocalizedMessage();
+ String msg = EscapeForHtml(ne.getLocalizedMessage());
writer = response.getWriter();
writer.write(msg);
response.setContentLength(msg.length());
@@ -182,7 +184,7 @@
%>
<%!
-ArrayList BuildLayerTree(MgMap map) throws MgException
+ArrayList BuildLayerTree(MgMap map, MgResourceService resSrvc) throws MgException
{
ArrayList tree = new ArrayList();
HashMap knownGroups = new HashMap();
@@ -192,7 +194,7 @@
for(int i = 0; i < groups.GetCount(); i++)
{
MgLayerGroup rtGroup = (MgLayerGroup)groups.GetItem(i);
- TreeItem node = new TreeItem(rtGroup.GetName(), true, rtGroup);
+ TreeItem node = new TreeItem(rtGroup.GetName(), true, rtGroup, "null");
knownGroups.put(node.name, node);
MgLayerGroup parentGroup = rtGroup.GetGroup();
if(parentGroup == null)
@@ -224,11 +226,23 @@
tree.add(node); //should not happen. place group in the root if parent is not known
}
}
+ // Get the layers
MgLayerCollection layers = map.GetLayers();
+
+ // Get the resource Ids of the layers
+ MgStringCollection resIds = new MgStringCollection();
for(int i = 0; i < layers.GetCount(); i++)
{
MgLayer rtLayer = (MgLayer) layers.GetItem(i);
- TreeItem node = new TreeItem(rtLayer.GetName(), false, rtLayer);
+ MgResourceIdentifier resId = rtLayer.GetLayerDefinition();
+ resIds.Add(resId.ToString());
+ }
+ MgStringCollection layersData = resSrvc.GetResourceContents(resIds, null);
+
+ for(int i = 0; i < layers.GetCount(); i++)
+ {
+ MgLayer rtLayer = (MgLayer) layers.GetItem(i);
+ TreeItem node = new TreeItem(rtLayer.GetName(), false, rtLayer, (String)layersData.GetItem(i));
MgLayerGroup parentGroup = rtLayer.GetGroup();
if(parentGroup == null)
tree.add(node);
@@ -326,6 +340,7 @@
if(fulldata)
{
MgResourceIdentifier resId = rtLayer.GetLayerDefinition();
+ String layerData = node.layerData;
String layerName = "lyr" + (intermediateVar++);
String objectId = rtLayer.GetObjectId();
output = output + String.format("var %s = new LayerItem(\"%s\", \"%s\", %s, %s, %s, %s, %s, \"%s\", \"%s\", %s);\n",
@@ -349,7 +364,7 @@
if(layerMap == null || !layerMap.containsKey(objectId))
{
- BuildLayerDefinitionData(resSrvc, resId, layerName);
+ BuildLayerDefinitionData(layerData, layerName);
}
}
else
@@ -369,15 +384,14 @@
%>
<%!
-void BuildLayerDefinitionData(MgResourceService resSrvc, MgResourceIdentifier resId, String layerVarName)
+void BuildLayerDefinitionData(String layerData, String layerVarName)
{
try
{
- MgByteReader layerByteReader = resSrvc.GetResourceContent(resId);
- InputStream layerStream = ByteReaderToStream(layerByteReader);
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
- Document doc = builder.parse(layerStream);
+ InputStream is = new ByteArrayInputStream(layerData.getBytes("UTF-8"));
+ Document doc = builder.parse(is);
int type = 0;
NodeList scaleRanges = doc.getElementsByTagName("VectorScaleRange");
if(scaleRanges.getLength() == 0) {
@@ -466,11 +480,6 @@
}
output = output + String.format("%s.lyrtype = %d;\n", new Object[]{layerVarName, new Integer(type) });
}
- catch(MgException e)
- {
- //broken layer definition. just don't create any info for that layer
- return;
- }
catch(Exception e)
{
//broken layer definition. just don't create any info for that layer
Modified: sandbox/rfc60/MgDev/Web/src/mapviewerjava/legendctrl.jsp
===================================================================
--- sandbox/rfc60/MgDev/Web/src/mapviewerjava/legendctrl.jsp 2009-12-09 22:21:34 UTC (rev 4405)
+++ sandbox/rfc60/MgDev/Web/src/mapviewerjava/legendctrl.jsp 2009-12-09 22:22:44 UTC (rev 4406)
@@ -58,7 +58,7 @@
}
catch(Exception ne)
{
- String msg = ne.getLocalizedMessage();
+ String msg = EscapeForHtml(ne.getLocalizedMessage());
writer = response.getWriter();
writer.write(msg);
response.setContentLength(msg.length());
Modified: sandbox/rfc60/MgDev/Web/src/mapviewerjava/legendui.jsp
===================================================================
--- sandbox/rfc60/MgDev/Web/src/mapviewerjava/legendui.jsp 2009-12-09 22:21:34 UTC (rev 4405)
+++ sandbox/rfc60/MgDev/Web/src/mapviewerjava/legendui.jsp 2009-12-09 22:22:44 UTC (rev 4406)
@@ -42,7 +42,7 @@
}
catch(Exception ne)
{
- String msg = ne.getLocalizedMessage();
+ String msg = EscapeForHtml(ne.getLocalizedMessage());
writer = response.getWriter();
writer.write(msg);
response.setContentLength(msg.length());
Modified: sandbox/rfc60/MgDev/Web/src/mapviewerjava/mainframe.jsp
===================================================================
--- sandbox/rfc60/MgDev/Web/src/mapviewerjava/mainframe.jsp 2009-12-09 22:21:34 UTC (rev 4405)
+++ sandbox/rfc60/MgDev/Web/src/mapviewerjava/mainframe.jsp 2009-12-09 22:22:44 UTC (rev 4406)
@@ -538,13 +538,13 @@
}
catch(MgException e)
{
- String msg = e.GetMessage();
+ String msg = EscapeForHtml(e.GetMessage());
response.getWriter().write(msg);
response.setContentLength(msg.length());
}
catch(Exception ne)
{
- String msg = ne.getLocalizedMessage();
+ String msg = EscapeForHtml(ne.getLocalizedMessage());
response.getWriter().write(msg);
response.setContentLength(msg.length());
}
Modified: sandbox/rfc60/MgDev/Web/src/mapviewerjava/printablepage.jsp
===================================================================
--- sandbox/rfc60/MgDev/Web/src/mapviewerjava/printablepage.jsp 2009-12-09 22:21:34 UTC (rev 4405)
+++ sandbox/rfc60/MgDev/Web/src/mapviewerjava/printablepage.jsp 2009-12-09 22:22:44 UTC (rev 4406)
@@ -84,7 +84,7 @@
}
catch(Exception ne)
{
- String msg = ne.getLocalizedMessage();
+ String msg = EscapeForHtml(ne.getLocalizedMessage());
writer = response.getWriter();
writer.write(msg);
response.setContentLength(msg.length());
Modified: sandbox/rfc60/MgDev/Web/src/mapviewerjava/printablepageui.jsp
===================================================================
--- sandbox/rfc60/MgDev/Web/src/mapviewerjava/printablepageui.jsp 2009-12-09 22:21:34 UTC (rev 4405)
+++ sandbox/rfc60/MgDev/Web/src/mapviewerjava/printablepageui.jsp 2009-12-09 22:22:44 UTC (rev 4406)
@@ -65,7 +65,7 @@
}
catch(Exception ne)
{
- String msg = ne.getLocalizedMessage();
+ String msg = EscapeForHtml(ne.getLocalizedMessage());
writer = response.getWriter();
writer.write(msg);
response.setContentLength(msg.length());
Modified: sandbox/rfc60/MgDev/Web/src/mapviewerjava/propertyctrl.jsp
===================================================================
--- sandbox/rfc60/MgDev/Web/src/mapviewerjava/propertyctrl.jsp 2009-12-09 22:21:34 UTC (rev 4405)
+++ sandbox/rfc60/MgDev/Web/src/mapviewerjava/propertyctrl.jsp 2009-12-09 22:22:44 UTC (rev 4406)
@@ -45,7 +45,7 @@
}
catch(Exception ne)
{
- String msg = ne.getLocalizedMessage();
+ String msg = EscapeForHtml(ne.getLocalizedMessage());
writer = response.getWriter();
writer.write(msg);
response.setContentLength(msg.length());
Modified: sandbox/rfc60/MgDev/Web/src/mapviewernet/common.aspx
===================================================================
--- sandbox/rfc60/MgDev/Web/src/mapviewernet/common.aspx 2009-12-09 22:21:34 UTC (rev 4405)
+++ sandbox/rfc60/MgDev/Web/src/mapviewernet/common.aspx 2009-12-09 22:22:44 UTC (rev 4406)
@@ -159,9 +159,9 @@
{
str = str.Replace("'", "'");
str = str.Replace("\"", """);
- str = str.Replace("\n", " ");
str = str.Replace("<", "<");
str = str.Replace(">", ">");
+ str = str.Replace("\\n", "<br>");
return str;
}
Modified: sandbox/rfc60/MgDev/Web/src/mapviewernet/formframe.aspx
===================================================================
--- sandbox/rfc60/MgDev/Web/src/mapviewernet/formframe.aspx 2009-12-09 22:21:34 UTC (rev 4405)
+++ sandbox/rfc60/MgDev/Web/src/mapviewernet/formframe.aspx 2009-12-09 22:22:44 UTC (rev 4406)
@@ -36,6 +36,7 @@
}
catch(Exception ne)
{
- Response.Write(ne.Message);
+ String errorMsg = EscapeForHtml(ne.Message);
+ Response.Write(errorMsg);
}
%>
Modified: sandbox/rfc60/MgDev/Web/src/mapviewernet/gettingstarted.aspx
===================================================================
--- sandbox/rfc60/MgDev/Web/src/mapviewernet/gettingstarted.aspx 2009-12-09 22:21:34 UTC (rev 4405)
+++ sandbox/rfc60/MgDev/Web/src/mapviewernet/gettingstarted.aspx 2009-12-09 22:22:44 UTC (rev 4406)
@@ -80,7 +80,8 @@
Response.Write(fixedupHtml);
}
catch(MgException mge) {
- Response.Write(mge.GetDetails());
+ String errorMsg = EscapeForHtml(mge.GetDetails());
+ Response.Write(errorMsg);
}
catch(Exception e) {
}
Modified: sandbox/rfc60/MgDev/Web/src/mapviewernet/legend.aspx
===================================================================
--- sandbox/rfc60/MgDev/Web/src/mapviewernet/legend.aspx 2009-12-09 22:21:34 UTC (rev 4405)
+++ sandbox/rfc60/MgDev/Web/src/mapviewernet/legend.aspx 2009-12-09 22:22:44 UTC (rev 4406)
@@ -29,11 +29,12 @@
<script runat="server">
class TreeItem
{
- public TreeItem(String name, bool isGroup, Object rtObject)
+ public TreeItem(String name, bool isGroup, Object rtObject, String layerData)
{
this.name = name;
this.isGroup = isGroup;
this.rtObject = rtObject;
+ this.layerData = layerData;
if(isGroup)
this.children = new ArrayList();
else
@@ -55,6 +56,7 @@
public ArrayList children;
public String parentName;
public TreeItem parent;
+ public String layerData;
}
String mapName = "";
@@ -96,7 +98,7 @@
int updateType = -1;
- ArrayList tree = BuildLayerTree(map);
+ ArrayList tree = BuildLayerTree(map, resourceSrvc);
if(summary)
{
updateType = 0;
@@ -129,9 +131,8 @@
}
catch(MgException mge)
{
- Response.Write(mge.GetMessage());
- Response.Write("<br>");
- Response.Write(mge.GetDetails());
+ String errorMsg = EscapeForHtml(mge.GetDetails());
+ Response.Write(errorMsg);
}
%>
@@ -190,7 +191,7 @@
return number.ToString(NumberFormatInfo.InvariantInfo);
}
-ArrayList BuildLayerTree(MgMap map)
+ArrayList BuildLayerTree(MgMap map, MgResourceService resSrvc)
{
ArrayList tree = new ArrayList();
Hashtable knownGroups = new Hashtable();
@@ -200,7 +201,7 @@
for(int i = 0; i < groups.GetCount(); i++)
{
MgLayerGroup rtGroup = (MgLayerGroup)groups.GetItem(i);
- TreeItem node = new TreeItem(rtGroup.GetName(), true, rtGroup);
+ TreeItem node = new TreeItem(rtGroup.GetName(), true, rtGroup, null);
knownGroups.Add(node.name, node);
MgLayerGroup parentGroup = rtGroup.GetGroup();
if(parentGroup == null)
@@ -232,11 +233,23 @@
tree.Add(node); //should not happen. place group in the root if parent is not known
}
}
+ // Get the layers
MgLayerCollection layers = map.GetLayers();
+
+ // Get the resource Ids of the layers
+ MgStringCollection resIds = new MgStringCollection();
for(int i = 0; i < layers.GetCount(); i++)
{
MgLayer rtLayer = (MgLayer) layers.GetItem(i);
- TreeItem node = new TreeItem(rtLayer.GetName(), false, rtLayer);
+ MgResourceIdentifier resId = rtLayer.GetLayerDefinition();
+ resIds.Add(resId.ToString());
+ }
+ MgStringCollection layersData = resSrvc.GetResourceContents(resIds, null);
+
+ for(int i = 0; i < layers.GetCount(); i++)
+ {
+ MgLayer rtLayer = (MgLayer) layers.GetItem(i);
+ TreeItem node = new TreeItem(rtLayer.GetName(), false, rtLayer, (String)layersData.GetItem(i));
MgLayerGroup parentGroup = rtLayer.GetGroup();
if(parentGroup == null)
tree.Add(node);
@@ -334,6 +347,7 @@
if(fulldata)
{
MgResourceIdentifier resId = rtLayer.GetLayerDefinition();
+ String layerData = node.layerData;
String layerName = "lyr" + (intermediateVar++);
String objectId = rtLayer.GetObjectId();
output = output + String.Format("var {0} = new LayerItem(\"{1}\", \"{2}\", {3}, {4}, {5}, {6}, {7}, \"{8}\", \"{9}\", {10});\n",
@@ -357,7 +371,7 @@
if(layerMap == null || !layerMap.ContainsKey(objectId))
{
- BuildLayerDefinitionData(resSrvc, resId, layerName);
+ BuildLayerDefinitionData(layerData, layerName);
}
}
else
@@ -376,14 +390,12 @@
}
-void BuildLayerDefinitionData(MgResourceService resSrvc, MgResourceIdentifier resId, String layerVarName)
+void BuildLayerDefinitionData(String layerData, String layerVarName)
{
try
{
- MgByteReader layerByteReader = resSrvc.GetResourceContent(resId);
- String layerDefString = layerByteReader.ToString();
XmlDocument doc = new XmlDocument();
- doc.LoadXml(layerDefString);
+ doc.LoadXml(layerData);
int type = 0;
XmlNodeList scaleRanges = doc.GetElementsByTagName("VectorScaleRange");
if(scaleRanges.Count == 0)
@@ -465,11 +477,6 @@
}
output = output + String.Format("{0}.lyrtype = {1};\n", layerVarName, type.ToString(NumberFormatInfo.InvariantInfo) );
}
- catch(MgException e)
- {
- //broken layer definition. just don't create any info for that layer
- return;
- }
catch(Exception e)
{
//broken layer definition. just don't create any info for that layer
Modified: sandbox/rfc60/MgDev/Web/src/mapviewernet/legendctrl.aspx
===================================================================
--- sandbox/rfc60/MgDev/Web/src/mapviewernet/legendctrl.aspx 2009-12-09 22:21:34 UTC (rev 4405)
+++ sandbox/rfc60/MgDev/Web/src/mapviewernet/legendctrl.aspx 2009-12-09 22:22:44 UTC (rev 4406)
@@ -55,7 +55,8 @@
}
catch(Exception ne)
{
- Response.Write(ne.Message);
+ String errorMsg = EscapeForHtml(ne.Message);
+ Response.Write(errorMsg);
}
%>
Modified: sandbox/rfc60/MgDev/Web/src/mapviewernet/legendui.aspx
===================================================================
--- sandbox/rfc60/MgDev/Web/src/mapviewernet/legendui.aspx 2009-12-09 22:21:34 UTC (rev 4405)
+++ sandbox/rfc60/MgDev/Web/src/mapviewernet/legendui.aspx 2009-12-09 22:22:44 UTC (rev 4406)
@@ -41,7 +41,8 @@
}
catch(Exception ne)
{
- Response.Write(ne.Message);
+ String errorMsg = EscapeForHtml(ne.Message);
+ Response.Write(errorMsg);
}
%>
Modified: sandbox/rfc60/MgDev/Web/src/mapviewernet/mainframe.aspx
===================================================================
--- sandbox/rfc60/MgDev/Web/src/mapviewernet/mainframe.aspx 2009-12-09 22:21:34 UTC (rev 4405)
+++ sandbox/rfc60/MgDev/Web/src/mapviewernet/mainframe.aspx 2009-12-09 22:22:44 UTC (rev 4406)
@@ -537,13 +537,13 @@
}
catch (MgException e)
{
- Response.Write(e.GetMessage());
- Response.Write("<br>");
- Response.Write(e.GetDetails());
+ String errorMsg = EscapeForHtml(e.GetDetails());
+ Response.Write(errorMsg);
}
catch (Exception ne)
{
- Response.Write(ne.Message);
+ String errorMsg = EscapeForHtml(ne.Message);
+ Response.Write(errorMsg);
}
%>
Modified: sandbox/rfc60/MgDev/Web/src/mapviewernet/mapframe.aspx
===================================================================
--- sandbox/rfc60/MgDev/Web/src/mapviewernet/mapframe.aspx 2009-12-09 22:21:34 UTC (rev 4405)
+++ sandbox/rfc60/MgDev/Web/src/mapviewernet/mapframe.aspx 2009-12-09 22:22:44 UTC (rev 4406)
@@ -190,9 +190,8 @@
}
catch(MgException mge)
{
- Response.Write(mge.GetMessage());
- Response.Write("<br>");
- Response.Write(mge.GetDetails());
+ String errorMsg = EscapeForHtml(mge.GetDetails());
+ Response.Write(errorMsg);
}
}
Modified: sandbox/rfc60/MgDev/Web/src/mapviewernet/printablepage.aspx
===================================================================
--- sandbox/rfc60/MgDev/Web/src/mapviewernet/printablepage.aspx 2009-12-09 22:21:34 UTC (rev 4405)
+++ sandbox/rfc60/MgDev/Web/src/mapviewernet/printablepage.aspx 2009-12-09 22:22:44 UTC (rev 4406)
@@ -71,7 +71,8 @@
}
catch(Exception ne)
{
- Response.Write(ne.Message);
+ String errorMsg = EscapeForHtml(ne.Message);
+ Response.Write(errorMsg);
}
%>
Modified: sandbox/rfc60/MgDev/Web/src/mapviewernet/printablepageui.aspx
===================================================================
--- sandbox/rfc60/MgDev/Web/src/mapviewernet/printablepageui.aspx 2009-12-09 22:21:34 UTC (rev 4405)
+++ sandbox/rfc60/MgDev/Web/src/mapviewernet/printablepageui.aspx 2009-12-09 22:22:44 UTC (rev 4406)
@@ -63,7 +63,8 @@
}
catch(Exception ne)
{
- Response.Write(ne.Message);
+ String errorMsg = EscapeForHtml(ne.Message);
+ Response.Write(errorMsg);
}
%>
Modified: sandbox/rfc60/MgDev/Web/src/mapviewerphp/common.php
===================================================================
--- sandbox/rfc60/MgDev/Web/src/mapviewerphp/common.php 2009-12-09 22:21:34 UTC (rev 4405)
+++ sandbox/rfc60/MgDev/Web/src/mapviewerphp/common.php 2009-12-09 22:22:44 UTC (rev 4406)
@@ -107,8 +107,8 @@
function EscapeForHtml($str)
{
- $org = array("'", "\"", "\n", "<", ">");
- $repl = array("'", """, " ", "<", ">" );
+ $org = array("'", "\"", "<", ">", '\n');
+ $repl = array("'", """, "<", ">", "<br>");
return str_replace($org, $repl, $str);
}
Modified: sandbox/rfc60/MgDev/Web/src/mapviewerphp/createlayer.php
===================================================================
--- sandbox/rfc60/MgDev/Web/src/mapviewerphp/createlayer.php 2009-12-09 22:21:34 UTC (rev 4405)
+++ sandbox/rfc60/MgDev/Web/src/mapviewerphp/createlayer.php 2009-12-09 22:22:44 UTC (rev 4406)
@@ -79,6 +79,7 @@
}
catch (MgException $e)
{
- echo $e->GetMessage();
+ $errorMsg = EscapeForHtml($e->GetMessage());
+ echo $errorMsg;
}
?>
Modified: sandbox/rfc60/MgDev/Web/src/mapviewerphp/gettingstarted.php
===================================================================
--- sandbox/rfc60/MgDev/Web/src/mapviewerphp/gettingstarted.php 2009-12-09 22:21:34 UTC (rev 4405)
+++ sandbox/rfc60/MgDev/Web/src/mapviewerphp/gettingstarted.php 2009-12-09 22:22:44 UTC (rev 4406)
@@ -81,7 +81,8 @@
}
catch(MgException $e)
{
- echo $e->GetDetails();
+ $errorMsg = EscapeForHtml($e->GetDetails());
+ echo $errorMsg;
return;
}
Modified: sandbox/rfc60/MgDev/Web/src/mapviewerphp/legend.php
===================================================================
--- sandbox/rfc60/MgDev/Web/src/mapviewerphp/legend.php 2009-12-09 22:21:34 UTC (rev 4405)
+++ sandbox/rfc60/MgDev/Web/src/mapviewerphp/legend.php 2009-12-09 22:22:44 UTC (rev 4406)
@@ -22,11 +22,12 @@
class TreeItem
{
- public function __construct($name, $isGroup, $rtObject)
+ public function __construct($name, $isGroup, $rtObject, $layerData)
{
$this->name = $name;
$this->isGroup = $isGroup;
$this->rtObject = $rtObject;
+ $this->layerData = $layerData;
if($isGroup)
$this->children = array();
else
@@ -47,6 +48,7 @@
public $rtObject;
public $children;
public $parentName;
+ public $layerData;
}
$mapName = "";
@@ -82,7 +84,7 @@
$map->Open($resourceSrvc, $mapName);
$layerMap = null;
- $tree = BuildLayerTree($map);
+ $tree = BuildLayerTree($map, $resourceSrvc);
if($summary)
{
@@ -105,7 +107,9 @@
}
catch(MgException $e)
{
- echo $e->GetMessage() . "<p>" . $e->GetStackTrace();
+ $errorMsg = EscapeForHtml($e->GetMessage());
+ $traceMsg = EscapeForHtml($e->GetStackTrace());
+ echo $errorMsg . "<p>" . $traceMsg;
return;
}
catch(Exception $ne)
@@ -117,7 +121,7 @@
$templ = file_get_contents("../viewerfiles/legendupdate.templ");
printf($templ, $updateType, $output, GetSurroundVirtualPath() . "legend.php");
-function BuildLayerTree($map)
+function BuildLayerTree($map, $resSrvc)
{
$tree = array();
$knownGroups = array();
@@ -127,7 +131,7 @@
for($i = 0; $i < $groups->GetCount(); $i++)
{
$rtGroup = $groups->GetItem($i);
- $node = new TreeItem($rtGroup->GetName(), true, $rtGroup);
+ $node = new TreeItem($rtGroup->GetName(), true, $rtGroup, null);
$knownGroups[$node->name] = $node;
$parentGroup = $rtGroup->GetGroup();
@@ -159,11 +163,23 @@
array_push($tree, $node); //should not happen. place group in the root if parent is not known
}
}
+ // Get the layers
$layers = $map->GetLayers();
+
+ // Get the resource Ids of the layers
+ $resIds = new MgStringCollection();
for($i = 0; $i < $layers->GetCount(); $i++)
{
$rtLayer = $layers->GetItem($i);
- $node = new TreeItem($rtLayer->GetName(), false, $rtLayer);
+ $resId = $rtLayer->GetLayerDefinition();
+ $resIds->Add($resId->ToString());
+ }
+ $layersData = $resSrvc->GetResourceContents($resIds, null);
+
+ for($i = 0; $i < $layers->GetCount(); $i++)
+ {
+ $rtLayer = $layers->GetItem($i);
+ $node = new TreeItem($rtLayer->GetName(), false, $rtLayer, $layersData->GetItem($i));
$parentGroup = $rtLayer->GetGroup();
if($parentGroup == null)
array_push($tree, $node);
@@ -245,6 +261,7 @@
if($fulldata)
{
$resId = $node->rtObject->GetLayerDefinition();
+ $layerData = $node->layerData;
$layerName = "lyr" . ($intermediateVar ++);
$objectId = $node->rtObject->GetObjectId();
$output = $output . sprintf("var %s = new LayerItem(\"%s\", \"%s\", %s, %s, %s, %s, %s, \"%s\", \"%s\", %s);\n",
@@ -265,7 +282,7 @@
++ $treeIndex;
if($layerMap == null || !isset($layerMap[$objectId]))
- BuildLayerDefinitionData($resSrvc, $resId, $layerName, $output);
+ BuildLayerDefinitionData($layerData, $layerName, $output);
}
else
{
@@ -281,21 +298,11 @@
}
}
-function BuildLayerDefinitionData($resSrvc, $resId, $layerVarName, &$output)
+function BuildLayerDefinitionData($layerData, $layerVarName, &$output)
{
global $intermediateVar;
- $xmldoc = null;
- try
- {
- $layerDef = $resSrvc->GetResourceContent($resId);
- $xmldoc = DOMDocument::loadXML(ByteReaderToString($layerDef));
- }
- catch(MgException $e)
- {
- //broken layer definition. just don't create any info for that layer
- return;
- }
+ $xmldoc = DOMDocument::loadXML($layerData);
$type = 0;
$scaleRanges = $xmldoc->getElementsByTagName('VectorScaleRange');
Modified: sandbox/rfc60/MgDev/Web/src/mapviewerphp/mainframe.php
===================================================================
--- sandbox/rfc60/MgDev/Web/src/mapviewerphp/mainframe.php 2009-12-09 22:21:34 UTC (rev 4405)
+++ sandbox/rfc60/MgDev/Web/src/mapviewerphp/mainframe.php 2009-12-09 22:22:44 UTC (rev 4406)
@@ -100,12 +100,12 @@
catch(MgException $e)
{
$shortError = $e->GetMessage();
- $longError = $e->GetDetails();
+ $longErrorMsg = EscapeForHtml($e->GetDetails());
header("HTTP/1.1 559 ");
header('Content-Type: text/html; charset=utf-8');
header("Status: 559 {$shortError}");
echo "<html>\n<body>\n";
- echo "<h2>{$shortError}</h2>\n{$longError}";
+ echo $longErrorMsg;
echo "</body>\n</html>\n";
return;
}
@@ -526,17 +526,18 @@
// in order to give a nice custom error message, it looks as
// if we shortcut things by using a 200 status.
$shortError = $e->GetMessage();
- $longError = $e->GetDetails();
+ $longErrorMsg = EscapeForHtml($e->GetDetails());
header("HTTP/1.1 200 ");
header('Content-Type: text/html; charset=utf-8');
header("Status: 200 {$shortError}");
echo "<html>\n<body>\n";
- echo "<h2>{$shortError}</h2>\n{$longError}";
+ echo $longErrorMsg;
echo "</body>\n</html>\n";
}
catch(Exception $ne)
{
- echo $ne->GetMessage();
+ $errorMsg = EscapeForHtml($ne->GetMessage());
+ echo $errorMsg;
}
}
Modified: sandbox/rfc60/MgDev/Web/src/mapviewerphp/mapframe.php
===================================================================
--- sandbox/rfc60/MgDev/Web/src/mapviewerphp/mapframe.php 2009-12-09 22:21:34 UTC (rev 4405)
+++ sandbox/rfc60/MgDev/Web/src/mapviewerphp/mapframe.php 2009-12-09 22:22:44 UTC (rev 4406)
@@ -157,7 +157,8 @@
}
catch(MgException $e)
{
- echo $e->GetDetails();
+ $errorMsg = EscapeForHtml($e->GetDetails());
+ echo $errorMsg;
}
}
Modified: sandbox/rfc60/MgDev/Web/src/schemareport/displayschema.php
===================================================================
--- sandbox/rfc60/MgDev/Web/src/schemareport/displayschema.php 2009-12-09 22:21:34 UTC (rev 4405)
+++ sandbox/rfc60/MgDev/Web/src/schemareport/displayschema.php 2009-12-09 22:22:44 UTC (rev 4406)
@@ -123,7 +123,9 @@
}
catch (MgException $e)
{
- echo $e->GetMessage();
+ $errorMsg = $e->GetMessage();
+ $errorMsg = str_replace('\n', '<br>', $errorMsg);
+ echo $errorMsg;
}
?>
More information about the mapguide-commits
mailing list