2012-01-12 10:39:05 +00:00
|
|
|
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
/*@
|
|
|
|
Ox.AnnotationFolder <f:Ox.Element> AnnotationFolder Object
|
|
|
|
() -> <f> AnnotationFolder Object
|
|
|
|
(options) -> <f> AnnotationFolder Object
|
|
|
|
(options, self) -> <f> AnnotationFolder Object
|
|
|
|
options <o> Options object
|
|
|
|
editable <b|false> If true, annotations can be added
|
|
|
|
id <s> id
|
|
|
|
items <a|[]> items
|
|
|
|
title <s> title
|
|
|
|
type <s|'text'> panel type
|
|
|
|
width <n|0>
|
|
|
|
self <o> shared private variable
|
|
|
|
@*/
|
|
|
|
|
|
|
|
Ox.AnnotationFolder = function(options, self) {
|
|
|
|
|
|
|
|
self = self || {};
|
|
|
|
var that = Ox.Element({}, self)
|
|
|
|
.defaults({
|
|
|
|
collapsed: false,
|
|
|
|
editable: false,
|
|
|
|
id: '',
|
|
|
|
'in': 0,
|
|
|
|
item: '',
|
|
|
|
items: [],
|
|
|
|
out: 0,
|
|
|
|
position: 0,
|
|
|
|
range: 'all',
|
|
|
|
selected: '',
|
2012-01-13 16:25:47 +00:00
|
|
|
showWidget: false,
|
2012-01-12 10:39:05 +00:00
|
|
|
sort: 'position',
|
|
|
|
title: '',
|
|
|
|
type: 'text',
|
|
|
|
users: 'all',
|
2012-01-13 16:25:47 +00:00
|
|
|
widgetSize: 256,
|
2012-01-12 10:39:05 +00:00
|
|
|
width: 0
|
|
|
|
})
|
|
|
|
.options(options || {});
|
|
|
|
|
|
|
|
self.sort = getSort();
|
2012-01-13 16:25:47 +00:00
|
|
|
self.widget = self.options.type == 'event' ? 'Calendar'
|
|
|
|
: self.options.type == 'place' ? 'Map' : '';
|
2012-01-12 10:39:05 +00:00
|
|
|
|
2012-01-14 11:39:55 +00:00
|
|
|
if (self.widget) {
|
|
|
|
self.$defineButton = Ox.Button({
|
|
|
|
disabled: !self.options.selected,
|
|
|
|
id: 'define',
|
|
|
|
style: 'symbol',
|
|
|
|
title: 'click',
|
|
|
|
tooltip: 'Define ' + Ox.toTitleCase(self.options.type),
|
|
|
|
type: 'image'
|
|
|
|
})
|
|
|
|
.bindEvent({
|
|
|
|
click: function() {
|
2012-01-15 15:05:17 +00:00
|
|
|
var item = Ox.getObjectById(self.options.items, self.options.selected);
|
|
|
|
that.triggerEvent('define', item.place ? {
|
|
|
|
id: item.place.id
|
|
|
|
} : {
|
|
|
|
name: item.value
|
|
|
|
});
|
2012-01-14 11:39:55 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
self.$addButton = Ox.Button({
|
|
|
|
disabled: !self.options.editable,
|
|
|
|
id: 'add',
|
|
|
|
style: 'symbol',
|
|
|
|
title: 'add',
|
|
|
|
tooltip: 'Add ' + self.options.item,
|
|
|
|
type: 'image'
|
|
|
|
}).bindEvent({
|
|
|
|
click: function() {
|
|
|
|
that.triggerEvent('add', {value: ''});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2012-01-12 10:39:05 +00:00
|
|
|
that.setElement(
|
|
|
|
Ox.CollapsePanel({
|
|
|
|
collapsed: self.options.collapsed,
|
2012-01-13 16:25:47 +00:00
|
|
|
extras: Ox.merge(
|
2012-01-14 11:39:55 +00:00
|
|
|
self.widget ? [self.$defineButton] : [],
|
|
|
|
[self.$addButton]
|
2012-01-13 16:25:47 +00:00
|
|
|
),
|
2012-01-12 10:39:05 +00:00
|
|
|
size: 16,
|
|
|
|
title: self.options.title
|
|
|
|
})
|
|
|
|
.addClass('OxAnnotationFolder')
|
|
|
|
.bindEvent({
|
2012-01-14 11:39:55 +00:00
|
|
|
toggle: toggleLayer
|
2012-01-12 10:39:05 +00:00
|
|
|
})
|
|
|
|
);
|
|
|
|
that.$content = that.$element.$content;
|
|
|
|
|
2012-01-13 16:25:47 +00:00
|
|
|
if (self.widget) {
|
|
|
|
self.widgetSize = self.options.showWidget * self.options.widgetSize;
|
|
|
|
self.$outer = Ox.Element()
|
2012-01-12 19:04:32 +00:00
|
|
|
.css({
|
2012-01-13 16:25:47 +00:00
|
|
|
display: 'table-cell',
|
2012-01-14 11:39:55 +00:00
|
|
|
width: self.options.width + 'px'
|
2012-01-13 16:25:47 +00:00
|
|
|
})
|
|
|
|
.appendTo(that.$content);
|
|
|
|
self.$inner = Ox.Element()
|
2012-01-14 11:39:55 +00:00
|
|
|
.css({
|
|
|
|
height: self.widgetSize + 'px',
|
|
|
|
overflow: 'hidden'
|
2012-01-12 19:04:32 +00:00
|
|
|
})
|
2012-01-14 11:39:55 +00:00
|
|
|
.appendTo(self.$outer);
|
|
|
|
if (options.type == 'event') {
|
|
|
|
self.$widget = self.$calendar = Ox.Calendar({
|
|
|
|
events: getEvents(),
|
|
|
|
height: self.widgetSize,
|
|
|
|
showZoombar: true,
|
|
|
|
width: self.options.width
|
|
|
|
})
|
|
|
|
.css({
|
|
|
|
width: self.options.width + 'px',
|
|
|
|
height: self.widgetSize + 'px'
|
|
|
|
})
|
|
|
|
.bindEvent({
|
|
|
|
select: function(data) {
|
|
|
|
selectAnnotation({id: data.annotationId});
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.appendTo(self.$inner);
|
|
|
|
} else { // place
|
|
|
|
self.$widget = self.$map = Ox.Map({
|
|
|
|
places: getPlaces(),
|
2012-01-15 15:05:17 +00:00
|
|
|
showTypes: true,
|
2012-01-14 11:39:55 +00:00
|
|
|
// FIXME: should be showZoombar
|
|
|
|
zoombar: true
|
|
|
|
// showLabels: true
|
|
|
|
})
|
|
|
|
.css({
|
|
|
|
width: self.options.width + 'px',
|
|
|
|
height: self.widgetSize + 'px'
|
|
|
|
})
|
|
|
|
.bindEvent({
|
|
|
|
// FIXME: should be select, not selectplace
|
|
|
|
selectplace: function(data) {
|
|
|
|
self.$annotations.options({selected: data.annotationId});
|
|
|
|
// selectAnnotation({id: data.annotationId});
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.appendTo(self.$inner);
|
|
|
|
}
|
2012-01-13 16:25:47 +00:00
|
|
|
self.$resizebar = Ox.Element({
|
|
|
|
tooltip: 'Drag to resize or click to toggle map' // fixme: update as w/ splitpanels
|
|
|
|
})
|
|
|
|
.addClass('OxResizebar OxHorizontal')
|
|
|
|
.css({
|
|
|
|
position: 'absolute',
|
2012-01-14 11:39:55 +00:00
|
|
|
top: self.widgetSize + 'px',
|
2012-01-13 16:25:47 +00:00
|
|
|
cursor: 'ns-resize'
|
2012-01-12 10:39:05 +00:00
|
|
|
})
|
2012-01-13 16:25:47 +00:00
|
|
|
.append($('<div>').addClass('OxSpace'))
|
|
|
|
.append($('<div>').addClass('OxLine'))
|
|
|
|
.append($('<div>').addClass('OxSpace'))
|
2012-01-12 10:39:05 +00:00
|
|
|
.bindEvent({
|
2012-01-13 16:25:47 +00:00
|
|
|
anyclick: toggleWidget,
|
|
|
|
dragstart: dragstart,
|
|
|
|
drag: drag,
|
|
|
|
dragend: dragend
|
|
|
|
})
|
|
|
|
.appendTo(self.$outer);
|
2012-01-12 10:39:05 +00:00
|
|
|
}
|
2012-01-13 16:25:47 +00:00
|
|
|
|
|
|
|
self.$annotations = Ox.ArrayEditable({
|
|
|
|
editable: self.options.editable,
|
|
|
|
items: getAnnotations(),
|
2012-01-15 15:05:17 +00:00
|
|
|
placeholder: 'No ' + self.options.title,
|
2012-01-13 16:25:47 +00:00
|
|
|
selected: self.options.selected,
|
2012-01-15 15:05:17 +00:00
|
|
|
separator: ';',
|
2012-01-13 16:25:47 +00:00
|
|
|
sort: self.sort,
|
|
|
|
submitOnBlur: false,
|
2012-01-16 11:22:34 +00:00
|
|
|
width: self.options.width,
|
2012-01-13 16:25:47 +00:00
|
|
|
type: self.options.type == 'text' ? 'textarea' : 'input'
|
|
|
|
})
|
|
|
|
//.css({marginTop: '256px'})
|
|
|
|
.bindEvent({
|
|
|
|
add: function(data) {
|
2012-01-15 15:05:17 +00:00
|
|
|
if (self.editing) {
|
|
|
|
// FIXME: changed value will not be saved!
|
|
|
|
}
|
|
|
|
that.triggerEvent('add', {value: data.value || ''});
|
2012-01-13 16:25:47 +00:00
|
|
|
},
|
|
|
|
blur: function() {
|
2012-01-15 15:05:17 +00:00
|
|
|
// the video editor will, if it has not received focus,
|
|
|
|
// call blurItem
|
2012-01-13 16:25:47 +00:00
|
|
|
that.triggerEvent('blur');
|
|
|
|
},
|
2012-01-15 15:05:17 +00:00
|
|
|
change: changeAnnotation,
|
2012-01-13 16:25:47 +00:00
|
|
|
'delete': function(data) {
|
2012-01-15 15:05:17 +00:00
|
|
|
self.editing = false;
|
2012-01-13 16:25:47 +00:00
|
|
|
that.triggerEvent('remove', {id: data.id});
|
|
|
|
},
|
|
|
|
edit: function() {
|
|
|
|
self.editing = true;
|
|
|
|
that.triggerEvent('edit');
|
|
|
|
},
|
|
|
|
select: selectAnnotation,
|
|
|
|
submit: submitAnnotation,
|
|
|
|
key_space: function() {
|
|
|
|
that.triggerEvent('paused');
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.appendTo(
|
|
|
|
['event', 'place'].indexOf(self.options.type) > -1
|
|
|
|
? self.$outer : that.$content
|
|
|
|
);
|
|
|
|
|
|
|
|
Ox.print('SAH', self.$annotations.height())
|
2012-01-12 10:39:05 +00:00
|
|
|
|
|
|
|
self.options.selected && setTimeout(function() {
|
|
|
|
selectAnnotation({id: self.options.selected});
|
|
|
|
}, 0);
|
|
|
|
|
2012-01-14 11:39:55 +00:00
|
|
|
showWarnings();
|
2012-01-13 16:25:47 +00:00
|
|
|
|
2012-01-15 15:05:17 +00:00
|
|
|
function changeAnnotation(data) {
|
|
|
|
var item = Ox.getObjectById(self.options.items, data.id);
|
|
|
|
item.value = data.value;
|
|
|
|
that.triggerEvent('change', item);
|
|
|
|
}
|
|
|
|
|
2012-01-13 16:25:47 +00:00
|
|
|
function dragstart() {
|
2012-01-14 11:39:55 +00:00
|
|
|
if (self.options.showWidget) {
|
|
|
|
self.drag = {
|
|
|
|
startSize: self.options.widgetSize
|
|
|
|
};
|
|
|
|
}
|
2012-01-13 16:25:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function drag(e) {
|
2012-01-14 11:39:55 +00:00
|
|
|
if (self.options.showWidget) {
|
|
|
|
self.options.widgetSize = Ox.limit(
|
|
|
|
self.drag.startSize + e.clientDY, 128, 384
|
|
|
|
);
|
|
|
|
if (self.options.widgetSize >= 248 && self.options.widgetSize <= 264) {
|
|
|
|
self.options.widgetSize = 256;
|
|
|
|
}
|
|
|
|
self.$resizebar.css({top: self.options.widgetSize + 'px'});
|
|
|
|
self.$inner.css({height: self.options.widgetSize + 'px'});
|
|
|
|
self.$widget.css({
|
|
|
|
height: self.options.widgetSize + 'px'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
//self.options.type == 'place' && self.$map.resizeMap();
|
2012-01-13 16:25:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function dragend(e) {
|
2012-01-14 11:39:55 +00:00
|
|
|
if (self.options.showWidget) {
|
|
|
|
that.triggerEvent('resizewidget', {size: self.options.widgetSize});
|
|
|
|
}
|
2012-01-13 16:25:47 +00:00
|
|
|
}
|
|
|
|
|
2012-01-12 10:39:05 +00:00
|
|
|
function getAnnotations() {
|
|
|
|
return self.options.items.filter(function(item) {
|
|
|
|
return self.editing && item.id == self.options.selected || (
|
|
|
|
(
|
|
|
|
self.options.range == 'all' || (
|
|
|
|
self.options.range == 'selection'
|
|
|
|
&& item['in'] < self.options.out
|
|
|
|
&& item.out > self.options['in']
|
|
|
|
) || (
|
|
|
|
self.options.range == 'position'
|
|
|
|
&& item['in'] <= self.options.position
|
|
|
|
&& item.out >= self.options.position
|
|
|
|
)
|
|
|
|
) && (
|
|
|
|
self.options.users == 'all'
|
|
|
|
|| self.options.users.indexOf(item.user) > -1
|
|
|
|
)
|
|
|
|
);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2012-01-13 16:25:47 +00:00
|
|
|
function getEvents() {
|
|
|
|
var events = [];
|
|
|
|
getAnnotations().forEach(function(item) {
|
|
|
|
if (item.event && Ox.getIndexById(events, item.event.id) == -1) {
|
|
|
|
events.push(Ox.extend({
|
|
|
|
annotationId: item.id
|
|
|
|
}, item.event));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
if (!events.length) {
|
|
|
|
events = [{id: 'FOO', name: '20th Century', type: 'date', start: '1900', end: '2000'}]
|
|
|
|
}
|
|
|
|
return events;
|
|
|
|
}
|
|
|
|
|
2012-01-12 19:04:32 +00:00
|
|
|
function getPlaces() {
|
|
|
|
var places = [];
|
|
|
|
getAnnotations().forEach(function(item) {
|
|
|
|
if (item.place && Ox.getIndexById(places, item.place.id) == -1) {
|
|
|
|
places.push(Ox.extend({
|
|
|
|
annotationId: item.id
|
|
|
|
}, item.place));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return places;
|
|
|
|
}
|
|
|
|
|
2012-01-12 10:39:05 +00:00
|
|
|
function getSort() {
|
|
|
|
return ({
|
|
|
|
duration: ['-duration', '+in', '+value'],
|
|
|
|
position: ['+in', '-duration', '+value'],
|
|
|
|
text: ['+value', '+in', '-duration']
|
|
|
|
})[self.options.sort];
|
|
|
|
}
|
|
|
|
|
|
|
|
function selectAnnotation(data) {
|
|
|
|
var item = Ox.getObjectById(self.options.items, data.id);
|
|
|
|
self.options.selected = item ? data.id : '';
|
2012-01-15 15:05:17 +00:00
|
|
|
self.widget && self.$defineButton.options({disabled: !self.options.selected});
|
2012-01-13 16:25:47 +00:00
|
|
|
///*
|
|
|
|
if (self.options.type == 'place') {
|
|
|
|
self.$map.options({
|
|
|
|
selected: item && item.place ? item.place.id : null
|
|
|
|
})
|
|
|
|
.panToPlace();
|
|
|
|
}
|
|
|
|
//*/
|
2012-01-12 10:39:05 +00:00
|
|
|
that.triggerEvent('select', Ox.extend(data, item ? {
|
|
|
|
'in': item['in'],
|
|
|
|
out: item.out,
|
|
|
|
layer: self.options.id
|
|
|
|
} : {}));
|
|
|
|
}
|
|
|
|
|
2012-01-14 11:39:55 +00:00
|
|
|
function showWarnings() {
|
2012-01-15 15:05:17 +00:00
|
|
|
if (self.widget && self.options.items.length) {
|
2012-01-14 11:39:55 +00:00
|
|
|
self.$annotations.find('.OxValue').each(function() {
|
|
|
|
var $element = $(this);
|
2012-01-15 15:05:17 +00:00
|
|
|
try { // FIXME: bad data, remove later!!
|
|
|
|
if (!Ox.getObject(
|
|
|
|
self.options.items, 'value', $element.html()
|
|
|
|
)[self.options.type]) {
|
|
|
|
$element.css({color: 'rgb(192, 64, 64)'});
|
|
|
|
}
|
|
|
|
} catch(e) {}
|
2012-01-14 11:39:55 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-01-12 10:39:05 +00:00
|
|
|
function submitAnnotation(data) {
|
|
|
|
var item = Ox.getObjectById(self.options.items, data.id);
|
|
|
|
item.value = data.value;
|
|
|
|
self.editing = false;
|
|
|
|
//self.$annotations.options({items: self.options.items});
|
|
|
|
self.options.sort == 'text' && self.$annotations.reloadItems();
|
|
|
|
that.triggerEvent('submit', item);
|
|
|
|
}
|
|
|
|
|
2012-01-14 11:39:55 +00:00
|
|
|
function toggleLayer() {
|
2012-01-12 10:39:05 +00:00
|
|
|
self.options.collapsed = !self.options.collapsed;
|
2012-01-14 11:39:55 +00:00
|
|
|
that.triggerEvent('togglelayer', {collapsed: self.options.collapsed});
|
2012-01-12 10:39:05 +00:00
|
|
|
}
|
|
|
|
|
2012-01-13 16:25:47 +00:00
|
|
|
function toggleWidget() {
|
|
|
|
self.options.showWidget = !self.options.showWidget;
|
|
|
|
self.widgetSize = self.options.showWidget * self.options.widgetSize;
|
|
|
|
self.$resizebar.animate({top: self.widgetSize + 'px'}, 250);
|
|
|
|
self.$inner.animate({height: self.widgetSize + 'px'}, 250);
|
2012-01-14 11:39:55 +00:00
|
|
|
self.$widget.animate({height: self.widgetSize + 'px'}, 250, function() {
|
|
|
|
self.$widget.options({height: self.widgetSize});
|
2012-01-13 16:25:47 +00:00
|
|
|
});
|
2012-01-14 11:39:55 +00:00
|
|
|
that.triggerEvent('togglewidget', {collapsed: !self.options.showWidget});
|
2012-01-13 16:25:47 +00:00
|
|
|
}
|
|
|
|
|
2012-01-15 15:05:17 +00:00
|
|
|
function updateAnnotations() {
|
|
|
|
self.$annotations.options({items: getAnnotations()});
|
|
|
|
showWarnings();
|
|
|
|
}
|
|
|
|
|
|
|
|
function updateWidget() {
|
|
|
|
self.options.type == 'event'
|
|
|
|
? self.$calendar.options({events: getEvents()})
|
|
|
|
: self.$map.options({places: getPlaces()});
|
|
|
|
}
|
|
|
|
|
2012-01-12 10:39:05 +00:00
|
|
|
self.setOption = function(key, value) {
|
|
|
|
if (['in', 'out'].indexOf(key) > -1 && self.editing) {
|
|
|
|
var index = Ox.getIndexById(self.options.items, self.options.selected);
|
|
|
|
self.options.items[index][key] = value;
|
|
|
|
self.options.items[index].duration = self.options.out - self.options['in'];
|
|
|
|
}
|
|
|
|
if (key == 'in') {
|
|
|
|
//fixme: array editable should support item updates while editing
|
2012-01-15 15:05:17 +00:00
|
|
|
if (self.options.range == 'selection') {
|
|
|
|
self.widget && updateWidget();
|
|
|
|
updateAnnotations();
|
2012-01-12 19:04:32 +00:00
|
|
|
}
|
2012-01-12 10:39:05 +00:00
|
|
|
} else if (key == 'out') {
|
2012-01-15 15:05:17 +00:00
|
|
|
if (self.options.range == 'selection') {
|
|
|
|
self.widget && updateWidget();
|
|
|
|
updateAnnotations();
|
2012-01-12 19:04:32 +00:00
|
|
|
}
|
2012-01-12 10:39:05 +00:00
|
|
|
} else if (key == 'position') {
|
2012-01-15 15:05:17 +00:00
|
|
|
if (self.options.range == 'position') {
|
|
|
|
self.widget && updateWidget();
|
|
|
|
updateAnnotations();
|
2012-01-12 19:04:32 +00:00
|
|
|
}
|
2012-01-12 10:39:05 +00:00
|
|
|
} else if (key == 'range') {
|
|
|
|
self.$annotations.options({items: getAnnotations()});
|
|
|
|
} else if (key == 'selected') {
|
2012-01-12 19:04:32 +00:00
|
|
|
if (value === '') {
|
|
|
|
self.editing = false;
|
|
|
|
}
|
2012-01-12 10:39:05 +00:00
|
|
|
self.$annotations.options({selected: value});
|
|
|
|
} else if (key == 'sort') {
|
|
|
|
self.sort = getSort();
|
|
|
|
self.$annotations.options({sort: self.sort});
|
2012-01-14 11:39:55 +00:00
|
|
|
showWarnings();
|
2012-01-12 10:39:05 +00:00
|
|
|
} else if (key == 'users') {
|
2012-01-15 15:05:17 +00:00
|
|
|
updateAnnotations();
|
2012-01-12 19:04:32 +00:00
|
|
|
} else if (key == 'width') {
|
2012-01-14 11:39:55 +00:00
|
|
|
Ox.print('RESIZE!!!!')
|
|
|
|
if (self.widget) {
|
|
|
|
self.$outer.options({width: self.options.width});
|
|
|
|
self.$inner.options({width: self.options.width});
|
|
|
|
self.$widget.options({width: self.options.width});
|
|
|
|
}
|
2012-01-12 19:04:32 +00:00
|
|
|
self.$annotations.options({
|
|
|
|
width: self.options.type == 'text' ? self.options.width + 8 : self.options.width
|
|
|
|
});
|
2012-01-12 10:39:05 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/*@
|
|
|
|
addItem <f> addItem
|
|
|
|
@*/
|
|
|
|
that.addItem = function(item) {
|
2012-01-15 15:05:17 +00:00
|
|
|
Ox.print('FOLDER ADD ITEM', item)
|
2012-01-12 10:39:05 +00:00
|
|
|
var pos = 0;
|
|
|
|
self.options.items.splice(pos, 0, item);
|
2012-01-15 15:05:17 +00:00
|
|
|
self.$annotations
|
|
|
|
.addItem(pos, item)
|
|
|
|
.options({selected: item.id})
|
|
|
|
.editItem();
|
|
|
|
//selectAnnotation(item);
|
|
|
|
//that.triggerEvent('edit');
|
|
|
|
return that;
|
2012-01-12 10:39:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
that.blurItem = function() {
|
|
|
|
self.$annotations.blurItem();
|
2012-01-15 15:05:17 +00:00
|
|
|
return that;
|
2012-01-12 10:39:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
that.editItem = function() {
|
|
|
|
self.$annotations.editItem();
|
2012-01-15 15:05:17 +00:00
|
|
|
return that;
|
2012-01-12 10:39:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*@
|
|
|
|
removeItems <f> removeItems
|
|
|
|
@*/
|
|
|
|
/*
|
|
|
|
that.removeItem = function(id) {
|
|
|
|
var pos = Ox.getIndexById(self.options.items, id);
|
|
|
|
self.options.items.splice(pos, 1);
|
|
|
|
self.$annotations.removeItems && self.$annotations.removeItems([id]);
|
|
|
|
};
|
|
|
|
*/
|
|
|
|
|
2012-01-15 15:05:17 +00:00
|
|
|
that.updateItem = function(item) {
|
|
|
|
var index = Ox.getIndexById(self.options.items, item.id);
|
|
|
|
self.options.items[index] = item;
|
|
|
|
self.widget && updateWidget();
|
|
|
|
updateAnnotations();
|
|
|
|
return that;
|
|
|
|
}
|
|
|
|
|
2012-01-12 10:39:05 +00:00
|
|
|
return that;
|
|
|
|
|
|
|
|
};
|