better static page

This commit is contained in:
j 2012-01-09 15:25:52 +05:30 committed by rolux
parent 49bf1acab0
commit da70450f78
9 changed files with 57 additions and 29 deletions

View file

@ -823,9 +823,8 @@ def item(request, id):
keys = [ keys = [
'year', 'year',
'director', 'director',
'country', 'topic',
'keywords', 'description'
'summary'
] ]
data = [] data = []
for key in keys: for key in keys:
@ -848,12 +847,13 @@ def item(request, id):
'settings': settings, 'settings': settings,
'data': data, 'data': data,
'clips': clips, 'clips': clips,
'icon': 'poster', 'icon': settings.CONFIG['user']['ui']['icons'] == 'frames' and 'icon' or 'poster',
} }
for key in ('title', 'description', 'keywords'): for key in ('title', 'description', 'keywords'):
value = item.get({ value = item.get({
'description': 'summary' in keys and 'summary' or 'description' 'description': 'summary' in keys and 'summary' or 'description',
'keywords': 'topic' in keys and 'topic' or 'keywords'
}.get(key, key)) }.get(key, key))
if isinstance(value, list): if isinstance(value, list):
value = value = ', '.join(value) value = value = ', '.join(value)

View file

@ -46,7 +46,7 @@
"filters": [ "filters": [
{"id": "source", "title": "Sources", "type": "string"}, {"id": "source", "title": "Sources", "type": "string"},
{"id": "project", "title": "Projects", "type": "string"}, {"id": "project", "title": "Projects", "type": "string"},
{"id": "topics", "title": "Topics", "type": "string"}, {"id": "topic", "title": "Topics", "type": "string"},
{"id": "name", "title": "People", "type": "string"}, {"id": "name", "title": "People", "type": "string"},
{"id": "keywords", "title": "Keywords", "type": "string"}, {"id": "keywords", "title": "Keywords", "type": "string"},
{"id": "language", "title": "Languages", "type": "string"}, {"id": "language", "title": "Languages", "type": "string"},
@ -517,7 +517,7 @@
{"id": "source", "sort": [{"key": "name", "operator": "+"}]}, {"id": "source", "sort": [{"key": "name", "operator": "+"}]},
{"id": "project", "sort": [{"key": "name", "operator": "+"}]}, {"id": "project", "sort": [{"key": "name", "operator": "+"}]},
{"id": "topic", "sort": [{"key": "items", "operator": "-"}]}, {"id": "topic", "sort": [{"key": "items", "operator": "-"}]},
{"id": "people", "sort": [{"key": "items", "operator": "-"}]}, {"id": "name", "sort": [{"key": "items", "operator": "-"}]},
{"id": "keywords", "sort": [{"key": "items", "operator": "-"}]}, {"id": "keywords", "sort": [{"key": "items", "operator": "-"}]},
{"id": "places", "sort": [{"key": "items", "operator": "-"}]} {"id": "places", "sort": [{"key": "items", "operator": "-"}]}
], ],
@ -529,7 +529,7 @@
"itemFind": {"conditions": [], "operator": "&"}, "itemFind": {"conditions": [], "operator": "&"},
"itemSort": [{"key": "position", "operator": "+"}], "itemSort": [{"key": "position", "operator": "+"}],
"itemView": "info", "itemView": "info",
"listColumns": ["title", "director", "location", "source", "language", "duration", "source"], "listColumns": ["title", "director", "location", "source", "language", "duration"],
"listColumnWidth": {}, "listColumnWidth": {},
"listSelection": [], "listSelection": [],
"listSort": [{"key": "title", "operator": "+"}], "listSort": [{"key": "title", "operator": "+"}],

View file

@ -29,7 +29,7 @@
</head> </head>
<body> <body>
<noscript> <noscript>
<img src="/{{id}}/poster256.jpg" style="float: left; margin-right: 8px"> <img src="/{{id}}/{{icon}}256.jpg" style="float: left; margin-right: 8px">
<h1>{{title}}</h1> <h1>{{title}}</h1>
{% for i in data %} {% for i in data %}
<div> <div>

View file

@ -132,7 +132,7 @@ pandora.UI = (function() {
// if the item view doesn't change, remains a video view, // if the item view doesn't change, remains a video view,
// video points don't exist yet, and won't be set, // video points don't exist yet, and won't be set,
// add default video points // 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, // if video points don't exist yet, and won't be set,
// add default video points // add default video points
add['videoPoints.' + item] = {'in': 0, out: 0, position: 0}; add['videoPoints.' + item] = {annotation: '', 'in': 0, out: 0, position: 0};
} }
} }

