2012-02-03 09:15:38 +00:00
|
|
|
'use strict';
|
2011-07-29 18:37:11 +00:00
|
|
|
|
2011-09-23 10:44:54 +00:00
|
|
|
pandora.ui.list = function() {
|
2012-06-30 16:15:08 +00:00
|
|
|
|
2013-07-21 12:59:11 +00:00
|
|
|
var that,
|
2014-01-23 14:35:38 +00:00
|
|
|
ui = pandora.user.ui,
|
|
|
|
view = ui.listView;
|
2011-09-23 10:44:54 +00:00
|
|
|
|
2011-05-25 19:42:45 +00:00
|
|
|
if (view == 'list') {
|
2012-06-27 07:41:39 +00:00
|
|
|
that = Ox.TableList({
|
2012-05-24 08:22:56 +00:00
|
|
|
columns: [].concat([{
|
2011-09-04 01:52:41 +00:00
|
|
|
align: 'center',
|
|
|
|
defaultWidth: 16,
|
|
|
|
format: function(value, data) {
|
|
|
|
var icon, width, height, margin, marginCSS, borderRadius;
|
2014-01-23 14:35:38 +00:00
|
|
|
if (ui.icons == 'posters') {
|
2011-09-04 01:52:41 +00:00
|
|
|
icon = 'poster';
|
|
|
|
width = value < 1 ? Math.round(14 * value / 2) * 2 : 14;
|
|
|
|
height = value < 1 ? 14 : Math.round(14 / value / 2) * 2;
|
|
|
|
margin = value < 1 ? Math.floor(7 - width / 2) - 3 : Math.floor(7 - height / 2);
|
|
|
|
marginCSS = value < 1 ? '0 0 0 ' + margin + 'px' : margin + 'px 0 0 -3px';
|
|
|
|
borderRadius = 0;
|
|
|
|
} else {
|
|
|
|
icon = 'icon';
|
|
|
|
width = 14;
|
|
|
|
height = 14;
|
|
|
|
marginCSS = '0 0 0 -3px';
|
|
|
|
borderRadius = '3px';
|
|
|
|
}
|
|
|
|
return $('<img>').css({
|
|
|
|
width: width - 2 + 'px',
|
|
|
|
height: height - 2 + 'px',
|
|
|
|
border: '1px solid rgb(48, 48, 48)',
|
|
|
|
borderRadius: '2px',
|
|
|
|
margin: marginCSS,
|
|
|
|
background: '-webkit-linear-gradient(top, rgb(32, 32, 32), rgb(0, 0, 0))'
|
|
|
|
}).load(function() {
|
|
|
|
$(this).css({
|
|
|
|
width: width + 'px',
|
|
|
|
height: height + 'px',
|
|
|
|
border: 0,
|
|
|
|
borderRadius: borderRadius
|
|
|
|
//background: 'transparent'
|
2012-01-09 12:17:55 +00:00
|
|
|
});
|
2011-09-04 01:52:41 +00:00
|
|
|
}).attr({
|
2014-02-02 11:30:25 +00:00
|
|
|
src: pandora.getMediaURL('/' + data.id + '/' + icon + '14.jpg?' + data.modified)
|
2011-09-04 01:52:41 +00:00
|
|
|
});
|
|
|
|
},
|
|
|
|
id: 'posterRatio',
|
2011-11-02 19:46:06 +00:00
|
|
|
resizable: false,
|
2013-05-09 10:13:58 +00:00
|
|
|
title: Ox._('Icon'),
|
2014-01-23 14:35:38 +00:00
|
|
|
titleImage: ui.icons == 'posters' ? 'SetPoster' : 'Icon',
|
|
|
|
visible: ui.listColumns.indexOf('posterRatio') > -1,
|
2011-09-04 01:52:41 +00:00
|
|
|
width: 16
|
2012-05-22 15:07:34 +00:00
|
|
|
}], pandora.site.sortKeys.filter(function(key) {
|
2012-04-19 09:34:40 +00:00
|
|
|
return !key.capability
|
2017-11-04 09:53:27 +00:00
|
|
|
|| pandora.hasCapability(key.capability);
|
2012-05-22 15:07:34 +00:00
|
|
|
}).map(function(key) {
|
2014-01-23 14:35:38 +00:00
|
|
|
var position = ui.listColumns.indexOf(key.id);
|
2012-05-22 15:07:34 +00:00
|
|
|
return {
|
2013-07-20 08:06:16 +00:00
|
|
|
addable: key.id != 'random',
|
2012-05-22 15:07:34 +00:00
|
|
|
align: ['string', 'text'].indexOf(
|
|
|
|
Ox.isArray(key.type) ? key.type[0]: key.type
|
|
|
|
) > -1 ? 'left' : key.type == 'list' ? 'center' : 'right',
|
|
|
|
defaultWidth: key.columnWidth,
|
|
|
|
format: key.format,
|
|
|
|
id: key.id,
|
|
|
|
operator: pandora.getSortOperator(key.id),
|
|
|
|
position: position,
|
|
|
|
removable: !key.columnRequired,
|
2013-05-09 10:13:58 +00:00
|
|
|
title: Ox._(key.title),
|
2012-05-22 15:07:34 +00:00
|
|
|
type: key.type,
|
|
|
|
visible: position > -1,
|
2014-01-23 14:35:38 +00:00
|
|
|
width: ui.listColumnWidth[key.id] || key.columnWidth
|
2012-05-22 15:07:34 +00:00
|
|
|
};
|
2011-11-02 19:46:06 +00:00
|
|
|
})),
|
2011-05-25 19:42:45 +00:00
|
|
|
columnsMovable: true,
|
|
|
|
columnsRemovable: true,
|
|
|
|
columnsResizable: true,
|
|
|
|
columnsVisible: true,
|
2011-09-01 09:17:49 +00:00
|
|
|
draggable: true,
|
2011-05-25 19:42:45 +00:00
|
|
|
id: 'list',
|
|
|
|
items: function(data, callback) {
|
2011-11-04 15:54:42 +00:00
|
|
|
//Ox.Log('', 'data, pandora.Query.toObject', data, pandora.Query.toObject())
|
2013-06-04 12:27:27 +00:00
|
|
|
pandora.api.find(Ox.extend(data, {
|
2014-01-23 14:35:38 +00:00
|
|
|
query: ui.find,
|
2016-09-15 15:20:24 +00:00
|
|
|
keys: data.keys ? ['editable', 'modified'].concat(data.keys) : void 0
|
2011-05-25 19:42:45 +00:00
|
|
|
}), callback);
|
2013-06-04 12:27:27 +00:00
|
|
|
return Ox.clone(data, true);
|
2011-05-25 19:42:45 +00:00
|
|
|
},
|
|
|
|
scrollbarVisible: true,
|
2014-01-23 14:35:38 +00:00
|
|
|
selected: ui.listSelection,
|
|
|
|
sort: ui.listSort,
|
2012-06-27 22:24:02 +00:00
|
|
|
unique: 'id'
|
2011-05-25 19:42:45 +00:00
|
|
|
})
|
|
|
|
.bindEvent({
|
2011-08-18 07:54:46 +00:00
|
|
|
columnchange: function(data) {
|
2011-06-27 13:39:35 +00:00
|
|
|
var columnWidth = {};
|
2011-09-26 16:46:31 +00:00
|
|
|
pandora.UI.set({listColumns: data.ids});
|
2011-05-25 19:42:45 +00:00
|
|
|
/*
|
|
|
|
data.ids.forEach(function(id) {
|
2011-10-29 17:46:46 +00:00
|
|
|
columnWidth[id] =
|
2014-01-23 14:35:38 +00:00
|
|
|
ui.lists[ui.list].columnWidth[id]
|
2011-09-26 16:46:31 +00:00
|
|
|
|| Ox.getObjectById(pandora.site.sortKeys, id).width
|
2011-05-25 19:42:45 +00:00
|
|
|
});
|
2011-09-26 16:46:31 +00:00
|
|
|
pandora.UI.set({listColumnWidth: columnWidth});
|
2011-05-25 19:42:45 +00:00
|
|
|
*/
|
|
|
|
},
|
2011-08-18 07:54:46 +00:00
|
|
|
columnresize: function(data) {
|
2011-09-26 16:46:31 +00:00
|
|
|
pandora.UI.set('listColumnWidth.' + data.id, data.width);
|
2011-05-25 19:42:45 +00:00
|
|
|
},
|
2011-08-18 07:54:46 +00:00
|
|
|
sort: function(data) {
|
2011-09-23 10:44:54 +00:00
|
|
|
pandora.UI.set({
|
|
|
|
listSort: [{key: data.key, operator: data.operator}]
|
|
|
|
});
|
2011-05-25 19:42:45 +00:00
|
|
|
}
|
|
|
|
});
|
2011-09-17 07:07:59 +00:00
|
|
|
} else if (view == 'grid') {
|
2011-06-19 17:49:25 +00:00
|
|
|
that = Ox.IconList({
|
2014-01-23 14:35:38 +00:00
|
|
|
borderRadius: ui.icons == 'posters' ? 0 : 16,
|
|
|
|
defaultRatio: ui.icons == 'posters' ? pandora.site.posters.ratio : 1,
|
2011-09-01 09:17:49 +00:00
|
|
|
draggable: true,
|
2011-05-25 19:42:45 +00:00
|
|
|
id: 'list',
|
|
|
|
item: function(data, sort, size) {
|
2014-01-23 14:35:38 +00:00
|
|
|
var ratio = ui.icons == 'posters'
|
2013-07-08 12:40:23 +00:00
|
|
|
? (ui.showSitePosters ? pandora.site.posters.ratio : data.posterRatio) : 1,
|
2014-02-02 11:30:25 +00:00
|
|
|
url = pandora.getMediaURL('/' + data.id + '/' + (
|
2011-10-09 12:46:35 +00:00
|
|
|
ui.icons == 'posters'
|
2012-03-20 11:56:30 +00:00
|
|
|
? (ui.showSitePosters ? 'siteposter' : 'poster') : 'icon'
|
2014-02-02 11:30:25 +00:00
|
|
|
) + size + '.jpg?' + data.modified),
|
2011-10-14 00:13:42 +00:00
|
|
|
format, info, sortKey = sort[0].key;
|
2012-03-08 13:27:12 +00:00
|
|
|
if (['title', 'director', 'random'].indexOf(sortKey) > -1) {
|
2015-03-29 17:24:05 +00:00
|
|
|
info = data['year'] || data['date'] || '';
|
2011-10-09 12:46:35 +00:00
|
|
|
} else {
|
2011-10-13 12:24:13 +00:00
|
|
|
format = pandora.getSortKeyData(sortKey).format;
|
2014-12-21 15:30:52 +00:00
|
|
|
if (Ox.isUndefined(data[sortKey]) || Ox.isNull(data[sortKey])) {
|
|
|
|
info = '';
|
|
|
|
} else if (format) {
|
2011-10-26 14:52:23 +00:00
|
|
|
info = (
|
|
|
|
/^color/.test(format.type.toLowerCase()) ? Ox.Theme : Ox
|
|
|
|
)['format' + Ox.toTitleCase(format.type)].apply(
|
2012-05-24 08:22:56 +00:00
|
|
|
this, [data[sortKey]].concat(format.args || [])
|
2011-10-26 14:52:23 +00:00
|
|
|
);
|
2013-03-03 12:38:41 +00:00
|
|
|
if (sortKey == 'rightslevel') {
|
2013-07-15 12:30:41 +00:00
|
|
|
info.css({width: size * 0.75 + 'px'});
|
2013-03-03 12:38:41 +00:00
|
|
|
}
|
2011-10-26 14:52:23 +00:00
|
|
|
} else {
|
2018-09-25 08:34:35 +00:00
|
|
|
info = data[sortKey] || '';
|
2011-10-26 14:52:23 +00:00
|
|
|
}
|
2011-10-09 12:46:35 +00:00
|
|
|
}
|
2011-05-25 19:42:45 +00:00
|
|
|
size = size || 128;
|
|
|
|
return {
|
2011-08-24 06:19:34 +00:00
|
|
|
height: Math.round(ratio <= 1 ? size : size / ratio),
|
2011-08-06 18:00:15 +00:00
|
|
|
id: data.id,
|
2011-09-29 06:16:54 +00:00
|
|
|
info: info,
|
2014-11-21 14:26:50 +00:00
|
|
|
title: pandora.getItemTitle(data),
|
2011-10-09 12:46:35 +00:00
|
|
|
url: url,
|
2011-08-24 06:19:34 +00:00
|
|
|
width: Math.round(ratio >= 1 ? size : size * ratio)
|
2011-05-25 19:42:45 +00:00
|
|
|
};
|
|
|
|
},
|
|
|
|
items: function(data, callback) {
|
2013-06-04 12:27:27 +00:00
|
|
|
pandora.api.find(Ox.extend(data, {
|
2014-01-23 14:35:38 +00:00
|
|
|
query: ui.find
|
2011-05-25 19:42:45 +00:00
|
|
|
}), callback);
|
2013-06-04 12:27:27 +00:00
|
|
|
return Ox.clone(data, true);
|
2011-05-25 19:42:45 +00:00
|
|
|
},
|
2016-09-15 15:20:24 +00:00
|
|
|
keys: ['id', 'editable', 'modified', 'posterRatio'].concat(pandora.site.itemTitleKeys),
|
2014-01-23 14:35:38 +00:00
|
|
|
selected: ui.listSelection,
|
2011-05-25 19:42:45 +00:00
|
|
|
size: 128,
|
2014-01-23 14:35:38 +00:00
|
|
|
sort: ui.listSort,
|
2011-05-25 19:42:45 +00:00
|
|
|
unique: 'id'
|
2012-12-29 16:40:02 +00:00
|
|
|
})
|
|
|
|
.addClass('OxMedia');
|
2011-06-27 13:39:35 +00:00
|
|
|
} else if (view == 'info') {
|
2011-08-19 02:13:16 +00:00
|
|
|
that = Ox.Element().css({margin: '16px'}).html(view + ' results view still missing.');
|
|
|
|
} else if (view == 'clips') {
|
2011-10-17 15:13:37 +00:00
|
|
|
that = Ox.InfoList({
|
2014-01-23 14:35:38 +00:00
|
|
|
borderRadius: ui.icons == 'posters' ? 0 : 16,
|
|
|
|
defaultRatio: ui.icons == 'posters' ? pandora.site.posters.ratio : 1,
|
2011-10-17 15:13:37 +00:00
|
|
|
draggable: true,
|
|
|
|
id: 'list',
|
|
|
|
item: function(data, sort, size) {
|
|
|
|
size = 128;
|
2021-09-30 20:44:20 +00:00
|
|
|
data.videoRatio = data.videoRatio || pandora.site.video.previewRatio;
|
2014-01-23 14:35:38 +00:00
|
|
|
var ratio = ui.icons == 'posters'
|
2013-07-08 12:40:23 +00:00
|
|
|
? (ui.showSitePosters ? pandora.site.posters.ratio : data.posterRatio) : 1,
|
2014-02-02 11:30:25 +00:00
|
|
|
url = pandora.getMediaURL('/' + data.id + '/' + (
|
2011-10-17 15:13:37 +00:00
|
|
|
ui.icons == 'posters'
|
2012-03-20 11:56:30 +00:00
|
|
|
? (ui.showSitePosters ? 'siteposter' : 'poster') : 'icon'
|
2014-02-02 11:30:25 +00:00
|
|
|
) + size + '.jpg?' + data.modified),
|
2011-10-17 15:13:37 +00:00
|
|
|
format, info, sortKey = sort[0].key;
|
|
|
|
if (['title', 'director'].indexOf(sortKey) > -1) {
|
2015-05-19 12:17:20 +00:00
|
|
|
info = data['year'] || data['date'] || '';
|
2011-10-17 15:13:37 +00:00
|
|
|
} else {
|
|
|
|
format = pandora.getSortKeyData(sortKey).format;
|
2018-09-25 08:34:35 +00:00
|
|
|
if (Ox.isUndefined(data[sortKey]) || Ox.isNull(data[sortKey])) {
|
|
|
|
info = '';
|
|
|
|
} else if (format) {
|
2011-10-26 14:52:23 +00:00
|
|
|
info = (
|
|
|
|
/^color/.test(format.type.toLowerCase()) ? Ox.Theme : Ox
|
|
|
|
)['format' + Ox.toTitleCase(format.type)].apply(
|
2012-05-24 08:22:56 +00:00
|
|
|
this, [data[sortKey]].concat(format.args || [])
|
2011-10-26 14:52:23 +00:00
|
|
|
);
|
2013-03-03 12:38:41 +00:00
|
|
|
if (sortKey == 'rightslevel') {
|
2013-07-15 12:30:41 +00:00
|
|
|
info.css({width: size * 0.75 + 'px'});
|
2013-03-03 12:38:41 +00:00
|
|
|
}
|
2011-10-26 14:52:23 +00:00
|
|
|
} else {
|
2018-09-25 08:34:35 +00:00
|
|
|
info = data[sortKey] || '';
|
2011-10-26 14:52:23 +00:00
|
|
|
}
|
2011-10-17 15:13:37 +00:00
|
|
|
}
|
|
|
|
return {
|
|
|
|
icon: {
|
|
|
|
height: Math.round(ratio <= 1 ? size : size / ratio),
|
|
|
|
id: data.id,
|
|
|
|
info: info,
|
2014-11-21 14:26:50 +00:00
|
|
|
title: pandora.getItemTitle(data),
|
2011-10-17 15:13:37 +00:00
|
|
|
url: url,
|
|
|
|
width: Math.round(ratio >= 1 ? size : size * ratio)
|
|
|
|
},
|
|
|
|
info: {
|
2013-08-05 22:03:02 +00:00
|
|
|
css: {marginTop: '2px'},
|
2011-10-19 10:47:33 +00:00
|
|
|
element: pandora.ui.itemClips,
|
2011-10-17 15:13:37 +00:00
|
|
|
id: data.id,
|
|
|
|
options: {
|
2011-10-19 16:40:52 +00:00
|
|
|
clips: data.clips,
|
2011-10-19 10:47:33 +00:00
|
|
|
duration: data.duration,
|
|
|
|
id: data.id,
|
|
|
|
ratio: data.videoRatio
|
2011-10-17 15:13:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
},
|
|
|
|
items: function(data, callback) {
|
2014-02-02 12:45:10 +00:00
|
|
|
pandora.getClipsQuery(function(clipsQuery) {
|
|
|
|
pandora.api.find(Ox.extend(data, {
|
|
|
|
query: ui.find,
|
|
|
|
clips: {
|
|
|
|
query: clipsQuery,
|
|
|
|
items: pandora.getClipsItems(),
|
|
|
|
keys: []
|
|
|
|
}
|
|
|
|
}), callback);
|
|
|
|
});
|
2013-06-04 12:27:27 +00:00
|
|
|
return Ox.clone(data, true);
|
2011-10-17 15:13:37 +00:00
|
|
|
},
|
2016-11-25 14:03:34 +00:00
|
|
|
keys: ['clips', 'duration', 'editable', 'id', 'modified', 'posterRatio', 'videoRatio', 'streams'].concat(pandora.site.itemTitleKeys),
|
2014-01-23 14:35:38 +00:00
|
|
|
selected: ui.listSelection,
|
2011-10-17 15:13:37 +00:00
|
|
|
size: 192,
|
2014-01-23 14:35:38 +00:00
|
|
|
sort: ui.listSort,
|
2011-10-20 16:49:01 +00:00
|
|
|
unique: 'id',
|
|
|
|
width: window.innerWidth
|
2014-01-23 14:35:38 +00:00
|
|
|
- ui.showSidebar * ui.sidebarSize - 1
|
2014-09-26 12:12:25 +00:00
|
|
|
- Ox.UI.SCROLLBAR_SIZE
|
2011-10-17 15:13:37 +00:00
|
|
|
})
|
2012-12-29 16:40:02 +00:00
|
|
|
.addClass('OxMedia')
|
2011-10-17 15:13:37 +00:00
|
|
|
.bindEvent({
|
|
|
|
key_left: function() {
|
|
|
|
// ...
|
|
|
|
},
|
|
|
|
key_right: function() {
|
|
|
|
// ...
|
|
|
|
}
|
|
|
|
});
|
2011-08-19 02:13:16 +00:00
|
|
|
} else if (view == 'timelines') {
|
|
|
|
that = Ox.InfoList({
|
2014-01-23 14:35:38 +00:00
|
|
|
borderRadius: ui.icons == 'posters' ? 0 : 16,
|
|
|
|
defaultRatio: ui.icons == 'posters' ? pandora.site.posters.ratio : 1,
|
2011-10-17 11:25:55 +00:00
|
|
|
draggable: true,
|
2011-08-18 11:32:47 +00:00
|
|
|
id: 'list',
|
|
|
|
item: function(data, sort, size) {
|
2011-08-19 06:40:19 +00:00
|
|
|
size = 128;
|
2011-10-20 13:33:18 +00:00
|
|
|
var clipsQuery = pandora.getClipsQuery(),
|
2024-09-16 19:51:37 +00:00
|
|
|
isClipsQuery = clipsQuery.conditions.length > 1,
|
2011-10-16 17:46:57 +00:00
|
|
|
ratio = ui.icons == 'posters'
|
2013-07-08 12:40:23 +00:00
|
|
|
? (ui.showSitePosters ? pandora.site.posters.ratio : data.posterRatio) : 1,
|
2014-02-02 11:30:25 +00:00
|
|
|
url = pandora.getMediaURL('/' + data.id + '/' + (
|
2011-10-16 17:46:57 +00:00
|
|
|
ui.icons == 'posters'
|
2012-03-20 11:56:30 +00:00
|
|
|
? (ui.showSitePosters ? 'siteposter' : 'poster') : 'icon'
|
2014-02-02 11:30:25 +00:00
|
|
|
) + size + '.jpg?' + data.modified),
|
2011-10-16 17:46:57 +00:00
|
|
|
format, info, sortKey = sort[0].key;
|
|
|
|
if (['title', 'director'].indexOf(sortKey) > -1) {
|
2015-05-19 12:17:20 +00:00
|
|
|
info = data['year'] || data['date'] || '';
|
2011-10-16 17:46:57 +00:00
|
|
|
} else {
|
|
|
|
format = pandora.getSortKeyData(sortKey).format;
|
2018-09-25 08:34:35 +00:00
|
|
|
if (Ox.isUndefined(data[sortKey]) || Ox.isNull(data[sortKey])) {
|
|
|
|
info = '';
|
|
|
|
} else if (format) {
|
2011-10-28 19:43:07 +00:00
|
|
|
info = (
|
|
|
|
/^color/.test(format.type.toLowerCase()) ? Ox.Theme : Ox
|
|
|
|
)['format' + Ox.toTitleCase(format.type)].apply(
|
2012-05-24 08:22:56 +00:00
|
|
|
this, [data[sortKey]].concat(format.args || [])
|
2011-10-28 19:43:07 +00:00
|
|
|
);
|
2013-03-03 12:38:41 +00:00
|
|
|
if (sortKey == 'rightslevel') {
|
2013-07-15 12:30:41 +00:00
|
|
|
info.css({width: size * 0.75 + 'px'});
|
2013-03-03 12:38:41 +00:00
|
|
|
}
|
2011-10-28 19:43:07 +00:00
|
|
|
} else {
|
2018-09-25 08:34:35 +00:00
|
|
|
info = data[sortKey] || '';
|
2011-10-28 19:43:07 +00:00
|
|
|
}
|
2011-10-17 15:13:37 +00:00
|
|
|
}
|
2011-08-18 11:32:47 +00:00
|
|
|
return {
|
2011-08-19 06:40:19 +00:00
|
|
|
icon: {
|
2011-10-16 17:46:57 +00:00
|
|
|
height: Math.round(ratio <= 1 ? size : size / ratio),
|
2011-08-19 06:40:19 +00:00
|
|
|
id: data.id,
|
2011-10-16 17:46:57 +00:00
|
|
|
info: info,
|
2014-11-21 14:26:50 +00:00
|
|
|
title: pandora.getItemTitle(data),
|
2011-10-16 17:46:57 +00:00
|
|
|
url: url,
|
|
|
|
width: Math.round(ratio >= 1 ? size : size * ratio)
|
2011-08-19 06:40:19 +00:00
|
|
|
},
|
2012-05-19 13:46:52 +00:00
|
|
|
info: data.rendered ? {
|
2011-10-17 15:13:37 +00:00
|
|
|
css: {marginTop: '2px'},
|
2011-08-19 06:40:19 +00:00
|
|
|
element: Ox.BlockVideoTimeline,
|
2011-10-17 10:19:17 +00:00
|
|
|
events: {
|
|
|
|
position: function(event) {
|
2014-01-23 14:35:38 +00:00
|
|
|
if (ui.videoPoints[data.id]) {
|
2011-10-20 13:33:18 +00:00
|
|
|
pandora.UI.set('videoPoints.' + data.id + '.position', event.position);
|
|
|
|
} else {
|
|
|
|
pandora.UI.set('videoPoints.' + data.id, {'in': 0, out: 0, position: event.position});
|
|
|
|
}
|
2012-06-10 19:19:37 +00:00
|
|
|
// FIXME: we need a way to set the position
|
|
|
|
// once the video preview has loaded
|
|
|
|
pandora.$ui.videoPreview && pandora.$ui.videoPreview.options({
|
|
|
|
position: event.position
|
|
|
|
});
|
2011-10-17 10:19:17 +00:00
|
|
|
}
|
|
|
|
},
|
2011-08-19 06:40:19 +00:00
|
|
|
id: data.id,
|
|
|
|
options: {
|
|
|
|
duration: data.duration,
|
2011-10-20 13:33:18 +00:00
|
|
|
find: isClipsQuery ? clipsQuery.conditions[0].value : '',
|
2012-04-18 07:45:17 +00:00
|
|
|
getImageURL: function(type, i) {
|
2014-02-02 11:30:25 +00:00
|
|
|
return pandora.getMediaURL(
|
|
|
|
'/' + data.id + '/timeline' + type + '16p' + i + '.jpg'
|
|
|
|
);
|
2011-10-17 10:19:17 +00:00
|
|
|
},
|
2014-01-23 14:35:38 +00:00
|
|
|
position: ui.videoPoints[data.id]
|
|
|
|
? ui.videoPoints[data.id].position : 0,
|
2011-10-20 13:33:18 +00:00
|
|
|
results: isClipsQuery ? data.clips.map(function(clip) {
|
2011-10-20 12:58:21 +00:00
|
|
|
return {'in': clip['in'], out: clip.out};
|
|
|
|
}) : [],
|
2011-10-20 13:33:18 +00:00
|
|
|
subtitles: isClipsQuery ? data.clips.map(function(clip) {
|
2011-10-20 12:58:21 +00:00
|
|
|
return {'in': clip['in'], out: clip.out, text: clip.annotations[0].value};
|
2012-04-18 07:45:17 +00:00
|
|
|
}) : [],
|
2014-01-23 14:35:38 +00:00
|
|
|
type: ui.videoTimeline
|
2011-08-19 06:40:19 +00:00
|
|
|
}
|
2012-05-19 13:46:52 +00:00
|
|
|
} : {
|
|
|
|
css: {marginTop: '2px'},
|
|
|
|
element: Ox.Element,
|
|
|
|
id: data.id,
|
|
|
|
options: {}
|
2011-08-19 06:40:19 +00:00
|
|
|
}
|
2011-08-18 11:32:47 +00:00
|
|
|
};
|
|
|
|
},
|
|
|
|
items: function(data, callback) {
|
2011-10-20 13:33:18 +00:00
|
|
|
var clipsQuery = pandora.getClipsQuery(),
|
2024-09-16 19:51:37 +00:00
|
|
|
isClipsQuery = clipsQuery.conditions.length > 1;
|
2013-06-04 12:27:27 +00:00
|
|
|
pandora.api.find(Ox.extend(data, Ox.extend({
|
2014-01-23 14:35:38 +00:00
|
|
|
query: ui.find
|
2011-10-20 12:58:21 +00:00
|
|
|
}, isClipsQuery ? {clips: {
|
|
|
|
query: clipsQuery,
|
|
|
|
items: 1000000,
|
|
|
|
keys: []
|
|
|
|
}} : {})), callback);
|
2013-06-04 12:27:27 +00:00
|
|
|
return Ox.clone(data, true);
|
2011-08-18 11:32:47 +00:00
|
|
|
},
|
2016-09-15 15:20:24 +00:00
|
|
|
keys: ['clips', 'duration', 'editable', 'id', 'modified', 'posterRatio', 'rendered'].concat(pandora.site.itemTitleKeys),
|
2014-01-23 14:35:38 +00:00
|
|
|
selected: ui.listSelection,
|
2011-08-19 02:13:16 +00:00
|
|
|
size: 192,
|
2014-01-23 14:35:38 +00:00
|
|
|
sort: ui.listSort,
|
2011-08-18 11:32:47 +00:00
|
|
|
unique: 'id'
|
2011-10-17 15:13:37 +00:00
|
|
|
})
|
|
|
|
.bindEvent({
|
|
|
|
key_left: function() {
|
|
|
|
// ...
|
|
|
|
},
|
|
|
|
key_right: function() {
|
|
|
|
// ...
|
|
|
|
}
|
|
|
|
});
|
2011-06-27 13:39:35 +00:00
|
|
|
} else if (view == 'maps') {
|
|
|
|
that = Ox.Element().css({margin: '16px'}).html(view + ' results view still missing.');
|
|
|
|
} else if (view == 'calendars') {
|
|
|
|
that = Ox.Element().css({margin: '16px'}).html(view + ' results view still missing.');
|
2011-06-16 20:00:10 +00:00
|
|
|
} else if (view == 'clip') {
|
2012-06-15 14:43:05 +00:00
|
|
|
that = pandora.$ui.clipList = pandora.ui.clipList();
|
2011-10-07 09:59:27 +00:00
|
|
|
} else if (view == 'video') {
|
2013-07-09 22:49:01 +00:00
|
|
|
that = pandora.ui.videoView();
|
2011-10-03 13:23:11 +00:00
|
|
|
} else if (['map', 'calendar'].indexOf(view) > -1) {
|
|
|
|
that = pandora.ui.navigationView(view);
|
2011-05-25 19:42:45 +00:00
|
|
|
}
|
|
|
|
|
2014-09-26 08:19:12 +00:00
|
|
|
if (['list', 'grid', 'clip'].indexOf(view) > -1) {
|
|
|
|
// react to the resize event of the split panel
|
|
|
|
that.bindEvent({
|
|
|
|
resize: function(data) {
|
|
|
|
that.size();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2013-07-10 17:27:38 +00:00
|
|
|
if (['list', 'grid', 'clips', 'timelines', 'video'].indexOf(view) > -1) {
|
2011-09-03 23:04:48 +00:00
|
|
|
|
2011-09-04 12:43:59 +00:00
|
|
|
pandora.enableDragAndDrop(that, true);
|
2011-08-28 06:24:01 +00:00
|
|
|
|
2011-09-04 12:43:59 +00:00
|
|
|
that.bindEvent({
|
|
|
|
closepreview: function(data) {
|
|
|
|
pandora.$ui.previewDialog.close();
|
2013-07-21 12:59:11 +00:00
|
|
|
delete pandora.$ui.previewDialog;
|
2011-09-04 12:43:59 +00:00
|
|
|
},
|
|
|
|
copy: function(data) {
|
2013-08-03 15:01:47 +00:00
|
|
|
pandora.clipboard.copy(data.ids, 'item');
|
2011-09-04 12:43:59 +00:00
|
|
|
},
|
2013-07-15 09:57:14 +00:00
|
|
|
copyadd: function(data) {
|
2013-08-03 15:01:47 +00:00
|
|
|
pandora.clipboard.add(data.ids, 'item');
|
2013-07-15 09:57:14 +00:00
|
|
|
},
|
2013-08-03 14:00:25 +00:00
|
|
|
cut: function(data) {
|
|
|
|
var listData = pandora.getListData();
|
|
|
|
if (listData.editable && listData.type == 'static') {
|
2013-08-03 15:01:47 +00:00
|
|
|
pandora.clipboard.copy(data.ids, 'item');
|
2014-01-23 14:35:38 +00:00
|
|
|
pandora.doHistory('cut', data.ids, ui._list, function() {
|
2013-08-03 14:00:25 +00:00
|
|
|
pandora.UI.set({listSelection: []});
|
|
|
|
pandora.reloadList();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
cutadd: function(data) {
|
|
|
|
var listData = pandora.getListData();
|
|
|
|
if (listData.editable && listData.type == 'static') {
|
2013-08-03 15:01:47 +00:00
|
|
|
pandora.clipboard.add(data.ids, 'item');
|
2014-01-23 14:35:38 +00:00
|
|
|
pandora.doHistory('cut', data.ids, ui._list, function() {
|
2013-08-03 14:00:25 +00:00
|
|
|
pandora.UI.set({listSelection: []});
|
|
|
|
pandora.reloadList();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
2011-09-04 12:43:59 +00:00
|
|
|
'delete': function(data) {
|
2013-08-02 15:10:47 +00:00
|
|
|
var listData = pandora.getListData();
|
|
|
|
if (listData.editable && listData.type == 'static') {
|
2014-01-23 14:35:38 +00:00
|
|
|
pandora.doHistory('delete', data.ids, ui._list, function() {
|
2013-08-02 15:10:47 +00:00
|
|
|
pandora.UI.set({listSelection: []});
|
|
|
|
pandora.reloadList();
|
|
|
|
});
|
|
|
|
}
|
2011-09-04 12:43:59 +00:00
|
|
|
},
|
|
|
|
init: function(data) {
|
2013-06-04 12:27:27 +00:00
|
|
|
var folder, list;
|
|
|
|
if (data.query.conditions.length == 0) {
|
2013-02-09 05:14:47 +00:00
|
|
|
pandora.$ui.allItems.update(data.items);
|
|
|
|
} else if (
|
2013-06-04 12:27:27 +00:00
|
|
|
data.query.conditions.length == 1
|
|
|
|
&& data.query.conditions[0].key == 'list'
|
|
|
|
&& data.query.conditions[0].operator == '=='
|
2013-02-09 05:14:47 +00:00
|
|
|
) {
|
2013-06-04 12:27:27 +00:00
|
|
|
list = data.query.conditions[0].value;
|
2013-02-09 05:14:47 +00:00
|
|
|
folder = pandora.getListData(list).folder;
|
2015-11-23 14:52:47 +00:00
|
|
|
if (pandora.$ui.folderList[folder]
|
|
|
|
&& !Ox.isEmpty(pandora.$ui.folderList[folder].value(list))) {
|
2013-02-09 08:26:22 +00:00
|
|
|
pandora.$ui.folderList[folder].value(
|
|
|
|
list, 'items', data.items
|
|
|
|
);
|
|
|
|
}
|
2013-02-09 05:14:47 +00:00
|
|
|
}
|
2012-03-21 04:58:02 +00:00
|
|
|
pandora.$ui.statusbar.set('total', data);
|
2011-09-04 12:43:59 +00:00
|
|
|
data = [];
|
2011-09-17 18:36:30 +00:00
|
|
|
pandora.site.totals.forEach(function(v) {
|
2011-09-04 12:43:59 +00:00
|
|
|
data[v.id] = 0;
|
|
|
|
});
|
2012-03-21 04:58:02 +00:00
|
|
|
pandora.$ui.statusbar.set('selected', data);
|
2011-09-04 12:43:59 +00:00
|
|
|
},
|
|
|
|
open: function(data) {
|
2011-10-19 12:29:16 +00:00
|
|
|
var set = {item: data.ids[0]};
|
|
|
|
if (data.isSpecialTarget) {
|
2014-01-23 14:35:38 +00:00
|
|
|
set.itemView = ui.videoView;
|
2011-10-19 12:29:16 +00:00
|
|
|
}
|
2014-01-23 14:35:38 +00:00
|
|
|
if (['accessed', 'timesaccessed'].indexOf(ui.listSort[0].key) > -1) {
|
2012-02-17 10:06:43 +00:00
|
|
|
Ox.Request.clearCache('find');
|
|
|
|
}
|
2011-10-19 12:29:16 +00:00
|
|
|
pandora.UI.set(set);
|
2011-09-04 12:43:59 +00:00
|
|
|
},
|
|
|
|
openpreview: function(data) {
|
2013-07-21 12:59:11 +00:00
|
|
|
if (!pandora.$ui.previewDialog) {
|
|
|
|
pandora.$ui.previewDialog = pandora.ui.previewDialog()
|
|
|
|
.open()
|
|
|
|
.bindEvent({
|
|
|
|
close: function() {
|
|
|
|
that.closePreview();
|
|
|
|
delete pandora.$ui.previewDialog;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
pandora.$ui.previewDialog.update();
|
2011-12-23 08:17:51 +00:00
|
|
|
}
|
2011-09-04 12:43:59 +00:00
|
|
|
},
|
|
|
|
paste: function(data) {
|
2013-08-03 15:01:47 +00:00
|
|
|
var items = pandora.clipboard.paste();
|
|
|
|
if (items.length && pandora.clipboard.type() == 'item' && pandora.getListData().editable) {
|
2014-01-23 14:35:38 +00:00
|
|
|
pandora.doHistory('paste', items, ui._list, function() {
|
2013-08-02 15:10:47 +00:00
|
|
|
pandora.UI.set({listSelection: items});
|
|
|
|
pandora.reloadList();
|
|
|
|
});
|
2013-07-13 23:01:17 +00:00
|
|
|
}
|
2011-09-04 12:43:59 +00:00
|
|
|
},
|
|
|
|
select: function(data) {
|
2011-12-19 17:20:06 +00:00
|
|
|
var query;
|
2011-09-23 10:44:54 +00:00
|
|
|
pandora.UI.set('listSelection', data.ids);
|
2011-12-23 08:17:51 +00:00
|
|
|
if (data.ids.length == 0) {
|
2012-03-21 04:58:02 +00:00
|
|
|
pandora.$ui.statusbar.set('selected', {items: 0});
|
2011-12-19 17:20:06 +00:00
|
|
|
} else {
|
2011-12-23 08:17:51 +00:00
|
|
|
if (Ox.isUndefined(data.rest)) {
|
|
|
|
query = {
|
|
|
|
conditions: data.ids.map(function(id) {
|
|
|
|
return {
|
|
|
|
key: 'id',
|
|
|
|
value: id,
|
|
|
|
operator: '=='
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
operator: '|'
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
query = {
|
2014-01-23 14:35:38 +00:00
|
|
|
conditions: [ui.find].concat(
|
2012-05-24 08:22:56 +00:00
|
|
|
data.rest.map(function(id) {
|
|
|
|
return {
|
|
|
|
key: 'id',
|
|
|
|
value: id,
|
|
|
|
operator: '!='
|
|
|
|
};
|
|
|
|
})
|
|
|
|
),
|
2011-12-23 08:17:51 +00:00
|
|
|
operator: '&'
|
|
|
|
};
|
|
|
|
}
|
|
|
|
pandora.api.find({
|
|
|
|
query: query
|
|
|
|
}, function(result) {
|
2012-03-21 04:58:02 +00:00
|
|
|
pandora.$ui.statusbar.set('selected', result.data);
|
2011-12-23 08:17:51 +00:00
|
|
|
});
|
2011-12-19 17:20:06 +00:00
|
|
|
}
|
2011-10-13 12:04:27 +00:00
|
|
|
},
|
2011-10-29 12:31:16 +00:00
|
|
|
pandora_listselection: function(data) {
|
|
|
|
that.options({selected: data.value});
|
|
|
|
},
|
2011-10-13 12:04:27 +00:00
|
|
|
pandora_listsort: function(data) {
|
|
|
|
that.options({sort: data.value});
|
2011-05-25 19:42:45 +00:00
|
|
|
}
|
2011-09-04 12:43:59 +00:00
|
|
|
});
|
2011-10-29 17:46:46 +00:00
|
|
|
|
2011-09-04 12:43:59 +00:00
|
|
|
}
|
|
|
|
|
2012-06-15 13:35:48 +00:00
|
|
|
if (['list', 'grid', 'timelines'].indexOf(view) > -1) {
|
2011-09-27 23:30:13 +00:00
|
|
|
that.bindEvent({
|
|
|
|
pandora_icons: function(data) {
|
2011-11-03 12:58:22 +00:00
|
|
|
var src, previousSrc;
|
2011-11-02 20:02:11 +00:00
|
|
|
// fixme: doesn't update title icon, passes useless options
|
2011-11-03 12:58:22 +00:00
|
|
|
if (hasIcons()) {
|
2014-01-23 14:35:38 +00:00
|
|
|
if (ui.listView == 'list') {
|
2014-09-26 12:30:51 +00:00
|
|
|
src = Ox.UI.getImageURL(
|
2011-11-03 12:58:22 +00:00
|
|
|
data.value == 'posters' ? 'symbolSetPoster' : 'symbolIcon'
|
|
|
|
);
|
2014-09-26 12:30:51 +00:00
|
|
|
previousSrc = Ox.UI.getImageURL(
|
2011-11-03 12:58:22 +00:00
|
|
|
data.previousValue == 'posters' ? 'symbolSetPoster' : 'symbolIcon'
|
2012-05-22 13:15:16 +00:00
|
|
|
);
|
|
|
|
that.find('img[src="' + previousSrc + '"]').attr({src: src});
|
2011-11-03 12:58:22 +00:00
|
|
|
} else {
|
|
|
|
that.options({
|
|
|
|
borderRadius: data.value == 'posters' ? 0 : 16,
|
2013-07-08 12:40:23 +00:00
|
|
|
defaultRatio: data.value == 'posters' ? pandora.site.posters.ratio : 1
|
2011-11-03 12:58:22 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
that.reloadList(true);
|
|
|
|
}
|
2011-09-23 10:44:54 +00:00
|
|
|
},
|
2012-03-20 12:01:26 +00:00
|
|
|
pandora_showsiteposters: function() {
|
2011-11-02 20:02:11 +00:00
|
|
|
// fixme: should be disabled if ui.icons != 'posters'
|
2014-01-23 14:35:38 +00:00
|
|
|
hasIcons() && ui.icons == 'posters' && that.reloadList(true);
|
2011-09-23 10:44:54 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2012-06-15 13:35:48 +00:00
|
|
|
if (view == 'timelines') {
|
|
|
|
that.bindEvent({
|
|
|
|
pandora_videotimeline: function(data) {
|
|
|
|
that.reloadList(true);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2011-11-02 20:02:11 +00:00
|
|
|
function hasIcons() {
|
|
|
|
return (
|
2014-01-23 14:35:38 +00:00
|
|
|
ui.listView == 'list'
|
|
|
|
&& ui.listColumns.indexOf('posterRatio') > -1
|
|
|
|
) || ['grid', 'timelines'].indexOf(ui.listView) > -1;
|
2011-11-02 20:02:11 +00:00
|
|
|
}
|
|
|
|
|
2011-05-25 19:42:45 +00:00
|
|
|
return that;
|
2011-09-04 12:43:59 +00:00
|
|
|
|
2011-05-25 19:42:45 +00:00
|
|
|
};
|
|
|
|
|