some more work on map/listmap
This commit is contained in:
parent
a3c18e57b0
commit
4d9a8537ef
9 changed files with 140 additions and 77 deletions
|
|
@ -260,19 +260,26 @@ Ox.Map = function(options, self) {
|
|||
bottom: 0
|
||||
})
|
||||
.appendTo(that);
|
||||
self.$placeFlag = $('<img>')
|
||||
.addClass('OxFlag')
|
||||
.attr({
|
||||
src: Ox.PATH + 'Ox.Geo/png/icons/16/NTHH.png'
|
||||
})
|
||||
.css({float: 'left', margin: '4px 2px 4px 4px'})
|
||||
.appendTo(self.$statusbar.$element);
|
||||
self.$placeNameInput = new Ox.Input({
|
||||
placeholder: 'Name',
|
||||
width: 96
|
||||
})
|
||||
//.css({position: 'absolute', left: 4, top: 4})
|
||||
.css({float: 'left', margin: '4px 1px 4px 4px'})
|
||||
.css({float: 'left', margin: '4px 2px 4px 2px'})
|
||||
.appendTo(self.$statusbar);
|
||||
self.$placeGeonameInput = new Ox.Input({
|
||||
placeholder: 'Geoname',
|
||||
width: 96
|
||||
})
|
||||
//.css({position: 'absolute', left: 104, top: 4})
|
||||
.css({float: 'left', margin: '4px 1px 4px 4px'})
|
||||
.css({float: 'left', margin: '4px 2px 4px 2px'})
|
||||
.appendTo(self.$statusbar);
|
||||
self.$placeButton = new Ox.Button({
|
||||
title: 'New Place',
|
||||
|
|
@ -407,7 +414,7 @@ Ox.Map = function(options, self) {
|
|||
place.id = place.id.substr(1); // fixme: NOT SAFE!
|
||||
place.name = self.$placeNameInput.value();
|
||||
place.geoname = self.$placeGeonameInput.value();
|
||||
place.countryCode = Ox.getCountryCode(place.geoname);
|
||||
place.countryCode = Ox.getCountryByGeoname(place.geoname).code;
|
||||
place.marker.update();
|
||||
self.places.push(place);
|
||||
self.resultPlace = null;
|
||||
|
|
@ -880,15 +887,20 @@ Ox.Map = function(options, self) {
|
|||
|
||||
function setStatus() {
|
||||
Ox.print('setStatus()', self.options.selected)
|
||||
var disabled, place, title;
|
||||
var code, country, disabled, place, title;
|
||||
if (self.options.statusbar) {
|
||||
place = getSelectedPlace();
|
||||
country = place ? Ox.getCountryByGeoname(place.geoname) : '';
|
||||
code = country ? country.code : 'NTHH';
|
||||
disabled = place && !place.editable;
|
||||
if (place) {
|
||||
title = place.id[0] == '_' ? 'Add Place' : 'Remove Place';
|
||||
} else {
|
||||
title = 'New Place';
|
||||
}
|
||||
disabled = place && !place.editable;
|
||||
self.$placeFlag.attr({
|
||||
src: Ox.PATH + 'Ox.Geo/png/icons/16/' + code + '.png'
|
||||
});
|
||||
self.$placeNameInput.options({
|
||||
disabled: disabled,
|
||||
value: place ? place.name : ''
|
||||
|
|
@ -967,12 +979,14 @@ Ox.Map = function(options, self) {
|
|||
function updateFormElements() {
|
||||
var width = that.width();
|
||||
self.$zoomInput && constructZoomInput();
|
||||
self.$placeNameInput && self.$placeNameInput.options({
|
||||
width: Math.floor((width - 112) / 2)
|
||||
});
|
||||
self.$placeGeonameInput && self.$placeGeonameInput.options({
|
||||
width: Math.ceil((width - 112) / 2)
|
||||
});
|
||||
if (self.options.statusbar) {
|
||||
self.$placeNameInput.options({
|
||||
width: Math.floor((width - 132) / 2)
|
||||
});
|
||||
self.$placeGeonameInput.options({
|
||||
width: Math.ceil((width - 132) / 2)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function zoom(z) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue