in annotation panel, make links to define/edit places/events work (fixes #561)
This commit is contained in:
parent
202d11177b
commit
db6f68681a
3 changed files with 57 additions and 39 deletions
|
@ -269,7 +269,6 @@ Ox.ListCalendar = function(options, self) {
|
||||||
return !!event.type;
|
return !!event.type;
|
||||||
}),
|
}),
|
||||||
height: self.options.height,
|
height: self.options.height,
|
||||||
selected: self.options.selected,
|
|
||||||
showControls: self.options.showControls,
|
showControls: self.options.showControls,
|
||||||
showToolbar: true,
|
showToolbar: true,
|
||||||
showZoombar: true,
|
showZoombar: true,
|
||||||
|
@ -544,6 +543,11 @@ Ox.ListCalendar = function(options, self) {
|
||||||
.$element
|
.$element
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// if loaded with selection, set calendar and form
|
||||||
|
self.options.selected && self.$list.triggerEvent({
|
||||||
|
select: {ids: [self.options.selected]}
|
||||||
|
});
|
||||||
|
|
||||||
function addEvent() {
|
function addEvent() {
|
||||||
Ox.Log('Calendar', 'ADD', self.$calendar.getBounds())
|
Ox.Log('Calendar', 'ADD', self.$calendar.getBounds())
|
||||||
var bounds = self.$calendar.getBounds(),
|
var bounds = self.$calendar.getBounds(),
|
||||||
|
|
|
@ -355,6 +355,15 @@ Ox.ListMap = function(options, self) {
|
||||||
select: selectItem
|
select: selectItem
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// if loaded with selection, set map and form
|
||||||
|
self.options.selected && self.$list.bindEventOnce({
|
||||||
|
load: function() {
|
||||||
|
self.$list.triggerEvent({
|
||||||
|
select: {ids: [self.options.selected]}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
self.$listStatusbar = Ox.Bar({
|
self.$listStatusbar = Ox.Bar({
|
||||||
size: 16
|
size: 16
|
||||||
});
|
});
|
||||||
|
@ -369,7 +378,6 @@ Ox.ListMap = function(options, self) {
|
||||||
findPlaceholder: 'Find on Map',
|
findPlaceholder: 'Find on Map',
|
||||||
height: self.options.height,
|
height: self.options.height,
|
||||||
places: self.options.places,
|
places: self.options.places,
|
||||||
selected: self.options.selected,
|
|
||||||
//statusbar: true,
|
//statusbar: true,
|
||||||
showControls: self.options.showControls,
|
showControls: self.options.showControls,
|
||||||
showLabels: self.options.showLabels,
|
showLabels: self.options.showLabels,
|
||||||
|
|
|
@ -1141,47 +1141,53 @@ Ox.Map = function(options, self) {
|
||||||
function selectPlace(id, zoom) {
|
function selectPlace(id, zoom) {
|
||||||
Ox.print('SELECT PLACE', id)
|
Ox.print('SELECT PLACE', id)
|
||||||
// id can be null (deselect)
|
// id can be null (deselect)
|
||||||
var place,
|
var place, selected = getSelectedMarker();
|
||||||
selected = getSelectedMarker();
|
if (!self.loaded) {
|
||||||
Ox.Log('Map', 'Ox.Map selectPlace()', id, selected);
|
setTimeout(function() {
|
||||||
if (id != selected) {
|
selectPlace(id, zoom)
|
||||||
place = getPlaceById(selected);
|
}, 1000);
|
||||||
place && place.deselect();
|
} else {
|
||||||
if (id !== null) {
|
Ox.Log('Map', 'Ox.Map selectPlace()', id, selected);
|
||||||
place = getPlaceById(id);
|
if (id != selected) {
|
||||||
if (place) {
|
place = getPlaceById(selected);
|
||||||
select();
|
place && place.deselect();
|
||||||
} else {
|
if (id !== null) {
|
||||||
// async && place doesn't exist yet
|
place = getPlaceById(id);
|
||||||
self.options.places({
|
if (place) {
|
||||||
keys: self.placeKeys,
|
select();
|
||||||
query: {
|
} else {
|
||||||
conditions: [
|
// async && place doesn't exist yet
|
||||||
{key: 'id', value: id, operator: '=='}
|
self.options.places({
|
||||||
],
|
keys: self.placeKeys,
|
||||||
operator: '&'
|
query: {
|
||||||
}
|
conditions: [
|
||||||
}, function(result) {
|
{key: 'id', value: id, operator: '=='}
|
||||||
if (result.data.items.length) {
|
],
|
||||||
place = new Ox.MapPlace(Ox.extend({
|
operator: '&'
|
||||||
map: that
|
|
||||||
}, result.data.items[0])).add();
|
|
||||||
self.places.push(place);
|
|
||||||
select();
|
|
||||||
if (zoom) {
|
|
||||||
zoomToPlace();
|
|
||||||
} else {
|
|
||||||
panToPlace();
|
|
||||||
}
|
}
|
||||||
}
|
}, function(result) {
|
||||||
});
|
if (result.data.items.length) {
|
||||||
|
place = new Ox.MapPlace(Ox.extend({
|
||||||
|
map: that
|
||||||
|
}, result.data.items[0])).add();
|
||||||
|
self.places.push(place);
|
||||||
|
select();
|
||||||
|
if (zoom) {
|
||||||
|
zoomToPlace();
|
||||||
|
} else {
|
||||||
|
panToPlace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
place = null;
|
||||||
|
select();
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
place = null;
|
|
||||||
select();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function select() {
|
function select() {
|
||||||
|
Ox.print('select...', place)
|
||||||
place && place.select();
|
place && place.select();
|
||||||
self.options.selected = id;
|
self.options.selected = id;
|
||||||
setPlaceControls(place);
|
setPlaceControls(place);
|
||||||
|
@ -1418,7 +1424,7 @@ Ox.Map = function(options, self) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (key == 'selected') {
|
} else if (key == 'selected') {
|
||||||
self.loaded && selectPlace(value || null);
|
selectPlace(value || null);
|
||||||
} else if (key == 'type') {
|
} else if (key == 'type') {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue