add rudimentary support for itemFind

This commit is contained in:
rolux 2011-10-30 09:49:12 +00:00
parent 9342bcd391
commit d4e1bc7e56
5 changed files with 129 additions and 101 deletions

View file

@ -488,6 +488,7 @@
{"id": "data", "title": "Data"},
{"id": "files", "title": "Files"}
],
// fixme: should be renamed to annotationLayers
"layers": [
{
"id": "privatenotes",
@ -601,6 +602,7 @@
"icons": "posters",
"infoIconSize": 256,
"item": "",
"itemFind": {"conditions": [], "operator": "&"},
"itemSort": [{"key": "position", "operator": "+"}],
"itemView": "info",
"listColumns": ["title", "director", "country", "year", "language", "runtime", "genre"],

View file

@ -65,7 +65,9 @@ pandora.UI = (function() {
Ox.forEach(listSettings, function(listSetting, setting) {
if (!pandora.user.ui.lists[list]) {
// add default list setting and copy to settings
add['lists.' + that.encode(list) + '.' + listSetting] = pandora.site.user.ui[setting];
add[
'lists.' + that.encode(list) + '.' + listSetting
] = pandora.site.user.ui[setting];
add[setting] = pandora.site.user.ui[setting];
} else {
// copy lists setting to settings
@ -73,12 +75,13 @@ pandora.UI = (function() {
}
});
}
add.itemFind = pandora.isItemFind(args.find)
? args.find : pandora.site.user.ui.itemFind;
}
// it is important to check for find first, so that if find
// changes list, pandora.user.ui._list is correct here
var item = args['item'] || pandora.user.ui.item,
list = pandora.user.ui._list || '';
Ox.print('item/list', item, list, '...', args['videoPoints.' + item])
if (!pandora.user.ui.lists[list]) {
add['lists.' + that.encode(list)] = {};
}

View file

@ -98,12 +98,13 @@ pandora.URL = (function() {
if (!pandora.user.ui.item) {
state.view = pandora.user.ui.listView;
state.sort = pandora.user.ui.listSort;
state.find = pandora.user.ui.find;
} else {
state.item = pandora.user.ui.item;
state.view = pandora.user.ui.itemView;
state.sort = pandora.user.ui.itemSort;
state.find = pandora.user.ui.itemFind;
}
state.find = pandora.user.ui.find
}
Ox.print('STATE .................... ->', state)
return state;
@ -139,9 +140,10 @@ pandora.URL = (function() {
if (state.page == 'home') {
//pandora.$ui.home = pandora.ui.home().showScreen();
pandora.$ui.home = pandora.ui.home().fadeInScreen();
} else if ([
'about', 'contact', 'faq', 'news', 'rights', 'software', 'terms', 'tour'
].indexOf(state.page) > -1) {
} else if (
Ox.getPositionById(pandora.site.sitePages, state.page) > -1
|| state.page == 'software'
) {
pandora.$ui.siteDialog = pandora.ui.siteDialog(state.page).open();
} else if (state.page == 'help') {
pandora.$ui.helpDialog = pandora.ui.helpDialog().open();
@ -168,8 +170,7 @@ pandora.URL = (function() {
var set = {
section: state.type == pandora.site.itemsSection ? 'items' : state.type,
item: state.item,
//find: state.find
item: state.item
};
if (state.view) {
@ -195,6 +196,8 @@ pandora.URL = (function() {
set['mapFind'] = state.span.substr(1);
set['mapSelection'] = '';
}
} else if (state.view == 'calendar') {
// ...
}
}
@ -202,17 +205,20 @@ pandora.URL = (function() {
set[!state.item ? 'listSort' : 'itemSort'] = state.sort;
}
///*
if (state.find) {
if (!state.item) {
find = state.find;
set.find = find;
} else {
set.find = state.find;
} else if (pandora.isItemFind(state.find)) {
set.itemFind = state.find;
}
}
if (!find) {
find = pandora.user.ui.find;
pandora.user.ui._list = pandora.getListsState(find)
pandora.user.ui._groupsState = pandora.getGroupsState(find);
pandora.user.ui._findState = pandora.getFindState(find);
}
//*/
Ox.Request.cancel();
$('video').each(function() {

View file

@ -148,16 +148,13 @@ pandora.ui.item = function() {
);
} else if (pandora.user.ui.itemView == 'video') {
// fixme: duplicated
var clipsQuery = pandora.getClipsQuery(),
isClipsQuery = !!clipsQuery.conditions.length;
// ...
pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.player = Ox.VideoPanelPlayer({
annotationsSize: pandora.user.ui.annotationsSize,
censored: censored,
cuts: result.data.cuts || [],
duration: result.data.duration,
find: isClipsQuery ? clipsQuery.conditions[0].value : '',
find: pandora.user.ui.itemFind.conditions[0]
? pandora.user.ui.itemFind.conditions[0].value : '',
getTimelineImageURL: function(i) {
return '/' + pandora.user.ui.item + '/timeline64p' + i + '.png';
},
@ -176,6 +173,12 @@ pandora.ui.item = function() {
volume: pandora.user.ui.videoVolume,
width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1
}).bindEvent({
find: function(data) {
pandora.UI.set('itemFind', {
conditions: [{key: 'subtitles', value: data.find, operator: '='}],
operator: '&'
});
},
muted: function(data) {
pandora.UI.set('muted', data.muted);
},
@ -203,14 +206,14 @@ pandora.ui.item = function() {
}));
} else if (pandora.user.ui.itemView == 'timeline') {
var clipsQuery = pandora.getClipsQuery(),
isClipsQuery = !!clipsQuery.conditions.length;
pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.editor = Ox.VideoEditor({
pandora.$ui.contentPanel.replaceElement(1,
pandora.$ui.editor = Ox.VideoEditor({
annotationsSize: pandora.user.ui.annotationsSize,
censored: censored,
cuts: result.data.cuts || [],
duration: result.data.duration,
find: isClipsQuery ? clipsQuery.conditions[0].value : '',
find: pandora.user.ui.itemFind.conditions[0]
? pandora.user.ui.itemFind.conditions[0].value : '',
getFrameURL: function(position) {
return '/' + pandora.user.ui.item + '/' + Ox.last(pandora.site.video.resolutions) + 'p' + position + '.jpg';
},
@ -237,6 +240,12 @@ pandora.ui.item = function() {
videoSize: pandora.user.ui.videoSize,
width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1
}).bindEvent({
find: function(data) {
pandora.UI.set('itemFind', {
conditions: [{key: 'subtitles', value: data.find, operator: '='}],
operator: '&'
});
},
points: function(data) {
pandora.UI.set('videoPoints.' + pandora.user.ui.item, {
'in': data['in'],
@ -285,7 +294,8 @@ pandora.ui.item = function() {
pandora_showannotations: function(data) {
pandora.$ui.editor.options({showAnnotations: data.value});
}
}));
})
);
that.bindEvent('resize', function(data) {
//Ox.print('resize item', data)
pandora.$ui.editor.options({

View file

@ -435,6 +435,7 @@ pandora.getClipsItems = function(width) {
};
pandora.getClipsQuery = function() {
// fixme: nice, but not needed
function addClipsConditions(conditions) {
conditions.forEach(function(condition) {
if (condition.conditions) {
@ -678,6 +679,12 @@ pandora.isClipView = function(view, item) {
).indexOf(view) > -1;
};
pandora.isItemFind = function(find) {
return find.conditions.length == 1
&& Ox.getPositionById(pandora.site.layers, find.conditions[0].key) > -1
&& find.conditions[0].operator == '=';
};
pandora.signin = function(data) {
pandora.user = data.user;
pandora.user.ui._list = pandora.getListsState(pandora.user.ui.find);