From 6530780bf000dc2f34484d5d2dd02d42356ce6ea Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Sat, 26 Feb 2011 04:22:49 +0000 Subject: [PATCH] merging changes --- build/js/ox.map.js | 25 +++++++++-- build/js/ox.ui.js | 105 +++++++++++++++++++++++++++++++++++---------- 2 files changed, 104 insertions(+), 26 deletions(-) diff --git a/build/js/ox.map.js b/build/js/ox.map.js index c8d90fbb..a70d3a54 100644 --- a/build/js/ox.map.js +++ b/build/js/ox.map.js @@ -1,8 +1,8 @@ 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) // 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) // 34 former countries (http://en.wikipedia.org/wiki/ISO_3166-3, http://www.imdb.com/country/) // 2 other countries (EU, UK) @@ -214,8 +214,10 @@ Ox.COUNTRIES = [ {code: 'TW', continent: 'Asia', name: 'Taiwan', region: 'Eastern Asia', 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: '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: '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: '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'}, @@ -248,7 +250,7 @@ Ox.COUNTRIES = [ {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: '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: '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'}, @@ -319,11 +321,26 @@ Ox.COUNTRY_CODES = Ox.map(Ox.COUNTRIES, function(country) { Ox.getCountryCode = (function() { 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 Gambia': 'Gambia', 'The Netherlands': 'Netherlands', + 'Trinidad & Tobago': 'Trinidad and Tobago', 'UK': 'United Kingdom', 'US Virgin Islands': 'United States Virgin Islands', - 'USA': 'United States' + 'USA': 'United States', + 'Western Sahara': 'Sahrawi' }; return function(geoname) { var countryCode = '', diff --git a/build/js/ox.ui.js b/build/js/ox.ui.js index 76171881..c9099e68 100644 --- a/build/js/ox.ui.js +++ b/build/js/ox.ui.js @@ -1435,8 +1435,28 @@ requires 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) { // fixme: dialog should be derived from a generic draggable @@ -3314,7 +3334,6 @@ requires */ function blur() { - Ox.print('blur!!!!!') that.loseFocus(); //that.removeClass('OxFocus'); self.options.value = self.$input.val(); @@ -8722,6 +8741,7 @@ requires var self = self || {}, that = new Ox.Element('div', self) .defaults({ + data: null, items: [], max: -1, min: 0, @@ -8730,6 +8750,13 @@ requires }) .options(options || {}); + if (self.options.data) { + self.options.items = [parseData( + self.options.data.key, + self.options.data.value + )]; + } + that.$element = new Ox.List({ construct: constructItem, itemHeight: 16, @@ -8818,6 +8845,22 @@ requires 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) { var items = items || self.options.items, level = level || 0, @@ -8940,6 +8983,15 @@ requires visible: true, width: 48 }, + { + align: 'right', + format: {type: 'area', args: [0]}, + id: 'size', + operator: '-', + title: 'Size', + visible: true, + width: 128 + }, { align: 'right', format: toFixed, @@ -8964,7 +9016,7 @@ requires id: 'south', operator: '+', title: 'South', - visible: true, + visible: false, width: 96 }, { @@ -8972,7 +9024,7 @@ requires id: 'west', operator: '+', title: 'West', - visible: true, + visible: false, width: 96 }, { @@ -8981,7 +9033,7 @@ requires id: 'north', operator: '+', title: 'North', - visible: true, + visible: false, width: 96 }, { @@ -8990,18 +9042,9 @@ requires id: 'east', operator: '+', title: 'East', - visible: true, + visible: false, width: 96 }, - { - align: 'right', - format: {type: 'area', args: [0]}, - id: 'size', - operator: '-', - title: 'Size', - visible: true, - width: 128 - }, { id: 'user', operator: '+', @@ -9012,7 +9055,7 @@ requires { format: 'date', id: 'created', - operator: '+', + operator: '-', title: 'Date Created', visible: false, width: 96, @@ -9020,10 +9063,18 @@ requires { format: 'date', id: 'modified', - operator: '+', + operator: '-', title: 'Date Modified', visible: false, width: 96, + }, + { + align: 'right', + id: 'matches', + operator: '-', + title: 'Matches', + visible: false, + width: 96, } ]; @@ -9064,9 +9115,7 @@ requires ] }) .bindEvent({ - 'delete': function(event, data) { - that.triggerEvent('removeplace', {id: data.ids[0]}); - }, + 'delete': removeItem, init: initList, load: function() { that.triggerEvent('loadlist'); @@ -9174,6 +9223,12 @@ requires 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) { Ox.print('selectItem', data.ids[0]) self.$map.options({selected: data.ids.length ? data.ids[0] : ''}); @@ -9488,6 +9543,7 @@ requires }, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { if (status != google.maps.GeocoderStatus.ZERO_RESULTS) { + Ox.print('GEOCODER RESULT', results[0]) callback(Place(results[0])); } else { callback(null); @@ -9528,8 +9584,6 @@ requires self.places = []; self.options.places.forEach(function(place, i) { 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 ? Ox.clone(self.places[i].bounds) : self.bounds.union(self.places[i].bounds); @@ -9583,9 +9637,12 @@ requires self.options.selected = id; self.selected = id; setStatus(); + that.triggerEvent('select', place); + /* that.triggerEvent('select', { id: self.options.selected }); + */ }; function setStatus() { @@ -9858,6 +9915,10 @@ requires } }; + that.removePlace = function(id) { + + }; + that.findPlace = function(name, callback) { getPlaceByName(name, function(place) { if (place) {