[Mapbender-commits] r8904 - trunk/mapbender/http/plugins

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu May 22 06:28:56 PDT 2014


Author: hwbllmnn
Date: 2014-05-22 06:28:55 -0700 (Thu, 22 May 2014)
New Revision: 8904

Modified:
   trunk/mapbender/http/plugins/mb_digitize_widget.php
Log:
added validation for stroke width


Modified: trunk/mapbender/http/plugins/mb_digitize_widget.php
===================================================================
--- trunk/mapbender/http/plugins/mb_digitize_widget.php	2014-05-22 13:21:00 UTC (rev 8903)
+++ trunk/mapbender/http/plugins/mb_digitize_widget.php	2014-05-22 13:28:55 UTC (rev 8904)
@@ -273,15 +273,24 @@
                 }
             });
             editStyleDialog.find('input').bind('change', function() {
-                editStyleDialog.find('input').each(function() {
-                    if(isline && $(this).attr('name').match(/fill/)) {
-                        return;
+                if(isline && $(this).attr('name').match(/fill/)) {
+                    return;
+                }
+
+                if($(this).attr('name') === 'stroke-width') {
+                    var val = $(this).val();
+                    if(!(!isNaN(parseFloat(val)) && isFinite(val)) || $(this).val() <= 0) {
+                        $(this).css('background-color', 'red');
+                        $(this).val(feature.properties['stroke-width']);
+                    } else {
+                        $(this).css('background-color', '');
                     }
-                    feature.properties[$(this).attr('name')] = $(this).val();
-                    kml.render();
-                    var preview = editStyleDialog.find('.digitize-preview').html('').get(0);
-                    kml.renderPreview(feature, preview);
-                });
+                }
+
+                feature.properties[$(this).attr('name')] = $(this).val();
+                kml.render();
+                var preview = editStyleDialog.find('.digitize-preview').html('').get(0);
+                kml.renderPreview(feature, preview);
             });
             $('.opacity-slider').slider('option', 'change', function() {
                 if(isline && $(this).attr('data-name') === 'fill-opacity') {



More information about the Mapbender_commits mailing list