[OpenLayers-Commits] r10936 - sandbox/bartvde/openls/openlayers/lib/OpenLayers/Format/XLS

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Wed Dec 1 04:22:31 EST 2010


Author: bartvde
Date: 2010-12-01 01:22:31 -0800 (Wed, 01 Dec 2010)
New Revision: 10936

Modified:
   sandbox/bartvde/openls/openlayers/lib/OpenLayers/Format/XLS/v1.js
Log:
some more writers in Format.XLS

Modified: sandbox/bartvde/openls/openlayers/lib/OpenLayers/Format/XLS/v1.js
===================================================================
--- sandbox/bartvde/openls/openlayers/lib/OpenLayers/Format/XLS/v1.js	2010-11-30 15:33:21 UTC (rev 10935)
+++ sandbox/bartvde/openls/openlayers/lib/OpenLayers/Format/XLS/v1.js	2010-12-01 09:22:31 UTC (rev 10936)
@@ -230,25 +230,50 @@
                         countryCode: address.countryCode
                     }
                 });
-                if (address.street) {
-                    this.writeNode("StreetAddress", address.street, node);
+                if (address.freeFormAddress) {
+                    this.writeNode("freeFormAddess", address.freeFormAddress, node);
+                } else {
+                    if (address.street) {
+                        this.writeNode("StreetAddress", address, node);
+                    }
+                    if (address.municipality) {
+                        this.writeNode("Municipality", address.municipality, node);
+                    }
+                    if (address.countrySubdivision) {
+                        this.writeNode("CountrySubdivision", address.countrySubdivision, node);
+                    }
+                    if (address.postalCode) {
+                        this.writeNode("PostalCode", address.postalCode, node);
+                    }
                 }
-                if (address.municipality) {
-                    this.writeNode("Municipality", address.municipality, node);
+                return node;
+            },
+            "freeFormAddress": function(freeFormAddress) {
+                return this.createElementNSPlus("freeFormAddress", 
+                    {value: freeFormAddress});
+            },
+            "StreetAddress": function(address) {
+                var node = this.createElementNSPlus("xls:StreetAddress");
+                if (address.building) {
+                    this.writeNode(node, "Building", address.building);
                 }
-                if (address.countrySubdivision) {
-                    this.writeNode("CountrySubdivision", address.countrySubdivision, node);
+                var street = address.street;
+                if (!(street instanceof Array)) {
+                    street = [street];
                 }
-                if (address.postalCode) {
-                    this.writeNode("PostalCode", address.postalCode, node);
+                for (var i=0, len=street.length; i < len; i++) {
+                    this.writeNode("Street", street[i], node);
                 }
                 return node;
             },
-            "StreetAddress": function(street) {
-                var node = this.createElementNSPlus("xls:StreetAddress");
-                this.writeNode("Street", street, node);
-                return node; 
-                
+            "Building": function(building) {
+                return this.createElementNSPlus("xls:Building", {
+                    attributes: {
+                        "number": building["number"],
+                        "subdivision": building.subdivision,
+                        "buildingName": building.buildingName
+                    }
+                });
             },
             "Street": function(street) {
                 return this.createElementNSPlus("xls:Street", {value: street});



More information about the Commits mailing list