2011-07-29 18:37:11 +00:00
|
|
|
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
2011-05-25 19:42:45 +00:00
|
|
|
pandora.ui.item = function() {
|
2011-06-19 17:49:25 +00:00
|
|
|
var that = Ox.Element();
|
2011-08-06 13:34:56 +00:00
|
|
|
pandora.api.get({
|
|
|
|
id: pandora.user.ui.item,
|
|
|
|
keys: []
|
|
|
|
}, pandora.user.level == 'admin' && pandora.user.ui.itemView == 'info' ? 0 : -1, function(result) {
|
2011-05-26 07:34:52 +00:00
|
|
|
if (result.status.code != 200) {
|
2011-06-06 15:48:11 +00:00
|
|
|
pandora.$ui.contentPanel.replaceElement(1,
|
2011-05-26 07:34:52 +00:00
|
|
|
Ox.Element().html(
|
2011-06-06 15:48:11 +00:00
|
|
|
'The '+pandora.site.itemName.singular+' you are looking for does not exist.'));
|
2011-06-27 13:39:35 +00:00
|
|
|
} else if (!result.data.rendered &&
|
|
|
|
['clips', 'map',
|
|
|
|
'player', 'timeline'].indexOf(pandora.user.ui.itemView)>-1) {
|
|
|
|
pandora.$ui.contentPanel.replaceElement(1,
|
|
|
|
Ox.Element().css({margin: '16px'}).html(
|
|
|
|
'We are sorry, "' + result.data.title +
|
|
|
|
'" does not have a '+pandora.user.ui.itemView +
|
|
|
|
' view right now.'));
|
2011-06-06 15:48:11 +00:00
|
|
|
} else if (pandora.user.ui.itemView == 'calendar') {
|
|
|
|
pandora.$ui.contentPanel.replaceElement(1, Ox.Element().html('Calendar'));
|
|
|
|
} else if (pandora.user.ui.itemView == 'clips') {
|
2011-08-07 03:04:33 +00:00
|
|
|
var ratio = result.data.stream.aspectRatio;
|
|
|
|
Ox.print('RATIO', ratio)
|
2011-06-20 16:56:18 +00:00
|
|
|
pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.clips = Ox.IconList({
|
2011-08-07 03:04:33 +00:00
|
|
|
fixedRatio: ratio,
|
2011-06-16 20:00:10 +00:00
|
|
|
item: function(data, sort, size) {
|
|
|
|
size = size || 128;
|
2011-08-07 03:04:33 +00:00
|
|
|
var width = ratio > 1 ? size : Math.round(size * ratio),
|
2011-08-06 18:00:15 +00:00
|
|
|
height = ratio > 1 ? Math.round(size / ratio) : size,
|
2011-08-07 03:04:33 +00:00
|
|
|
url = '/' + pandora.user.ui.item + '/' + height + 'p' + data['in'] + '.jpg';
|
2011-06-16 20:00:10 +00:00
|
|
|
return {
|
|
|
|
height: height,
|
|
|
|
id: data['id'],
|
2011-08-06 18:00:15 +00:00
|
|
|
info: Ox.formatDuration(data['in'], 'short') + ' - ' + Ox.formatDuration(data['out'], 'short'),
|
2011-06-16 20:00:10 +00:00
|
|
|
title: data.value,
|
|
|
|
url: url,
|
|
|
|
width: width
|
|
|
|
};
|
|
|
|
},
|
|
|
|
items: function(data, callback) {
|
|
|
|
pandora.api.findAnnotations($.extend(data, {
|
|
|
|
itemQuery: {
|
|
|
|
conditions:[{
|
|
|
|
key: 'id',
|
|
|
|
value: pandora.user.ui.item,
|
|
|
|
operator: '='
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
}), callback);
|
|
|
|
},
|
|
|
|
keys: ['id', 'value', 'in', 'out'],
|
|
|
|
size: 128,
|
|
|
|
sort: pandora.user.ui.lists[pandora.user.ui.list].sort,
|
|
|
|
unique: 'id'
|
2011-06-20 16:56:18 +00:00
|
|
|
}).bindEvent({
|
|
|
|
open: function(event, data) {
|
|
|
|
var id = data.ids[0],
|
|
|
|
item = pandora.user.ui.item,
|
|
|
|
position = pandora.$ui.clips.value(id, 'in');
|
|
|
|
pandora.UI.set('videoPosition|' + item, position);
|
|
|
|
pandora.URL.set(item + '/timeline');
|
|
|
|
}
|
2011-06-16 20:00:10 +00:00
|
|
|
}));
|
2011-06-06 15:48:11 +00:00
|
|
|
} else if (pandora.user.ui.itemView == 'info') {
|
2011-05-26 07:34:52 +00:00
|
|
|
//Ox.print('result.data', result.data)
|
2011-08-05 18:26:27 +00:00
|
|
|
if (pandora.user.level == 'admin' && false) {
|
2011-05-25 19:42:45 +00:00
|
|
|
var $form,
|
2011-06-19 17:49:25 +00:00
|
|
|
$edit = Ox.Element()
|
|
|
|
.append($form = Ox.FormElementGroup({
|
2011-06-27 13:39:35 +00:00
|
|
|
elements: Ox.map(pandora.site.sortKeys, function(key) {
|
2011-06-19 17:49:25 +00:00
|
|
|
return Ox.Input({
|
2011-05-25 19:42:45 +00:00
|
|
|
id: key.id,
|
|
|
|
label: key.title,
|
|
|
|
labelWidth: 100,
|
2011-05-26 07:34:52 +00:00
|
|
|
value: result.data[key.id],
|
2011-05-25 19:42:45 +00:00
|
|
|
type: 'text',
|
|
|
|
width: 500
|
|
|
|
});
|
|
|
|
}),
|
|
|
|
separators: [
|
|
|
|
{title: '', width: 0}
|
|
|
|
]
|
|
|
|
}))
|
2011-06-19 17:49:25 +00:00
|
|
|
.append(Ox.Button({
|
2011-05-25 19:42:45 +00:00
|
|
|
title: 'Save',
|
|
|
|
type: 'text'
|
|
|
|
}).bindEvent({
|
|
|
|
click: function(event, data) {
|
|
|
|
var values = $form.value();
|
|
|
|
var changed = {};
|
2011-06-06 15:48:11 +00:00
|
|
|
Ox.map(pandora.site.itemKeys, function(key, i) {
|
2011-05-26 07:34:52 +00:00
|
|
|
if(values[i] && values[i] != ''+result.data[key.id]) {
|
|
|
|
if(Ox.isArray(key.type) && key.type[0] == 'string') {
|
2011-05-25 19:42:45 +00:00
|
|
|
changed[key.id] = values[i].split(', ');
|
2011-05-26 07:34:52 +00:00
|
|
|
} else {
|
2011-05-25 19:42:45 +00:00
|
|
|
changed[key.id] = values[i];
|
2011-05-26 07:34:52 +00:00
|
|
|
}
|
2011-05-25 19:42:45 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
if(changed) {
|
2011-06-06 15:48:11 +00:00
|
|
|
pandora.api.editItem(Ox.extend(changed, {id: pandora.user.ui.item}), function(result) {
|
2011-05-25 19:42:45 +00:00
|
|
|
//fixme just reload parts that need reloading
|
|
|
|
window.location.reload();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}));
|
2011-06-06 15:48:11 +00:00
|
|
|
pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.item = $edit);
|
2011-05-25 19:42:45 +00:00
|
|
|
} else {
|
2011-08-05 18:26:27 +00:00
|
|
|
pandora.$ui.contentPanel.replaceElement(1,
|
|
|
|
pandora.$ui.item = pandora.ui.infoView(result.data)
|
|
|
|
.bindEvent({
|
|
|
|
resize: function() {
|
|
|
|
pandora.$ui.item.resize();
|
|
|
|
}
|
|
|
|
})
|
|
|
|
);
|
|
|
|
/*
|
2011-05-25 19:42:45 +00:00
|
|
|
$.get('/static/html/itemInfo.html', {}, function(template) {
|
|
|
|
//Ox.print(template);
|
2011-06-07 04:09:31 +00:00
|
|
|
var posterRatio = result.data.poster.width / result.data.poster.height;
|
|
|
|
result.data.posterWidth = posterRatio > 1 ? 256 : Math.round(256 * posterRatio);
|
|
|
|
result.data.posterHeight = posterRatio < 1 ? 256 : Math.round(256 / posterRatio);
|
|
|
|
result.data.posterLeft = Math.floor((256 - result.data.posterWidth) / 2);
|
2011-06-06 15:48:11 +00:00
|
|
|
pandora.$ui.contentPanel.replaceElement(1,
|
2011-06-07 04:09:31 +00:00
|
|
|
pandora.$ui.item = Ox.Element().append($.tmpl(template, result.data))
|
2011-05-25 19:42:45 +00:00
|
|
|
);
|
|
|
|
});
|
2011-08-05 18:26:27 +00:00
|
|
|
*/
|
2011-05-25 19:42:45 +00:00
|
|
|
}
|
|
|
|
|
2011-06-06 15:48:11 +00:00
|
|
|
} else if (pandora.user.ui.itemView == 'map') {
|
2011-08-17 19:30:37 +00:00
|
|
|
var video = result.data.stream;
|
2011-06-19 17:49:25 +00:00
|
|
|
pandora.$ui.contentPanel.replaceElement(1, Ox.SplitPanel({
|
2011-06-19 11:09:50 +00:00
|
|
|
elements: [
|
|
|
|
{
|
|
|
|
element: pandora.$ui.map = Ox.Map({
|
|
|
|
height: window.innerHeight - pandora.user.ui.showGroups * pandora.user.ui.groupsSize - 61,
|
|
|
|
places: function(data, callback) {
|
|
|
|
var itemQuery = {conditions: [{
|
|
|
|
key: 'id',
|
|
|
|
value: pandora.user.ui.item,
|
|
|
|
operator: '='
|
|
|
|
}]},
|
|
|
|
query = {conditions:[]};
|
|
|
|
return pandora.api.findPlaces($.extend(data, {
|
|
|
|
itemQuery: itemQuery,
|
|
|
|
query: query
|
|
|
|
}), callback);
|
|
|
|
},
|
|
|
|
showTypes: true,
|
|
|
|
toolbar: true,
|
|
|
|
width: window.innerWidth - pandora.user.ui.showSidebar * pandora.user.ui.sidebarSize - 2 - 144 - Ox.UI.SCROLLBAR_SIZE
|
2011-06-20 15:02:53 +00:00
|
|
|
}).bindEvent({
|
|
|
|
selectplace: function(event, place) {
|
|
|
|
if(place) {
|
|
|
|
pandora.$ui.clips.options({
|
|
|
|
items: function(data, callback) {
|
|
|
|
return pandora.api.findAnnotations($.extend(data, {
|
|
|
|
query: {
|
|
|
|
conditions:[{key: 'place', value: place.id, operator:'='}]
|
|
|
|
},
|
|
|
|
itemQuery: {conditions: [{
|
|
|
|
key: 'id',
|
|
|
|
value: pandora.user.ui.item,
|
|
|
|
operator: '='
|
|
|
|
}]}
|
|
|
|
}), callback);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
pandora.$ui.clips.options({
|
|
|
|
items: []
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2011-06-19 11:09:50 +00:00
|
|
|
})
|
|
|
|
},
|
|
|
|
{
|
2011-06-20 15:02:53 +00:00
|
|
|
element: pandora.$ui.clips = Ox.IconList({
|
2011-08-17 19:30:37 +00:00
|
|
|
fixedRatio: video.aspectRatio,
|
2011-06-20 15:02:53 +00:00
|
|
|
item: function(data, sort, size) {
|
|
|
|
size = size || 128;
|
|
|
|
var ratio = data.aspectRatio,
|
|
|
|
width = size,
|
2011-08-17 19:30:37 +00:00
|
|
|
height = parseInt(size/ratio),
|
|
|
|
url = '/' + data.item + '/' + height + 'p' + data['in'] + '.jpg';
|
2011-06-20 15:02:53 +00:00
|
|
|
return {
|
|
|
|
height: height,
|
|
|
|
id: data['id'],
|
|
|
|
info: Ox.formatDuration(data['in'], 'short') +' - '+ Ox.formatDuration(data['out'], 'short'),
|
|
|
|
title: data.value,
|
|
|
|
url: url,
|
|
|
|
width: width
|
|
|
|
};
|
|
|
|
},
|
|
|
|
items: [],
|
|
|
|
keys: ['id', 'value', 'in', 'out', 'aspectRatio', 'item'],
|
|
|
|
size: 128,
|
|
|
|
sort: pandora.user.ui.lists[pandora.user.ui.list].sort,
|
|
|
|
unique: 'id'
|
2011-06-20 16:56:18 +00:00
|
|
|
}).bindEvent({
|
|
|
|
open: function(event, data) {
|
|
|
|
var id = data.ids[0],
|
|
|
|
item = pandora.user.ui.item,
|
|
|
|
position = pandora.$ui.clips.value(id, 'in');
|
|
|
|
pandora.UI.set('videoPosition|' + item, position);
|
|
|
|
pandora.URL.set(item + '/timeline');
|
|
|
|
}
|
2011-06-20 15:02:53 +00:00
|
|
|
}),
|
2011-06-19 11:09:50 +00:00
|
|
|
id: 'place',
|
|
|
|
size: 144 + Ox.UI.SCROLLBAR_SIZE
|
|
|
|
}
|
|
|
|
],
|
|
|
|
orientation: 'horizontal'
|
|
|
|
})
|
|
|
|
.bindEvent('resize', function() {
|
|
|
|
pandora.$ui.map.resizeMap();
|
|
|
|
}));
|
2011-06-06 15:48:11 +00:00
|
|
|
} else if (pandora.user.ui.itemView == 'player') {
|
2011-08-17 19:34:55 +00:00
|
|
|
// fixme: duplicated
|
|
|
|
var layers = [],
|
|
|
|
video = result.data.stream,
|
|
|
|
cuts = result.data.cuts || [],
|
|
|
|
format = $.support.video.supportedFormat(video.formats),
|
|
|
|
streams = {};
|
|
|
|
video.height = video.resolutions[0];
|
2011-05-25 19:42:45 +00:00
|
|
|
video.width = parseInt(video.height * video.aspectRatio / 2) * 2;
|
2011-08-17 19:34:55 +00:00
|
|
|
video.resolutions.forEach(function(profile) {
|
|
|
|
streams[profile] = video.baseUrl + '/' + profile + 'p.' + format;
|
|
|
|
});
|
|
|
|
$.each(pandora.site.layers, function(i, layer) {
|
|
|
|
layers[i] = $.extend({}, layer, {items: result.data.layers[layer.id]});
|
|
|
|
});
|
|
|
|
//
|
2011-06-19 17:49:25 +00:00
|
|
|
pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.player = Ox.VideoPanelPlayer({
|
2011-06-06 15:48:11 +00:00
|
|
|
annotationsSize: pandora.user.ui.annotationsSize,
|
2011-05-25 19:42:45 +00:00
|
|
|
duration: video.duration,
|
2011-08-17 19:34:55 +00:00
|
|
|
getTimelineImageURL: function(i) {
|
|
|
|
return '/' + pandora.user.ui.item + '/timeline64p' + i + '.png';
|
|
|
|
},
|
2011-06-06 15:48:11 +00:00
|
|
|
height: pandora.$ui.contentPanel.size(1),
|
2011-08-17 19:34:55 +00:00
|
|
|
muted: pandora.user.ui.videoMuted,
|
2011-06-06 15:48:11 +00:00
|
|
|
position: pandora.user.ui.videoPosition[pandora.user.ui.item] || 0,
|
2011-08-17 19:34:55 +00:00
|
|
|
scaleToFill: pandora.user.ui.videoScale == 'fill',
|
2011-06-06 15:48:11 +00:00
|
|
|
showAnnotations: pandora.user.ui.showAnnotations,
|
|
|
|
showControls: pandora.user.ui.showControls,
|
2011-08-17 19:34:55 +00:00
|
|
|
subtitles: result.data.layers.subtitles.map(function(subtitle) {
|
|
|
|
return {'in': subtitle['in'], out: subtitle.out, text: subtitle.value};
|
|
|
|
}),
|
|
|
|
timeline: '/' + pandora.user.ui.item + '/timeline16p.png',
|
|
|
|
video: streams,
|
2011-05-25 19:42:45 +00:00
|
|
|
videoHeight: video.height,
|
2011-08-17 19:34:55 +00:00
|
|
|
//videoId: pandora.user.ui.item,
|
2011-05-25 19:42:45 +00:00
|
|
|
videoWidth: video.width,
|
2011-08-17 19:34:55 +00:00
|
|
|
volume: pandora.user.ui.videoVolume,
|
2011-06-06 15:48:11 +00:00
|
|
|
width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1
|
2011-05-25 19:42:45 +00:00
|
|
|
}).bindEvent({
|
2011-08-17 19:34:55 +00:00
|
|
|
muted: function(data) {
|
|
|
|
pandora.UI.set('muted', data.muted);
|
|
|
|
},
|
|
|
|
resizeannotations: function(data) {
|
|
|
|
pandora.UI.set('annotationsSize', data.annotationsSize);
|
|
|
|
},
|
|
|
|
scale: function(data) {
|
|
|
|
pandora.UI.set('videoScale', data.scale);
|
|
|
|
},
|
|
|
|
toggleannotations: function(data) {
|
|
|
|
pandora.UI.set('showAnnotations', data.showAnnotations);
|
|
|
|
},
|
|
|
|
togglecontrols: function(data) {
|
|
|
|
pandora.UI.set('showControls', data.showControls);
|
|
|
|
},
|
|
|
|
volume: function(data) {
|
|
|
|
pandora.UI.set('volume', data.volume);
|
2011-05-25 19:42:45 +00:00
|
|
|
},
|
|
|
|
}));
|
2011-06-06 15:48:11 +00:00
|
|
|
} else if (pandora.user.ui.itemView == 'statistics') {
|
2011-06-27 13:39:35 +00:00
|
|
|
var stats = Ox.Container();
|
|
|
|
Ox.TreeList({
|
|
|
|
data: result.data,
|
2011-08-06 01:04:09 +00:00
|
|
|
width: pandora.$ui.mainPanel.size(1) - Ox.UI.SCROLLBAR_SIZE
|
2011-06-27 13:39:35 +00:00
|
|
|
}).appendTo(stats);
|
|
|
|
|
|
|
|
pandora.$ui.contentPanel.replaceElement(1, stats);
|
|
|
|
|
2011-06-06 15:48:11 +00:00
|
|
|
} else if (pandora.user.ui.itemView == 'timeline') {
|
2011-05-25 19:42:45 +00:00
|
|
|
var layers = [],
|
2011-05-26 07:34:52 +00:00
|
|
|
video = result.data.stream,
|
2011-06-01 13:16:50 +00:00
|
|
|
cuts = result.data.cuts || [],
|
2011-05-26 07:34:52 +00:00
|
|
|
format = $.support.video.supportedFormat(video.formats),
|
|
|
|
streams = {};
|
2011-08-16 10:13:48 +00:00
|
|
|
video.height = video.resolutions[0];
|
2011-05-25 19:42:45 +00:00
|
|
|
video.width = parseInt(video.height * video.aspectRatio / 2) * 2;
|
2011-08-16 10:13:48 +00:00
|
|
|
video.resolutions.forEach(function(profile) {
|
2011-05-26 07:34:52 +00:00
|
|
|
streams[profile] = video.baseUrl + '/' + profile + 'p.' + format;
|
|
|
|
});
|
2011-06-06 15:48:11 +00:00
|
|
|
$.each(pandora.site.layers, function(i, layer) {
|
2011-05-26 07:34:52 +00:00
|
|
|
layers[i] = $.extend({}, layer, {items: result.data.layers[layer.id]});
|
2011-05-25 19:42:45 +00:00
|
|
|
});
|
2011-06-19 17:49:25 +00:00
|
|
|
pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.editor = Ox.VideoEditor({
|
2011-06-06 15:48:11 +00:00
|
|
|
annotationsSize: pandora.user.ui.annotationsSize,
|
2011-05-25 19:42:45 +00:00
|
|
|
cuts: cuts,
|
|
|
|
duration: video.duration,
|
|
|
|
find: '',
|
|
|
|
getFrameURL: function(position) {
|
2011-08-06 18:17:22 +00:00
|
|
|
return '/' + pandora.user.ui.item + '/' + video.height.toString() + 'p' + position.toString() + '.jpg';
|
2011-05-25 19:42:45 +00:00
|
|
|
},
|
|
|
|
getLargeTimelineImageURL: function(i) {
|
2011-08-06 18:00:15 +00:00
|
|
|
return '/' + pandora.user.ui.item + '/timeline64p' + i + '.png';
|
2011-05-25 19:42:45 +00:00
|
|
|
},
|
|
|
|
getSmallTimelineImageURL: function(i) {
|
2011-08-06 18:00:15 +00:00
|
|
|
return '/' + pandora.user.ui.item + '/timeline16p' + i + '.png';
|
2011-05-25 19:42:45 +00:00
|
|
|
},
|
2011-06-06 15:48:11 +00:00
|
|
|
height: pandora.$ui.contentPanel.size(1),
|
2011-05-25 19:42:45 +00:00
|
|
|
id: 'editor',
|
|
|
|
'in': 0,
|
|
|
|
layers: layers,
|
|
|
|
out: 0,
|
2011-06-06 15:48:11 +00:00
|
|
|
position: pandora.user.ui.videoPosition[pandora.user.ui.item] || 0,
|
2011-05-25 19:42:45 +00:00
|
|
|
posterFrame: parseInt(video.duration / 2),
|
2011-06-06 15:48:11 +00:00
|
|
|
showAnnotations: pandora.user.ui.showAnnotations,
|
2011-05-25 19:42:45 +00:00
|
|
|
showLargeTimeline: true,
|
|
|
|
// fixme: layers have value, subtitles has text?
|
2011-05-26 07:34:52 +00:00
|
|
|
subtitles: result.data.layers.subtitles.map(function(subtitle) {
|
2011-05-25 19:42:45 +00:00
|
|
|
return {'in': subtitle['in'], out: subtitle.out, text: subtitle.value};
|
|
|
|
}),
|
2011-08-17 19:34:55 +00:00
|
|
|
video: streams,
|
2011-05-25 19:42:45 +00:00
|
|
|
videoHeight: video.height,
|
2011-08-17 19:34:55 +00:00
|
|
|
//videoId: pandora.user.ui.item,
|
2011-05-25 19:42:45 +00:00
|
|
|
videoWidth: video.width,
|
2011-06-06 15:48:11 +00:00
|
|
|
videoSize: pandora.user.ui.videoSize,
|
|
|
|
width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1
|
2011-05-25 19:42:45 +00:00
|
|
|
}).bindEvent({
|
2011-08-17 15:20:43 +00:00
|
|
|
resize: function(data) {
|
2011-06-06 15:48:11 +00:00
|
|
|
pandora.$ui.editor.options({
|
2011-05-25 19:42:45 +00:00
|
|
|
height: data
|
|
|
|
});
|
|
|
|
},
|
2011-08-17 15:20:43 +00:00
|
|
|
resizeend: function(data) {
|
|
|
|
pandora.UI.set({annotationsSize: data});
|
|
|
|
},
|
|
|
|
togglesize: function(data) {
|
2011-05-25 19:42:45 +00:00
|
|
|
pandora.UI.set({videoSize: data.size});
|
|
|
|
},
|
2011-08-17 19:34:55 +00:00
|
|
|
addannotation: function(data) {
|
2011-05-25 19:42:45 +00:00
|
|
|
Ox.print('addAnnotation', data);
|
2011-06-06 15:48:11 +00:00
|
|
|
data.item = pandora.user.ui.item;
|
2011-05-25 19:42:45 +00:00
|
|
|
data.value = 'Click to edit';
|
|
|
|
pandora.api.addAnnotation(data, function(result) {
|
2011-06-06 15:48:11 +00:00
|
|
|
pandora.$ui.editor.addAnnotation(data.layer, result.data);
|
2011-05-25 19:42:45 +00:00
|
|
|
});
|
|
|
|
},
|
2011-08-17 19:34:55 +00:00
|
|
|
removeannotations: function(data) {
|
2011-05-25 19:42:45 +00:00
|
|
|
pandora.api.removeAnnotations(data, function(result) {
|
|
|
|
//fixme: check for errors
|
2011-06-06 15:48:11 +00:00
|
|
|
pandora.$ui.editor.removeAnnotations(data.layer, data.ids);
|
2011-05-25 19:42:45 +00:00
|
|
|
});
|
|
|
|
},
|
2011-08-17 19:34:55 +00:00
|
|
|
toggleannotations: function(data) {
|
|
|
|
pandora.UI.set('showAnnotations', data.showAnnotations);
|
2011-08-17 15:20:43 +00:00
|
|
|
},
|
2011-08-17 19:34:55 +00:00
|
|
|
updateannotation: function(data) {
|
2011-05-25 19:42:45 +00:00
|
|
|
//fixme: check that edit was successfull
|
2011-06-15 14:36:42 +00:00
|
|
|
pandora.api.editAnnotation(data, function(result) {
|
|
|
|
Ox.print('done updateAnnotation', result);
|
|
|
|
|
|
|
|
});
|
2011-05-25 19:42:45 +00:00
|
|
|
}
|
|
|
|
}));
|
|
|
|
that.bindEvent('resize', function(event, data) {
|
|
|
|
//Ox.print('resize item', data)
|
2011-06-06 15:48:11 +00:00
|
|
|
pandora.$ui.editor.options({
|
2011-05-25 19:42:45 +00:00
|
|
|
height: data
|
|
|
|
});
|
|
|
|
});
|
|
|
|
/*
|
2011-06-06 15:48:11 +00:00
|
|
|
pandora.$ui.rightPanel.bindEvent('resize', function(event, data) {
|
|
|
|
Ox.print('... rightPanel resize', data, pandora.$ui.timelinePanel.size(1))
|
|
|
|
pandora.$ui.editor.options({
|
|
|
|
width: data - pandora.$ui.timelinePanel.size(1) - 1
|
2011-05-25 19:42:45 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
*/
|
2011-06-06 15:48:11 +00:00
|
|
|
} else if (pandora.user.ui.itemView == 'files') {
|
|
|
|
pandora.$ui.contentPanel.replaceElement(1,
|
2011-06-19 17:49:25 +00:00
|
|
|
pandora.$ui.item = Ox.FilesView({
|
2011-05-26 07:34:52 +00:00
|
|
|
id: result.data.id
|
2011-05-25 19:42:45 +00:00
|
|
|
})
|
|
|
|
);
|
2011-06-06 18:40:24 +00:00
|
|
|
} else if (pandora.user.ui.itemView == 'frames' || pandora.user.ui.itemView == 'posters') {
|
|
|
|
pandora.$ui.contentPanel.replaceElement(1,
|
2011-06-07 03:17:36 +00:00
|
|
|
pandora.$ui.item = pandora.ui.mediaView().bindEvent({
|
|
|
|
resize: function() {
|
|
|
|
pandora.$ui.item.resize();
|
|
|
|
}
|
|
|
|
})
|
2011-06-06 18:40:24 +00:00
|
|
|
);
|
2011-05-25 19:42:45 +00:00
|
|
|
}
|
2011-05-26 07:34:52 +00:00
|
|
|
var director = result.data.director?' ('+result.data.director.join(', ')+')':'';
|
2011-06-06 15:48:11 +00:00
|
|
|
pandora.$ui.total.html(result.data.title + director);
|
2011-05-25 19:42:45 +00:00
|
|
|
});
|
|
|
|
return that;
|
|
|
|
};
|
|
|
|
|