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": [
{"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": "",

View file

@ -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": "",

View file

@ -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) {

View file

@ -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 (

View file

@ -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'
}

View file

@ -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();
}
}

View file

@ -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 {

View file

@ -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);
});
);
}
});

View file

@ -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');
}

View file

@ -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();

View file

@ -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[