').css({height: '16px'}).appendTo($right);
@@ -552,7 +424,6 @@ pandora.ui.infoView = function(data) {
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) {
pandora.UI.set({item: result.data.id});
@@ -579,25 +450,19 @@ pandora.ui.infoView = function(data) {
function formatKey(key, isStatistics) {
var item = Ox.getObjectById(pandora.site.itemKeys, key);
- key = item ? item.title : key;
+ key = Ox._(item ? item.title : key);
return isStatistics
? $('
').css({marginBottom: '4px', fontWeight: 'bold'})
- .html(Ox.toTitleCase(key).replace(' Per ', ' per '))
- : '
' + Ox.toTitleCase(key) + ': ';
+ .html(Ox._(Ox.toTitleCase(key).replace(' Per ', ' per ')))
+ : '
' + Ox._(Ox.toTitleCase(key))
+ + ': ';
}
function formatLight(str) {
return '
' + str + '';
}
- 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';
- }
+ function formatLink(value, key) {
return (Ox.isArray(value) ? value : [value]).map(function(value) {
return key ?
'
' + value + ''
@@ -605,6 +470,18 @@ pandora.ui.infoView = function(data) {
}).join(', ');
}
+ function formatValue(value, key) {
+ var ret;
+ if (key == 'date') {
+ ret = value ? Ox.formatDate(value,
+ ['', '%Y', '%B %Y', '%B %e, %Y'][value.split('-').length]
+ ) : '';
+ } else {
+ ret = value;
+ }
+ return formatLink(ret, key);
+ }
+
function getRightsLevelElement(rightsLevel) {
return Ox.Theme.formatColorLevel(
rightsLevel,
@@ -614,6 +491,12 @@ pandora.ui.infoView = function(data) {
);
}
+ function getValue(key, value) {
+ return !value ? ''
+ : Ox.contains(listKeys, key) ? value.join(', ')
+ : value;
+ }
+
function renderCapabilities(rightsLevel) {
var capabilities = [].concat(
canEdit ? [{name: 'canSeeItem', symbol: 'Find'}] : [],
@@ -674,8 +557,8 @@ pandora.ui.infoView = function(data) {
});
if (!canEdit) {
Ox.Button({
- title: 'Help',
- tooltip: 'About Rights',
+ title: Ox._('Help'),
+ tooltip: Ox._('About Rights'),
type: 'image'
})
.css({marginLeft: '52px'})
@@ -689,6 +572,39 @@ pandora.ui.infoView = function(data) {
});
}
+ function renderGroup(keys) {
+ var $element;
+ if (canEdit || keys.filter(function(key) {
+ return data[key];
+ }).length) {
+ $element = $('
').css(css);
+ keys.forEach(function(key, i) {
+ if (canEdit || data[key]) {
+ if ($element.children().length) {
+ $('').html('; ').appendTo($element);
+ }
+ $('').html(formatKey(key)).appendTo($element);
+ Ox.EditableContent({
+ clickLink: pandora.clickLink,
+ format: function(value) {
+ return formatValue(value, key);
+ },
+ placeholder: formatLight('unknown'),
+ tooltip: canEdit ? pandora.getEditTooltip() : '',
+ value: getValue(key, data[key])
+ })
+ .bindEvent({
+ submit: function(data) {
+ editMetadata(key, data.value);
+ }
+ })
+ .appendTo($element);
+ }
+ });
+ $element.appendTo($center);
+ }
+ }
+
function renderRightsLevel() {
var $rightsLevelElement = getRightsLevelElement(data.rightslevel),
$rightsLevelSelect;
@@ -696,7 +612,7 @@ pandora.ui.infoView = function(data) {
if (canEdit) {
$rightsLevelSelect = Ox.Select({
items: pandora.site.rightsLevels.map(function(rightsLevel, i) {
- return {id: i, title: rightsLevel.name};
+ return {id: i, title: Ox._(rightsLevel.name)};
}),
width: 128,
value: data.rightslevel
@@ -771,8 +687,8 @@ pandora.ui.infoView = function(data) {
that.reload = function() {
var src = src = '/' + data.id + '/' + (
- ui.icons == 'posters' ? '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;