[Mapbender-commits] r9171 - in trunk/mapbender: http/css http/php http/plugins lib

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Mar 16 03:20:21 PDT 2015


Author: syed
Date: 2015-03-16 03:20:20 -0700 (Mon, 16 Mar 2015)
New Revision: 9171

Modified:
   trunk/mapbender/http/css/kmltree.css
   trunk/mapbender/http/php/mb_publish_wmc.php
   trunk/mapbender/http/php/mod_CalculateAreaAndLength.php
   trunk/mapbender/http/plugins/kmlTree.js
   trunk/mapbender/http/plugins/mb_digitize_widget.php
   trunk/mapbender/lib/mb.ui.displayKmlFeatures.js
Log:
add accodion-menu in edit-features dialog, change publish functionality to display the openData-licenses only

Modified: trunk/mapbender/http/css/kmltree.css
===================================================================
--- trunk/mapbender/http/css/kmltree.css	2015-03-13 10:56:24 UTC (rev 9170)
+++ trunk/mapbender/http/css/kmltree.css	2015-03-16 10:20:20 UTC (rev 9171)
@@ -202,3 +202,14 @@
 
 }
 
+.geometry-div{
+
+    text-align: right
+
+}
+
+.geometry-div .geometry-p{
+
+    margin: 1px;
+
+}

Modified: trunk/mapbender/http/php/mb_publish_wmc.php
===================================================================
--- trunk/mapbender/http/php/mb_publish_wmc.php	2015-03-13 10:56:24 UTC (rev 9170)
+++ trunk/mapbender/http/php/mb_publish_wmc.php	2015-03-16 10:20:20 UTC (rev 9171)
@@ -38,12 +38,13 @@
 
 
 }else if($dataMode === 'getAllLicencesMode'){
-
+    $openData_only  = $_POST['openData_only'];
     $resultArray = array();
-    $sql = 'SELECT name FROM termsofuse';
+    $sql = 'SELECT name FROM termsofuse where isopen = $1';
+    $v = array($openData_only);
+    $t = array("c");
+    $res = db_prep_query($sql, $v, $t);
     header('Content-Type: application/json');
-    $res = db_query($sql);
-
     //echo db_fetch_array($res);
     while($row = db_fetch_array($res)){
         $resultArray[]= $row;

Modified: trunk/mapbender/http/php/mod_CalculateAreaAndLength.php
===================================================================
--- trunk/mapbender/http/php/mod_CalculateAreaAndLength.php	2015-03-13 10:56:24 UTC (rev 9170)
+++ trunk/mapbender/http/php/mod_CalculateAreaAndLength.php	2015-03-16 10:20:20 UTC (rev 9171)
@@ -30,7 +30,7 @@
 
 } else if ($geom_type == 'polygon') {
 
-    $sql = "SELECT st_area(st_GeogFromText( $1 )) as sqm";
+    $sql = "SELECT st_area(st_GeogFromText( $1 )) as sqm, st_length(st_GeogFromText( $1 )) as meter ";
 }
 
 
@@ -38,10 +38,18 @@
 $t = array("c");
 $res = db_prep_query($sql, $v, $t);
 //fetch the array
-if($row = db_fetch_array($res)){
+$rslt= array();
 
-        $rslt = $row[0];
-        echo $rslt;
+while($row = db_fetch_array($res)){
+
+    $rslt[0] = $row[0];
+
+        if (sizeof($row) > 1) {
+
+            $rslt[1] = $row[1];
+
+        }
 }
 
 
+echo json_encode($rslt);

Modified: trunk/mapbender/http/plugins/kmlTree.js
===================================================================
--- trunk/mapbender/http/plugins/kmlTree.js	2015-03-13 10:56:24 UTC (rev 9170)
+++ trunk/mapbender/http/plugins/kmlTree.js	2015-03-16 10:20:20 UTC (rev 9171)
@@ -191,22 +191,7 @@
                                     }
                                     $('#export-DataCollection').attr("src", "../php/mod_GetPublishedData.php?wmc_id=" + wmc_id + "&outputFormat=" + outputFormat);
 
-                                    // $.ajax({
-                                    //     url: '../php/mod_GetPublishedData.php',
-                                    //     type: 'GET',
-                                    //     data: {
-                                    //         wmc_id: wmc_id,
-                                    //         outputFormat: outputFormat
-                                    //     },
 
-                                    //     success: function(data) {
-                                    //         console.log(data);
-                                    //         console.log('Export completed');
-                                    //      }
-
-                                    // });
-
-
                                 });
 
                                 $('.exportDataLink').bind('click', function(event) {
@@ -222,16 +207,13 @@
                                         }
                                     });
 
