merge changes from dev

This commit is contained in:
j 2010-12-06 18:43:01 +01:00
commit ce4fe60fc6

View file

@ -1929,23 +1929,23 @@ requires
});
$.each(self.options.items, function(i, item) {
var id = item.element.options('id');
that.append(self.$items[i] = new Ox.FormItem(item))
.append(self.$messages[i] = new Ox.Element().addClass('OxFormMessage'));
// fixme: use widget.bindEvent()
Ox.Event.bind(id, 'validate', function(event, data) {
item.element.bindEvent({
validate: function(event, data) {
validate(i, data.valid);
});
Ox.Event.bind(id, 'blur', function(event, data) {
},
blur: function(event, data) {
validate(i, data.valid);
if (data.valid) {
self.$messages[i].html('').hide();
} else {
self.$messages[i].html(data.message).show();
}
});
Ox.Event.bind(id, 'submit', function(event, data) {
},
submit: function(event, data) {
self.formIsValid && that.submit();
}
});
});
@ -4620,15 +4620,13 @@ requires
function findPlace(event, data) {
Ox.print('findPlace', data);
self.$map.find(data.value, function(location) {
if (location) {
that.$label.html(location.name.formatted);
}
self.$map.find(data.value, function(place) {
place && that.$label.html(place.geoname);
})
}
function onSelect(event, data) {
that.$label.html(data.name.formatted);
that.$label.html(data.geoname);
}
function onZoom(event, data) {
@ -7244,6 +7242,7 @@ requires
geocoder: new google.maps.Geocoder(),
selected: -1
});
if (Ox.isObject(self.options.places[0])) {
$.each(self.options.places, function(i, place) {
place.bounds = getBounds(),
place.center = place.bounds.getCenter();
@ -7260,19 +7259,36 @@ requires
);
}
});
Ox.print('loadMap');
Ox.print(self.bounds)
loadMap();
} else {
self.counter = 0;
$.each(self.options.places, function(i, place) {
getLocationByName(place, function(place) {
Ox.print(self.counter, i, place);
self.options.places[i] = place;
if (self.counter++ == self.options.places.length - 1) {
loadMap();
}
});
});
}
function loadMap() {
self.center = self.bounds ? self.bounds.getCenter() : new google.maps.LatLng(0, 0);
self.zoom = 1;
$.extend(self, {
map: new google.maps.Map(that.$element[0], {
center: self.bounds.getCenter(),
center: self.center,
disableDefaultUI: true,
mapTypeId: google.maps.MapTypeId[self.options.type.toUpperCase()],
zoom: 0
zoom: self.zoom
})
});
if (self.bounds) {
self.map.fitBounds(self.bounds);
self.center = self.map.getCenter();
// self.center = self.map.getCenter();
self.zoom = self.map.getZoom();
}
google.maps.event.addListener(self.map, 'click', click);
google.maps.event.addListener(self.map, 'zoom_changed', zoomChanged);
$.each(self.options.places, function(i, place) {
@ -7280,6 +7296,8 @@ requires
});
resize();
that.gainFocus();
}
function canContain(outerBounds, innerBounds) {
var outerSpan = outerBounds.toSpan(),
@ -7554,7 +7572,7 @@ requires
};
}
function Rectangle(area) {
function Rectangle(area) { // fixme: not used
var latlng = {
sw: new google.maps.LatLng(area[0][0], area[0][1]),
ne: new google.maps.LatLng(area[1][0], area[1][1])
@ -7600,15 +7618,15 @@ requires
};
that.find = function(name, callback) {
getLocationByName(name, function(location) {
if (location) {
getLocationByName(name, function(place) {
if (place) {
//self.marker = location.marker.add();
self.polygon && self.polygon.remove();
self.polygon = location.polygon.add();
self.bounds = location.bounds;
self.polygon = place.polygon.add();
self.bounds = place.bounds;
self.map.fitBounds(self.bounds);
}
callback(location);
callback(place);
});
};