[mapguide-commits] r4517 -
trunk/Tools/Maestro/Maestro/ResourceEditors
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Sun Jan 10 10:10:01 EST 2010
Author: ksgeograf
Date: 2010-01-10 10:10:00 -0500 (Sun, 10 Jan 2010)
New Revision: 4517
Modified:
trunk/Tools/Maestro/Maestro/ResourceEditors/MapEditor.cs
Log:
Maestro:
Better support for metadata on a MapDefinition
Modified: trunk/Tools/Maestro/Maestro/ResourceEditors/MapEditor.cs
===================================================================
--- trunk/Tools/Maestro/Maestro/ResourceEditors/MapEditor.cs 2010-01-10 13:15:18 UTC (rev 4516)
+++ trunk/Tools/Maestro/Maestro/ResourceEditors/MapEditor.cs 2010-01-10 15:10:00 UTC (rev 4517)
@@ -181,7 +181,20 @@
{
m_isUpdating = true;
- txtDescription.Text = m_map.Metadata.Replace("<MapDescription>", "").Replace("</MapDescription>", "");
+ try
+ {
+ System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
+ doc.LoadXml("<root>" + m_map.Metadata + "</root>");
+ if (doc["root"]["MapDescription"] != null)
+ txtDescription.Text = doc["root"]["MapDescription"].InnerText;
+ else
+ txtDescription.Text = "";
+ }
+ catch
+ {
+ txtDescription.Text = m_map.Metadata.Replace("<MapDescription>", "").Replace("</MapDescription>", "");
+ }
+
if (m_editor.CurrentConnection.CoordinateSystem == null || m_map.CoordinateSystem == null || m_map.CoordinateSystem.Length == 0 || !m_editor.CurrentConnection.CoordinateSystem.IsLoaded)
txtCoordsys.Text = m_map.CoordinateSystem;
else
@@ -1139,7 +1152,20 @@
if (m_isUpdating)
return;
- m_map.Metadata = "<MapDescription>" + txtDescription.Text + "</MapDescription>";
+ try
+ {
+ System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
+ doc.LoadXml("<root>" + System.Web.HttpUtility.HtmlDecode(m_map.Metadata) + "</root>");
+ if (doc["root"]["MapDescription"] == null)
+ doc["root"].AppendChild(doc.CreateElement("MapDescription"));
+
+ doc["root"]["MapDescription"].InnerText = txtDescription.Text;
+ m_map.Metadata = doc["root"].InnerXml;
+ }
+ catch
+ {
+ m_map.Metadata = "<MapDescription>" + txtDescription.Text + "</MapDescription>";
+ }
m_editor.HasChanged();
}
More information about the mapguide-commits
mailing list