From 908e468f46ca3ef31863a240ab2f9d6b0205f1b4 Mon Sep 17 00:00:00 2001 From: rolux Date: Sun, 30 Oct 2011 21:05:57 +0000 Subject: [PATCH] updating map/calendar item views --- pandora/0xdb.jsonc | 1 + static/js/pandora/URL.js | 2 +- static/js/pandora/item.js | 14 +++++++++--- static/js/pandora/navigationView.js | 34 ++++++++++++++--------------- static/js/pandora/rightPanel.js | 9 ++++---- static/js/pandora/toolbar.js | 13 +++++++++++ 6 files changed, 47 insertions(+), 26 deletions(-) diff --git a/pandora/0xdb.jsonc b/pandora/0xdb.jsonc index ec02b8dbf..41b288f4f 100644 --- a/pandora/0xdb.jsonc +++ b/pandora/0xdb.jsonc @@ -13,6 +13,7 @@ for items of a rights level up to and including x */ "capabilities": { + // "canClickMap": {"friend": true, "staff": true, "admin": true}, "canDeleteItems": {"admin": true}, "canDownloadVideo": {"guest": 0, "member": 0, "friend": 4, "staff": 4, "admin": 4}, "canEditMetadata": {"staff": true, "admin": true}, diff --git a/static/js/pandora/URL.js b/static/js/pandora/URL.js index 22f8f757e..3f4f49a7c 100644 --- a/static/js/pandora/URL.js +++ b/static/js/pandora/URL.js @@ -226,7 +226,7 @@ pandora.URL = (function() { }); if (!pandora.$ui.appPanel && state.item && find) { - // on page load, if item is set and there is or was a query, + // on page load, if item is set and there was a query, // we have to check if the item actually matches the query, // and otherwise reset find pandora.api.find({ diff --git a/static/js/pandora/item.js b/static/js/pandora/item.js index ca570560c..03b70df6e 100644 --- a/static/js/pandora/item.js +++ b/static/js/pandora/item.js @@ -6,9 +6,9 @@ pandora.ui.item = function() { pandora.api.get({ id: pandora.user.ui.item, - keys: ['video', 'timeline'].indexOf(pandora.user.ui.itemView) > -1 ? - [ 'cuts', 'duration', 'layers', 'parts', 'rendered', 'rightslevel', 'size', 'title', 'videoRatio'] : [] - }, pandora.user.level == 'admin' && pandora.user.ui.itemView == 'info' ? 0 : -1, function(result) { + keys: ['video', 'timeline'].indexOf(pandora.user.ui.itemView) > -1 + ? [ 'cuts', 'director', 'duration', 'layers', 'parts', 'rendered', 'rightslevel', 'size', 'title', 'videoRatio', 'year'] : [] + }, pandora.user.ui.itemView == 'info' && pandora.site.capabilities.canEditMetadata[pandora.user.level] ? 0 : -1, function(result) { if (result.status.code == 200) { // fixme: can the history state title get updated too? @@ -27,6 +27,14 @@ pandora.ui.item = function() { ); }*/ + pandora.$ui.itemTitle + .options({ + title: '' + result.data.title + + (result.data.director ? ' (' + result.data.director.join(', ') + ')' : '') + + (result.data.year ? ' ' + result.data.year : '') + '' + }) + .show(); + if (['video', 'timeline'].indexOf(pandora.user.ui.itemView) > -1) { // fixme: layers have value, subtitles has text? var subtitles = result.data.layers.subtitles diff --git a/static/js/pandora/navigationView.js b/static/js/pandora/navigationView.js index edebf3753..389cdc808 100644 --- a/static/js/pandora/navigationView.js +++ b/static/js/pandora/navigationView.js @@ -15,21 +15,25 @@ pandora.ui.navigationView = function(type, videoRatio) { $element = Ox.Element(), - $itemIcon = $('') + $itemIcon = type == 'map' ? $('') .addClass('OxFlag') .attr({ - src: type == 'map' - ? Ox.getImageByGeoname('icon', 16, '') - : '/static/png/icon16.png' + src: Ox.getImageByGeoname('icon', 16, '') }) - .css({float: 'left', margin: '4px'}), + .css({float: 'left', margin: '2px'}) : '', $itemLabel = Ox.Label({ textAlign: 'center', title: '', - width: 96 + Ox.UI.SCROLLBAR_SIZE + width: 0 // 76 + Ox.UI.SCROLLBAR_SIZE + }) + .css({ + position: 'absolute', + left: 4 + !!ui.item * 20 + (type == 'map') * 20 + 'px', + top: '4px', + right: '24px', + width: 'auto' }) - .css({float: 'left', margin: '4px 0 4px 0'}) .bindEvent({ singleclick: function() { $element[type == 'map' ? 'panToPlace' : 'panToEvent'](); @@ -43,7 +47,7 @@ pandora.ui.navigationView = function(type, videoRatio) { title: 'close', type: 'image' }) - .css({float: 'left', margin: '4px'}) + .css({float: 'right', margin: '2px'}) .bindEvent({ click: function() { $element.options({selected: null}); @@ -52,6 +56,8 @@ pandora.ui.navigationView = function(type, videoRatio) { }), $item = $('
') + .css({padding: '2px'}) + .append(ui.item ? pandora.$ui.sortMenu = pandora.ui.sortMenu() : '') .append($itemIcon) .append($itemLabel) .append($itemButton), @@ -94,9 +100,8 @@ pandora.ui.navigationView = function(type, videoRatio) { orientation: 'vertical' }) .bindEvent({ - resize: function(data) { - resizeToolbar(data.size); - $list.size(); + resize: function() { + $list.size() }, resizeend: function(data) { var size = data.size; @@ -113,7 +118,6 @@ pandora.ui.navigationView = function(type, videoRatio) { // finished, causing the list size to be off by one setTimeout(function() { $element['resize' + Ox.toTitleCase(type)](); - resizeToolbar(size); $list.size(); }, 0); }); @@ -142,6 +146,7 @@ pandora.ui.navigationView = function(type, videoRatio) { that.replaceElement(0, $element = Ox.Map({ + // clickable: pandora.site.capabilities.canClickMap[pandora.user.level], find: ui.mapFind, // 20 menu + 24 toolbar + 1 resizebar + 16 statusbar height: window.innerHeight - ui.showGroups * ui.groupsSize - 61, @@ -218,14 +223,9 @@ pandora.ui.navigationView = function(type, videoRatio) { } - resizeToolbar(listSize); updateToolbar(); updateStatusbar(); - function resizeToolbar(width) { - $itemLabel.options({width: width - 48}); - } - function selectItem(data) { var id = data.id || ''; updateToolbar(id ? data : null); diff --git a/static/js/pandora/rightPanel.js b/static/js/pandora/rightPanel.js index 1fbfec86c..9d3d2a2a1 100644 --- a/static/js/pandora/rightPanel.js +++ b/static/js/pandora/rightPanel.js @@ -48,13 +48,12 @@ pandora.ui.rightPanel = function() { pandora.$ui.player.options({width: data.size}); } else if (pandora.user.ui.itemView == 'timeline') { pandora.$ui.editor.options({width: data.size}); + } else if (pandora.user.ui.listView == 'map') { + pandora.$ui.map.resizeMap(); + } else if (pandora.user.ui.listView == 'calendar') { + pandora.$ui.calendar.resizeCalendar(); } } - }, - pandora_itemview: function(data) { - if (pandora.isClipView() != pandora.isClipView(data.previousValue)) { - that.replaceElement(0, pandora.$ui.toolbar = pandora.ui.toolbar()); - } } }); } diff --git a/static/js/pandora/toolbar.js b/static/js/pandora/toolbar.js index 16c004afe..01bd7ab75 100644 --- a/static/js/pandora/toolbar.js +++ b/static/js/pandora/toolbar.js @@ -18,6 +18,19 @@ pandora.ui.toolbar = function() { ).append( pandora.$ui.orderButton = pandora.ui.orderButton() ); + ui.item && that.append( + pandora.$ui.itemTitle = Ox.Label({ + textAlign: 'center' + }) + .css({ + position: 'absolute', + left: '236px', + top: '4px', + right: (ui._list ? 324 : 310) + 'px', + width: 'auto' + }) + .hide() + ); that.append( pandora.$ui.findElement = pandora.ui.findElement() );