1
0
Fork 0
forked from 0x2620/oxjs

changes in video editor and list map

This commit is contained in:
rlx 2012-02-05 01:56:23 +00:00
commit 353fce1f14
5 changed files with 41 additions and 26 deletions

View file

@ -69,7 +69,7 @@ Ox.ListMap = function(options, self) {
title: 'Id',
unique: true,
visible: false,
width: 64
width: 32
},
{
format: function(value, data) {
@ -326,7 +326,8 @@ Ox.ListMap = function(options, self) {
columnsVisible: true,
//items: Ox.clone(self.options.places),
items: self.options.places,
keys: ['area', 'geoname'], // needed for icon and flag
// area needed for icon, geoname needed for flag
keys: ['area', 'geoname', 'matches'],
max: 1,
min: 0,
pageLength: self.options.pageLength,
@ -649,7 +650,7 @@ Ox.ListMap = function(options, self) {
.appendTo(self.$placeStatusbar);
self.$addPlaceButton = Ox.Button({
tooltip: 'Add Place',
title: 'Add Place',
width: 90
})
.css({float: 'right', margin: '4px'})
@ -833,8 +834,8 @@ Ox.ListMap = function(options, self) {
var values = {
id: self.selectedPlace,
alternativeNames: [], geoname: '', type: '',
latitude: null, longitude: null,
south: null, west: null, north: null, east: null
lat: null, lng: null,
south: null, west: null, north: null, east: null, area: null
};
self.$definePlaceButton.options({disabled: true, title: 'Clearing...'});
self.options.editPlace(values, function() {
@ -848,7 +849,7 @@ Ox.ListMap = function(options, self) {
}
function definePlace() {
self.$map.newPlace();
self.$map.newPlace(); // this will call selectPlace, then editPlace
self.$definePlaceButton.options({title: 'Clear Place'})
}
@ -917,6 +918,9 @@ Ox.ListMap = function(options, self) {
self.$addPlaceButton.options({disabled: true, title: 'Removing...'})
self.options.removePlace({id: self.selectedPlace}, function() {
self.$list.options({selected: []}).reloadList(true);
self.options.mode == 'define' && self.$definePlaceButton.options({
disabled: true
});
self.$addPlaceButton.options({disabled: false, title: 'Add Place'})
});
}
@ -946,6 +950,7 @@ Ox.ListMap = function(options, self) {
title: 'Define Place'
}).show();
self.$addPlaceButton.options({
disabled: self.$list.value(self.options.selected, 'matches') > 0,
title: 'Remove Place'
}).show();
}
@ -960,14 +965,19 @@ Ox.ListMap = function(options, self) {
isUndefined = !!self.options.selected
&& !self.$list.value(self.options.selected, 'type');
Ox.print('isResult', isResult, 'isUndefined', isUndefined, self.options.selected)
if (!isUndefined) {
if (!(isUndefined && !place.id)) {
// if isUndefined && !place.id, then we're handling the
// map deselect, which we don't want to pass to the list
self.$list.options({
selected: place.id && !isResult ? [place.id] : []
});
}
if (place.id) {
if (isResult && isUndefined) {
place.name = self.$list.value(self.selectedPlace, 'name');
self.selectedPlace = self.options.selected;
place.id = self.options.selected;
place.name = self.$list.value(self.options.selected, 'name');
Ox.print('PLACE::::::', place)
}
self.options.mode == 'define' && self.$findPlaceButton.hide();
self.$placeFlag.attr({
@ -977,19 +987,21 @@ Ox.ListMap = function(options, self) {
self.$placeTitle.show();
self.$placeForm.values(place).show();
self.$areaKmInput.value(Ox.formatArea(place.area));
updateMatches();
self.$matchesInput.value(place.matches);
//updateMatches();
self.options.mode == 'define' && self.$definePlaceButton.options({
title: isUndefined && !isResult ? 'Define Place' : 'Clear Place'
}).show();
self.$addPlaceButton.options({
disabled: self.options.mode == 'define' && place.matches > 0,
title: isResult ? 'Add Place' : 'Remove Place'
}).show();
if (isResult && isUndefined) {
Ox.print('???? s.o.s s.sP', self.options.selected, self.selectedPlace)
self.selectedPlace = self.options.selected;
self.$map.addPlace(place);
self.$addPlaceButton.options({title: 'Remove Place'});
editPlace([
'geoname', 'type',
'latitude', 'longitude',
'lat', 'lng',
'south', 'west', 'north', 'east', 'area'
]);
}