rename item views ('video' -> 'player', 'timeline' -> 'editor')

This commit is contained in:
rolux 2012-04-17 09:06:19 +02:00
parent 9e1294b801
commit f5f6ff468f
11 changed files with 67 additions and 61 deletions

View file

@ -560,8 +560,8 @@
"itemViews": [ "itemViews": [
{"id": "info", "title": "Info"}, {"id": "info", "title": "Info"},
{"id": "clips", "title": "Clips"}, {"id": "clips", "title": "Clips"},
{"id": "video", "title": "Video"}, {"id": "player", "title": "Player"},
{"id": "timeline", "title": "Timeline"}, {"id": "editor", "title": "Editor"},
{"id": "map", "title": "Map"}, {"id": "map", "title": "Map"},
{"id": "calendar", "title": "Calendar"}, {"id": "calendar", "title": "Calendar"},
{"id": "data", "title": "Data"}, {"id": "data", "title": "Data"},
@ -748,7 +748,7 @@
"videoSize": "small", "videoSize": "small",
"videoSubtitles": true, "videoSubtitles": true,
"videoTimeline": "antialias", "videoTimeline": "antialias",
"videoView": "video", "videoView": "player",
"videoVolume": 1 "videoVolume": 1
}, },
"username": "", "username": "",

View file

@ -474,8 +474,8 @@
"itemViews": [ "itemViews": [
{"id": "info", "title": "Info"}, {"id": "info", "title": "Info"},
{"id": "clips", "title": "Clips"}, {"id": "clips", "title": "Clips"},
{"id": "video", "title": "Video"}, {"id": "player", "title": "Player"},
{"id": "timeline", "title": "Timeline"}, {"id": "editor", "title": "Editor"},
{"id": "map", "title": "Map"}, {"id": "map", "title": "Map"},
{"id": "calendar", "title": "Calendar"}, {"id": "calendar", "title": "Calendar"},
{"id": "data", "title": "Data"}, {"id": "data", "title": "Data"},
@ -670,7 +670,7 @@
"videoScale": "fit", "videoScale": "fit",
"videoSize": "large", "videoSize": "large",
"videoTimeline": "antialias", "videoTimeline": "antialias",
"videoView": "video", "videoView": "player",
"videoVolume": 1 "videoVolume": 1
}, },
"username": "", "username": "",

View file

