From a4d0ae40672a03ce8200179f5a20e5326ae08514 Mon Sep 17 00:00:00 2001 From: rolux Date: Sat, 8 Oct 2011 09:57:02 +0000 Subject: [PATCH] some improvements to handling of @foo map urls --- static/js/pandora/URL.js | 24 ++++++++++++++++++------ static/js/pandora/ui/clipPlayer.js | 1 + static/js/pandora/ui/navigationView.js | 2 ++ static/js/pandora/utils.js | 1 + 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/static/js/pandora/URL.js b/static/js/pandora/URL.js index 536843eb..e76f9449 100644 --- a/static/js/pandora/URL.js +++ b/static/js/pandora/URL.js @@ -26,6 +26,18 @@ pandora.URL = (function() { state.view = pandora.user.ui.itemView; } } + if (!keys || keys.indexOf('mapSelection') > -1) { + state.item = pandora.user.ui.item; + state.view = 'map'; + state.span = pandora.user.ui.mapSelection + ? '@' + pandora.user.ui.mapSelection : ''; + } + if (!keys || keys.indexOf('mapFind') > -1) { + state.item = pandora.user.ui.item; + state.view = 'map'; + state.span = pandora.user.ui.mapFind + ? '@' + pandora.user.ui.mapFind : ''; + } if (!keys || keys.filter(function(key) { return /^videoPoints/.test(key); }).length) { @@ -156,13 +168,13 @@ pandora.URL = (function() { } else if (state.view == 'map') { // fixme: this doesn't handle map coordinates if (state.span[0] != '@') { - pandora.user.ui.mapSelection = state.span; - //set['mapSelection'] = state.span; - //set['mapFind'] = ''; + //pandora.user.ui.mapSelection = state.span; + set['mapSelection'] = state.span; + set['mapFind'] = ''; } else { - pandora.user.ui.mapFind = state.span.substr(1); - //set['mapFind'] = state.span.substr(1); - //set['mapSelection'] = ''; + //pandora.user.ui.mapFind = state.span.substr(1); + set['mapFind'] = state.span.substr(1); + set['mapSelection'] = ''; } } } diff --git a/static/js/pandora/ui/clipPlayer.js b/static/js/pandora/ui/clipPlayer.js index eff1a33f..38f7e109 100644 --- a/static/js/pandora/ui/clipPlayer.js +++ b/static/js/pandora/ui/clipPlayer.js @@ -1,5 +1,6 @@ // vim: et:ts=4:sw=4:sts=4:ft=javascript pandora.ui.clipPlayer = function() { + // FIXME: is clipPlayer the best name for this? var that = Ox.VideoPlayer({ controlsBottom: ['play', 'previous', 'next', 'volume'], controlsTop: ['fullscreen', 'scale'], diff --git a/static/js/pandora/ui/navigationView.js b/static/js/pandora/ui/navigationView.js index 823b10f1..de4e317b 100644 --- a/static/js/pandora/ui/navigationView.js +++ b/static/js/pandora/ui/navigationView.js @@ -249,6 +249,8 @@ pandora.ui.navigationView = function(type, videoRatio) { } }); } + Ox.print('MAP SELECTION', id, data) + pandora.UI.set({mapSelection: id ? data.name : ''}); } function updateStatusbar(items) { diff --git a/static/js/pandora/utils.js b/static/js/pandora/utils.js index fdfaeec3..4b2fcba5 100644 --- a/static/js/pandora/utils.js +++ b/static/js/pandora/utils.js @@ -519,6 +519,7 @@ pandora.getMetadataByIdOrName = function(item, view, str, callback) { } else { getId(canBePlace ? 'place' : '', function(id) { if (id) { + Ox.print('found place id', id) callback(id, 'map'); } else { getId(canBeEvent ? 'event' : '', function(id) {