1
0
Fork 0
forked from 0x2620/oxjs

merging changes

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

View file

@ -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) {