[Commits] r1771 - in sandbox/redlining/ux/FeatureEditing: examples ux/widgets ux/widgets/form ux/widgets/plugins

commits at geoext.org commits at geoext.org
Tue Jan 19 05:05:22 CET 2010


Author: cmoullet
Date: 2010-01-19 05:05:21 +0100 (Tue, 19 Jan 2010)
New Revision: 1771

Modified:
   sandbox/redlining/ux/FeatureEditing/examples/RedLiningPanelExample.js
   sandbox/redlining/ux/FeatureEditing/ux/widgets/FeatureEditingControler.js
   sandbox/redlining/ux/FeatureEditing/ux/widgets/form/FeaturePanel.js
   sandbox/redlining/ux/FeatureEditing/ux/widgets/form/RedLiningPanel.js
   sandbox/redlining/ux/FeatureEditing/ux/widgets/plugins/ExportFeature.js
   sandbox/redlining/ux/FeatureEditing/ux/widgets/plugins/ExportFeatures.js
   sandbox/redlining/ux/FeatureEditing/ux/widgets/plugins/ImportFeatures.js
Log:
Add QuickTips / JSLint

Modified: sandbox/redlining/ux/FeatureEditing/examples/RedLiningPanelExample.js
===================================================================
--- sandbox/redlining/ux/FeatureEditing/examples/RedLiningPanelExample.js	2010-01-19 03:06:37 UTC (rev 1770)
+++ sandbox/redlining/ux/FeatureEditing/examples/RedLiningPanelExample.js	2010-01-19 04:05:21 UTC (rev 1771)
@@ -2,6 +2,8 @@
 
 Ext.onReady(function() {
 
+    Ext.QuickTips.init();
+
     mapPanel = new GeoExt.MapPanel({
         region: "center",
         layers: [new OpenLayers.Layer.WMS("Global Imagery",

Modified: sandbox/redlining/ux/FeatureEditing/ux/widgets/FeatureEditingControler.js
===================================================================
--- sandbox/redlining/ux/FeatureEditing/ux/widgets/FeatureEditingControler.js	2010-01-19 03:06:37 UTC (rev 1770)
+++ sandbox/redlining/ux/FeatureEditing/ux/widgets/FeatureEditingControler.js	2010-01-19 04:05:21 UTC (rev 1771)
@@ -174,16 +174,16 @@
             toggleGroup: this.map.id,
             allowDepress: false,
             pressed: false,
-            tooltip: OpenLayers.i18n("todo"),
+            tooltip: OpenLayers.i18n("Edit Feature"),
             // check item options
             group: this.map.id,
             checked: false
-        }
+        };
 
         if(this.useIcons === true) {
-            actionOptions['iconCls'] = "gx-featureediting-editfeature";
+            actionOptions.iconCls = "gx-featureediting-editfeature";
         } else {
-            actionOptions['text'] = OpenLayers.i18n("EditFeature");
+            actionOptions.text = OpenLayers.i18n("EditFeature");
         }
 
         var action = new GeoExt.Action(actionOptions);
@@ -204,43 +204,47 @@
      */
     initDrawControls: function() {
         var layer, control, handler, geometryTypes, geometryType,
-            options, action, iconCls, actionOptions;
+            options, action, iconCls, actionOptions, tooltip;
 
         geometryTypes = [];
         options = {};
         layer = this.activeLayer;
 
-        if(layer.geometryType) {
-            geometryTypes.push(layer.geometryType);
+        if(OpenLayers.i18n(layer.geometryType)) {
+            geometryTypes.push(OpenLayers.i18n(layer.geometryType));
         } else {
-            geometryTypes.push("Point");
-            geometryTypes.push("LineString");
-            geometryTypes.push("Polygon");
-            geometryTypes.push("Label");
+            geometryTypes.push(OpenLayers.i18n("Point"));
+            geometryTypes.push(OpenLayers.i18n("LineString"));
+            geometryTypes.push(OpenLayers.i18n("Polygon"));
+            geometryTypes.push(OpenLayers.i18n("Label"));
         }
 
         for(var i=0; i<geometryTypes.length; i++) {
             geometryType = geometryTypes[i];
 
             switch(geometryType) {
-              case "LineString":
-              case "MultiLineString":
+              case OpenLayers.i18n("LineString"):
+              case OpenLayers.i18n("MultiLineString"):
                 handler = OpenLayers.Handler.Path;
                 iconCls = "gx-featureediting-draw-line";
+                tooltip = OpenLayers.i18n("Create line");
                 break;
-              case "Point":
-              case "MultiPoint":
+              case OpenLayers.i18n("Point"):
+              case OpenLayers.i18n("MultiPoint"):
                 handler = OpenLayers.Handler.Point;
                 iconCls = "gx-featureediting-draw-point";
+                tooltip = OpenLayers.i18n("Create point");
                 break;
-              case "Polygon":
-              case "MultiPolygon":
+              case OpenLayers.i18n("Polygon"):
+              case OpenLayers.i18n("MultiPolygon"):
                 handler = OpenLayers.Handler.Polygon;
                 iconCls = "gx-featureediting-draw-polygon";
+                tooltip = OpenLayers.i18n("Create polygon");
                 break;
-              case "Label":
+              case OpenLayers.i18n("Label"):
                 handler = OpenLayers.Handler.Point;
                 iconCls = "gx-featureediting-draw-label";
+                tooltip = OpenLayers.i18n("Create label");
                 break;
             }
 
@@ -250,7 +254,7 @@
             this.drawControls.push(control);
             this.map.addControl(control);
 
-            if(geometryType == "Label") {
+            if(geometryType == OpenLayers.i18n("Label")) {
                 control.events.on({
                    "featureadded": this.onLabelAdded,
                     scope: this
@@ -269,7 +273,7 @@
                 toggleGroup: this.map.id,
                 allowDepress: false,
                 pressed: false,
-                tooltip: OpenLayers.i18n("todo"),
+                tooltip: tooltip,
                 // check item options
                 group: this.map.id,
                 checked: false
@@ -277,9 +281,9 @@
 
             // use icons or text for the display
             if(this.useIcons === true) {
-                actionOptions['iconCls'] = iconCls;
+                actionOptions.iconCls = iconCls;
             } else {
-                actionOptions['text'] = geometryType;
+                actionOptions.text = geometryType;
             }
 
             action = new GeoExt.Action(actionOptions);
@@ -305,13 +309,14 @@
     initDeleteAllAction: function() {
         var actionOptions = {
             handler: this.deleteAllFeatures,
-            scope: this
-        }
+            scope: this,
+            tooltip: OpenLayers.i18n('Delete all features')  
+        };
 
         if(this.useIcons === true) {
-            actionOptions['iconCls'] = "gx-featureediting-delete";
+            actionOptions.iconCls = "gx-featureediting-delete";
         } else {
-            actionOptions['text'] = OpenLayers.i18n('DeleteAll');
+            actionOptions.text = OpenLayers.i18n('DeleteAll');
         }
 
         var action = new Ext.Action(actionOptions);
@@ -495,7 +500,7 @@
     /** private: methodreactivateDrawControl[]
      */
     reactivateDrawControl: function() {
-        if(this.lastDrawControl && this.activeLayer.selectedFeatures.length == 0) {
+        if(this.lastDrawControl && this.activeLayer.selectedFeatures.length === 0) {
             this.featureControl.deactivate();
             this.lastDrawControl.activate();
             this.lastDrawControl = null;

Modified: sandbox/redlining/ux/FeatureEditing/ux/widgets/form/FeaturePanel.js
===================================================================
--- sandbox/redlining/ux/FeatureEditing/ux/widgets/form/FeaturePanel.js	2010-01-19 03:06:37 UTC (rev 1770)
+++ sandbox/redlining/ux/FeatureEditing/ux/widgets/form/FeaturePanel.js	2010-01-19 04:05:21 UTC (rev 1771)
@@ -195,18 +195,17 @@
     initDeleteAction: function() {
         var actionOptions = {
             handler: this.deleteFeatures,
-            scope: this
-        }
+            scope: this,
+            tooltip: OpenLayers.i18n('Delete feature')
+        };
 
         if(this.useIcons === true) {
-            actionOptions['iconCls'] = "gx-featureediting-delete";
+            actionOptions.iconCls = "gx-featureediting-delete";
         } else {
-            actionOptions['text'] = OpenLayers.i18n('Delete');
+            actionOptions.text = OpenLayers.i18n('Delete');
         }
 
-        var action = new Ext.Action(actionOptions);
-
-        this.deleteAction = action;
+        this.deleteAction = new Ext.Action(actionOptions);
     },
 
     /** private: method[deleteFeatures]
@@ -250,7 +249,7 @@
     save: function() {
         var feature;
 
-        if(this.features && this.features.length == 0) {
+        if(this.features && this.features.length === 0) {
             return;
         }
 

Modified: sandbox/redlining/ux/FeatureEditing/ux/widgets/form/RedLiningPanel.js
===================================================================
--- sandbox/redlining/ux/FeatureEditing/ux/widgets/form/RedLiningPanel.js	2010-01-19 03:06:37 UTC (rev 1770)
+++ sandbox/redlining/ux/FeatureEditing/ux/widgets/form/RedLiningPanel.js	2010-01-19 04:05:21 UTC (rev 1771)
@@ -85,8 +85,8 @@
               context: {
                   'name': function(feature) {
                       var szValue;
-                      if (feature.attributes['name'] && feature.isLabel === true) {
-                          szValue = feature.attributes['name'];
+                      if (feature.attributes.name && feature.isLabel === true) {
+                          szValue = feature.attributes.name;
                       } else {
                           szValue = "";
                       }
@@ -192,21 +192,21 @@
         var feature = (event.geometry) ? event : event.feature;
 
         // if it's the last feature that is unselected
-        if(feature.layer.selectedFeatures.length == 0) {
+        if(feature.layer.selectedFeatures.length === 0) {
             this.applyNormalStyle(feature.layer);
         }
     },
 
     applyNormalStyle: function(layer) {
-        styles = layer.styleMap.styles;
-        styles['default'] = styles['normal'];
+        var styles = layer.styleMap.styles;
+        styles['default'] = styles.normal;
 
         layer.redraw();
     },
 
     applyFadedStyle: function(layer) {
-        styles = layer.styleMap.styles;
-        styles['default'] = styles['faded'];
+        var styles = layer.styleMap.styles;
+        styles['default'] = styles.faded;
 
         layer.redraw();
     }

Modified: sandbox/redlining/ux/FeatureEditing/ux/widgets/plugins/ExportFeature.js
===================================================================
--- sandbox/redlining/ux/FeatureEditing/ux/widgets/plugins/ExportFeature.js	2010-01-19 03:06:37 UTC (rev 1770)
+++ sandbox/redlining/ux/FeatureEditing/ux/widgets/plugins/ExportFeature.js	2010-01-19 04:05:21 UTC (rev 1771)
@@ -9,13 +9,14 @@
 
         var actionOptions = {
             handler: this.exportFeatures,
-            scope: this
-        }
+            scope: this,
+            tooltip: OpenLayers.i18n('Export KML')
+        };
 
         if(this.controler.useIcons === true) {
-            actionOptions['iconCls'] = "gx-featureediting-export";
+            actionOptions.iconCls = "gx-featureediting-export";
         } else {
-            actionOptions['text'] = OpenLayers.i18n("Export");
+            actionOptions.text = OpenLayers.i18n("Export");
         }
 
         var action = new Ext.Action(actionOptions);

Modified: sandbox/redlining/ux/FeatureEditing/ux/widgets/plugins/ExportFeatures.js
===================================================================
--- sandbox/redlining/ux/FeatureEditing/ux/widgets/plugins/ExportFeatures.js	2010-01-19 03:06:37 UTC (rev 1770)
+++ sandbox/redlining/ux/FeatureEditing/ux/widgets/plugins/ExportFeatures.js	2010-01-19 04:05:21 UTC (rev 1771)
@@ -7,13 +7,14 @@
 
         var actionOptions = {
             handler: this.exportFeatures,
-            scope: this
-        }
+            scope: this,
+            tooltip: OpenLayers.i18n('Export KML')
+        };
 
         if(this.controler.useIcons === true) {
-            actionOptions['iconCls'] = "gx-featureediting-export";
+            actionOptions.iconCls = "gx-featureediting-export";
         } else {
-            actionOptions['text'] = OpenLayers.i18n("Export");
+            actionOptions.text = OpenLayers.i18n("Export");
         }
 
         var action = new Ext.Action(actionOptions);

Modified: sandbox/redlining/ux/FeatureEditing/ux/widgets/plugins/ImportFeatures.js
===================================================================
--- sandbox/redlining/ux/FeatureEditing/ux/widgets/plugins/ImportFeatures.js	2010-01-19 03:06:37 UTC (rev 1770)
+++ sandbox/redlining/ux/FeatureEditing/ux/widgets/plugins/ImportFeatures.js	2010-01-19 04:05:21 UTC (rev 1771)
@@ -10,13 +10,14 @@
 
         var actionOptions = {
             handler: this.importFeatures,
-            scope: this
+            scope: this,
+            tooltip: OpenLayers.i18n('Import KML')
         };
 
         if(this.controler.useIcons === true) {
-            actionOptions['iconCls'] = "gx-featureediting-import";
+            actionOptions.iconCls = "gx-featureediting-import";
         } else {
-            actionOptions['text'] = OpenLayers.i18n("Import");
+            actionOptions.text = OpenLayers.i18n("Import");
         }
 
         var action = new Ext.Action(actionOptions);



More information about the Commits mailing list