From 707fdd95eddf2cc35cfb3567f0895a7b7caeef33 Mon Sep 17 00:00:00 2001 From: rolux Date: Tue, 17 Apr 2012 10:03:11 +0200 Subject: [PATCH] add timeline item view --- pandora/0xdb.jsonc | 1 + pandora/padma.jsonc | 1 + static/js/pandora/UI.js | 4 ++-- static/js/pandora/URL.js | 5 +++-- static/js/pandora/info.js | 2 +- static/js/pandora/item.js | 12 ++++++++++-- static/js/pandora/menu.js | 8 ++++---- static/js/pandora/rightPanel.js | 2 ++ static/js/pandora/utils.js | 20 ++++++++++++-------- 9 files changed, 36 insertions(+), 19 deletions(-) diff --git a/pandora/0xdb.jsonc b/pandora/0xdb.jsonc index 93cfebfc..a908e157 100644 --- a/pandora/0xdb.jsonc +++ b/pandora/0xdb.jsonc @@ -560,6 +560,7 @@ "itemViews": [ {"id": "info", "title": "Info"}, {"id": "clips", "title": "Clips"}, + {"id": "timeline", "title": "Timeline"}, {"id": "player", "title": "Player"}, {"id": "editor", "title": "Editor"}, {"id": "map", "title": "Map"}, diff --git a/pandora/padma.jsonc b/pandora/padma.jsonc index 38345fb8..a9e19f0d 100644 --- a/pandora/padma.jsonc +++ b/pandora/padma.jsonc @@ -474,6 +474,7 @@ "itemViews": [ {"id": "info", "title": "Info"}, {"id": "clips", "title": "Clips"}, + {"id": "timeline", "title": "Timeline"}, {"id": "player", "title": "Player"}, {"id": "editor", "title": "Editor"}, {"id": "map", "title": "Map"}, diff --git a/static/js/pandora/UI.js b/static/js/pandora/UI.js index 7293d013..0a04ba15 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 - && ['player', 'editor'].indexOf(pandora.user.ui.itemView) > -1 + && ['timeline', 'player', 'editor'].indexOf(pandora.user.ui.itemView) > -1 && !pandora.user.ui.videoPoints[item] && !args['videoPoints.' + item] ) { @@ -136,7 +136,7 @@ pandora.UI = (function() { } } - if (['player', 'editor'].indexOf(args.itemView) > -1) { + if (['timeline', '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 f7f1e2e7..13733923 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 (['player', 'editor'].indexOf(state.view) > -1) { + } else if (['timeline', '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 (['player', 'editor'].indexOf(state.view) > -1) { + if (['timeline', 'player', 'editor'].indexOf(state.view) > -1) { if (Ox.isArray(state.span)) { set['videoPoints.' + state.item] = { annotation: '', @@ -226,6 +226,7 @@ pandora.URL = (function() { calendar: 'date' }, item: { + timeline: 'duration', player: 'duration', editor: 'duration', map: 'location', diff --git a/static/js/pandora/info.js b/static/js/pandora/info.js index 04dad1e6..940d7096 100644 --- a/static/js/pandora/info.js +++ b/static/js/pandora/info.js @@ -89,7 +89,7 @@ pandora.ui.info = function() { 'videoPoints.' + id, {'in': 0, out: 0, position: data.position} ); - if (ui.item && ['player', 'editor'].indexOf(ui.itemView) > -1) { + if (ui.item && ['timeline', 'player', 'editor'].indexOf(ui.itemView) > -1) { pandora.$ui[ui.itemView].options({ position: data.position }); diff --git a/static/js/pandora/item.js b/static/js/pandora/item.js index dbcc7a8b..5d95cb3d 100644 --- a/static/js/pandora/item.js +++ b/static/js/pandora/item.js @@ -4,7 +4,9 @@ pandora.ui.item = function() { var that = Ox.Element(), - isVideoView = ['player', 'editor'].indexOf(pandora.user.ui.itemView) > -1; + isVideoView = [ + 'timeline', 'player', 'editor' + ].indexOf(pandora.user.ui.itemView) > -1; pandora.api.get({ id: pandora.user.ui.item, @@ -50,7 +52,7 @@ pandora.ui.item = function() { } if (!result.data.rendered && [ - 'clips', 'map', 'player', 'editor' + 'clips', 'timeline', 'player', 'editor', 'map', 'calendar' ].indexOf(pandora.user.ui.itemView) > -1) { pandora.$ui.contentPanel.replaceElement(1, Ox.Element() @@ -125,6 +127,12 @@ pandora.ui.item = function() { pandora.ui.clipsView(result.data.videoRatio) ); + } else if (pandora.user.ui.itemView == 'timeline') { + + pandora.$ui.contentPanel.replaceElement(1, + pandora.$ui.editor = pandora.ui.timeline(result.data) + ); + } else if (pandora.user.ui.itemView == 'player') { pandora.$ui.contentPanel.replaceElement(1, diff --git a/static/js/pandora/menu.js b/static/js/pandora/menu.js index 26d71062..bdc9052f 100644 --- a/static/js/pandora/menu.js +++ b/static/js/pandora/menu.js @@ -87,7 +87,7 @@ pandora.ui.mainMenu = function() { }) }, ] }, { id: 'clips', title: 'Open Clips', items: [ - { group: 'videoview', min: 1, max: 1, items: ['player', 'editor'].map(function(view) { + { group: 'videoview', min: 1, max: 1, items: ['timeline', 'player', 'editor'].map(function(view) { return {id: view, title: Ox.toTitleCase(view), checked: ui.videoView == view}; }) } ] }, @@ -442,8 +442,8 @@ pandora.ui.mainMenu = function() { }, pandora_itemview: function(data) { var action, - isVideoView = ['player', 'editor'].indexOf(data.value) > -1, - wasVideoView = ['player', 'editor'].indexOf(data.previousValue) > -1; + isVideoView = ['timeline', 'player', 'editor'].indexOf(data.value) > -1, + wasVideoView = ['timeline', 'player', 'editor'].indexOf(data.previousValue) > -1; that.checkItem('viewMenu_item_' + data.value); if (isVideoView) { that.checkItem('viewMenu_clips_' + data.value); @@ -451,7 +451,7 @@ pandora.ui.mainMenu = function() { if (isVideoView != wasVideoView) { that[isVideoView ? 'enableItem' : 'disableItem']('showannotations'); } - if ((data.value == 'video') != (data.previousValue == 'video')) { + if ((data.value == 'player') != (data.previousValue == 'player')) { 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 d6453438..7c4740b6 100644 --- a/static/js/pandora/rightPanel.js +++ b/static/js/pandora/rightPanel.js @@ -43,6 +43,8 @@ pandora.ui.rightPanel = function() { pandora.$ui.browser.scrollToSelection(); if (pandora.user.ui.itemView == 'clips') { pandora.$ui.clipList.size(); + } else if (pandora.user.ui.itemView == 'timeline') { + pandora.$ui.timeline.options({width: data.size}); } else if (pandora.user.ui.itemView == 'player') { pandora.$ui.player.options({width: data.size}); } else if (pandora.user.ui.itemView == 'editor') { diff --git a/static/js/pandora/utils.js b/static/js/pandora/utils.js index 9b221a50..2f62966b 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 == 'player' || view == 'editor' + !view || view == 'timeline' || view == 'player' || view == 'editor' ) && item && !isName, canBeEvent = !view || view == 'calendar', canBePlace = !view || view == 'map'; @@ -1063,11 +1063,17 @@ pandora.resizeWindow = function() { pandora.$ui.item.resize(); } else if (pandora.user.ui.itemView == 'clips') { pandora.$ui.clipList.size(); + } else if (pandora.user.ui.itemView == 'timeline') { + pandora.$ui.timeline && pandora.$ui.timeline.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 == '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 + // 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 == 'editor') { pandora.$ui.editor && pandora.$ui.editor.options({ @@ -1121,12 +1127,10 @@ 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 - && ['player', 'editor'].indexOf(pandora.user.ui.itemView) > -1 + && ['timeline', 'player', 'editor'].indexOf(pandora.user.ui.itemView) > -1 && pandora.UI.set( 'videoPosition.' + pandora.user.ui.item, - pandora.$ui[ - pandora.user.ui.itemView == 'video' ? 'player' : 'editor' - ].options('position') + pandora.$ui[pandora.user.ui.itemView].options('position') ); */ };