View file

@ -39,7 +39,7 @@ pandora.URL = (function() {
// ... // ...
} else if (['video', 'timeline'].indexOf(state.view) > -1) { } else if (['video', 'timeline'].indexOf(state.view) > -1) {
var videoPoints = pandora.user.ui.videoPoints[state.item] || {}; var videoPoints = pandora.user.ui.videoPoints[state.item] || {};
state.span = Ox.merge( state.span = videoPoints.annotation || Ox.merge(
videoPoints.position videoPoints.position
? videoPoints.position ? videoPoints.position
: [], : [],
@ -57,6 +57,8 @@ pandora.URL = (function() {
function setState(state, callback) { function setState(state, callback) {
Ox.Log('URL', 'setState:', state);
pandora.user.ui._list = pandora.getListState(pandora.user.ui.find); pandora.user.ui._list = pandora.getListState(pandora.user.ui.find);
pandora.user.ui._filterState = pandora.getFilterState(pandora.user.ui.find); pandora.user.ui._filterState = pandora.getFilterState(pandora.user.ui.find);
pandora.user.ui._findState = pandora.getFindState(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 (state.span) {
if (['video', 'timeline'].indexOf(state.view) > -1) { if (['video', 'timeline'].indexOf(state.view) > -1) {
// fixme: this doesn't handle annotation ids if (Ox.isArray(state.span)) {
set['videoPoints.' + state.item] = { set['videoPoints.' + state.item] = {
position: state.span[0] || 0, annotation: '',
'in': state.span[1] || 0, 'in': state.span[1] || 0,
out: Math.max(state.span[1] || 0, state.span[2] || 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') { } else if (state.view == 'map') {
// fixme: this doesn't handle map coordinates // fixme: this doesn't handle map coordinates
@ -226,7 +232,7 @@ pandora.URL = (function() {
pages: [ pages: [
'about', 'api', 'contact', 'faq', 'help', 'home', 'news', 'about', 'api', 'contact', 'faq', 'help', 'home', 'news',
'preferences', 'rights', 'signin', 'signout', 'signup', 'preferences', 'rights', 'signin', 'signout', 'signup',
'software', 'terms', 'tour', 'tv' 'software', 'terms', 'tour', 'tutorial', 'tv'
], ],
sortKeys: sortKeys, sortKeys: sortKeys,
spanType: spanType, spanType: spanType,

View file

@ -101,6 +101,7 @@ pandora.ui.clipList = function(videoRatio) {
var id = data.ids[0], var id = data.ids[0],
item = !ui.item ? id.split('/')[0] : ui.item, item = !ui.item ? id.split('/')[0] : ui.item,
points = { points = {
annotation: that.value(id, 'annotations')[0].id.split('/')[1],
'in': that.value(id, 'in'), 'in': that.value(id, 'in'),
out: that.value(id, 'out') out: that.value(id, 'out')
}, },
@ -198,7 +199,6 @@ pandora.ui.clipList = function(videoRatio) {
that.options({sort: data.value}); that.options({sort: data.value});
} }
}); });
return that; return that;
} }

View file

@ -264,7 +264,7 @@ pandora.ui.infoView = function(data) {
) )
.appendTo($text); .appendTo($text);
var list_keys = ['language', 'category', 'director', 'cinematographer', 'features']; var list_keys = ['language', 'topic', 'director', 'cinematographer', 'features'];
$('<div>').html('<br>').appendTo($text); $('<div>').html('<br>').appendTo($text);
[ [
'date', 'date',
@ -275,7 +275,7 @@ pandora.ui.infoView = function(data) {
'language', 'language',
'source', 'source',
'project', 'project',
'category', 'topic',
'user', 'user',
].forEach(function(key) { ].forEach(function(key) {
var $div = $('<div>') var $div = $('<div>')
@ -387,14 +387,14 @@ pandora.ui.infoView = function(data) {
var edit = {id: data.id}; var edit = {id: data.id};
if (key == 'title') { if (key == 'title') {
edit[key] = value; edit[key] = value;
} else if(['director', 'country', 'language', 'category'].indexOf(key) > -1) { } else if(list_keys.indexOf(key) > -1) {
edit[key] = value ? value.split(', ') : []; edit[key] = value ? value.split(', ') : [];
} else { } else {
edit[key] = value; edit[key] = value;
} }
pandora.api.edit(edit, function(result) { pandora.api.edit(edit, function(result) {
Ox.Request.clearCache(); // fixme: too much? can change filter/list etc
if (result.data.id != data.id) { if (result.data.id != data.id) {
Ox.Request.clearCache(); // fixme: too much
pandora.UI.set({item: result.data.id}); pandora.UI.set({item: result.data.id});
pandora.$ui.browser.value(data.id, 'id', result.data.id); pandora.$ui.browser.value(data.id, 'id', result.data.id);
} }

View file

@ -226,6 +226,9 @@ pandora.ui.item = function() {
position: pandora.user.ui.videoPoints[pandora.user.ui.item].position, position: pandora.user.ui.videoPoints[pandora.user.ui.item].position,
posterFrame: parseInt(videoOptions.video.duration / 2), posterFrame: parseInt(videoOptions.video.duration / 2),
resolution: pandora.user.ui.videoResolution, 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, showAnnotations: pandora.user.ui.showAnnotations,
showLargeTimeline: true, showLargeTimeline: true,
subtitles: videoOptions.subtitles, subtitles: videoOptions.subtitles,
@ -259,6 +262,7 @@ pandora.ui.item = function() {
}, },
points: function(data) { points: function(data) {
pandora.UI.set('videoPoints.' + pandora.user.ui.item, { pandora.UI.set('videoPoints.' + pandora.user.ui.item, {
annotation: pandora.user.ui.videoPoints[pandora.user.ui.item].annotation,
'in': data['in'], 'in': data['in'],
out: data.out, out: data.out,
position: pandora.user.ui.videoPoints[pandora.user.ui.item].position position: pandora.user.ui.videoPoints[pandora.user.ui.item].position
@ -278,6 +282,9 @@ pandora.ui.item = function() {
resolution: function(data) { resolution: function(data) {
pandora.UI.set('videoResolution', data.resolution); 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) { subtitles: function(data) {
pandora.UI.set('videoSubtitles', data.subtitles); pandora.UI.set('videoSubtitles', data.subtitles);
}, },

View file

@ -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 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) // and returns the id (or none) and the view (or none)
// fixme: "subtitles:23" is still missing // fixme: "subtitles:23" is still missing
Ox.Log('', 'getMetadataByIdOrName', item, view, str); Ox.Log('URL', 'getMetadataByIdOrName', item, view, str);
var isName = str[0] == '@', var isName = str[0] == '@',
canBeAnnotation = ( canBeAnnotation = (
!view || view == 'video' || view == 'timeline' !view || view == 'video' || view == 'timeline'
@ -641,7 +641,7 @@ pandora.getMetadataByIdOrName = function(item, view, str, callback) {
str = isName ? str.substr(1) : str; str = isName ? str.substr(1) : str;
getId(canBeAnnotation ? 'annotation' : '', function(id) { getId(canBeAnnotation ? 'annotation' : '', function(id) {
if (id) { if (id) {
Ox.Log('', 'id?', id) Ox.Log('URL', 'id?', id)
callback(id, pandora.user.ui.videoView); callback(id, pandora.user.ui.videoView);
} else { } else {
getId(canBePlace ? 'place' : '', function(id) { getId(canBePlace ? 'place' : '', function(id) {
@ -668,20 +668,35 @@ pandora.getMetadataByIdOrName = function(item, view, str, callback) {
query: { query: {
conditions: [{ conditions: [{
key: isName ? 'name' : 'id', key: isName ? 'name' : 'id',
value: type == 'annotation' ? item + '/' + str : str, value: type != 'annotation' ? str : item + '/' + str,
operator: '==' operator: '=='
}], }],
operator: '&' operator: '&'
}, },
keys: ['id'], keys: type != 'annotation' ? ['id'] : ['id', 'in', 'out'],
range: [0, 1] range: [0, 1]
}, item ? { }, item && type != 'annotation' ? {
itemQuery: { itemQuery: {
conditions: [{key: 'id', value: item, operator: '=='}], conditions: [{key: 'id', value: item, operator: '=='}],
operator: '&' operator: '&'
} }
} : {}), function(result) { } : {}), 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 { } else {
callback(); callback();