From 5f14ef0e4b205be43ec681f5a55ccba51d465b9b Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Tue, 3 Jan 2012 00:36:56 +0530 Subject: [PATCH] implement 'view annotations at position / in selection / all' --- pandora/0xdb.jsonc | 16 ++++++++++++---- pandora/padma.jsonc | 38 ++++++++++++++++++++++++++------------ static/js/pandora/item.js | 38 ++++++++++++++++++++++++++++++-------- 3 files changed, 68 insertions(+), 24 deletions(-) diff --git a/pandora/0xdb.jsonc b/pandora/0xdb.jsonc index 75ff697a..923d4986 100644 --- a/pandora/0xdb.jsonc +++ b/pandora/0xdb.jsonc @@ -16,6 +16,7 @@ // "canClickMap": {"friend": true, "staff": true, "admin": true}, "canDeleteItems": {"admin": true}, "canDownloadVideo": {"guest": 0, "member": 0, "friend": 4, "staff": 4, "admin": 4}, + "canEditAnnotations": {"staff": true, "admin": true}, "canEditFeaturedLists": {"staff": true, "admin": true}, "canEditMetadata": {"staff": true, "admin": true}, "canEditSitePages": {"staff": true, "admin": true}, @@ -496,25 +497,30 @@ { "id": "privatenotes", "title": "Private Notes", - "type": "text", + "canAddAnnotations": {"member": true, "friend": true, "staff": true, "admin": true}, "overlap": true, - "private": true + "private": true, + "type": "text" }, { "id": "publicnotes", "title": "Public Notes", + "canAddAnnotations": {"member": true, "friend": true, "staff": true, "admin": true}, "overlap": true, "type": "text" }, { "id": "subtitles", "title": "Subtitles", - "type": "text", + "canAddAnnotations": {"staff": true, "admin": true}, + "hasEvents": true, + "hasPlaces": true, "overlay": true, "sort": [ {"id": "words", "title": "Words", "type": "words"}, {"id": "wordsperminute", "title": "Words per Minute", "type": "wordsperminute"} - ] + ], + "type": "text" } ], "listViews": [ @@ -588,6 +594,8 @@ "level": "guest", "newsletter": true, "ui": { + "annotationsFont": "small", + "annotationsRange": "all", "annotationsSize": 256, "clipsColumns": 2, "columns": { diff --git a/pandora/padma.jsonc b/pandora/padma.jsonc index dc6dcd24..b65999d1 100644 --- a/pandora/padma.jsonc +++ b/pandora/padma.jsonc @@ -16,6 +16,7 @@ // "canClickMap": {"friend": true, "staff": true, "admin": true}, "canDeleteItems": {"admin": true}, "canDownloadVideo": {"guest": 1, "member": 1, "staff": 4, "admin": 4}, + "canEditAnnotations": {"staff": true, "admin": true}, "canEditFeaturedLists": {"staff": true, "admin": true}, "canEditMetadata": {"staff": true, "admin": true}, "canEditSitePages": {"staff": true, "admin": true}, @@ -317,9 +318,9 @@ "id": "size", "title": "Size", "type": "integer", + "capability": "canSeeFiles", "columnWidth": 60, - "format": {"type": "value", "args": ["B"]}, - "rightsLevel": 1 + "format": {"type": "value", "args": ["B"]} }, { "id": "bitrate", @@ -332,16 +333,16 @@ "id": "numberoffiles", "title": "Number of Files", "type": "integer", + "capability": "canSeeFiles", "columnWidth": 60, - "value": {"key": "files", "type": "length"}, - "rightsLevel": 1 + "value": {"key": "files", "type": "length"} }, { "id": "filename", "title": "Filename", "type": ["string"], - "find": true, - "rightsLevel": 1 + "capability": "canSeeFiles", + "find": true }, { "id": "modified", @@ -391,26 +392,37 @@ { "id": "places", "title": "Places", - "type": "place", - "overlap": true + "canAddAnnotations": {"member": true, "staff": true, "admin": true}, + "overlap": true, + "type": "place" + }, + { + "id": "events", + "title": "Events", + "canAddAnnotations": {"member": true, "staff": true, "admin": true}, + "overlap": true, + "type": "event" }, { "id": "keywords", "title": "Keywords", + "canAddAnnotations": {"member": true, "staff": true, "admin": true}, "overlap": true, "type": "string" }, { "id": "descriptions", "title": "Descriptions", - "type": "text", - "overlay": true + "canAddAnnotations": {"member": true, "staff": true, "admin": true}, + "overlay": true, + "type": "text" }, { "id": "transcripts", "title": "Transcripts", - "type": "text", - "overlay": true + "canAddAnnotations": {"member": true, "staff": true, "admin": true}, + "overlay": true, + "type": "text" } ], "listViews": [ @@ -477,6 +489,8 @@ "user": { "level": "guest", "ui": { + "annotationsFont": "small", + "annotationsRange": "all", "annotationsSize": 256, "clipsColumns": 2, "columns": { diff --git a/static/js/pandora/item.js b/static/js/pandora/item.js index 1ab1c2fa..71267ced 100644 --- a/static/js/pandora/item.js +++ b/static/js/pandora/item.js @@ -194,6 +194,8 @@ pandora.ui.item = function() { } else if (pandora.user.ui.itemView == 'timeline') { pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.editor = Ox.VideoEditor({ + annotationsFont: pandora.user.ui.annotationsFont, + annotationsRange: pandora.user.ui.annotationsRange, annotationsSize: pandora.user.ui.annotationsSize, censored: videoOptions.censored, cuts: result.data.cuts || [], @@ -213,7 +215,11 @@ pandora.ui.item = function() { height: pandora.$ui.contentPanel.size(1), id: 'editor', 'in': pandora.user.ui.videoPoints[pandora.user.ui.item]['in'], - layers: videoOptions.layers, + layers: videoOptions.layers.map(function(layer) { + return Ox.extend({ + editable: layer.canAddAnnotations[pandora.user.level] + }, layer); + }), muted: pandora.user.ui.videoMuted, out: pandora.user.ui.videoPoints[pandora.user.ui.item].out, position: pandora.user.ui.videoPoints[pandora.user.ui.item].position, @@ -229,6 +235,15 @@ pandora.ui.item = function() { volume: pandora.user.ui.videoVolume, width: pandora.$ui.document.width() - pandora.$ui.mainPanel.size(0) - 1 }).bindEvent({ + annotationsFont: function(data) { + pandora.UI.set({annotationsFont: data.font}); + }, + annotationsRange: function(data) { + pandora.UI.set({annotationsRange: data.range}); + }, + annotationsSize: function(data) { + pandora.UI.set({annotationsSize: data.size}); + }, find: function(data) { pandora.UI.set('itemFind', data.find ? { conditions: [{key: 'subtitles', value: data.find, operator: '='}], @@ -256,9 +271,6 @@ pandora.ui.item = function() { height: data.size }); }, - resizeend: function(data) { - pandora.UI.set({annotationsSize: data.size}); - }, resolution: function(data) { pandora.UI.set('videoResolution', data.resolution); }, @@ -270,9 +282,13 @@ pandora.ui.item = function() { }, addannotation: function(data) { Ox.Log('', 'addAnnotation', data); - data.item = pandora.user.ui.item; - data.value = 'Click to edit'; - pandora.api.addAnnotation(data, function(result) { + pandora.api.addAnnotation({ + 'in': data['in'], + item: pandora.user.ui.item, + layer: data.layer, + out: data.out, + value: 'Click to edit', + }, function(result) { pandora.$ui.editor.addAnnotation(data.layer, result.data); }); }, @@ -286,8 +302,14 @@ pandora.ui.item = function() { pandora.UI.set('showAnnotations', data.showAnnotations); }, updateannotation: function(data) { + Ox.Log('', 'editAnnotations', data); //fixme: check that edit was successfull - pandora.api.editAnnotation(data, function(result) { + pandora.api.editAnnotation({ + id: data.id, + 'in': data['in'], + out: data.out, + value: data.value, + }, function(result) { Ox.Log('', 'done updateAnnotation', result); }); },