')
+ .css({
+ marginTop: '4px',
+ textAlign: 'justify',
+ MozUserSelect: 'text',
+ WebkitUserSelect: 'text'
+ })
+ .html(
+ formatKey('reviews') + data.reviews.map(function(review) {
+ return '
'
+ }).join(', ')
+ )
+ .appendTo($text);
+
+ $('
').css({height: '8px'}).appendTo($text);
+
+ if (pandora.user.level == 'admin') {
+ var icon = 'posters',
+ selectedImage = {};
+ $poster.bind({
+ click: function() {
+ if (!editPoster) {
+ $info.animate({
+ left: 0
+ }, 250);
+ editPoster = true;
+ } else {
+ $info.animate({
+ left: -listWidth + 'px'
+ }, 250);
+ editPoster = false;
+ }
+ }
+ });
+
+ pandora.api.get({
+ id: data.id,
+ keys: [icon]
+ }, function(result) {
+ Ox.print('RESULT', result.data)
+ var images = result.data[icon];
+ selectedImage = images.filter(function(image) {
+ return image.selected;
+ })[0];
+ $list = Ox.IconList({
+ 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: icon == 'posters' ? data.source : Ox.formatDuration(data.position),
+ url: data.url,
+ width: ratio >= 1 ? size : size * ratio
+ }
+ },
+ items: images,
+ keys: icon == 'posters'
+ ? ['index', 'source', 'width', 'height', 'url']
+ : ['index', 'position', 'width', 'height', 'url'],
+ max: 1,
+ min: 1,
+ orientation: 'vertical',
+ selected: [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];
+ //renderPreview(selectedImage);
+ pandora.api[icon == 'posters' ? 'setPoster' : 'setPosterFrame'](Ox.extend({
+ id: data.id
+ }, icon == 'posters' ? {
+ source: selectedImage.source
+ } : {
+ position: selectedImage.index // fixme: api slightly inconsistent
+ }), function(result) {
+ var imageRatio = selectedImage.width / selectedImage.height;
+ $('img[src*="/' + item + '/poster"]').each(function() {
+ var $this = $(this),
+ size = Math.max($this.width(), $this.height()),
+ src = $this.attr('src').split('?')[0] + '?' + Ox.uid();
+ $('
')
+ .attr({src: src})
+ .load(function() {
+ $this.attr({src: src});
+ icon == 'posters' && $this.css(imageRatio < 1 ? {
+ width: Math.round(size * imageRatio) + 'px',
+ height: size + 'px'
+ } : {
+ width: size + 'px',
+ height: Math.round(size / imageRatio) + 'px'
+ });
+ });
+ });
+ });
+ }
+ })
+ .appendTo($info);
+ });
+ }
+
+ function formatKey(key) {
+ return '
' + Ox.toTitleCase(key) + ': ';
+ }
+
+ function formatValue(value, key) {
+ return (Ox.isArray(value) ? value : [value]).map(function(value) {
+ return key ? '
' + value + '' : value;
+ }).join(', ');
+ }
+
+ that.resize = function() {
+ var height = pandora.$ui.contentPanel.size(1);
+ $list && $list.css({height: height + 'px'});
+ $data.css({height: height + 'px'});
+ };
+
+ return that;
+
+}
\ No newline at end of file
diff --git a/static/js/pandora/ui/item.js b/static/js/pandora/ui/item.js
index 24cf831a6..d9f5d9ccf 100644
--- a/static/js/pandora/ui/item.js
+++ b/static/js/pandora/ui/item.js
@@ -59,7 +59,7 @@ pandora.ui.item = function() {
}));
} else if (pandora.user.ui.itemView == 'info') {
//Ox.print('result.data', result.data)
- if (pandora.user.level == 'admin') {
+ if (pandora.user.level == 'admin' && false) {
var $form,
$edit = Ox.Element()
.append($form = Ox.FormElementGroup({
@@ -103,6 +103,15 @@ pandora.ui.item = function() {
}));
pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.item = $edit);
} else {
+ pandora.$ui.contentPanel.replaceElement(1,
+ pandora.$ui.item = pandora.ui.infoView(result.data)
+ .bindEvent({
+ resize: function() {
+ pandora.$ui.item.resize();
+ }
+ })
+ );
+ /*
$.get('/static/html/itemInfo.html', {}, function(template) {
//Ox.print(template);
var posterRatio = result.data.poster.width / result.data.poster.height;
@@ -113,6 +122,7 @@ pandora.ui.item = function() {
pandora.$ui.item = Ox.Element().append($.tmpl(template, result.data))
);
});
+ */
}
} else if (pandora.user.ui.itemView == 'map') {
diff --git a/static/json/pandora.json b/static/json/pandora.json
index b2bb587a1..b9b9b3058 100644
--- a/static/json/pandora.json
+++ b/static/json/pandora.json
@@ -40,5 +40,6 @@
"js/pandora/ui/appPanel.js",
"js/pandora/ui/flipbook.js",
"js/pandora/ui/editor.js",
+ "js/pandora/ui/infoView.js",
"js/pandora/ui/mediaView.js"
]