-                                    // var exportDataLinkContent = '<div><input size="35" type="text" value="http://192.168.0.117/mapbender/php/mod_GetPublishedData.php?wmc_id='+wmc_id+'&outputFormat='+format+'/></div>';
                                     var exportDataLinkContent = '<div><label for="exportLinkInput">Link: </label><input id="exportLinkInput" size="35" type="text" value="http://'+window.location.hostname+'/mapbender/php/mod_GetPublishedData.php?wmc_id='+wmc_id+'&outputFormat='+format+'"></div>';
-                                    // var exportDataLinkContent = '<div>test</div>';
                                     $(exportDataLinkDlg).append(exportDataLinkContent);
                                 });
                             }
                         })
                         .end()
                         .find('tr').bind('click', function() {
-                            console.log('test');
                             var id = $($(this).find('td')[0]).text();
                             var d;
                             $.each(origData, function(_, val) {
@@ -356,7 +338,6 @@
 
                                         $(publishDialog).find('#publishConfirmed').bind('click', function() {
                                             $(publishDialog).dialog('close');
-                                            // var initialLicense;
                                             var chooseLicenseDialog = $('<div id="chooseLicenseDialog"></div>').dialog({
                                                 title: "Choose OpenData license for datacollection " + d[1],
                                                 width: 720,
@@ -367,8 +348,7 @@
                                                     of: window
                                                 },
                                                 close: function() {
-                                                    // $('#kml-load-tabs').tabs('destroy');
-                                                    // $(this).html('').dialog('destroy');
+
                                                     $('#chooseLicenseDialog').dialog('destroy');
                                                     $('#chooseLicenseDialog').remove();
                                                 }
@@ -378,14 +358,10 @@
                                                 "<tr><th>Lizenz</th>" +
                                                 "<th>Logo</th><th>Beschreibung</th><th>Opendata</th></tr>" +
                                                 "<tr><td><select id='licenseChooser name='license'>" +
-                                                // "<option>Lizenz wählen</option>" +
-                                                // "<option>cc-by</option><option>cc-by-nc</option>" +
-                                                // "<option>cc-by-nd</option><option>cc-by-nc-nd</option>" +
-                                                // "<option>cc-by-sa</option><option>cc-by-nc-sa</option>"+
                                                 "</select></td>" +
                                                 "<td id='licenseImg'></td>" +
                                                 "<td id='licenseDescription'></td>" +
-                                                "<td id='licenseOpen' nowrap></td></tr>" + // TODO: add content for this field
+                                                "<td id='licenseOpen' nowrap></td></tr>" +
                                                 "<tr id='submitLicense' ><td style='border:none;cursor:pointer; nowrap'><img src='../img/osgeo_graphics/check.png' style='margin-top:10px'/> <span>Publish data</span></td></tr>" +
                                                 "</table></div>";
 
@@ -398,7 +374,8 @@
                                                 data: {
                                                     wmc_id: id,
                                                     mode: 'getAllLicencesMode',
-                                                    license: 'empty'
+                                                    license: 'empty',
+                                                    openData_only: options.openData_only,
                                                 },
 
                                                 success: function(data) {
@@ -408,24 +385,18 @@
                                                         $('#licenseTbl select').append("<option>" + data[i].name + "</option>");
                                                     }
 
-
-
                                                 }
 
-
-
                                             });
 
 
-
-
                                             $.ajax({
                                                 url: '../php/mb_publish_wmc.php',
                                                 type: 'POST',
                                                 data: {
                                                     wmc_id: id,
                                                     mode: 'getLicenseMode',
-                                                    license: 'cc-by-nc-nd'
+                                                    license: 'cc-by'
                                                 },
 
                                                 success: function(data) {
@@ -614,7 +585,6 @@
     });
 
     o.$target.bind('kml:loaded', function(e, obj) {
-        //console.log(obj);
         var checked = obj.display ? 'checked="checked"' : '';
         title = obj.url;
         if (obj.refreshing) {

Modified: trunk/mapbender/http/plugins/mb_digitize_widget.php
===================================================================
--- trunk/mapbender/http/plugins/mb_digitize_widget.php	2015-03-13 10:56:24 UTC (rev 9170)
+++ trunk/mapbender/http/plugins/mb_digitize_widget.php	2015-03-16 10:20:20 UTC (rev 9171)
@@ -93,13 +93,23 @@
     var editAttributesHtml = '<div title="Feature attributes">' +
         '<div class="digitize-image digitize-style"></div>' +
         '<div class="digitize-preview"></div><br></br>' +
+        '<div class="attrAccordion">' +
         '<table><tr><td>Name</td><td><input type="text" name="name" value="Titel"></input></td></tr>' +
         '<tr><td>Description</td><td><input type="text" name="description" value="Beschreibung CDATA"></input></td></tr>' +
-        '</table><br></br>' +
+        '</table></div><br></br>' +
         '<div class="digitize-image digitize-add"></div>' +
         '<div class="digitize-image digitize-save"></div>' +
         '</div>';
 
+    var tableEditAttributesHtml = '<div title="Feature attributes">' +
+        '<div class="digitize-image digitize-style"></div>' +
+        '<div class="digitize-preview"></div><br></br>' +
+        '<div class="attrAccordion">' +
+        '</div><br></br>' +
+        '<div class="digitize-image digitize-add"></div>' +
+        '<div class="digitize-image digitize-save"></div>' +
+        '</div>';
+
     var editStyleHtml = '<div title="Edit style">' +
         '<div class="digitize-preview"></div>' +
         '<form id="digitize-marker-form"><label><input type="radio" name="marker-type" checked="checked" value="predefined">Predefined</input></label>' +
@@ -241,6 +251,7 @@
         }).bind("dialogclose", function () {
             button.stop();
             $(this).find('.digitize-image').unbind('click');
+            $(attributesDialog).html(editAttributesHtml);
         });
 
         attributesDialog.parent().find('a > span.ui-icon-closethick').bind('click', function() {
@@ -254,7 +265,7 @@
         editStyleDialog.dialog({
             autoOpen: false,
             position: [o.$target.offset().left, o.$target.offset().top],
-            width: 350,
+            width: 400,
             height: 180
         }).bind('dialogclose', function() {
             button.stop();
@@ -651,17 +662,24 @@
 
 
             }else{
-
+                //TODO: add variables for each html element -->> usability and easier to read the source-code
                 attributesDialog.dialog('open');
                 attributesDialog.find('*').unbind();
-                var rows = '';
-                var nonEditableRows = '<tr><th>Fix-Data</th></tr>';
-                var editableRows = '<tr><th>Editable-Data</th></tr>';
-                var customRows = '<tr><th>Custom-Data</th></tr>';
+                attributesDialog.html(tableEditAttributesHtml);
+                var geometryDiv = $('<div class= "geometry-div"></div>');
+                // create for each section [#4] one table in a div and put it in html of .attrAccordion
+                var nonEditableRows = '<h3 style="text-align:center;">Fix-Data</h3><div><table class="ftr-data-tbl fix-data">';//</table></div>';
+                // var nonEditableRows = '<tr><th>Fix-Data</th></tr>';
+                var editableRows = '<h3 style="text-align:center;">Editable-Data</h3><div><table class="ftr-data-tbl edit-data">';//</table></div>';
+                // var editableRows = '<tr><th>Editable-Data</th></tr>';
+                var customRows = '<h3 style="text-align:center;">Custom-Data</h3><div><table class="ftr-data-tbl custom-data">';//</table></div>';
+                // var customRows = '<tr><th>Custom-Data</th></tr>';
+                var styleRows = '<h3 style="text-align:center;">Style-Data</h3><div><table class="ftr-data-tbl style-data">';//</table></div>';
                 // var divider = "<tr><th>divider</th></tr>";
+
                 $.each(feature.properties, function(k, v) {
                     if(k.match(/Mapbender:/)) return; // was soll hiermiet passieren?
-                    if (k == "Fläche [m²]" || k == "Länge [m]" || k == "uuid" || k == "created" || k == "updated") {
+                    if ( k == "uuid" || k == "created" || k == "updated" ) {
 
                         nonEditableRows += '<tr><td>' + k + '</td><td><input disabled type="text" name="' + k + '" value="' + v + '"></input></td></tr>';
 
@@ -669,20 +687,50 @@
 
                         editableRows += '<tr><td>' + k + '</td><td><input type="text" name="' + k + '" value="' + v + '"></input></td></tr>';
 
-                    }else{
+                    } else if( k.match('marker') != null  ){
 
+                        styleRows += '<tr><td>' + k + '</td><td><input type="text" name="' + k + '" value="' + v + '"></input></td></tr>';
+
+                    } else if( k == "Fläche [m²]" || k == "Länge [m]" ||  k == "Umfang [m]" ){
+
+                            geometryDiv.append('<div><p class = " geometry-p "name="' + k + '">'+ k +' : ' + v + '</p></div>');
+
+                    } else{
+
                         customRows += '<tr><td>' + k + '</td><td><input type="text" name="' + k + '" value="' + v + '"></input></td></tr>';
 
                     }
                 });
+                //close the table tags
+                nonEditableRows += '</table></div>';
+                editableRows += '</table></div>';
+                styleRows += '</table></div>';
+                customRows += '</table></div>';
 
-                attributesDialog.find('table').html("'"+editableRows+"'"+nonEditableRows+"'"+customRows);
+                var icons = {
+                    header: "ui-icon-circle-arrow-e",
+                    activeHeader: "ui-icon-circle-arrow-s"
+                };
+                // $('.attrAccordion').append(nonEditableRows)
+                // .append(editableRows)
+                // .append(customRows).accordion({
+                //     collapsible: false
+                // });
+                $('.attrAccordion').append(nonEditableRows)
+                .append(editableRows)
+                .append(styleRows)
+                .append(customRows).accordion({
+                    collapsible: false
+                });
+                attributesDialog.prepend(geometryDiv);
+                // attributesDialog.find('table').html("'"+editableRows+"'"+nonEditableRows+"'"+customRows);
                 // attributesDialog.find('table').append(editableRows);
                 // attributesDialog.find('table').append(nonEditableRows);
                 // $(divider).after(rows);
+                // $( '.attrAccodion' ).accordion();
                 attributesDialog.find('.digitize-add').bind('click', function() {
-                    var newRow = $('<tr><td><input type="text"></input></td><td><input type="text"></input></td></tr>');
-                    attributesDialog.find('table').append(newRow);
+                    var newRow = $('<tr><td><input style="width:100px" type="text"></input></td><td><input style="width:100px" type="text"></input></td></tr>');
+                    attributesDialog.find('.ftr-data-tbl.custom-data').append(newRow);
                     newRow.find('input').first().bind('change', function() {
                         newRow.find('input').last().attr('name', $(this).val());
                     });
@@ -709,7 +757,6 @@
                 });
                 var preview = attributesDialog.find('.digitize-preview').html('').get(0);
                 kml.renderPreview(feature, preview);
-
             }
 
 
@@ -977,7 +1024,7 @@
     this.destroy = function () {
         if (o.$target.size() > 0) {
             o.$target.mb_digitize("destroy")
-            //				.unbind("mb_digitizepointadded", newPoint)
+            //              .unbind("mb_digitizepointadded", newPoint)
                 .unbind("mb_digitizelastpointadded", finishDigitize)
                 .unbind("mb_digitizereinitialize", reinitializeDigitize);
         }

Modified: trunk/mapbender/lib/mb.ui.displayKmlFeatures.js
===================================================================
--- trunk/mapbender/lib/mb.ui.displayKmlFeatures.js	2015-03-13 10:56:24 UTC (rev 9170)
+++ trunk/mapbender/lib/mb.ui.displayKmlFeatures.js	2015-03-16 10:20:20 UTC (rev 9171)
@@ -453,6 +453,7 @@
             $.ajax({
                 url: '../php/mod_CalculateAreaAndLength.php',
                 type: 'POST',
+                dataType: 'json',
                 data: {
                     geom_type: modifiedData.geomType,
                     wkt_geom: modifiedData.toText()
@@ -461,11 +462,12 @@
 
                     if (geom.geomType == 'polygon') {
 
-                        multi.e.setElement('Fläche [m²]', data);
+                        multi.e.setElement('Fläche [m²]', data[0]);
+                        multi.e.setElement('Umfang [m]', data[1]);
 
                     } else {
 
-                        multi.e.setElement('Länge [m]', data);
+                        multi.e.setElement('Länge [m]', data[0]);
                     }
 
                 },



More information about the Mapbender_commits mailing list