Compare commits

..

No commits in common. "7fa2a8a33803ec632d1471933a5cf2c65291b5ba" and "ae211e0e95e295bd7ff3faa67709116dc1fc8023" have entirely different histories.

3 changed files with 38 additions and 144 deletions

View file

@ -37,7 +37,6 @@ pandora.ui.documentFilterForm = function(options) {
return item.id;
})
}]),
listName: Ox._('Collection'),
list: mode == 'find' ? {
sort: pandora.user.ui.collectionSort,
view: pandora.user.ui.collectionView

View file

@ -12,9 +12,7 @@ pandora.ui.filterDialog = function() {
click: function() {
var list = pandora.$ui.filterForm.getList();
if (list.save) {
pandora.api[
pandora.user.ui.section == 'documents' ? 'addCollection' : 'addList'
]({
pandora.api.addList({
name: list.name,
query: list.query,
status: 'private',
@ -22,21 +20,12 @@ pandora.ui.filterDialog = function() {
}, function(result) {
var $list = pandora.$ui.folderList.personal,
id = result.data.id;
if (pandora.user.ui.section) {
pandora.UI.set({
findDocuments: {
conditions: [{key: 'collection', value: id, operator: '=='}],
operator: '&'
}
});
} else {
pandora.UI.set({
find: {
conditions: [{key: 'list', value: id, operator: '=='}],
operator: '&'
}
});
}
Ox.Request.clearCache(); // fixme: remove
$list.bindEventOnce({
load: function(data) {

View file

@ -919,130 +919,21 @@ pandora.ui.infoView = function(data, isMixed) {
});
}
function renderFrames() {
pandora.api.get({
id: data.id,
keys: ['frames']
}, 0, function(result) {
var images = result.data.frames.map(function(image) {
return Ox.extend(image, {index: image.index.toString()});
}),
selectedImage = images.filter(function(image) {
return image.selected;
})[0],
modified = data.modified;
$list = Ox.IconList({
defaultRatio: !data.stream ? pandora.site.posters.ratio : data.stream.aspectratio,
fixedRatio: !data.stream ? false : data.stream.aspectratio,
item: function(data, sort, size) {
var ratio = data.width / data.height;
size = size || 128;
return {
height: ratio <= 1 ? size : size / ratio,
id: data.id,
info: data.width + ' × ' + data.height + ' px',
title: Ox.formatDuration(data.position),
url: data.url,
width: ratio >= 1 ? size : size * ratio
}
},
items: images,
keys: ['index', 'position', 'width', 'height', 'url'],
max: 1,
min: 1,
orientation: 'both',
// fixme: should never be undefined
selected: selectedImage ? [selectedImage['index']] : [],
size: 128,
sort: [{key: 'index', operator: '+'}],
unique: 'index'
})
.addClass('OxMedia')
.css({
display: 'block',
position: 'absolute',
left: 0,
top: 0,
width: listWidth + 'px',
height: getHeight() + 'px'
})
.bindEvent({
select: function(event) {
var index = event.ids[0];
selectedImage = images.filter(function(image) {
return image.index == index;
})[0];
var imageRatio = selectedImage.width / selectedImage.height,
src = selectedImage.url
if ($browserImages.length == 0) {
$browserImages = pandora.$ui.browser.find('img[src*="/' + data.id + '/"]');
}
pandora.api.setPosterFrame({
id: data.id,
// fixme: api slightly inconsistent, this shouldn't be "position"
position: selectedImage.index
}, function() {
var src;
Ox.Request.clearCache();
if (ui.icons == 'frames') {
src = pandora.getMediaURL('/' + data.id + '/icon512.jpg?' + Ox.uid());
$icon.attr({src: src});
$reflectionIcon.attr({src: src});
if (pandora.$ui.videoPreview) {
pandora.$ui.videoPreview.options({
position: $list.value(selectedImage.index, 'position')
});
}
} else if (ui.icons == 'posters' && ui.showSitePosters) {
src = pandora.getMediaURL('/' + data.id + '/siteposter512.jpg?' + Ox.uid());
$icon.attr({src: src});
$reflectionIcon.attr({src: src});
}
$browserImages.each(function() {
$(this).attr({src: pandora.getMediaURL('/' + data.id + '/' + (
ui.icons == 'posters'
? ui.showSitePosters ? 'siteposter' : 'poster'
: 'icon'
) + '128.jpg?' + Ox.uid())});
});
if (ui.listSort[0].key == 'modified') {
pandora.$ui.browser.reloadList();
}
});
}
})
.appendTo($info);
$list.size();
});
}
function renderList() {
if (ui.icons == 'posters' && !ui.showSitePosters) {
renderPosters()
} else {
renderFrames()
}
}
function renderPosters() {
pandora.api.get({
id: data.id,
keys: ['posters']
keys: [ui.icons == 'posters' ? 'posters' : 'frames']
}, 0, function(result) {
var images = result.data.posters.map(function(image) {
var images = result.data[ui.icons == 'posters' ? 'posters' : 'frames'].map(function(image) {
return Ox.extend(image, {index: image.index.toString()});
}),
selectedImage = images.filter(function(image) {
return image.selected;
})[0],
modified = data.modified;
if (images.length == 1) {
renderFrames()
return
}
$list = Ox.IconList({
defaultRatio: pandora.site.posters.ratio,
fixedRatio: false,
defaultRatio: ui.icons == 'posters' || !data.stream ? pandora.site.posters.ratio : data.stream.aspectratio,
fixedRatio: ui.icons == 'posters' || !data.stream ? false : data.stream.aspectratio,
item: function(data, sort, size) {
var ratio = data.width / data.height;
size = size || 128;
@ -1050,15 +941,17 @@ pandora.ui.infoView = function(data, isMixed) {
height: ratio <= 1 ? size : size / ratio,
id: data.id,
info: data.width + ' × ' + data.height + ' px',
title: data.source,
title: ui.icons == 'posters' ? data.source : Ox.formatDuration(data.position),
url: data.url.replace('http://', '//') + (
data.source == pandora.site.site.url ? '?' + modified : ''
ui.icons == 'posters' && data.source == pandora.site.site.url ? '?' + modified : ''
),
width: ratio >= 1 ? size : size * ratio
}
},
items: images,
keys: ['index', 'source', 'width', 'height', 'url'],
keys: ui.icons == 'posters'
? ['index', 'source', 'width', 'height', 'url']
: ['index', 'position', 'width', 'height', 'url'],
max: 1,
min: 1,
orientation: 'both',
@ -1088,12 +981,12 @@ pandora.ui.infoView = function(data, isMixed) {
if ($browserImages.length == 0) {
$browserImages = pandora.$ui.browser.find('img[src*="/' + data.id + '/"]');
}
if (!ui.showSitePosters) {
if (ui.icons == 'posters' && !ui.showSitePosters) {
$browserImages.each(function() {
var $this = $(this),
size = Math.max($this.width(), $this.height());
$this.attr({src: src});
$this.css(imageRatio < 1 ? {
ui.icons == 'posters' && $this.css(imageRatio < 1 ? {
width: Math.round(size * imageRatio) + 'px',
height: size + 'px'
} : {
@ -1107,17 +1000,31 @@ pandora.ui.infoView = function(data, isMixed) {
iconSize = iconSize == 256 ? 512 : 256;
toggleIconSize();
}
pandora.api.setPoster({
id: data.id,
pandora.api[ui.icons == 'posters' ? 'setPoster' : 'setPosterFrame'](Ox.extend({
id: data.id
}, ui.icons == 'posters' ? {
source: selectedImage.source
}, function() {
} : {
// fixme: api slightly inconsistent, this shouldn't be "position"
position: selectedImage.index
}), function() {
var src;
Ox.Request.clearCache();
if (ui.icons == 'frames') {
src = pandora.getMediaURL('/' + data.id + '/icon512.jpg?' + Ox.uid());
$icon.attr({src: src});
$reflectionIcon.attr({src: src});
if (pandora.$ui.videoPreview) {
pandora.$ui.videoPreview.options({
position: $list.value(selectedImage.index, 'position')
});
}
}
if (!ui.showSitePosters) {
$browserImages.each(function() {
$(this).attr({
src: pandora.getMediaURL('/' + data.id + '/poster128.jpg?' + Ox.uid())
});
$(this).attr({src: pandora.getMediaURL('/' + data.id + '/' + (
ui.icons == 'posters' ? 'poster' : 'icon'
) + '128.jpg?' + Ox.uid())});
});
}
if (ui.listSort[0].key == 'modified') {
@ -1131,7 +1038,6 @@ pandora.ui.infoView = function(data, isMixed) {
});
}
function renderRightsLevel() {
var $rightsLevelElement = getRightsLevelElement(data.rightslevel),
$rightsLevelSelect;