fixed: #10887: Map Point dropdown doesn't update

This commit is contained in:
Doug Bell 2009-10-27 01:01:57 -05:00
parent b24a3f4eb5
commit b577b950e9
4 changed files with 93 additions and 28 deletions

View file

@ -388,6 +388,8 @@ sub view {
var mapId = "%s";
var mapUrl = "%s";
var map = new GMap2( document.getElementById("map_" + mapId) );
map.url = mapUrl;
map.assetId = mapId;
map.setCenter(new GLatLng(%s, %s), %s);
map.setUIToDefault();
map.extrasUrl = "%s";
@ -414,7 +416,7 @@ ENDHTML
}
$mapHtml .= <<'ENDHTML';
markermanager.addMarkers( WebGUI.Map.preparePoints(map, markermanager, mapUrl, points), 0 );
markermanager.addMarkers( WebGUI.Map.preparePoints(map, markermanager, points), 0 );
ENDHTML
}
@ -434,13 +436,13 @@ ENDHTML
if ( document.getElementById( "setCenter_" + mapId ) ) {
var button = document.getElementById( "setCenter_" + mapId );
GEvent.addDomListener( button, "click", function () {
WebGUI.Map.setCenter( map, mapUrl );
WebGUI.Map.setCenter( map );
} );
}
if ( document.getElementById( "addPoint_" + mapId ) ) {
var button = document.getElementById( "addPoint_" + mapId );
GEvent.addDomListener( button, "click", function () {
WebGUI.Map.editPoint( map, markermanager, mapUrl );
WebGUI.Map.editPoint( map, markermanager );
} );
}
});
@ -463,6 +465,18 @@ ENDHTML
id => sprintf( 'setCenter_%s', $self->getId ),
} );
# Select box to choose a map point
tie my %selectPointOptions, 'Tie::IxHash', (
"" => '-- ' . $i18n->get('select a point'),
map { $_->{assetId} => $_->{title} } sort { $a->{title} cmp $b->{title} } @{$var->{mapPoints}},
);
$var->{ selectPoint }
= WebGUI::Form::selectBox( $session, {
extras => q{onchange="WebGUI.Map.focusOn(this.options[this.selectedIndex].value);"},
id => sprintf( q{selectPoint_%s}, $self->getId ),
options => \%selectPointOptions,
} );
return $self->processTemplate( $var, undef, $self->{_viewTemplate} );
}