').css({height: '16px'}).appendTo($statistics);
-
- if (canEdit) {
- $icon.bindEvent({
- doubleclick: function() {
- pandora.UI.set('showIconBrowser', !ui.showIconBrowser);
- $info.animate({
- left: ui.showIconBrowser ? 0 : -listWidth + 'px'
- }, 250);
- $icon.options({
- tooltip: !pandora.user.ui.showIconBrowser
- ? 'Doubleclick to edit icon'
- : 'Doubleclick to hide icons'
- });
- }
- });
- renderList();
- }
+ $('
').css({height: '16px'}).appendTo($right);
function editMetadata(key, value) {
if (value != data[key]) {
var edit = {id: data.id};
if (key == 'title') {
- Ox.extend(edit, parseTitle(value));
- } else if(['director', 'country'].indexOf(key) > -1) {
+ edit[key] = value;
+ } else if (listKeys.indexOf(key) >= 0) {
edit[key] = value ? value.split(', ') : [];
} else {
- edit[key] = value;
+ edit[key] = value ? value : null;
}
pandora.api.edit(edit, function(result) {
+ data[key] = value;
+ descriptions[key] && descriptions[key].options({
+ value: result.data[key + 'description']
+ });
+
+ 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);
}
@@ -524,6 +523,14 @@ pandora.ui.infoView = function(data) {
pandora.$ui.browser.value(result.data.id, 'director', result.data.director);
pandora.$ui.browser.value(result.data.id, 'country', result.data.country);
pandora.$ui.browser.value(result.data.id, 'year', result.data.year);
+ pandora.$ui.itemTitle
+ .options({
+ title: '
' + result.data.title
+ + (Ox.len(result.data.director)
+ ? ' (' + result.data.director.join(', ') + ')'
+ : '')
+ + (result.data.year ? ' ' + result.data.year : '') + ''
+ });
//pandora.$ui.contentPanel.replaceElement(0, pandora.$ui.browser = pandora.ui.browser());
});
}
@@ -539,21 +546,17 @@ pandora.ui.infoView = function(data) {
return '
' + str + '';
}
- function formatTitle(title) {
- var match = /(\(S\d{2}E\d{2}\))/.exec(title);
- if (match) {
- title = title.replace(match[0], formatLight(match[0]));
- }
- return title + (
- data.originalTitle && data.originalTitle != title
- ? ' ' + formatLight('(' + data.originalTitle + ')') : ''
- );
- }
-
function formatValue(value, key) {
+ if(key == 'date') {
+ return value ? Ox.formatDate(value,
+ ['', '%Y', '%B %Y', '%B %e, %Y'][value.split('-').length]
+ ) : '';
+ } else if(key == 'duration') {
+ return value < 60 ? Math.round(value) + ' sec' : Math.round(value / 60) + ' min';
+ }
return (Ox.isArray(value) ? value : [value]).map(function(value) {
return key ?
- '
' + value + ''
+ '
' + value + ''
: value;
}).join(', ');
}
@@ -567,36 +570,6 @@ pandora.ui.infoView = function(data) {
);
}
- function parseTitle(title) {
- var data = {title: title},
- match = /(\(S(\d{2})E(\d{2})\))/.exec(title),
- split;
- if (match) {
- data.season = parseInt(match[2], 10);
- data.episode = parseInt(match[3], 10);
- split = title.split(match[1]);
- data.seriesTitle = split[0].trim();
- data.episodeTitle = split[1].trim();
- }
- return data;
- }
-
- function reloadMetadata() {
- var item = ui.item;
- // fixme: maybe there's a better method name for this?
- pandora.api.updateExternalData({
- id: ui.item
- }, function(result) {
- //reloading metadata might change results too(i.e. genre)
- Ox.Request.clearCache();
- if (ui.item == item && ui.itemView == 'info') {
- pandora.$ui.contentPanel.replaceElement(
- 1, pandora.$ui.item = pandora.ui.item()
- );
- }
- });
- }
-
function renderCapabilities(rightsLevel) {
var capabilities = Ox.merge(
canEdit ? [{name: 'canSeeItem', symbol: 'Find'}] : [],
@@ -645,10 +618,7 @@ pandora.ui.infoView = function(data) {
+ (hasCapability ? 'can' : 'can\'t') + ' '
+ Ox.map(Ox.toSlashes(capability.name).split('/'), function(word, i) {
return i == 0 ? null : word.toLowerCase();
- }).join(' ')
- .replace('see item', 'see the item')
- .replace('play video', 'play the full video')
- .replace('download video', 'download the video'),
+ }).join(' '),
title: capability.symbol,
type: 'image'
})
@@ -675,109 +645,6 @@ pandora.ui.infoView = function(data) {
});
}
- function renderList() {
- pandora.api.get({
- id: data.id,
- keys: [ui.icons == 'posters' ? 'posters' : 'frames']
- }, 0, function(result) {
- var images = result.data[ui.icons == 'posters' ? 'posters' : 'frames'],
- selectedImage = images.filter(function(image) {
- return image.selected;
- })[0];
- $list = Ox.IconList({
- defaultRatio: ui.icons == 'posters' ? 5/8 : data.stream.aspectratio,
- fixedRatio: ui.icons == 'posters' ? 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 + ' x ' + data.height + ' px',
- title: ui.icons == 'posters' ? data.source : Ox.formatDuration(data.position),
- url: data.url.replace('http://', '//'),
- width: ratio >= 1 ? size : size * ratio
- }
- },
- items: images,
- keys: ui.icons == 'posters'
- ? ['index', 'source', 'width', 'height', 'url']
- : ['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'
- })
- .css({
- display: 'block',
- position: 'absolute',
- left: 0,
- top: 0,
- width: listWidth + 'px',
- height: pandora.$ui.contentPanel.size(1) + '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.replace('http://', '//');
- if ($browserImages.length == 0) {
- $browserImages = pandora.$ui.browser.find('img[src*="/' + data.id + '/"]');
- }
- if (ui.icons == 'posters' && !ui.showSitePosters) {
- $browserImages.each(function() {
- var $this = $(this),
- size = Math.max($this.width(), $this.height());
- $this.attr({src: src});
- ui.icons == 'posters' && $this.css(imageRatio < 1 ? {
- width: Math.round(size * imageRatio) + 'px',
- height: size + 'px'
- } : {
- width: size + 'px',
- height: Math.round(size / imageRatio) + 'px'
- });
- });
- $icon.attr({src: src});
- $reflectionIcon.attr({src: src});
- iconRatio = imageRatio;
- iconSize = iconSize == 256 ? 512 : 256;
- toggleIconSize();
- }
- pandora.api[ui.icons == 'posters' ? 'setPoster' : 'setPosterFrame'](Ox.extend({
- id: data.id
- }, ui.icons == 'posters' ? {
- source: selectedImage.source
- } : {
- // fixme: api slightly inconsistent, this shouldn't be "position"
- position: selectedImage.index
- }), function() {
- // fixme: update the info (video preview) frame as well
- var src;
- if (ui.icons == 'frames') {
- src = '/' + data.id + '/icon512.jpg?' + Ox.uid()
- $icon.attr({src: src});
- $reflectionIcon.attr({src: src});
- }
- $browserImages.each(function() {
- $(this).attr({src: '/' + data.id + '/' + (
- ui.icons == 'posters' ? 'poster' : 'icon'
- ) + '128.jpg?' + Ox.uid()});
- });
- });
- }
- })
- .appendTo($info);
- $list.size();
- });
- }
-
function renderRightsLevel() {
var $rightsLevelElement = getRightsLevelElement(data.rightslevel),
$rightsLevelSelect;
@@ -848,7 +715,11 @@ pandora.ui.infoView = function(data) {
width: iconSize + 'px',
height: iconSize / 2 + 'px'
}, 250);
- $text.animate({
+ $data.animate({
+ top: margin + iconHeight + margin + 'px',
+ width: iconSize + 'px',
+ }, 250);
+ $center.animate({
left: margin + (iconSize == 256 ? 256 : iconWidth) + margin + 'px',
}, 250);
pandora.UI.set({infoIconSize: iconSize});
@@ -856,22 +727,18 @@ pandora.ui.infoView = function(data) {
that.reload = function() {
var src = src = '/' + data.id + '/' + (
- ui.icons == 'posters'
- ? (ui.showSitePosters ? 'siteposter' : 'poster') : 'icon'
- ) + '512.jpg?' + Ox.uid()
+ ui.icons == 'posters' ? 'poster' : 'icon'
+ ) + '512.jpg?' + Ox.uid();
$icon.attr({src: src});
$reflectionIcon.attr({src: src});
iconSize = iconSize == 256 ? 512 : 256;
iconRatio = ui.icons == 'posters'
? (ui.showSitePosters ? 5/8 : data.posterRatio) : 1;
toggleIconSize();
- pandora.user.level == 'admin' && $list.replaceWith($list = renderList());
};
that.resize = function() {
- var height = pandora.$ui.contentPanel.size(1);
- $list && $list.css({height: height + 'px'});
- $data.css({height: height + 'px'});
+
};
that.bindEvent({