[mapguide-commits] r7210 - in branches/maestro-4.0.x: . Maestro Maestro.Base/UI

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Nov 19 03:03:11 PST 2012


Author: jng
Date: 2012-11-19 03:03:11 -0800 (Mon, 19 Nov 2012)
New Revision: 7210

Modified:
   branches/maestro-4.0.x/
   branches/maestro-4.0.x/Maestro.Base/UI/SiteExplorer.cs
   branches/maestro-4.0.x/Maestro/changelog.txt
Log:
#2107: Backport to 4.0.x


Property changes on: branches/maestro-4.0.x
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/Tools/Maestro:6490-6494,6923-6924,6926,6928,7026,7034,7056,7058,7060-7061,7073-7074,7125-7128,7164,7166,7168,7175
   + /trunk/Tools/Maestro:6490-6494,6923-6924,6926,6928,7026,7034,7056,7058,7060-7061,7073-7074,7125-7128,7164,7166,7168,7175,7209

Modified: branches/maestro-4.0.x/Maestro/changelog.txt
===================================================================
--- branches/maestro-4.0.x/Maestro/changelog.txt	2012-11-19 10:40:12 UTC (rev 7209)
+++ branches/maestro-4.0.x/Maestro/changelog.txt	2012-11-19 11:03:11 UTC (rev 7210)
@@ -1,6 +1,7 @@
 4.0.4
 -----
  - Improved WMS Feature Source editor
+ - Fix: Un-intuitive cross-connection copying logic
  - Fix: Web Layout editor - Available command selection wackiness
  - Fix: XSD data type case-sensitivity when parsing FDO Data properties
  - Fix: Improve memory usage in SetResourceData (Local/LocalNative) for really large files

Modified: branches/maestro-4.0.x/Maestro.Base/UI/SiteExplorer.cs
===================================================================
--- branches/maestro-4.0.x/Maestro.Base/UI/SiteExplorer.cs	2012-11-19 10:40:12 UTC (rev 7209)
+++ branches/maestro-4.0.x/Maestro.Base/UI/SiteExplorer.cs	2012-11-19 11:03:11 UTC (rev 7210)
@@ -420,7 +420,107 @@
                     }
                     else
                     {
-                        CopyResourcesToFolder(data, connectionName, folderId);
+                        /*
+                         * Consider the following layout:
+                         * 
+                         * ConnectionA (Root):
+                         *      Samples
+                         *          Sheboygan
+                         *              Data
+                         *                  *.FeatureSource
+                         *              Layers
+                         *                  *.LayerDefinition
+                         *              Maps
+                         *                  *.MapDefinition
+                         * 
+                         * ConnectionB (Root):
+                         *      Foo
+                         *      Bar
+                         *          Snafu
+                         * 
+                         * These are the possible scenarios and outcomes:
+                         * 
+                         * Case 1 - Copy folder Samples/Sheboygan/Data into ConnectionB root:
+                         * 
+                         * Expect:
+                         * 
+                         * ConnectionB (Root):
+                         *     Data
+                         *          *.FeatureSource
+                         *     Foo
+                         *     Bar
+                         *          Snafu
+                         * 
+                         * Case 2 - Copy Samples/Sheboygan/Data/*.FeatureSource into ConnectionB root:
+                         * 
+                         * Expect:
+                         * 
+                         * ConnectionB (Root):
+                         *     *.FeatureSource
+                         *     Foo
+                         *     Bar
+                         *          Snafu
+                         *          
+                         * Case 3 - Copy Samples/Sheboygan/Data/*.FeatureSource into Connection B/Foo:
+                         * 
+                         * Expect:
+                         * 
+                         * ConnectionB (Root):
+                         *      Foo
+                         *          *.FeatureSource
+                         *      Bar
+                         *          Snafu
+                         *          
+                         * Case 4 - Copy Samples/Sheboygan/Data into Connection B/Foo:
+                         * 
+                         * Expect:
+                         * 
+                         * ConnectionB (Root):
+                         *      Foo
+                         *          Data
+                         *              *.FeatureSource
+                         *      Bar
+                         *          Snafu
+                         *          
+                         * Case 5 - Copy Samples/Sheboygan/Data into Connection B/Bar/Snafu:
+                         * 
+                         * Expect:
+                         * 
+                         * ConnectionB (Root):
+                         *      Foo
+                         *      Bar
+                         *          Snafu
+                         *              Data
+                         *                  *.FeatureSource
+                         * 
+                         * Case 6 - Copy Samples/Sheboygan/Data/*.FeatureSource into Connection B/Bar/Snafu:
+                         * 
+                         * ConnectionB (Root):
+                         *      Foo
+                         *      Bar
+                         *          Snafu
+                         *              *.FeatureSource
+                         * 
+                         */
+
+
+                        if (data.All(x => x.ResourceId.IsFolder))
+                        {
+                            if (data.Length > 1)
+                            {
+                                //folderId = GetCommonParent(data);
+                                CopyResourcesToFolder(data, connectionName, folderId);
+                            }
+                            else
+                            {
+                                folderId += data.First().ResourceId.Name + "/";
+                                CopyResourcesToFolder(data, connectionName, folderId);
+                            }
+                        }
+                        else
+                        {
+                            CopyResourcesToFolder(data, connectionName, folderId);
+                        }
                     }
                 }
             }
@@ -446,20 +546,6 @@
 
             }
 
-            /*
-            //If we're dropping to the root, the common parent becomes our 
-            //target root
-            if (folderId == "Library://")
-                folderId = rootSourceParent;
-            */
-            //If common parent is not root, we want the name of the folder to append
-            //to our target
-            if (rootSourceParent != "Library://")
-            {
-                ResourceIdentifier resId = new ResourceIdentifier(rootSourceParent);
-                folderId = folderId + resId.Name + "/";
-            }
-
             var targets = new List<string>();
             foreach (var resId in sourceIds)
             {
@@ -521,15 +607,19 @@
                     //Use first one as a sample to see how far we can go. Keep going until we have
                     //a parent that doesn't match all of them. The one we recorded before then will
                     //be the common parent
-                    while (matches == data.Length)
+                    while (true)
                     {
-                        parent = test;
                         partIndex++;
-                        if (partIndex < parts.Length) //Shouldn't happen, but just in case
+                        if (partIndex > parts.Length) //Shouldn't happen, but just in case
                             break;
 
-                        test = test + parts[partIndex];
-                        matches = data.Where(x => x.ResourceId.ResourceId.StartsWith(test)).Count(); 
+                        parent = test;
+
+                        test = test + parts[partIndex - 1] + "/";
+                        matches = data.Where(x => x.ResourceId.ResourceId.StartsWith(test)).Count();
+
+                        if (matches > 0 && matches != data.Length)
+                            break;
                     }
                     return parent;
                 }



More information about the mapguide-commits mailing list