[Mapbender-commits] r8835 - trunk/mapbender/http/plugins
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Mon May 12 00:41:02 PDT 2014
Author: hwbllmnn
Date: 2014-05-12 00:41:02 -0700 (Mon, 12 May 2014)
New Revision: 8835
Modified:
trunk/mapbender/http/plugins/mb_digitize_widget.php
Log:
reorganized kml digitizer a bit, connected various dialogs
Modified: trunk/mapbender/http/plugins/mb_digitize_widget.php
===================================================================
--- trunk/mapbender/http/plugins/mb_digitize_widget.php 2014-05-08 14:52:35 UTC (rev 8834)
+++ trunk/mapbender/http/plugins/mb_digitize_widget.php 2014-05-12 07:41:02 UTC (rev 8835)
@@ -113,7 +113,7 @@
'</ul>';
var geomMenu = '<ul class="digitize-contextmenu">' +
- '<li><div class="digitize-image digitize-pencil"></div><span class="margin-left: 30px;">Edit</span></li>' +
+ '<li><div class="digitize-image digitize-pencil"></div>Edit</li>' +
'<li><div class="digitize-image digitize-zoomto"></div>Zoom to</li>' +
'<li><div class="digitize-image digitize-add"></div>New</li>' +
'<li><div class="digitize-image digitize-export"></div>Export</li>' +
@@ -131,17 +131,18 @@
'</ul>';
var digitizeDialog,
+ editDialog,
+ attributesDialog,
button,
that = this,
inProgress = false,
- title = o.title,
- defaultHtml = digitizeHtml;
+ title = o.title;
- var create = function () {
+ var create = function() {
//
// Initialise digitize dialog
//
- digitizeDialog = $(defaultHtml);
+ digitizeDialog = $(digitizeHtml);
digitizeDialog.dialog({
autoOpen: false,
position: [o.$target.offset().left, o.$target.offset().top]
@@ -149,6 +150,22 @@
button.stop();
that.destroy();
});
+ editDialog = $(editHtml);
+ editDialog.dialog({
+ autoOpen: false,
+ position: [o.$target.offset().left, o.$target.offset().top]
+ }).bind("dialogclose", function () {
+ button.stop();
+ that.destroy();
+ });
+ attributesDialog = $(editAttributesHtml);
+ attributesDialog.dialog({
+ autoOpen: false,
+ position: [o.$target.offset().left, o.$target.offset().top]
+ }).bind("dialogclose", function () {
+ button.stop();
+ that.destroy();
+ });
//
// Initialise button
@@ -169,58 +186,73 @@
$('#mapframe1').bind('kml:loaded', function(evt, item) {
var url = item.url;
- $('li[title="' + url + '"] > a').live('contextmenu', function() {
- var $link = $(this);
- var menu = $(folderMenu);
- $(document.body).append(menu);
- var pos = $link.offset();
- menu.css({position: 'absolute', top: pos.top, left: pos.left}).menu()
- .children().addClass('ui-menu-item')
- .hover(function() {$(this).addClass('ui-state-hover'); },
- function() {$(this).removeClass('ui-state-hover'); });
- menu.children('li:has(.digitize-zoomto)').bind('click', function() {
- $link.click();
- menu.menu('destroy').remove();
- });
- menu.children('li:has(.digitize-remove)').bind('click', function() {
- $('#mapframe1').data('kml').remove(item.url);
- $link.parent().remove();
- menu.menu('destroy').remove();
- });
- return false;
- });
- $('li[title="' + url + '"] > ul > li').live('contextmenu', function() {
- var $link = $(this);
- var menu = $(geomMenu);
- $(document.body).append(menu);
- var pos = $link.offset();
- menu.css({position: 'absolute', top: pos.top, left: pos.left}).menu()
- .children().addClass('ui-menu-item')
- .hover(function() {$(this).addClass('ui-state-hover'); },
- function() {$(this).removeClass('ui-state-hover'); });
- menu.children('li:has(.digitize-zoomto)').bind('click', function() {
- $link.click();
- menu.menu('destroy').remove();
- });
- menu.children('li:has(.digitize-remove)').bind('click', function() {
- var kml = $('#mapframe1').data('kml');
- var url = $link.parent().parent().attr('title');
- var ids = [];
- var i = 0;
- $.each($link.siblings(), function(k, v) {
- ids.push($(v).attr('idx'));
- $(v).attr('idx', i++);
- });
- $link.remove();
- kml.reorderFeatures(url, ids);
+ $('li[title="' + url + '"] > a').live('contextmenu', contextmenuLayer);
+ $('li[title="' + url + '"] > ul > li').live('contextmenu', contextmenuObject);
+ });
+ };
- menu.menu('destroy').remove();
- });
- return false;
+ var contextmenuObject = function() {
+ var $link = $(this);
+ var menu = $(geomMenu);
+ $(document.body).append(menu);
+ var pos = $link.offset();
+ menu.css({position: 'absolute', top: pos.top, left: pos.left}).menu()
+ .children().addClass('ui-menu-item')
+ .hover(function() {$(this).addClass('ui-state-hover'); },
+ function() {$(this).removeClass('ui-state-hover'); });
+ menu.children('li:has(.digitize-zoomto)').bind('click', function() {
+ $link.click();
+ menu.menu('destroy').remove();
+ });
+ menu.children('li:has(.digitize-pencil)').bind('click', function() {
+ editDialog.dialog('open');
+ editDialog.find('.digitize-attributes').bind('click', function() {
+ attributesDialog.dialog('open');
});
+ menu.menu('destroy').remove();
});
+ menu.children('li:has(.digitize-remove)').bind('click', function() {
+ var kml = $('#mapframe1').data('kml');
+ var url = $link.parent().parent().attr('title');
+ var ids = [];
+ var i = 0;
+ $.each($link.siblings(), function(k, v) {
+ ids.push($(v).attr('idx'));
+ $(v).attr('idx', i++);
+ });
+ $link.remove();
+ kml.reorderFeatures(url, ids);
+
+ menu.menu('destroy').remove();
+ });
+ return false;
};
+ var contextmenuLayer = function() {
+ var $link = $(this);
+ var menu = $(folderMenu);
+ $(document.body).append(menu);
+ var pos = $link.offset();
+ menu.css({position: 'absolute', top: pos.top, left: pos.left}).menu()
+ .children().addClass('ui-menu-item')
+ .hover(function() {$(this).addClass('ui-state-hover'); },
+ function() {$(this).removeClass('ui-state-hover'); });
+ menu.children('li:has(.digitize-zoomto)').bind('click', function() {
+ $link.click();
+ menu.menu('destroy').remove();
+ });
+ menu.children('li:has(.digitize-remove)').bind('click', function() {
+ $('#mapframe1').data('kml').remove(item.url);
+ $link.parent().remove();
+ menu.menu('destroy').remove();
+ });
+ menu.children('li:has(.digitize-add)').bind('click', function() {
+ digitizeDialog.dialog('open');
+ menu.menu('destroy').remove();
+ });
+ return false;
+ };
+
var finishDigitize = function () {
inProgress = false;
that.deactivate();
@@ -253,7 +285,6 @@
}
if (!inProgress) {
inProgress = true;
- digitizeDialog.html(defaultHtml);
}
digitizeDialog.dialog("open");
@@ -269,7 +300,6 @@
if (digitizeDialog.dialog("isOpen")) {
digitizeDialog.dialog("close");
}
- digitizeDialog.html(defaultHtml);
//remove digitized x and y values from print dialog
$('input[name="digitized_x_values"]').val("");
More information about the Mapbender_commits
mailing list