[Mapbender-commits] r9230 - in trunk/mapbender/http: css plugins widgets

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Jun 29 05:27:37 PDT 2015


Author: syed
Date: 2015-06-29 05:27:37 -0700 (Mon, 29 Jun 2015)
New Revision: 9230

Modified:
   trunk/mapbender/http/css/digitize_new.css
   trunk/mapbender/http/plugins/mb_digitize_widget.php
   trunk/mapbender/http/widgets/w_digitize.js
Log:
change export menu in the kml-tree

Modified: trunk/mapbender/http/css/digitize_new.css
===================================================================
--- trunk/mapbender/http/css/digitize_new.css	2015-06-25 13:23:18 UTC (rev 9229)
+++ trunk/mapbender/http/css/digitize_new.css	2015-06-29 12:27:37 UTC (rev 9230)
@@ -182,6 +182,7 @@
     line-height: 50px;
     padding-left: 40px;
     padding-top: 40px;
+    cursor:default;
 }
 
 .export-format-gpx {
@@ -194,6 +195,7 @@
     line-height: 50px;
     padding-left: 40px;
     padding-top: 40px;
+    cursor:default;
 }
 
 .export-format-geojson {
@@ -206,6 +208,7 @@
     line-height: 50px;
     padding-left: 40px;
     padding-top: 40px;
+    cursor:default;
 }
 
 label > input[type="radio"] {
@@ -215,3 +218,7 @@
 #selected-features-list {
     list-style-type: none;
 }
+
+.exportDataLink {
+    cursor: pointer;
+}

Modified: trunk/mapbender/http/plugins/mb_digitize_widget.php
===================================================================
--- trunk/mapbender/http/plugins/mb_digitize_widget.php	2015-06-25 13:23:18 UTC (rev 9229)
+++ trunk/mapbender/http/plugins/mb_digitize_widget.php	2015-06-29 12:27:37 UTC (rev 9230)
@@ -166,15 +166,25 @@
         '<li><div class="digitize-image digitize-close"></div><?php echo _mb("Close");?></li>' +
         '</ul>';
 
-        var exportHtml = '<div id="export-dialog" title="<?php echo _mb("Export my features");?>">'
-        + '<form>'
-        + '<label class="export-format-kml">KML<input type="radio" name="export-format" value="kml" checked="checked"></input></label>'
-        + '<label class="export-format-gpx">GPX<input type="radio" name="export-format" value="gpx"></input></label>'
-        + '<label class="export-format-geojson">geoJSON<input type="radio" name="export-format" value="geojson"></input></label><br></br>'
-        + '<a download="myfeatures.kml" href="#" class="digitize-image digitize-export" style="float: left;"></a>'
-        + '</form>'
-        + '</div>';
+        // var exportHtml = '<div id="export-dialog" title="<?php echo _mb("Export my features");?>">'
+        // + '<form>'
+        // + '<label class="export-format-kml">KML<input type="radio" name="export-format" value="kml" checked="checked"></input></label>'
+        // + '<label class="export-format-gpx">GPX<input type="radio" name="export-format" value="gpx"></input></label>'
+        // + '<label class="export-format-geojson">geoJSON<input type="radio" name="export-format" value="geojson"></input></label><br></br>'
+        // + '<a download="myfeatures.kml" href="#" class="digitize-image digitize-export" style="float: left;"></a>'
+        // + '</form>'
+        // + '</div>';
 
+        var exportHtml = '<div id="export-dialog"><table><tbody>' +
+            '<tr><td>KML:</td><td><label class="export-format-kml exportDatasetIcon" style="padding-top:11px;"></label></td><td class="exportDataLink kml" '+
+             'outputFormat="kml"><img src="../img/gnome/document-save.png"/></td></tr>' +
+            '<tr><td>GPX:</td><td><label class="export-format-gpx exportDatasetIcon" style="padding-top:11px;"></label></td><td class="exportDataLink gpx" '+
+            'outputFormat="gpx"><img src="../img/gnome/document-save.png"/></td></tr>' +
+            '<tr><td>GeoJson:</td><td><label class="export-format-geojson exportDatasetIcon" style="padding-top:11px;"></label></td><td class="exportDataLink geojson" ' +
+            'outputFormat="geojson"><img src="../img/gnome/document-save.png"/></td></tr>' +
+            '</tbody></table></div>';
+
+
         var digitizeDialog,
         editDialog,
         attributesDialog,
@@ -272,7 +282,7 @@
             autoOpen: false,
             position: [o.$target.offset().left, o.$target.offset().top],
             width: 400,
