From f5f6ff468f4a0e5c039b25651b53f09bea2e40ce Mon Sep 17 00:00:00 2001 From: rolux Date: Tue, 17 Apr 2012 09:06:19 +0200 Subject: [PATCH] rename item views ('video' -> 'player', 'timeline' -> 'editor') --- pandora/0xdb.jsonc | 6 ++-- pandora/padma.jsonc | 6 ++-- static/js/pandora.js | 4 +++ static/js/pandora/UI.js | 4 +-- static/js/pandora/URL.js | 8 ++--- static/js/pandora/browser.js | 2 +- static/js/pandora/info.js | 6 ++-- static/js/pandora/item.js | 56 ++++++++++++++++++--------------- static/js/pandora/menu.js | 24 +++++++------- static/js/pandora/rightPanel.js | 4 +-- static/js/pandora/utils.js | 8 ++--- 11 files changed, 67 insertions(+), 61 deletions(-) diff --git a/pandora/0xdb.jsonc b/pandora/0xdb.jsonc index 423d16bea..93cfebfcc 100644 --- a/pandora/0xdb.jsonc +++ b/pandora/0xdb.jsonc @@ -560,8 +560,8 @@ "itemViews": [ {"id": "info", "title": "Info"}, {"id": "clips", "title": "Clips"}, - {"id": "video", "title": "Video"}, - {"id": "timeline", "title": "Timeline"}, + {"id": "player", "title": "Player"}, + {"id": "editor", "title": "Editor"}, {"id": "map", "title": "Map"}, {"id": "calendar", "title": "Calendar"}, {"id": "data", "title": "Data"}, @@ -748,7 +748,7 @@ "videoSize": "small", "videoSubtitles": true, "videoTimeline": "antialias", - "videoView": "video", + "videoView": "player", "videoVolume": 1 }, "username": "", diff --git a/pandora/padma.jsonc b/pandora/padma.jsonc index 2dd97e399..38345fb87 100644 --- a/pandora/padma.jsonc +++ b/pandora/padma.jsonc @@ -474,8 +474,8 @@ "itemViews": [ {"id": "info", "title": "Info"}, {"id": "clips", "title": "Clips"}, - {"id": "video", "title": "Video"}, - {"id": "timeline", "title": "Timeline"}, + {"id": "player", "title": "Player"}, + {"id": "editor", "title": "Editor"}, {"id": "map", "title": "Map"}, {"id": "calendar", "title": "Calendar"}, {"id": "data", "title": "Data"}, @@ -670,7 +670,7 @@ "videoScale": "fit", "videoSize": "large", "videoTimeline": "antialias", - "videoView": "video", + "videoView": "player", "videoVolume": 1 }, "username": "", diff --git a/static/js/pandora.js b/static/js/pandora.js index fcf96ceb8..731936979 100644 --- a/static/js/pandora.js +++ b/static/js/pandora.js @@ -228,6 +228,10 @@ appPanel delete pandora.user.ui[key]; } }); + // patch itemView ... this can be removed at a later point + if (pandora.user.ui.itemView == 'video') { + pandora.user.ui.itemView = 'player'; + } Ox.extend(pandora.site, { calendar: data.site.layers.some(function(layer) { diff --git a/static/js/pandora/UI.js b/static/js/pandora/UI.js index 3c1004b3f..7293d013c 100644 --- a/static/js/pandora/UI.js +++ b/static/js/pandora/UI.js @@ -125,7 +125,7 @@ pandora.UI = (function() { add['lists.' + that.encode(list) + '.selection'] = [args.item]; if ( !args.itemView - && ['video', 'timeline'].indexOf(pandora.user.ui.itemView) > -1 + && ['player', 'editor'].indexOf(pandora.user.ui.itemView) > -1 && !pandora.user.ui.videoPoints[item] && !args['videoPoints.' + item] ) { @@ -136,7 +136,7 @@ pandora.UI = (function() { } } - if (['video', 'timeline'].indexOf(args.itemView) > -1) { + if (['player', 'editor'].indexOf(args.itemView) > -1) { // when switching to a video view, add it as default video view args.videoView = args.itemView; if ( diff --git a/static/js/pandora/URL.js b/static/js/pandora/URL.js index 0eaa1bde8..f7f1e2e73 100644 --- a/static/js/pandora/URL.js +++ b/static/js/pandora/URL.js @@ -37,7 +37,7 @@ pandora.URL = (function() { : ''; } else if (state.view == 'calendar') { // ... - } else if (['video', 'timeline'].indexOf(state.view) > -1) { + } else if (['player', 'editor'].indexOf(state.view) > -1) { var videoPoints = pandora.user.ui.videoPoints[state.item] || {}; state.span = videoPoints.annotation || Ox.merge( videoPoints.position @@ -89,7 +89,7 @@ pandora.URL = (function() { } if (state.span) { - if (['video', 'timeline'].indexOf(state.view) > -1) { + if (['player', 'editor'].indexOf(state.view) > -1) { if (Ox.isArray(state.span)) { set['videoPoints.' + state.item] = { annotation: '', @@ -226,8 +226,8 @@ pandora.URL = (function() { calendar: 'date' }, item: { - video: 'duration', - timeline: 'duration', + player: 'duration', + editor: 'duration', map: 'location', calendar: 'date' } diff --git a/static/js/pandora/browser.js b/static/js/pandora/browser.js index 189365e02..1c5b90148 100644 --- a/static/js/pandora/browser.js +++ b/static/js/pandora/browser.js @@ -122,7 +122,7 @@ pandora.ui.browser = function() { toggle: function(data) { pandora.UI.set({showBrowser: !data.collapsed}); if (data.collapsed) { - if (pandora.user.ui.itemView == 'timeline') { + if (pandora.user.ui.itemView == 'editor') { pandora.$ui.editor.gainFocus(); } } diff --git a/static/js/pandora/info.js b/static/js/pandora/info.js index 6ec9c7629..04dad1e66 100644 --- a/static/js/pandora/info.js +++ b/static/js/pandora/info.js @@ -89,10 +89,8 @@ pandora.ui.info = function() { 'videoPoints.' + id, {'in': 0, out: 0, position: data.position} ); - if (ui.item && ['video', 'timeline'].indexOf(ui.itemView) > -1) { - pandora.$ui[ - ui.itemView == 'video' ? 'player' : 'editor' - ].options({ + if (ui.item && ['player', 'editor'].indexOf(ui.itemView) > -1) { + pandora.$ui[ui.itemView].options({ position: data.position }); } else { diff --git a/static/js/pandora/item.js b/static/js/pandora/item.js index e100b5999..dbcc7a8bf 100644 --- a/static/js/pandora/item.js +++ b/static/js/pandora/item.js @@ -4,12 +4,15 @@ pandora.ui.item = function() { var that = Ox.Element(), - videoOptions; + isVideoView = ['player', 'editor'].indexOf(pandora.user.ui.itemView) > -1; pandora.api.get({ id: pandora.user.ui.item, - keys: ['video', 'timeline'].indexOf(pandora.user.ui.itemView) > -1 - ? [ 'cuts', 'director', 'duration', 'layers', 'parts', 'posterFrame', 'rendered', 'rightslevel', 'size', 'title', 'videoRatio', 'year'] : [] + keys: isVideoView ? [ + 'cuts', 'director', 'duration', 'layers', + 'parts', 'posterFrame', '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) { @@ -41,13 +44,13 @@ pandora.ui.item = function() { }) .show(); - if (['video', 'timeline'].indexOf(pandora.user.ui.itemView) > -1) { + if (isVideoView) { // fixme: layers have value, subtitles has text? Ox.extend(result.data, pandora.getVideoOptions(result.data)); } if (!result.data.rendered && [ - 'clips', 'map', 'video', 'timeline' + 'clips', 'map', 'player', 'editor' ].indexOf(pandora.user.ui.itemView) > -1) { pandora.$ui.contentPanel.replaceElement(1, Ox.Element() @@ -122,13 +125,13 @@ pandora.ui.item = function() { pandora.ui.clipsView(result.data.videoRatio) ); - } else if (pandora.user.ui.itemView == 'video') { + } else if (pandora.user.ui.itemView == 'player') { pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.player = pandora.ui.player(result.data) ); - } else if (pandora.user.ui.itemView == 'timeline') { + } else if (pandora.user.ui.itemView == 'editor') { pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.editor = pandora.ui.editor(result.data) @@ -175,27 +178,28 @@ pandora.ui.item = function() { } - if (result.data.rendered - && ['video', 'timeline'].indexOf(pandora.user.ui.itemView) > -1) { + if (isVideoView && result.data.rendered) { // handle links in annotations - var widget = pandora.user.ui.itemView == 'video' ? 'player' : 'editor'; - pandora.$ui[widget].bindEvent('pandora_videopoints.' + pandora.user.ui.item.toLowerCase(), function(data) { - Ox.print('DATA.VALUE', JSON.stringify(data.value)); - var options = {}; - if (data.value.annotation) { - options.selected = pandora.user.ui.item + '/' + data.value.annotation; - } else { - // if annotation got set to something other than '', - // points and position will be set in consequence, - // so lets try to keep events from looping - ['annotation', 'in', 'out', 'position'].forEach(function(key) { - if (!Ox.isUndefined(data.value[key])) { - options[key == 'annotation' ? 'selected' : key] = data.value[key]; - } - }); + pandora.$ui[pandora.user.ui.itemView].bindEvent( + 'pandora_videopoints.' + pandora.user.ui.item.toLowerCase(), + function(data) { + //Ox.print('DATA.VALUE', JSON.stringify(data.value)); + var options = {}; + if (data.value.annotation) { + options.selected = pandora.user.ui.item + '/' + data.value.annotation; + } else { + // if annotation got set to something other than '', + // points and position will be set in consequence, + // so lets try to keep events from looping + ['annotation', 'in', 'out', 'position'].forEach(function(key) { + if (!Ox.isUndefined(data.value[key])) { + options[key == 'annotation' ? 'selected' : key] = data.value[key]; + } + }); + } + pandora.$ui[pandora.user.ui.itemView].options(options); } - pandora.$ui[widget].options(options); - }); + ); } }); diff --git a/static/js/pandora/menu.js b/static/js/pandora/menu.js index 26d6d5676..26d710628 100644 --- a/static/js/pandora/menu.js +++ b/static/js/pandora/menu.js @@ -87,8 +87,8 @@ pandora.ui.mainMenu = function() { }) }, ] }, { id: 'clips', title: 'Open Clips', items: [ - { group: 'videoview', min: 1, max: 1, items: ['video', 'timeline'].map(function(view) { - return {id: view, title: view == 'video' ? 'Player' : 'Editor', checked: ui.videoView == view}; + { group: 'videoview', min: 1, max: 1, items: ['player', 'editor'].map(function(view) { + return {id: view, title: Ox.toTitleCase(view), checked: ui.videoView == view}; }) } ] }, {}, @@ -106,8 +106,8 @@ pandora.ui.mainMenu = function() { { id: 'showinfo', title: (ui.showInfo ? 'Hide' : 'Show') + ' Info', disabled: !ui.showSidebar, keyboard: 'shift i' }, { id: 'showfilters', title: (ui.showFilters ? 'Hide' : 'Show') + ' Filters', disabled: !!ui.item, keyboard: 'shift f' }, { id: 'showbrowser', title: (ui.showBrowser ? 'Hide' : 'Show') + ' ' + pandora.site.itemName.singular + ' Browser', disabled: !ui.item, keyboard: 'shift b' }, - { id: 'showannotations', title: (ui.showAnnotations ? 'Hide' : 'Show') + ' Annotations', disabled: !ui.item || ['timeline', 'video'].indexOf(ui.itemView) == -1, keyboard: 'shift a' }, - { id: 'showtimeline', title: (ui.showTimeline ? 'Hide' : 'Show') + ' Timeline', disabled: !ui.item || ui.itemView != 'video', keyboard: 'shift t' }, + { id: 'showannotations', title: (ui.showAnnotations ? 'Hide' : 'Show') + ' Annotations', disabled: !ui.item || ['player', 'editor'].indexOf(ui.itemView) == -1, keyboard: 'shift a' }, + { id: 'showtimeline', title: (ui.showTimeline ? 'Hide' : 'Show') + ' Timeline', disabled: !ui.item || ui.itemView != 'player', keyboard: 'shift t' }, {}, { id: 'fullscreen', title: 'Enter Fullscreen', disabled: !ui.item || ui.itemView != 'video' }, {}, @@ -232,8 +232,8 @@ pandora.ui.mainMenu = function() { } else if (data.id == 'videoview') { var set = {videoView: value}; if ( - value == 'video' && ui.itemView == 'timeline' - || value == 'timeline' && ui.itemView == 'video' + (value == 'player' && ui.itemView == 'editor') + || (value == 'editor' && ui.itemView == 'player') ) { set.itemView = value; } @@ -383,7 +383,7 @@ pandora.ui.mainMenu = function() { } }, key_shift_a: function() { - ui.item && ['video', 'timeline'].indexOf(ui.itemView) > -1 + ui.item && ['player', 'editor'].indexOf(ui.itemView) > -1 && pandora.UI.set({showAnnotations: !ui.showAnnotations}); }, key_shift_b: function() { @@ -431,10 +431,10 @@ pandora.ui.mainMenu = function() { that.disableItem('showtimeline'); that.disableItem('fullscreen'); } else { - if (['video', 'timeline'].indexOf(ui.itemView) > -1) { + if (['player', 'editor'].indexOf(ui.itemView) > -1) { that.enableItem('showannotations'); } - if (ui.itemView == 'video') { + if (ui.itemView == 'player') { that.enableItem('showtimeline'); that.enableItem('fullscreen'); } @@ -442,8 +442,8 @@ pandora.ui.mainMenu = function() { }, pandora_itemview: function(data) { var action, - isVideoView = ['video', 'timeline'].indexOf(data.value) > -1, - wasVideoView = ['video', 'timeline'].indexOf(data.previousValue) > -1; + isVideoView = ['player', 'editor'].indexOf(data.value) > -1, + wasVideoView = ['player', 'editor'].indexOf(data.previousValue) > -1; that.checkItem('viewMenu_item_' + data.value); if (isVideoView) { that.checkItem('viewMenu_clips_' + data.value); @@ -452,7 +452,7 @@ pandora.ui.mainMenu = function() { that[isVideoView ? 'enableItem' : 'disableItem']('showannotations'); } if ((data.value == 'video') != (data.previousValue == 'video')) { - action = data.value == 'video' ? 'enableItem' : 'disableItem'; + action = data.value == 'player' ? 'enableItem' : 'disableItem'; that[action]('showtimeline'); that[action]('fullscreen'); } diff --git a/static/js/pandora/rightPanel.js b/static/js/pandora/rightPanel.js index b503c7a51..d64534386 100644 --- a/static/js/pandora/rightPanel.js +++ b/static/js/pandora/rightPanel.js @@ -43,9 +43,9 @@ pandora.ui.rightPanel = function() { pandora.$ui.browser.scrollToSelection(); if (pandora.user.ui.itemView == 'clips') { pandora.$ui.clipList.size(); - } else if (pandora.user.ui.itemView == 'video') { + } else if (pandora.user.ui.itemView == 'player') { pandora.$ui.player.options({width: data.size}); - } else if (pandora.user.ui.itemView == 'timeline') { + } else if (pandora.user.ui.itemView == 'editor') { pandora.$ui.editor.options({width: data.size}); } else if (pandora.user.ui.listView == 'map') { pandora.$ui.map.resizeMap(); diff --git a/static/js/pandora/utils.js b/static/js/pandora/utils.js index 4b46893f0..9b221a502 100644 --- a/static/js/pandora/utils.js +++ b/static/js/pandora/utils.js @@ -663,7 +663,7 @@ pandora.getMetadataByIdOrName = function(item, view, str, callback) { Ox.Log('URL', 'getMetadataByIdOrName', item, view, str); var isName = str[0] == '@', canBeAnnotation = ( - !view || view == 'video' || view == 'timeline' + !view || view == 'player' || view == 'editor' ) && item && !isName, canBeEvent = !view || view == 'calendar', canBePlace = !view || view == 'map'; @@ -1063,13 +1063,13 @@ pandora.resizeWindow = function() { pandora.$ui.item.resize(); } else if (pandora.user.ui.itemView == 'clips') { pandora.$ui.clipList.size(); - } else if (pandora.user.ui.itemView == 'video') { + } else if (pandora.user.ui.itemView == 'player') { pandora.$ui.player && pandora.$ui.player.options({ // fixme: duplicated height: pandora.$ui.contentPanel.size(1), width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1 }); - } else if (pandora.user.ui.itemView == 'timeline') { + } else if (pandora.user.ui.itemView == 'editor') { pandora.$ui.editor && pandora.$ui.editor.options({ // fixme: duplicated height: pandora.$ui.contentPanel.size(1), @@ -1121,7 +1121,7 @@ pandora.unloadWindow = function() { // fixme: ajax request has to have async set to false for this to work pandora.user.ui.section == 'items' && pandora.user.ui.item - && ['video', 'timeline'].indexOf(pandora.user.ui.itemView) > -1 + && ['player', 'editor'].indexOf(pandora.user.ui.itemView) > -1 && pandora.UI.set( 'videoPosition.' + pandora.user.ui.item, pandora.$ui[