diff --git a/static/js/pandora/UI.js b/static/js/pandora/UI.js
index 46d53b7df..18aac2b23 100644
--- a/static/js/pandora/UI.js
+++ b/static/js/pandora/UI.js
@@ -132,7 +132,7 @@ pandora.UI = (function() {
// if the item view doesn't change, remains a video view,
// video points don't exist yet, and won't be set,
// add default video points
- add['videoPoints.' + item] = {'in': 0, out: 0, position: 0};
+ add['videoPoints.' + item] = {annotation: '', 'in': 0, out: 0, position: 0};
}
}
@@ -145,7 +145,7 @@ pandora.UI = (function() {
) {
// if video points don't exist yet, and won't be set,
// add default video points
- add['videoPoints.' + item] = {'in': 0, out: 0, position: 0};
+ add['videoPoints.' + item] = {annotation: '', 'in': 0, out: 0, position: 0};
}
}
diff --git a/static/js/pandora/URL.js b/static/js/pandora/URL.js
index a557fa687..e0dbd65c2 100644
--- a/static/js/pandora/URL.js
+++ b/static/js/pandora/URL.js
@@ -39,7 +39,7 @@ pandora.URL = (function() {
// ...
} else if (['video', 'timeline'].indexOf(state.view) > -1) {
var videoPoints = pandora.user.ui.videoPoints[state.item] || {};
- state.span = Ox.merge(
+ state.span = videoPoints.annotation || Ox.merge(
videoPoints.position
? videoPoints.position
: [],
@@ -57,6 +57,8 @@ pandora.URL = (function() {
function setState(state, callback) {
+ Ox.Log('URL', 'setState:', state);
+
pandora.user.ui._list = pandora.getListState(pandora.user.ui.find);
pandora.user.ui._filterState = pandora.getFilterState(pandora.user.ui.find);
pandora.user.ui._findState = pandora.getFindState(pandora.user.ui.find);
@@ -86,11 +88,15 @@ pandora.URL = (function() {
if (state.span) {
if (['video', 'timeline'].indexOf(state.view) > -1) {
- // fixme: this doesn't handle annotation ids
- set['videoPoints.' + state.item] = {
- position: state.span[0] || 0,
- 'in': state.span[1] || 0,
- out: Math.max(state.span[1] || 0, state.span[2] || 0)
+ if (Ox.isArray(state.span)) {
+ set['videoPoints.' + state.item] = {
+ annotation: '',
+ 'in': state.span[1] || 0,
+ out: Math.max(state.span[1] || 0, state.span[2] || 0),
+ position: state.span[0]
+ };
+ } else {
+ set['videoPoints.' + state.item + '.annotation'] = state.span;
}
} else if (state.view == 'map') {
// fixme: this doesn't handle map coordinates
@@ -226,7 +232,7 @@ pandora.URL = (function() {
pages: [
'about', 'api', 'contact', 'faq', 'help', 'home', 'news',
'preferences', 'rights', 'signin', 'signout', 'signup',
- 'software', 'terms', 'tour', 'tv'
+ 'software', 'terms', 'tour', 'tutorial', 'tv'
],
sortKeys: sortKeys,
spanType: spanType,
diff --git a/static/js/pandora/clipList.js b/static/js/pandora/clipList.js
index eacd278b8..6e7817549 100644
--- a/static/js/pandora/clipList.js
+++ b/static/js/pandora/clipList.js
@@ -101,6 +101,7 @@ pandora.ui.clipList = function(videoRatio) {
var id = data.ids[0],
item = !ui.item ? id.split('/')[0] : ui.item,
points = {
+ annotation: that.value(id, 'annotations')[0].id.split('/')[1],
'in': that.value(id, 'in'),
out: that.value(id, 'out')
},
@@ -198,7 +199,6 @@ pandora.ui.clipList = function(videoRatio) {
that.options({sort: data.value});
}
});
-
return that;
}
diff --git a/static/js/pandora/infoView.padma.js b/static/js/pandora/infoView.padma.js
index dd7053968..9beeea5b0 100644
--- a/static/js/pandora/infoView.padma.js
+++ b/static/js/pandora/infoView.padma.js
@@ -264,7 +264,7 @@ pandora.ui.infoView = function(data) {
)
.appendTo($text);
- var list_keys = ['language', 'category', 'director', 'cinematographer', 'features'];
+ var list_keys = ['language', 'topic', 'director', 'cinematographer', 'features'];
$('
').html('
').appendTo($text);
[
'date',
@@ -275,7 +275,7 @@ pandora.ui.infoView = function(data) {
'language',
'source',
'project',
- 'category',
+ 'topic',
'user',
].forEach(function(key) {
var $div = $('
')
@@ -387,14 +387,14 @@ pandora.ui.infoView = function(data) {
var edit = {id: data.id};
if (key == 'title') {
edit[key] = value;
- } else if(['director', 'country', 'language', 'category'].indexOf(key) > -1) {
+ } else if(list_keys.indexOf(key) > -1) {
edit[key] = value ? value.split(', ') : [];
} else {
edit[key] = value;
}
pandora.api.edit(edit, function(result) {
+ Ox.Request.clearCache(); // fixme: too much? can change filter/list etc
if (result.data.id != data.id) {
- Ox.Request.clearCache(); // fixme: too much
pandora.UI.set({item: result.data.id});
pandora.$ui.browser.value(data.id, 'id', result.data.id);
}
diff --git a/static/js/pandora/item.js b/static/js/pandora/item.js
index 70284bac6..793ed8b9a 100644
--- a/static/js/pandora/item.js
+++ b/static/js/pandora/item.js
@@ -226,6 +226,9 @@ pandora.ui.item = function() {
position: pandora.user.ui.videoPoints[pandora.user.ui.item].position,
posterFrame: parseInt(videoOptions.video.duration / 2),
resolution: pandora.user.ui.videoResolution,
+ selected: pandora.user.ui.videoPoints[pandora.user.ui.item].annotation
+ ? pandora.user.ui.item + '/' + pandora.user.ui.videoPoints[pandora.user.ui.item].annotation
+ : '',
showAnnotations: pandora.user.ui.showAnnotations,
showLargeTimeline: true,
subtitles: videoOptions.subtitles,
@@ -259,6 +262,7 @@ pandora.ui.item = function() {
},
points: function(data) {
pandora.UI.set('videoPoints.' + pandora.user.ui.item, {
+ annotation: pandora.user.ui.videoPoints[pandora.user.ui.item].annotation,
'in': data['in'],
out: data.out,
position: pandora.user.ui.videoPoints[pandora.user.ui.item].position
@@ -278,6 +282,9 @@ pandora.ui.item = function() {
resolution: function(data) {
pandora.UI.set('videoResolution', data.resolution);
},
+ select: function(data) {
+ pandora.UI.set('videoPoints.' + pandora.user.ui.item + '.annotation', data.id.split('/')[1]);
+ },
subtitles: function(data) {
pandora.UI.set('videoSubtitles', data.subtitles);
},
diff --git a/static/js/pandora/utils.js b/static/js/pandora/utils.js
index dc9acb5c9..f70b04f02 100644
--- a/static/js/pandora/utils.js
+++ b/static/js/pandora/utils.js
@@ -631,7 +631,7 @@ pandora.getMetadataByIdOrName = function(item, view, str, callback) {
// and checks if it's an annotation/event/place id or an event/place name,
// and returns the id (or none) and the view (or none)
// fixme: "subtitles:23" is still missing
- Ox.Log('', 'getMetadataByIdOrName', item, view, str);
+ Ox.Log('URL', 'getMetadataByIdOrName', item, view, str);
var isName = str[0] == '@',
canBeAnnotation = (
!view || view == 'video' || view == 'timeline'
@@ -641,7 +641,7 @@ pandora.getMetadataByIdOrName = function(item, view, str, callback) {
str = isName ? str.substr(1) : str;
getId(canBeAnnotation ? 'annotation' : '', function(id) {
if (id) {
- Ox.Log('', 'id?', id)
+ Ox.Log('URL', 'id?', id)
callback(id, pandora.user.ui.videoView);
} else {
getId(canBePlace ? 'place' : '', function(id) {
@@ -668,20 +668,35 @@ pandora.getMetadataByIdOrName = function(item, view, str, callback) {
query: {
conditions: [{
key: isName ? 'name' : 'id',
- value: type == 'annotation' ? item + '/' + str : str,
+ value: type != 'annotation' ? str : item + '/' + str,
operator: '=='
}],
operator: '&'
},
- keys: ['id'],
+ keys: type != 'annotation' ? ['id'] : ['id', 'in', 'out'],
range: [0, 1]
- }, item ? {
+ }, item && type != 'annotation' ? {
itemQuery: {
conditions: [{key: 'id', value: item, operator: '=='}],
operator: '&'
}
} : {}), function(result) {
- callback(result.data.items.length ? result.data.items[0].id : '');
+ var annotation, span;
+ if (result.data.items.length) {
+ span = result.data.items[0];
+ annotation = span.id.split('/')[1];
+ type == 'annotation' && pandora.UI.set('videoPoints.' + item, {
+ annotation: annotation,
+ 'in': span['in'],
+ out: span.out,
+ position: span['in']
+ });
+ }
+ callback(
+ !span ? ''
+ : type != 'annotation' ? span.id
+ : annotation
+ );
});
} else {
callback();