2011-07-29 18:37:11 +00:00
|
|
|
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
2012-02-03 09:15:38 +00:00
|
|
|
'use strict';
|
2011-10-03 13:23:11 +00:00
|
|
|
|
2011-05-25 19:42:45 +00:00
|
|
|
pandora.ui.item = function() {
|
2011-09-17 07:07:59 +00:00
|
|
|
|
2012-02-17 08:57:21 +00:00
|
|
|
var that = Ox.Element(),
|
|
|
|
videoOptions;
|
2011-09-17 07:07:59 +00:00
|
|
|
|
2011-08-06 13:34:56 +00:00
|
|
|
pandora.api.get({
|
|
|
|
id: pandora.user.ui.item,
|
2011-10-30 21:05:57 +00:00
|
|
|
keys: ['video', 'timeline'].indexOf(pandora.user.ui.itemView) > -1
|
2012-02-02 05:16:12 +00:00
|
|
|
? [ 'cuts', 'director', 'duration', 'layers', 'parts', 'posterFrame', 'rendered', 'rightslevel', 'size', 'title', 'videoRatio', 'year'] : []
|
2011-10-30 21:05:57 +00:00
|
|
|
}, pandora.user.ui.itemView == 'info' && pandora.site.capabilities.canEditMetadata[pandora.user.level] ? 0 : -1, function(result) {
|
2011-09-17 07:07:59 +00:00
|
|
|
|
|
|
|
if (result.status.code == 200) {
|
2011-11-09 22:32:54 +00:00
|
|
|
// we want to cache the title in any way, so that after closing
|
|
|
|
// a dialog and getting to this item, the title is correct
|
|
|
|
var documentTitle = pandora.getDocumentTitle(result.data.title);
|
|
|
|
document.title = pandora.getPageTitle(document.location.pathname) || documentTitle;
|
2011-09-17 07:07:59 +00:00
|
|
|
}
|
|
|
|
|
2011-09-20 04:11:25 +00:00
|
|
|
/*if (result.status.code != 200) {
|
|
|
|
pandora.$ui.contentPanel.replaceElement(1,
|
|
|
|
Ox.Element()
|
|
|
|
.css({marginTop: '32px', fontSize: '12px', textAlign: 'center'})
|
|
|
|
.html(
|
|
|
|
'Sorry, we can\'t find the '
|
|
|
|
+ pandora.site.itemName.singular.toLowerCase()
|
|
|
|
+ ' you\'re looking for.'
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}*/
|
|
|
|
|
2011-10-30 21:05:57 +00:00
|
|
|
pandora.$ui.itemTitle
|
|
|
|
.options({
|
|
|
|
title: '<b>' + result.data.title
|
2011-12-30 08:00:38 +00:00
|
|
|
+ (Ox.len(result.data.director)
|
2011-12-27 13:52:16 +00:00
|
|
|
? ' (' + result.data.director.join(', ') + ')'
|
|
|
|
: '')
|
2011-10-30 21:05:57 +00:00
|
|
|
+ (result.data.year ? ' ' + result.data.year : '') + '</b>'
|
|
|
|
})
|
|
|
|
.show();
|
|
|
|
|
2011-10-22 21:03:28 +00:00
|
|
|
if (['video', 'timeline'].indexOf(pandora.user.ui.itemView) > -1) {
|
2011-10-23 02:29:20 +00:00
|
|
|
// fixme: layers have value, subtitles has text?
|
2012-02-17 08:57:21 +00:00
|
|
|
videoOptions = pandora.getVideoOptions(result.data);
|
2011-10-22 21:03:28 +00:00
|
|
|
}
|
|
|
|
|
2011-09-20 04:11:25 +00:00
|
|
|
if (!result.data.rendered && [
|
2011-09-22 03:20:55 +00:00
|
|
|
'clips', 'map', 'video', 'timeline'
|
2011-10-22 21:03:28 +00:00
|
|
|
].indexOf(pandora.user.ui.itemView) > -1) {
|
2011-06-27 13:39:35 +00:00
|
|
|
pandora.$ui.contentPanel.replaceElement(1,
|
2011-08-24 22:15:50 +00:00
|
|
|
Ox.Element()
|
|
|
|
.css({marginTop: '32px', fontSize: '12px', textAlign: 'center'})
|
|
|
|
.html(
|
2011-10-23 02:29:20 +00:00
|
|
|
'Sorry, <i>' + result.data.title
|
2011-08-24 22:15:50 +00:00
|
|
|
+ '</i> currently doesn\'t have a '
|
|
|
|
+ pandora.user.ui.itemView + ' view.'
|
|
|
|
)
|
|
|
|
);
|
2011-09-17 07:07:59 +00:00
|
|
|
|
2011-06-06 15:48:11 +00:00
|
|
|
} else if (pandora.user.ui.itemView == 'info') {
|
2011-11-04 15:54:42 +00:00
|
|
|
//Ox.Log('', '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',
|
2011-10-29 17:46:46 +00:00
|
|
|
width: 500
|
2011-05-25 19:42:45 +00:00
|
|
|
});
|
|
|
|
}),
|
|
|
|
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({
|
2011-09-17 17:40:15 +00:00
|
|
|
click: function(data) {
|
|
|
|
// fixme: cleanup
|
2011-05-25 19:42:45 +00:00
|
|
|
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-10-22 22:12:56 +00:00
|
|
|
pandora.api.edit(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-10-29 17:46:46 +00:00
|
|
|
});
|
2011-05-25 19:42:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}));
|
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
|
|
|
}
|
|
|
|
|
2011-09-23 10:44:54 +00:00
|
|
|
} else if (pandora.user.ui.itemView == 'clips') {
|
2012-02-17 16:13:48 +00:00
|
|
|
|
2011-09-30 10:33:45 +00:00
|
|
|
pandora.$ui.contentPanel.replaceElement(1,
|
2011-10-30 15:36:14 +00:00
|
|
|
pandora.ui.clipsView(result.data.videoRatio)
|
2011-09-30 10:33:45 +00:00
|
|
|
);
|
2011-09-23 10:44:54 +00:00
|
|
|
|
2011-09-22 03:20:55 +00:00
|
|
|
} else if (pandora.user.ui.itemView == 'video') {
|
2012-02-17 16:13:48 +00:00
|
|
|
|
2012-01-12 10:39:19 +00:00
|
|
|
pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.player = Ox.VideoPanel({
|
2012-02-01 07:13:46 +00:00
|
|
|
annotationsCalendarSize: pandora.user.ui.annotationsCalendarSize,
|
2012-01-12 19:05:43 +00:00
|
|
|
annotationsFont: pandora.user.ui.annotationsFont,
|
2012-02-01 07:13:46 +00:00
|
|
|
annotationsMapSize: pandora.user.ui.annotationsMapSize,
|
2012-01-12 19:05:43 +00:00
|
|
|
annotationsRange: pandora.user.ui.annotationsRange,
|
2011-10-20 19:32:12 +00:00
|
|
|
annotationsSize: pandora.user.ui.annotationsSize,
|
2012-01-12 19:05:43 +00:00
|
|
|
annotationsSort: pandora.user.ui.annotationsSort,
|
2012-02-01 07:13:46 +00:00
|
|
|
censored: videoOptions.censored,
|
2012-01-17 15:44:09 +00:00
|
|
|
clickLink: pandora.clickLink,
|
2011-10-20 19:32:12 +00:00
|
|
|
cuts: result.data.cuts || [],
|
|
|
|
duration: result.data.duration,
|
2011-12-22 15:48:48 +00:00
|
|
|
enableSubtitles: pandora.user.ui.videoSubtitles,
|
2012-02-01 12:01:39 +00:00
|
|
|
find: pandora.user.ui.itemFind,
|
2011-10-20 19:32:12 +00:00
|
|
|
getTimelineImageURL: function(i) {
|
|
|
|
return '/' + pandora.user.ui.item + '/timeline64p' + i + '.png';
|
|
|
|
},
|
|
|
|
height: pandora.$ui.contentPanel.size(1),
|
|
|
|
'in': pandora.user.ui.videoPoints[pandora.user.ui.item]['in'],
|
2012-01-12 19:05:43 +00:00
|
|
|
layers: videoOptions.layers,
|
2011-10-20 19:32:12 +00:00
|
|
|
muted: pandora.user.ui.videoMuted,
|
|
|
|
out: pandora.user.ui.videoPoints[pandora.user.ui.item].out,
|
|
|
|
position: pandora.user.ui.videoPoints[pandora.user.ui.item].position,
|
2011-12-20 13:08:30 +00:00
|
|
|
resolution: pandora.user.ui.videoResolution,
|
2011-10-20 19:32:12 +00:00
|
|
|
scaleToFill: pandora.user.ui.videoScale == 'fill',
|
2012-02-17 16:13:48 +00:00
|
|
|
selected: pandora.user.ui.videoPoints[pandora.user.ui.item].annotation
|
|
|
|
? pandora.user.ui.item + '/' + pandora.user.ui.videoPoints[pandora.user.ui.item].annotation
|
|
|
|
: '',
|
2011-10-20 19:32:12 +00:00
|
|
|
showAnnotations: pandora.user.ui.showAnnotations,
|
2012-02-01 07:13:46 +00:00
|
|
|
showAnnotationsCalendar: pandora.user.ui.showAnnotationsCalendar,
|
|
|
|
showAnnotationsMap: pandora.user.ui.showAnnotationsMap,
|
2012-01-12 19:05:43 +00:00
|
|
|
showLayers: pandora.user.ui.showLayers,
|
2012-02-01 07:13:46 +00:00
|
|
|
showUsers: pandora.site.annotations.showUsers,
|
2011-11-05 22:14:10 +00:00
|
|
|
showTimeline: pandora.user.ui.showTimeline,
|
2011-12-19 21:12:23 +00:00
|
|
|
subtitles: videoOptions.subtitles,
|
2011-10-20 19:32:12 +00:00
|
|
|
tooltips: true,
|
|
|
|
timeline: '/' + pandora.user.ui.item + '/timeline16p.png',
|
2011-12-19 21:12:23 +00:00
|
|
|
video: videoOptions.video,
|
2011-10-20 19:32:12 +00:00
|
|
|
volume: pandora.user.ui.videoVolume,
|
|
|
|
width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1
|
|
|
|
}).bindEvent({
|
2012-01-12 19:05:43 +00:00
|
|
|
annotationsfont: function(data) {
|
|
|
|
pandora.UI.set({annotationsFont: data.font});
|
|
|
|
},
|
|
|
|
annotationsrange: function(data) {
|
|
|
|
pandora.UI.set({annotationsRange: data.range});
|
|
|
|
},
|
|
|
|
annotationssize: function(data) {
|
|
|
|
pandora.UI.set({annotationsSize: data.size});
|
|
|
|
},
|
|
|
|
annotationssort: function(data) {
|
|
|
|
pandora.UI.set({annotationsSort: data.sort});
|
|
|
|
},
|
2011-10-30 09:49:12 +00:00
|
|
|
find: function(data) {
|
2012-02-01 12:01:39 +00:00
|
|
|
pandora.UI.set('itemFind', data.find);
|
2011-10-30 09:49:12 +00:00
|
|
|
},
|
2011-10-20 19:32:12 +00:00
|
|
|
muted: function(data) {
|
2011-11-05 15:17:23 +00:00
|
|
|
pandora.UI.set('videoMuted', data.muted);
|
2011-10-20 19:32:12 +00:00
|
|
|
},
|
|
|
|
position: function(data) {
|
2011-11-05 16:09:15 +00:00
|
|
|
pandora.UI.set(
|
|
|
|
'videoPoints.' + pandora.user.ui.item + '.position',
|
|
|
|
data.position
|
|
|
|
);
|
2011-10-20 19:32:12 +00:00
|
|
|
},
|
|
|
|
resizeannotations: function(data) {
|
|
|
|
pandora.UI.set('annotationsSize', data.annotationsSize);
|
|
|
|
},
|
2012-02-01 07:13:46 +00:00
|
|
|
resizecalendar: function(data) {
|
|
|
|
pandora.UI.set('annotationsCalendarSize', data.size);
|
|
|
|
},
|
|
|
|
resizemap: function(data) {
|
|
|
|
pandora.UI.set('annotationsMapSize', data.size);
|
|
|
|
},
|
2011-12-20 13:08:30 +00:00
|
|
|
resolution: function(data) {
|
|
|
|
pandora.UI.set('videoResolution', data.resolution);
|
|
|
|
},
|
2011-10-20 19:32:12 +00:00
|
|
|
scale: function(data) {
|
|
|
|
pandora.UI.set('videoScale', data.scale);
|
|
|
|
},
|
2012-02-17 16:29:10 +00:00
|
|
|
select: function(data) {
|
|
|
|
pandora.UI.set('videoPoints.' + pandora.user.ui.item + '.annotation', data.id.split('/')[1]);
|
|
|
|
},
|
2011-12-22 15:48:48 +00:00
|
|
|
subtitles: function(data) {
|
|
|
|
pandora.UI.set('videoSubtitles', data.subtitles);
|
|
|
|
},
|
2012-02-01 07:13:46 +00:00
|
|
|
togglemap: function(data) {
|
|
|
|
pandora.UI.set('showAnnotationsMap', !data.collapsed);
|
|
|
|
},
|
|
|
|
togglesize: function(data) {
|
|
|
|
pandora.UI.set({videoSize: data.size});
|
|
|
|
},
|
2011-10-20 19:32:12 +00:00
|
|
|
toggleannotations: function(data) {
|
|
|
|
pandora.UI.set('showAnnotations', data.showAnnotations);
|
|
|
|
},
|
2012-01-12 19:05:43 +00:00
|
|
|
togglelayer: function(data) {
|
|
|
|
pandora.UI.set('showLayers.' + data.layer, !data.collapsed);
|
|
|
|
},
|
2011-11-05 22:14:10 +00:00
|
|
|
toggletimeline: function(data) {
|
|
|
|
pandora.UI.set('showTimeline', data.showTimeline);
|
2011-10-20 19:32:12 +00:00
|
|
|
},
|
|
|
|
volume: function(data) {
|
2011-11-05 15:17:23 +00:00
|
|
|
pandora.UI.set('videoVolume', data.volume);
|
2011-10-20 19:32:12 +00:00
|
|
|
},
|
|
|
|
pandora_showannotations: function(data) {
|
|
|
|
pandora.$ui.player.options({showAnnotations: data.value});
|
2011-11-05 22:14:10 +00:00
|
|
|
},
|
|
|
|
pandora_showtimeline: function(data) {
|
|
|
|
pandora.$ui.player.options({showTimeline: data.value});
|
2011-10-20 19:32:12 +00:00
|
|
|
}
|
|
|
|
}));
|
2011-09-17 07:07:59 +00:00
|
|
|
|
2011-06-06 15:48:11 +00:00
|
|
|
} else if (pandora.user.ui.itemView == 'timeline') {
|
2012-02-17 16:13:48 +00:00
|
|
|
|
2011-10-30 09:49:12 +00:00
|
|
|
pandora.$ui.contentPanel.replaceElement(1,
|
|
|
|
pandora.$ui.editor = Ox.VideoEditor({
|
2012-01-13 16:26:07 +00:00
|
|
|
annotationsCalendarSize: pandora.user.ui.annotationsCalendarSize,
|
2012-01-02 19:06:56 +00:00
|
|
|
annotationsFont: pandora.user.ui.annotationsFont,
|
2012-01-13 16:26:07 +00:00
|
|
|
annotationsMapSize: pandora.user.ui.annotationsMapSize,
|
2012-01-02 19:06:56 +00:00
|
|
|
annotationsRange: pandora.user.ui.annotationsRange,
|
2011-10-30 09:49:12 +00:00
|
|
|
annotationsSize: pandora.user.ui.annotationsSize,
|
2012-01-03 20:17:44 +00:00
|
|
|
annotationsSort: pandora.user.ui.annotationsSort,
|
2011-12-20 13:08:30 +00:00
|
|
|
censored: videoOptions.censored,
|
2012-01-17 15:44:09 +00:00
|
|
|
clickLink: pandora.clickLink,
|
2011-10-30 09:49:12 +00:00
|
|
|
cuts: result.data.cuts || [],
|
|
|
|
duration: result.data.duration,
|
2012-01-30 23:29:04 +00:00
|
|
|
enableDownload: pandora.site.capabilities.canDownloadVideo[pandora.user.level] >= result.data.rightslevel,
|
2012-02-17 09:06:06 +00:00
|
|
|
enableImport: pandora.site.capabilities.canImportAnnotations[pandora.user.level],
|
2011-12-22 15:48:48 +00:00
|
|
|
enableSubtitles: pandora.user.ui.videoSubtitles,
|
2012-02-01 12:01:39 +00:00
|
|
|
find: pandora.user.ui.itemFind,
|
2011-10-30 09:49:12 +00:00
|
|
|
getFrameURL: function(position) {
|
2012-01-02 19:50:55 +00:00
|
|
|
return '/' + pandora.user.ui.item + '/' + pandora.user.ui.videoResolution + 'p' + position + '.jpg';
|
2011-10-30 09:49:12 +00:00
|
|
|
},
|
|
|
|
getLargeTimelineImageURL: function(i) {
|
|
|
|
return '/' + pandora.user.ui.item + '/timeline64p' + i + '.png';
|
|
|
|
},
|
|
|
|
getSmallTimelineImageURL: function(i) {
|
|
|
|
return '/' + pandora.user.ui.item + '/timeline16p' + i + '.png';
|
|
|
|
},
|
|
|
|
height: pandora.$ui.contentPanel.size(1),
|
|
|
|
id: 'editor',
|
|
|
|
'in': pandora.user.ui.videoPoints[pandora.user.ui.item]['in'],
|
2012-01-02 19:06:56 +00:00
|
|
|
layers: videoOptions.layers.map(function(layer) {
|
|
|
|
return Ox.extend({
|
|
|
|
editable: layer.canAddAnnotations[pandora.user.level]
|
|
|
|
}, layer);
|
|
|
|
}),
|
2011-10-30 09:49:12 +00:00
|
|
|
muted: pandora.user.ui.videoMuted,
|
|
|
|
out: pandora.user.ui.videoPoints[pandora.user.ui.item].out,
|
|
|
|
position: pandora.user.ui.videoPoints[pandora.user.ui.item].position,
|
2012-02-02 05:16:12 +00:00
|
|
|
posterFrame: result.data.posterFrame,
|
|
|
|
posterFrameControls: !pandora.site.media.importPosterFrames,
|
2011-12-20 13:08:30 +00:00
|
|
|
resolution: pandora.user.ui.videoResolution,
|
2012-01-09 09:55:52 +00:00
|
|
|
selected: pandora.user.ui.videoPoints[pandora.user.ui.item].annotation
|
|
|
|
? pandora.user.ui.item + '/' + pandora.user.ui.videoPoints[pandora.user.ui.item].annotation
|
|
|
|
: '',
|
2011-10-30 09:49:12 +00:00
|
|
|
showAnnotations: pandora.user.ui.showAnnotations,
|
2012-01-13 16:26:07 +00:00
|
|
|
showAnnotationsCalendar: pandora.user.ui.showAnnotationsCalendar,
|
|
|
|
showAnnotationsMap: pandora.user.ui.showAnnotationsMap,
|
2011-10-30 09:49:12 +00:00
|
|
|
showLargeTimeline: true,
|
2012-01-11 07:51:26 +00:00
|
|
|
showLayers: pandora.user.ui.showLayers,
|
2012-01-12 10:39:19 +00:00
|
|
|
showUsers: pandora.site.annotations.showUsers,
|
2011-12-20 13:08:30 +00:00
|
|
|
subtitles: videoOptions.subtitles,
|
2011-10-30 09:49:12 +00:00
|
|
|
tooltips: true,
|
2011-12-20 13:08:30 +00:00
|
|
|
video: videoOptions.video,
|
2011-10-30 09:49:12 +00:00
|
|
|
videoRatio: result.data.videoRatio,
|
|
|
|
videoSize: pandora.user.ui.videoSize,
|
2011-11-05 15:17:23 +00:00
|
|
|
volume: pandora.user.ui.videoVolume,
|
2011-10-30 09:49:12 +00:00
|
|
|
width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1
|
|
|
|
}).bindEvent({
|
2012-01-14 11:40:15 +00:00
|
|
|
addannotation: function(data) {
|
|
|
|
Ox.Log('', 'addAnnotation', data);
|
2012-02-15 21:29:12 +00:00
|
|
|
// async to not capture keyboard input
|
2012-01-31 10:54:22 +00:00
|
|
|
setTimeout(function() {
|
2012-02-15 21:29:12 +00:00
|
|
|
var d = new Date(),
|
|
|
|
created = Ox.formatDate(d, '%Y-%m-%dT%H:%M:%SZ'),
|
2012-02-17 16:13:48 +00:00
|
|
|
date = Ox.formatDate(d, '%B %e, %Y'),
|
|
|
|
type = Ox.getObjectById(pandora.site.layers, data.layer).type;
|
|
|
|
pandora.$ui.editor.addAnnotation(data.layer, Ox.extend(
|
|
|
|
{
|
|
|
|
created: created,
|
|
|
|
date: date,
|
|
|
|
duration: data.out - data['in'],
|
|
|
|
editable: true,
|
|
|
|
id: '_' + Ox.uid(),
|
|
|
|
'in': data['in'],
|
|
|
|
modified: created,
|
|
|
|
out: data.out,
|
|
|
|
user: pandora.user.username,
|
|
|
|
value: '',
|
|
|
|
},
|
|
|
|
type == 'place' ? {
|
|
|
|
place: {lat: null, lng: null}
|
|
|
|
} : type == 'event' ? {
|
|
|
|
event: {start: '', end: ''}
|
|
|
|
} : {}
|
2012-02-01 17:21:29 +00:00
|
|
|
));
|
2012-01-14 11:40:15 +00:00
|
|
|
});
|
|
|
|
},
|
2012-01-12 10:39:19 +00:00
|
|
|
annotationsfont: function(data) {
|
2012-01-02 19:06:56 +00:00
|
|
|
pandora.UI.set({annotationsFont: data.font});
|
|
|
|
},
|
2012-01-12 10:39:19 +00:00
|
|
|
annotationsrange: function(data) {
|
2012-01-02 19:06:56 +00:00
|
|
|
pandora.UI.set({annotationsRange: data.range});
|
|
|
|
},
|
2012-01-12 10:39:19 +00:00
|
|
|
annotationssize: function(data) {
|
2012-01-02 19:06:56 +00:00
|
|
|
pandora.UI.set({annotationsSize: data.size});
|
|
|
|
},
|
2012-01-12 10:39:19 +00:00
|
|
|
annotationssort: function(data) {
|
2012-01-03 20:17:44 +00:00
|
|
|
pandora.UI.set({annotationsSort: data.sort});
|
|
|
|
},
|
2012-01-15 15:05:37 +00:00
|
|
|
define: function(data) {
|
|
|
|
pandora.$ui.placesDialog && pandora.$ui.placesDialog.remove();
|
|
|
|
pandora.$ui.placesDialog = pandora.ui.placesDialog(data).open();
|
|
|
|
},
|
2012-02-01 07:13:46 +00:00
|
|
|
downloadvideo: function(data) {
|
2012-01-30 23:29:04 +00:00
|
|
|
document.location.href = '/' + pandora.user.ui.item + '/torrent/';
|
2012-01-30 22:11:30 +00:00
|
|
|
},
|
2012-02-01 07:13:46 +00:00
|
|
|
downloadselection: function(data) {
|
2012-02-17 16:29:10 +00:00
|
|
|
document.location.href = '/' + pandora.user.ui.item
|
|
|
|
+ '/' + Ox.max(pandora.site.video.resolutions)
|
|
|
|
+ 'p.webm?t=' + data['in'] + ',' + data.out;
|
2012-01-30 22:11:30 +00:00
|
|
|
},
|
2012-01-14 11:40:15 +00:00
|
|
|
editannotation: function(data) {
|
|
|
|
Ox.Log('', 'editAnnotation', data);
|
2012-01-31 10:54:22 +00:00
|
|
|
function callback(result) {
|
|
|
|
Ox.Log('', 'editAnnotation result', result);
|
2012-02-18 09:59:56 +00:00
|
|
|
result.data.date = Ox.formatDate(result.data.modified.substr(0, 10),
|
|
|
|
'%B %e, %Y');
|
2012-01-31 10:54:22 +00:00
|
|
|
pandora.$ui.editor.updateAnnotation(data.id, result.data);
|
|
|
|
};
|
|
|
|
if (data.id[0] == '_') {
|
|
|
|
pandora.api.addAnnotation({
|
|
|
|
'in': data['in'],
|
|
|
|
item: pandora.user.ui.item,
|
|
|
|
layer: data.layer,
|
|
|
|
out: data.out,
|
|
|
|
value: data.value
|
|
|
|
}, callback);
|
|
|
|
} else {
|
|
|
|
pandora.api.editAnnotation({
|
|
|
|
id: data.id,
|
|
|
|
'in': data['in'],
|
|
|
|
out: data.out,
|
|
|
|
value: data.value
|
|
|
|
}, callback);
|
|
|
|
}
|
2012-01-14 11:40:15 +00:00
|
|
|
},
|
2012-02-01 07:13:46 +00:00
|
|
|
embedselection: function(data) {
|
2012-01-30 22:11:30 +00:00
|
|
|
pandora.$ui.embedDialog && pandora.$ui.embedDialog.remove();
|
|
|
|
pandora.$ui.embedDialog = pandora.ui.embedDialog(data).open();
|
|
|
|
},
|
2011-10-30 09:49:12 +00:00
|
|
|
find: function(data) {
|
2012-02-01 12:01:39 +00:00
|
|
|
pandora.UI.set('itemFind', data.find);
|
2011-10-30 09:49:12 +00:00
|
|
|
},
|
2012-02-16 17:46:40 +00:00
|
|
|
findannotations: function(data) {
|
2012-02-16 11:34:46 +00:00
|
|
|
pandora.UI.set({
|
|
|
|
item: '',
|
|
|
|
find: {
|
|
|
|
conditions: [{key: data.key, value: data.value, operator: '='}],
|
|
|
|
operator: '&'
|
|
|
|
},
|
|
|
|
listView: 'clip'
|
|
|
|
});
|
|
|
|
},
|
2012-02-14 19:06:25 +00:00
|
|
|
importannotations: function(data) {
|
|
|
|
pandora.ui.importAnnotations().open();
|
|
|
|
},
|
2012-01-27 14:28:49 +00:00
|
|
|
info: function(data) {
|
|
|
|
pandora.ui.annotationDialog(data.layer).open();
|
|
|
|
},
|
2011-11-05 15:17:23 +00:00
|
|
|
muted: function(data) {
|
|
|
|
pandora.UI.set('videoMuted', data.muted);
|
|
|
|
},
|
2011-10-30 09:49:12 +00:00
|
|
|
points: function(data) {
|
|
|
|
pandora.UI.set('videoPoints.' + pandora.user.ui.item, {
|
2012-01-09 09:55:52 +00:00
|
|
|
annotation: pandora.user.ui.videoPoints[pandora.user.ui.item].annotation,
|
2011-10-30 09:49:12 +00:00
|
|
|
'in': data['in'],
|
|
|
|
out: data.out,
|
|
|
|
position: pandora.user.ui.videoPoints[pandora.user.ui.item].position
|
|
|
|
});
|
|
|
|
},
|
|
|
|
position: function(data) {
|
2011-11-05 16:09:15 +00:00
|
|
|
pandora.UI.set(
|
|
|
|
'videoPoints.' + pandora.user.ui.item + '.position',
|
|
|
|
data.position
|
|
|
|
);
|
2011-10-30 09:49:12 +00:00
|
|
|
},
|
2012-02-02 05:16:12 +00:00
|
|
|
posterframe: function(data) {
|
|
|
|
pandora.api.setPosterFrame({
|
|
|
|
id: pandora.user.ui.item,
|
|
|
|
position: data.position
|
|
|
|
});
|
|
|
|
},
|
2012-01-14 11:40:15 +00:00
|
|
|
removeannotation: function(data) {
|
2012-02-01 22:31:03 +00:00
|
|
|
pandora.UI.set('videoPoints.' + pandora.user.ui.item + '.annotation', null);
|
2012-01-14 11:40:15 +00:00
|
|
|
pandora.api.removeAnnotation({
|
|
|
|
id: data.id
|
|
|
|
}, function(result) {
|
|
|
|
//fixme: check for errors
|
|
|
|
//pandora.$ui.editor.removeAnnotation(data.layer, data.id);
|
|
|
|
});
|
|
|
|
},
|
2011-10-30 09:49:12 +00:00
|
|
|
resize: function(data) {
|
|
|
|
pandora.$ui.editor.options({
|
|
|
|
height: data.size
|
|
|
|
});
|
|
|
|
},
|
2012-01-14 11:40:15 +00:00
|
|
|
resizecalendar: function(data) {
|
|
|
|
pandora.UI.set('annotationsCalendarSize', data.size);
|
|
|
|
},
|
|
|
|
resizemap: function(data) {
|
|
|
|
pandora.UI.set('annotationsMapSize', data.size);
|
|
|
|
},
|
2011-12-20 13:08:30 +00:00
|
|
|
resolution: function(data) {
|
|
|
|
pandora.UI.set('videoResolution', data.resolution);
|
|
|
|
},
|
2012-01-09 09:55:52 +00:00
|
|
|
select: function(data) {
|
|
|
|
pandora.UI.set('videoPoints.' + pandora.user.ui.item + '.annotation', data.id.split('/')[1]);
|
|
|
|
},
|
2011-12-22 15:48:48 +00:00
|
|
|
subtitles: function(data) {
|
|
|
|
pandora.UI.set('videoSubtitles', data.subtitles);
|
|
|
|
},
|
2012-01-14 11:40:15 +00:00
|
|
|
togglecalendar: function(data) {
|
|
|
|
pandora.UI.set('showAnnotationsCalendar', !data.collapsed);
|
2011-10-30 09:49:12 +00:00
|
|
|
},
|
2012-01-14 11:40:15 +00:00
|
|
|
togglemap: function(data) {
|
|
|
|
pandora.UI.set('showAnnotationsMap', !data.collapsed);
|
2011-10-30 09:49:12 +00:00
|
|
|
},
|
2012-01-14 11:40:15 +00:00
|
|
|
togglesize: function(data) {
|
|
|
|
pandora.UI.set({videoSize: data.size});
|
2012-01-03 10:26:50 +00:00
|
|
|
},
|
|
|
|
toggleannotations: function(data) {
|
|
|
|
pandora.UI.set('showAnnotations', data.showAnnotations);
|
|
|
|
},
|
2012-01-11 07:51:26 +00:00
|
|
|
togglelayer: function(data) {
|
|
|
|
pandora.UI.set('showLayers.' + data.layer, !data.collapsed);
|
|
|
|
},
|
2011-10-30 09:49:12 +00:00
|
|
|
pandora_showannotations: function(data) {
|
|
|
|
pandora.$ui.editor.options({showAnnotations: data.value});
|
|
|
|
}
|
|
|
|
})
|
|
|
|
);
|
2012-02-17 16:13:48 +00:00
|
|
|
|
2011-09-23 10:44:54 +00:00
|
|
|
} else if (pandora.user.ui.itemView == 'map') {
|
2012-02-17 16:13:48 +00:00
|
|
|
|
2011-10-03 13:23:11 +00:00
|
|
|
pandora.$ui.contentPanel.replaceElement(1, pandora.ui.navigationView('map', result.data.videoRatio));
|
2011-09-23 10:44:54 +00:00
|
|
|
|
|
|
|
} else if (pandora.user.ui.itemView == 'calendar') {
|
2012-02-17 16:13:48 +00:00
|
|
|
|
2011-10-13 12:04:27 +00:00
|
|
|
pandora.$ui.contentPanel.replaceElement(1, pandora.ui.navigationView('calendar', result.data.videoRatio));
|
2011-09-23 10:44:54 +00:00
|
|
|
|
2011-09-28 17:32:03 +00:00
|
|
|
} else if (pandora.user.ui.itemView == 'data') {
|
2012-02-17 16:13:48 +00:00
|
|
|
|
2011-09-28 17:32:03 +00:00
|
|
|
var stats = Ox.Container();
|
|
|
|
Ox.TreeList({
|
|
|
|
data: result.data,
|
|
|
|
width: pandora.$ui.mainPanel.size(1) - Ox.UI.SCROLLBAR_SIZE
|
|
|
|
}).appendTo(stats);
|
|
|
|
pandora.$ui.contentPanel.replaceElement(1, stats);
|
2011-09-23 10:44:54 +00:00
|
|
|
|
2011-06-06 15:48:11 +00:00
|
|
|
} else if (pandora.user.ui.itemView == 'files') {
|
2012-02-17 16:13:48 +00:00
|
|
|
|
2011-06-06 15:48:11 +00:00
|
|
|
pandora.$ui.contentPanel.replaceElement(1,
|
2011-10-15 15:21:41 +00:00
|
|
|
pandora.$ui.item = pandora.ui.filesView({
|
2011-05-26 07:34:52 +00:00
|
|
|
id: result.data.id
|
2011-05-25 19:42:45 +00:00
|
|
|
})
|
|
|
|
);
|
2011-09-17 07:07:59 +00:00
|
|
|
|
2011-06-06 18:40:24 +00:00
|
|
|
} else if (pandora.user.ui.itemView == 'frames' || pandora.user.ui.itemView == 'posters') {
|
2012-02-17 16:13:48 +00:00
|
|
|
|
2011-06-06 18:40:24 +00:00
|
|
|
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
|
|
|
);
|
2012-02-17 16:13:48 +00:00
|
|
|
|
2011-05-25 19:42:45 +00:00
|
|
|
}
|
2012-02-17 16:13:48 +00:00
|
|
|
|
|
|
|
if (['video', 'timeline'].indexOf(pandora.user.ui.itemView) > -1) {
|
|
|
|
// handle links in annotations
|
|
|
|
var widget = pandora.user.ui.itemView == 'video' ? 'player' : 'editor';
|
|
|
|
pandora.$ui[widget].bindEvent('pandora_videopoints.' + pandora.user.ui.item.toLowerCase(), function(data) {
|
|
|
|
Ox.print('DATA.VALUE', JSON.stringify(data.value));
|
|
|
|
var options = {};
|
|
|
|
if (data.value.annotation) {
|
|
|
|
options.selected = pandora.user.ui.item + '/' + data.value.annotation;
|
|
|
|
} else {
|
|
|
|
// if annotation got set to something other than '',
|
|
|
|
// points and position will be set in consequence,
|
|
|
|
// so lets try to keep events from looping
|
|
|
|
['annotation', 'in', 'out', 'position'].forEach(function(key) {
|
|
|
|
if (!Ox.isUndefined(data.value[key])) {
|
|
|
|
options[key == 'annotation' ? 'selected' : key] = data.value[key];
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
pandora.$ui[widget].options(options);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2011-05-25 19:42:45 +00:00
|
|
|
});
|
2011-09-17 07:07:59 +00:00
|
|
|
|
2011-05-25 19:42:45 +00:00
|
|
|
return that;
|
2011-09-17 07:07:59 +00:00
|
|
|
|
2011-05-25 19:42:45 +00:00
|
|
|
};
|
|
|
|
|