-            height: 180
+            height: 260
         }).bind('dialogclose', function() {
             button.stop();
             $(this).find('input').unbind('change');
@@ -326,40 +336,42 @@
 };
 
 var exportItem = function(data) {
-    var dlg = $(exportHtml).dialog({ width: 330, height: 165 });
-    $(dlg).find('input').bind('change', function() {
-        if(!$(this).is(':checked')) {
-            return;
-        }
-        var fmt = $(this).val();
-        var url;
-        if(fmt === 'kml') {
-            url = tokml(data, {simplestyle: true});
-        }
-        if(fmt === 'gpx') {
-            url = togpx(data, {simplestyle: true});
-        }
-        if(fmt === 'geojson') {
-            url = JSON.stringify(data);
-        }
-        url = 'data:application/octet-stream,' + encodeURIComponent(url);
+    var dlg = $(exportHtml).dialog({ width: 330, height: 220 });
+    // $(dlg).find('input').bind('change', function() {
+    //     if(!$(this).is(':checked')) {
+    //         return;
+    //     }
+    //     var fmt = $(this).val();
+    //     var url;
+    //     if(fmt === 'kml') {
+    //         url = tokml(data, {simplestyle: true});
+    //     }
+    //     if(fmt === 'gpx') {
+    //         url = togpx(data, {simplestyle: true});
+    //     }
+    //     if(fmt === 'geojson') {
+    //         url = JSON.stringify(data);
+    //     }
+    //     url = 'data:application/octet-stream,' + encodeURIComponent(url);
 
-        var lnk = $(dlg).find('.digitize-export')
-        .attr('download', 'myfeatures.' + fmt)
-        .attr('href', url);
-    }).change();
+    //     var lnk = $(dlg).find('.digitize-export')
+    //     .attr('download', 'myfeatures.' + fmt)
+    //     .attr('href', url);
+    // }).change();
 
-    $(dlg).find('.digitize-export').bind('click', function() {
+    $(dlg).find('.exportDataLink').bind('click', function() {
+
+        var outputformat = $(this).attr('outputformat');
+        var url;
         if(window.chrome) {
-            var fmt = $(dlg).find('input:checked').val();
-            var url;
-            if(fmt === 'kml') {
+            // var fmt = $(dlg).find('input:checked').val();
+            if(outputformat === 'kml') {
                 url = tokml(data, {simplestyle: true});
             }
-            if(fmt === 'gpx') {
+            if(outputformat === 'gpx') {
                 url = togpx(data, {simplestyle: true});
             }
-            if(fmt === 'geojson') {
+            if(outputformat === 'geojson') {
                 if (data.type != "Feature") {
 
                     url = JSON.stringify(data);
@@ -373,7 +385,7 @@
             }
 
             var link = document.createElement("a");
-            link.setAttribute('download', 'myfeatures.' + fmt);
+            link.setAttribute('download', 'myfeatures.' + outputformat);
             link.href = URL.createObjectURL(new Blob([url], {type: 'application/octet-stream'}));
             link.click();
 
@@ -462,7 +474,7 @@
             }
         });
 
-        editStyleDialog.find('form input').bind('change', function() {
+        editStyleDialog.find('form input').bind('click', function() {
             editStyleDialog.find('.digitize-style-' + $(this).val()).css('display', 'block').siblings('table').css('display', 'none');
         });
 
@@ -802,7 +814,7 @@
             var kml = $('#mapframe1').data('kml');
             var url = $link.parent().parent().attr('title');
             var feature = kml._kmls[url].data.features[idx];
-            editDialog.find('span').text(feature.properties.title);
+            editDialog.find('span').text(feature.properties.name);
             editDialog.dialog('open');
             editDialog.find('.digitize-attributes').bind('click', editAttributes(feature, kml, url));
             editDialog.find('.digitize-export').bind('click', function() {

Modified: trunk/mapbender/http/widgets/w_digitize.js
===================================================================
--- trunk/mapbender/http/widgets/w_digitize.js	2015-06-25 13:23:18 UTC (rev 9229)
+++ trunk/mapbender/http/widgets/w_digitize.js	2015-06-29 12:27:37 UTC (rev 9230)
@@ -377,9 +377,9 @@
     },
 
     startMoving: function(e) {
-        this.moving = true;
         this.moveStartPoint = this.pointFromEvent(e);
         this.originalDigitizePoints = this._digitizePoints;
+        this.moving = true;
     },
 
     move: function(e) {



More information about the Mapbender_commits mailing list