diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 1fbd37f1e..1c0e35461 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -24,6 +24,9 @@ - fixed SMS/Email notification handling (Patrick Donelan, SDH Consulting) - fixed #10624: map template problem with floats - fixed #10793: Map->Add Point photo field missing + - fixed #10625: Map point no save button + - fixed #10639: Map: Can't edit or delete points + - fixed #10640: Map: points not working correctly 7.7.17 - fixed #10697: Story: Image crowds text diff --git a/docs/upgrades/packages-7.7.18/default-map-point-edit.wgpkg b/docs/upgrades/packages-7.7.18/default-map-point-edit.wgpkg index 9aac85cb4..c04b72934 100644 Binary files a/docs/upgrades/packages-7.7.18/default-map-point-edit.wgpkg and b/docs/upgrades/packages-7.7.18/default-map-point-edit.wgpkg differ diff --git a/docs/upgrades/packages-7.7.18/default-map-point-view.wgpkg b/docs/upgrades/packages-7.7.18/default-map-point-view.wgpkg index 1a4cc3184..5be271821 100644 Binary files a/docs/upgrades/packages-7.7.18/default-map-point-view.wgpkg and b/docs/upgrades/packages-7.7.18/default-map-point-view.wgpkg differ diff --git a/docs/upgrades/packages-7.7.18/default-map-view.wgpkg b/docs/upgrades/packages-7.7.18/default-map-view.wgpkg index eac4fc8e2..4df1a3a0a 100644 Binary files a/docs/upgrades/packages-7.7.18/default-map-view.wgpkg and b/docs/upgrades/packages-7.7.18/default-map-view.wgpkg differ diff --git a/lib/WebGUI/Asset/MapPoint.pm b/lib/WebGUI/Asset/MapPoint.pm index 320f282ad..55e105148 100644 --- a/lib/WebGUI/Asset/MapPoint.pm +++ b/lib/WebGUI/Asset/MapPoint.pm @@ -296,6 +296,10 @@ sub getTemplateVarsEditForm { ; $var->{ form_footer } = WebGUI::Form::formFooter( $session ); + $var->{ form_save } = WebGUI::Form::submit( $session, { + name => "save", + } ); + # Stuff from this class's definition my $definition = __PACKAGE__->definition($session)->[0]->{properties}; for my $key ( keys %{$definition} ) { diff --git a/lib/WebGUI/Asset/Wobject/Map.pm b/lib/WebGUI/Asset/Wobject/Map.pm index daee44034..2b590d662 100644 --- a/lib/WebGUI/Asset/Wobject/Map.pm +++ b/lib/WebGUI/Asset/Wobject/Map.pm @@ -16,6 +16,7 @@ use strict; use Tie::IxHash; use WebGUI::International; use WebGUI::Utility; +use HTML::Entities qw(encode_entities); use base 'WebGUI::Asset::Wobject'; # To get an installer for your wobject, add the Installable AssetAspect @@ -520,6 +521,8 @@ sub www_ajaxEditPointSave { my $form = $self->session->form; my $i18n = WebGUI::International->new( $session, 'Asset_Map' ); + # We're returning as HTML because application/json causes download pop-up + # and text/plain causes
...
in firefox $session->http->setMimeType("text/html"); $session->log->preventDebugOutput; @@ -547,7 +550,8 @@ sub www_ajaxEditPointSave { $asset->requestAutoCommit; } - return JSON->new->encode($asset->getMapInfo); + # Encode entities because we're returning as HTML + return encode_entities( JSON->new->encode($asset->getMapInfo) ); } #------------------------------------------------------------------- diff --git a/www/extras/yui-webgui/build/map/map.js b/www/extras/yui-webgui/build/map/map.js index 8570b2f67..f9149e649 100644 --- a/www/extras/yui-webgui/build/map/map.js +++ b/www/extras/yui-webgui/build/map/map.js @@ -51,8 +51,15 @@ WebGUI.Map.editPoint // Callback should open the window with the form var callback = function (text, code) { - marker.openInfoWindowHtml( text ); - + marker.infoWin.innerHTML = text; + var button = marker.infoWin.getElementsByTagName( "form" )[0].elements["save"]; + marker.openInfoWindow( marker.infoWin ); + YAHOO.util.Event.addListener( button, "click", function (e) { + // Closing the info window triggers infowindowbeforeclose + marker.closeInfoWindow(); + YAHOO.util.Event.stopEvent(e); + return false; + } ); GEvent.addListener( marker, "infowindowbeforeclose", function () { WebGUI.Map.editPointSave( map, mgr, mapUrl, marker ); }); @@ -86,9 +93,11 @@ WebGUI.Map.editPointSave GEvent.clearListeners( marker, "click" ); GEvent.clearListeners( marker, "infowindowbeforeclose" ); - // Set the marker's title - marker.kh.title = point.title; - // I hate the google maps API. + // Decode HTML entities because JSON is being returned as text/html + // See WebGUI::Asset::Wobject::Map www_ajaxEditPointSave + var decoder = document.createElement( "textarea" ); + decoder.innerHTML = point.content; + point.content = decoder.value; var infoWin = document.createElement( "div" ); infoWin.innerHTML = point.content;