@ -228,6 +228,10 @@ appPanel
delete pandora.user.ui[key]; 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, { Ox.extend(pandora.site, {
calendar: data.site.layers.some(function(layer) { calendar: data.site.layers.some(function(layer) {

View file

@ -125,7 +125,7 @@ pandora.UI = (function() {
add['lists.' + that.encode(list) + '.selection'] = [args.item]; add['lists.' + that.encode(list) + '.selection'] = [args.item];
if ( if (
!args.itemView !args.itemView
&& ['video', 'timeline'].indexOf(pandora.user.ui.itemView) > -1 && ['player', 'editor'].indexOf(pandora.user.ui.itemView) > -1
&& !pandora.user.ui.videoPoints[item] && !pandora.user.ui.videoPoints[item]
&& !args['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 // when switching to a video view, add it as default video view
args.videoView = args.itemView; args.videoView = args.itemView;
if ( if (

View file

@ -37,7 +37,7 @@ pandora.URL = (function() {
: ''; : '';
} else if (state.view == 'calendar') { } 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] || {}; var videoPoints = pandora.user.ui.videoPoints[state.item] || {};
state.span = videoPoints.annotation || Ox.merge( state.span = videoPoints.annotation || Ox.merge(
videoPoints.position videoPoints.position
@ -89,7 +89,7 @@ pandora.URL = (function() {
} }
if (state.span) { if (state.span) {
if (['video', 'timeline'].indexOf(state.view) > -1) { if (['player', 'editor'].indexOf(state.view) > -1) {
if (Ox.isArray(state.span)) { if (Ox.isArray(state.span)) {
set['videoPoints.' + state.item] = { set['videoPoints.' + state.item] = {
annotation: '', annotation: '',
@ -226,8 +226,8 @@ pandora.URL = (function() {
calendar: 'date' calendar: 'date'
}, },
item: { item: {
video: 'duration', player: 'duration',
timeline: 'duration', editor: 'duration',
map: 'location', map: 'location',
calendar: 'date' calendar: 'date'
} }

View file

@ -122,7 +122,7 @@ pandora.ui.browser = function() {
toggle: function(data) { toggle: function(data) {
pandora.UI.set({showBrowser: !data.collapsed}); pandora.UI.set({showBrowser: !data.collapsed});
if (data.collapsed) { if (data.collapsed) {
if (pandora.user.ui.itemView == 'timeline') { if (pandora.user.ui.itemView == 'editor') {
pandora.$ui.editor.gainFocus(); pandora.$ui.editor.gainFocus();
} }
} }

View file

@ -89,10 +89,8 @@ pandora.ui.info = function() {
'videoPoints.' + id, 'videoPoints.' + id,
{'in': 0, out: 0, position: data.position} {'in': 0, out: 0, position: data.position}
); );
if (ui.item && ['video', 'timeline'].indexOf(ui.itemView) > -1) { if (ui.item && ['player', 'editor'].indexOf(ui.itemView) > -1) {
pandora.$ui[ pandora.$ui[ui.itemView].options({
ui.itemView == 'video' ? 'player' : 'editor'
].options({
position: data.position position: data.position
}); });
} else { } else {

View file

@ -4,12 +4,15 @@
pandora.ui.item = function() { pandora.ui.item = function() {
var that = Ox.Element(), var that = Ox.Element(),
videoOptions; isVideoView = ['player', 'editor'].indexOf(pandora.user.ui.itemView) > -1;
pandora.api.get({ pandora.api.get({
id: pandora.user.ui.item, id: pandora.user.ui.item,
keys: ['video', 'timeline'].indexOf(pandora.user.ui.itemView) > -1 keys: isVideoView ? [
? [ 'cuts', 'director', 'duration', 'layers', 'parts', 'posterFrame', 'rendered', 'rightslevel', 'size', 'title', 'videoRatio', 'year'] : [] '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) { }, pandora.user.ui.itemView == 'info' && pandora.site.capabilities.canEditMetadata[pandora.user.level] ? 0 : -1, function(result) {
if (result.status.code == 200) { if (result.status.code == 200) {
@ -41,13 +44,13 @@ pandora.ui.item = function() {
}) })
.show(); .show();
if (['video', 'timeline'].indexOf(pandora.user.ui.itemView) > -1) { if (isVideoView) {
// fixme: layers have value, subtitles has text? // fixme: layers have value, subtitles has text?
Ox.extend(result.data, pandora.getVideoOptions(result.data)); Ox.extend(result.data, pandora.getVideoOptions(result.data));
} }
if (!result.data.rendered && [ if (!result.data.rendered && [
'clips', 'map', 'video', 'timeline' 'clips', 'map', 'player', 'editor'
].indexOf(pandora.user.ui.itemView) > -1) { ].indexOf(pandora.user.ui.itemView) > -1) {
pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.contentPanel.replaceElement(1,
Ox.Element() Ox.Element()
@ -122,13 +125,13 @@ pandora.ui.item = function() {
pandora.ui.clipsView(result.data.videoRatio) 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.contentPanel.replaceElement(1,
pandora.$ui.player = pandora.ui.player(result.data) 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.contentPanel.replaceElement(1,
pandora.$ui.editor = pandora.ui.editor(result.data) pandora.$ui.editor = pandora.ui.editor(result.data)
@ -175,27 +178,28 @@ pandora.ui.item = function() {
} }
if (result.data.rendered if (isVideoView && result.data.rendered) {
&& ['video', 'timeline'].indexOf(pandora.user.ui.itemView) > -1) {
// handle links in annotations // handle links in annotations
var widget = pandora.user.ui.itemView == 'video' ? 'player' : 'editor'; pandora.$ui[pandora.user.ui.itemView].bindEvent(
pandora.$ui[widget].bindEvent('pandora_videopoints.' + pandora.user.ui.item.toLowerCase(), function(data) { 'pandora_videopoints.' + pandora.user.ui.item.toLowerCase(),
Ox.print('DATA.VALUE', JSON.stringify(data.value)); function(data) {
var options = {}; //Ox.print('DATA.VALUE', JSON.stringify(data.value));
if (data.value.annotation) { var options = {};
options.selected = pandora.user.ui.item + '/' + data.value.annotation; if (data.value.annotation) {
} else { options.selected = pandora.user.ui.item + '/' + data.value.annotation;
// if annotation got set to something other than '', } else {
// points and position will be set in consequence, // if annotation got set to something other than '',
// so lets try to keep events from looping // points and position will be set in consequence,
['annotation', 'in', 'out', 'position'].forEach(function(key) { // so lets try to keep events from looping
if (!Ox.isUndefined(data.value[key])) { ['annotation', 'in', 'out', 'position'].forEach(function(key) {
options[key == 'annotation' ? 'selected' : key] = data.value[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); );
});
} }
}); });

View file

@ -87,8 +87,8 @@ pandora.ui.mainMenu = function() {
}) }, }) },
] }, ] },
{ id: 'clips', title: 'Open Clips', items: [ { id: 'clips', title: 'Open Clips', items: [
{ group: 'videoview', min: 1, max: 1, items: ['video', 'timeline'].map(function(view) { { group: 'videoview', min: 1, max: 1, items: ['player', 'editor'].map(function(view) {
return {id: view, title: view == 'video' ? 'Player' : 'Editor', checked: ui.videoView == 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: '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: '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: '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: '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 != 'video', keyboard: 'shift t' }, { 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' }, { id: 'fullscreen', title: 'Enter Fullscreen', disabled: !ui.item || ui.itemView != 'video' },
{}, {},
@ -232,8 +232,8 @@ pandora.ui.mainMenu = function() {
} else if (data.id == 'videoview') { } else if (data.id == 'videoview') {
var set = {videoView: value}; var set = {videoView: value};
if ( if (
value == 'video' && ui.itemView == 'timeline' (value == 'player' && ui.itemView == 'editor')
|| value == 'timeline' && ui.itemView == 'video' || (value == 'editor' && ui.itemView == 'player')
) { ) {
set.itemView = value; set.itemView = value;
} }
@ -383,7 +383,7 @@ pandora.ui.mainMenu = function() {
} }
}, },
key_shift_a: 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}); && pandora.UI.set({showAnnotations: !ui.showAnnotations});
}, },
key_shift_b: function() { key_shift_b: function() {
@ -431,10 +431,10 @@ pandora.ui.mainMenu = function() {
that.disableItem('showtimeline'); that.disableItem('showtimeline');
that.disableItem('fullscreen'); that.disableItem('fullscreen');
} else { } else {
if (['video', 'timeline'].indexOf(ui.itemView) > -1) { if (['player', 'editor'].indexOf(ui.itemView) > -1) {
that.enableItem('showannotations'); that.enableItem('showannotations');
} }
if (ui.itemView == 'video') { if (ui.itemView == 'player') {
that.enableItem('showtimeline'); that.enableItem('showtimeline');
that.enableItem('fullscreen'); that.enableItem('fullscreen');
} }
@ -442,8 +442,8 @@ pandora.ui.mainMenu = function() {
}, },
pandora_itemview: function(data) { pandora_itemview: function(data) {
var action, var action,
isVideoView = ['video', 'timeline'].indexOf(data.value) > -1, isVideoView = ['player', 'editor'].indexOf(data.value) > -1,
wasVideoView = ['video', 'timeline'].indexOf(data.previousValue) > -1; wasVideoView = ['player', 'editor'].indexOf(data.previousValue) > -1;
that.checkItem('viewMenu_item_' + data.value); that.checkItem('viewMenu_item_' + data.value);
if (isVideoView) { if (isVideoView) {
that.checkItem('viewMenu_clips_' + data.value); that.checkItem('viewMenu_clips_' + data.value);
@ -452,7 +452,7 @@ pandora.ui.mainMenu = function() {
that[isVideoView ? 'enableItem' : 'disableItem']('showannotations'); that[isVideoView ? 'enableItem' : 'disableItem']('showannotations');
} }
if ((data.value == 'video') != (data.previousValue == 'video')) { if ((data.value == 'video') != (data.previousValue == 'video')) {
action = data.value == 'video' ? 'enableItem' : 'disableItem'; action = data.value == 'player' ? 'enableItem' : 'disableItem';
that[action]('showtimeline'); that[action]('showtimeline');
that[action]('fullscreen'); that[action]('fullscreen');
} }

View file

@ -43,9 +43,9 @@ pandora.ui.rightPanel = function() {
pandora.$ui.browser.scrollToSelection(); pandora.$ui.browser.scrollToSelection();
if (pandora.user.ui.itemView == 'clips') { if (pandora.user.ui.itemView == 'clips') {
pandora.$ui.clipList.size(); 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}); 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}); pandora.$ui.editor.options({width: data.size});
} else if (pandora.user.ui.listView == 'map') { } else if (pandora.user.ui.listView == 'map') {
pandora.$ui.map.resizeMap(); pandora.$ui.map.resizeMap();

View file

@ -663,7 +663,7 @@ pandora.getMetadataByIdOrName = function(item, view, str, callback) {
Ox.Log('URL', 'getMetadataByIdOrName', item, view, str); Ox.Log('URL', 'getMetadataByIdOrName', item, view, str);
var isName = str[0] == '@', var isName = str[0] == '@',
canBeAnnotation = ( canBeAnnotation = (
!view || view == 'video' || view == 'timeline' !view || view == 'player' || view == 'editor'
) && item && !isName, ) && item && !isName,
canBeEvent = !view || view == 'calendar', canBeEvent = !view || view == 'calendar',
canBePlace = !view || view == 'map'; canBePlace = !view || view == 'map';
@ -1063,13 +1063,13 @@ pandora.resizeWindow = function() {
pandora.$ui.item.resize(); pandora.$ui.item.resize();
} else if (pandora.user.ui.itemView == 'clips') { } else if (pandora.user.ui.itemView == 'clips') {
pandora.$ui.clipList.size(); 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({ pandora.$ui.player && pandora.$ui.player.options({
// fixme: duplicated // fixme: duplicated
height: pandora.$ui.contentPanel.size(1), height: pandora.$ui.contentPanel.size(1),
width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 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({ pandora.$ui.editor && pandora.$ui.editor.options({
// fixme: duplicated // fixme: duplicated
height: pandora.$ui.contentPanel.size(1), 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 // fixme: ajax request has to have async set to false for this to work
pandora.user.ui.section == 'items' pandora.user.ui.section == 'items'
&& pandora.user.ui.item && pandora.user.ui.item
&& ['video', 'timeline'].indexOf(pandora.user.ui.itemView) > -1 && ['player', 'editor'].indexOf(pandora.user.ui.itemView) > -1
&& pandora.UI.set( && pandora.UI.set(
'videoPosition.' + pandora.user.ui.item, 'videoPosition.' + pandora.user.ui.item,
pandora.$ui[ pandora.$ui[