merging changes

This commit is contained in:
rlx 2011-02-26 04:22:49 +00:00
parent fe026fc0e5
commit 6530780bf0
2 changed files with 104 additions and 26 deletions

View file

@ -1,8 +1,8 @@
Ox.COUNTRIES = [ Ox.COUNTRIES = [
// 302 countries () // 304 countries (see http://en.wikipedia.org/wiki/Table_of_administrative_divisions_by_country)
// 193 sovereign countries (see http://en.wikipedia.org/wiki/List_of_sovereign_states) // 193 sovereign countries (see http://en.wikipedia.org/wiki/List_of_sovereign_states)
// 11 unrecognized countries (see http://en.wikipedia.org/wiki/List_of_sovereign_states#Other_states) // 11 unrecognized countries (see http://en.wikipedia.org/wiki/List_of_sovereign_states#Other_states)
// 62 dependent countries (4 Australia, 2 China, 2 Denmark, 1 Finland, 13 France, 4 Netherlands, // 62 dependent countries (6 Australia, 2 China, 2 Denmark, 1 Finland, 13 France, 4 Netherlands,
// 3 New Zealand, 2 Norway, 2 Spain, 22 United Kingdom, 6 United States, plus Antarctica) // 3 New Zealand, 2 Norway, 2 Spain, 22 United Kingdom, 6 United States, plus Antarctica)
// 34 former countries (http://en.wikipedia.org/wiki/ISO_3166-3, http://www.imdb.com/country/) // 34 former countries (http://en.wikipedia.org/wiki/ISO_3166-3, http://www.imdb.com/country/)
// 2 other countries (EU, UK) // 2 other countries (EU, UK)
@ -214,8 +214,10 @@ Ox.COUNTRIES = [
{code: 'TW', continent: 'Asia', name: 'Taiwan', region: 'Eastern Asia', type: 'unrecognized'}, {code: 'TW', continent: 'Asia', name: 'Taiwan', region: 'Eastern Asia', type: 'unrecognized'},
{code: 'MD-TR', continent: 'Europe', name: 'Transnistria', region: 'Eastern Europe', type: 'unrecognized'}, {code: 'MD-TR', continent: 'Europe', name: 'Transnistria', region: 'Eastern Europe', type: 'unrecognized'},
{code: 'AQ', continent: 'Antarctica', country: ['Argentina', 'Australia', 'Chile', 'France', 'New Zealand', 'Norway', 'United Kingdom'], name: 'Antarctica'}, {code: 'AQ', continent: 'Antarctica', country: ['Argentina', 'Australia', 'Chile', 'France', 'New Zealand', 'Norway', 'United Kingdom'], name: 'Antarctica'},
{code: 'AU-AC', country: 'Australia', name: 'Ashmore and Cartier Islands', type: 'dependent'},
{code: 'CX', continent: 'Asia', country: 'Australia', name: 'Christmas Island', region: 'South-Eastern Asia', type: 'dependent'}, {code: 'CX', continent: 'Asia', country: 'Australia', name: 'Christmas Island', region: 'South-Eastern Asia', type: 'dependent'},
{code: 'CC', continent: 'Asia', country: 'Australia', name: 'Cocos Islands', region: 'South-Eastern Asia', type: 'dependent'}, {code: 'CC', continent: 'Asia', country: 'Australia', name: 'Cocos Islands', region: 'South-Eastern Asia', type: 'dependent'},
{code: 'AU-CS', country: 'Australia', name: 'Coral Sea Islands', type: 'dependent'},
{code: 'HM', continent: 'Antarctica', country: 'Australia', name: 'Heard Island and McDonald Islands', type: 'dependent'}, {code: 'HM', continent: 'Antarctica', country: 'Australia', name: 'Heard Island and McDonald Islands', type: 'dependent'},
{code: 'NF', continent: 'Oceania', country: 'Australia', name: 'Norfolk Island', region: 'Australia and New Zealand', type: 'dependent'}, {code: 'NF', continent: 'Oceania', country: 'Australia', name: 'Norfolk Island', region: 'Australia and New Zealand', type: 'dependent'},
{code: 'HK', continent: 'Asia', country: 'China', name: 'Hong Kong', region: 'Eastern Asia', type: 'dependent'}, {code: 'HK', continent: 'Asia', country: 'China', name: 'Hong Kong', region: 'Eastern Asia', type: 'dependent'},
@ -248,7 +250,7 @@ Ox.COUNTRIES = [
{code: 'IC', continent: 'Africa', country: 'Spain', name: 'Canary Islands', region: 'Northern Africa', type: 'dependent'}, {code: 'IC', continent: 'Africa', country: 'Spain', name: 'Canary Islands', region: 'Northern Africa', type: 'dependent'},
{code: 'EA', continent: 'Africa', country: 'Spain', name: 'Ceuta and Melilla', region: 'Northern Africa', type: 'dependent'}, {code: 'EA', continent: 'Africa', country: 'Spain', name: 'Ceuta and Melilla', region: 'Northern Africa', type: 'dependent'},
{code: 'AI', continent: 'North America', country: 'United Kingdom', name: 'Anguilla', region: 'Carribean', type: 'dependent'}, {code: 'AI', continent: 'North America', country: 'United Kingdom', name: 'Anguilla', region: 'Carribean', type: 'dependent'},
{code: 'AC', continent: 'Africa', country: 'United Kingdom', name: 'Ascension Island', region: 'Western Africa', type: 'dependent'}, {code: 'AC', continent: 'Africa', country: 'United Kingdom', name: 'Ascension', region: 'Western Africa', type: 'dependent'},
{code: 'BM', continent: 'North America', country: 'United Kingdom', name: 'Bermuda', region: 'Northern America', type: 'dependent'}, {code: 'BM', continent: 'North America', country: 'United Kingdom', name: 'Bermuda', region: 'Northern America', type: 'dependent'},
{code: 'IO', country: 'United Kingdom', name: 'British Indian Ocean Territory', type: 'dependent'}, {code: 'IO', country: 'United Kingdom', name: 'British Indian Ocean Territory', type: 'dependent'},
{code: 'VG', continent: 'North America', country: 'United Kingdom', name: 'British Virgin Islands', region: 'Carribean', type: 'dependent'}, {code: 'VG', continent: 'North America', country: 'United Kingdom', name: 'British Virgin Islands', region: 'Carribean', type: 'dependent'},
@ -319,11 +321,26 @@ Ox.COUNTRY_CODES = Ox.map(Ox.COUNTRIES, function(country) {
Ox.getCountryCode = (function() { Ox.getCountryCode = (function() {
var aliases = { var aliases = {
'Cocos (Keeling) Islands': 'Cocos Islands',
'Congo': 'Republic of the Congo',
'French Southern and Antarctic Lands': 'French Southern Territories',
'Macedonia (FYROM)': 'Macedonia',
'Pitcairn Islands': 'Pitcairn',
'Reunion': 'Réunion',
'St Barthélemy': 'Saint Barthélemy',
'St Helena': 'Saint Helena',
'St Kitts and Nevis': 'Saint Kitts and Nevis',
'St Lucia': 'Saint Lucia',
'St Pierre and Miquelon': 'Saint Pierre and Miquelon',
'St Vincent and the Grenadines': 'Saint Vincent and the Grenadines',
'The Bahamas': 'Bahamas', 'The Bahamas': 'Bahamas',
'The Gambia': 'Gambia',
'The Netherlands': 'Netherlands', 'The Netherlands': 'Netherlands',
'Trinidad & Tobago': 'Trinidad and Tobago',
'UK': 'United Kingdom', 'UK': 'United Kingdom',
'US Virgin Islands': 'United States Virgin Islands', 'US Virgin Islands': 'United States Virgin Islands',
'USA': 'United States' 'USA': 'United States',
'Western Sahara': 'Sahrawi'
}; };
return function(geoname) { return function(geoname) {
var countryCode = '', var countryCode = '',

View file

@ -1435,8 +1435,28 @@ requires
return that; return that;
}; };
/** /*
============================================================================
Calendars
============================================================================
*/ */
Ox.Calendar = function(options, self) {
var self = self || {},
that = new Ox.Element('div', self)
.defaults({
dates: [],
height: 256,
width: 256
})
.options(options || {});
return that;
};
Ox.Dialog = function(options, self) { Ox.Dialog = function(options, self) {
// fixme: dialog should be derived from a generic draggable // fixme: dialog should be derived from a generic draggable
@ -3314,7 +3334,6 @@ requires
*/ */
function blur() { function blur() {
Ox.print('blur!!!!!')
that.loseFocus(); that.loseFocus();
//that.removeClass('OxFocus'); //that.removeClass('OxFocus');
self.options.value = self.$input.val(); self.options.value = self.$input.val();
@ -8722,6 +8741,7 @@ requires
var self = self || {}, var self = self || {},
that = new Ox.Element('div', self) that = new Ox.Element('div', self)
.defaults({ .defaults({
data: null,
items: [], items: [],
max: -1, max: -1,
min: 0, min: 0,
@ -8730,6 +8750,13 @@ requires
}) })
.options(options || {}); .options(options || {});
if (self.options.data) {
self.options.items = [parseData(
self.options.data.key,
self.options.data.value
)];
}
that.$element = new Ox.List({ that.$element = new Ox.List({
construct: constructItem, construct: constructItem,
itemHeight: 16, itemHeight: 16,
@ -8818,6 +8845,22 @@ requires
return ret; return ret;
} }
function parseData(key, value) {
var ret = {
id: key,
title: key.split('.').pop()
};
if (Ox.isArray(value) || Ox.isObject(value)) {
ret.items = []
Ox.forEach(value, function(v, k) {
ret.items.push(parseData(key + '.' + k, v));
});
} else {
ret.title += ': ' + (Ox.isFunction(value) ? 'function' : value)
}
return ret;
}
function parseItems(items, level) { function parseItems(items, level) {
var items = items || self.options.items, var items = items || self.options.items,
level = level || 0, level = level || 0,
@ -8940,6 +8983,15 @@ requires
visible: true, visible: true,
width: 48 width: 48
}, },
{
align: 'right',
format: {type: 'area', args: [0]},
id: 'size',
operator: '-',
title: 'Size',
visible: true,
width: 128
},
{ {
align: 'right', align: 'right',
format: toFixed, format: toFixed,
@ -8964,7 +9016,7 @@ requires
id: 'south', id: 'south',
operator: '+', operator: '+',
title: 'South', title: 'South',
visible: true, visible: false,
width: 96 width: 96
}, },
{ {
@ -8972,7 +9024,7 @@ requires
id: 'west', id: 'west',
operator: '+', operator: '+',
title: 'West', title: 'West',
visible: true, visible: false,
width: 96 width: 96
}, },
{ {
@ -8981,7 +9033,7 @@ requires
id: 'north', id: 'north',
operator: '+', operator: '+',
title: 'North', title: 'North',
visible: true, visible: false,
width: 96 width: 96
}, },
{ {
@ -8990,18 +9042,9 @@ requires
id: 'east', id: 'east',
operator: '+', operator: '+',
title: 'East', title: 'East',
visible: true, visible: false,
width: 96 width: 96
}, },
{
align: 'right',
format: {type: 'area', args: [0]},
id: 'size',
operator: '-',
title: 'Size',
visible: true,
width: 128
},
{ {
id: 'user', id: 'user',
operator: '+', operator: '+',
@ -9012,7 +9055,7 @@ requires
{ {
format: 'date', format: 'date',
id: 'created', id: 'created',
operator: '+', operator: '-',
title: 'Date Created', title: 'Date Created',
visible: false, visible: false,
width: 96, width: 96,
@ -9020,10 +9063,18 @@ requires
{ {
format: 'date', format: 'date',
id: 'modified', id: 'modified',
operator: '+', operator: '-',
title: 'Date Modified', title: 'Date Modified',
visible: false, visible: false,
width: 96, width: 96,
},
{
align: 'right',
id: 'matches',
operator: '-',
title: 'Matches',
visible: false,
width: 96,
} }
]; ];
@ -9064,9 +9115,7 @@ requires
] ]
}) })
.bindEvent({ .bindEvent({
'delete': function(event, data) { 'delete': removeItem,
that.triggerEvent('removeplace', {id: data.ids[0]});
},
init: initList, init: initList,
load: function() { load: function() {
that.triggerEvent('loadlist'); that.triggerEvent('loadlist');
@ -9174,6 +9223,12 @@ requires
self.$map.zoomToPlace(data.ids[0]); self.$map.zoomToPlace(data.ids[0]);
} }
function removeItem(event, data) {
var id = data.ids[0];
that.triggerEvent('removeplace', {id: id});
self.$map.removePlace(id);
}
function selectItem(event, data) { function selectItem(event, data) {
Ox.print('selectItem', data.ids[0]) Ox.print('selectItem', data.ids[0])
self.$map.options({selected: data.ids.length ? data.ids[0] : ''}); self.$map.options({selected: data.ids.length ? data.ids[0] : ''});
@ -9488,6 +9543,7 @@ requires
}, function(results, status) { }, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) { if (status == google.maps.GeocoderStatus.OK) {
if (status != google.maps.GeocoderStatus.ZERO_RESULTS) { if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {
Ox.print('GEOCODER RESULT', results[0])
callback(Place(results[0])); callback(Place(results[0]));
} else { } else {
callback(null); callback(null);
@ -9528,8 +9584,6 @@ requires
self.places = []; self.places = [];
self.options.places.forEach(function(place, i) { self.options.places.forEach(function(place, i) {
self.places[i] = Place(Ox.clone(place)); self.places[i] = Place(Ox.clone(place));
Ox.print('BOUNDS', self.places.map(function(v) {return v.bounds}))
Ox.print('self.places', i, self.places[i])
self.bounds = i == 0 ? self.bounds = i == 0 ?
Ox.clone(self.places[i].bounds) : Ox.clone(self.places[i].bounds) :
self.bounds.union(self.places[i].bounds); self.bounds.union(self.places[i].bounds);
@ -9583,9 +9637,12 @@ requires
self.options.selected = id; self.options.selected = id;
self.selected = id; self.selected = id;
setStatus(); setStatus();
that.triggerEvent('select', place);
/*
that.triggerEvent('select', { that.triggerEvent('select', {
id: self.options.selected id: self.options.selected
}); });
*/
}; };
function setStatus() { function setStatus() {
@ -9858,6 +9915,10 @@ requires
} }
}; };
that.removePlace = function(id) {
};
that.findPlace = function(name, callback) { that.findPlace = function(name, callback) {
getPlaceByName(name, function(place) { getPlaceByName(name, function(place) {
if (place) { if (place) {