diff --git a/static/js/pandora/URL.js b/static/js/pandora/URL.js index ed85aa4b..fcc24d8a 100644 --- a/static/js/pandora/URL.js +++ b/static/js/pandora/URL.js @@ -90,12 +90,13 @@ pandora.URL = (function() { view = view ? view[0] : position ? pandora.user.ui.videoView : pandora.user.ui.itemView; - pandora.UI.set({ + pandora.UI.set(Ox.extend({ section: 'items', item: item, itemView: view - }); - Ox.print('POSITION', position) + }, ['player', 'timeline'].indexOf(view) > -1 ? { + videoView: view + } : {})); if (position) { split[length - 1] = position[0].split('-').map(function(point, i) { // fixme: this is duplicated, see Ox.VideoPlayer() parsePositionInput() diff --git a/static/js/pandora/ui/item.js b/static/js/pandora/ui/item.js index 830e1125..a0b3994b 100644 --- a/static/js/pandora/ui/item.js +++ b/static/js/pandora/ui/item.js @@ -6,9 +6,23 @@ pandora.ui.item = function() { keys: [] }, pandora.user.level == 'admin' && pandora.user.ui.itemView == 'info' ? 0 : -1, function(result) { if (result.status.code != 200) { - pandora.$ui.contentPanel.replaceElement(1, - Ox.Element().html( - 'The '+pandora.site.itemName.singular+' you are looking for does not exist.')); + // fixme: this is quite a hack + pandora.api.find({ + query: { + conditions: [{key: 'title', value: decodeURI(pandora.user.ui.item), operator: '='}], + operator: '' + }, + keys: ['id'] + }, function(result) { + if (result.data.items.length) { + pandora.user.ui.item = ''; + pandora.URL.set(result.data.items[0].id); + } else { + pandora.$ui.contentPanel.replaceElement(1, + Ox.Element().html( + 'Sorry, we can\'t find the ' + pandora.site.itemName.singular + ' you\'re looking for.' + '
' + JSON.stringify(result.data))); + } + }); } else if (!result.data.rendered && ['clips', 'map', 'player', 'timeline'].indexOf(pandora.user.ui.itemView)>-1) {