diff --git a/pandora/0xdb.jsonc b/pandora/0xdb.jsonc
index 8495a99c3..6de338678 100644
--- a/pandora/0xdb.jsonc
+++ b/pandora/0xdb.jsonc
@@ -15,13 +15,12 @@
"capabilities": {
"canDeleteItems": {"admin": true},
"canEditItemIcons": {"staff": true, "admin": true},
- "canPlayClips": {"guest": 1, "member": 2, "friend": 3, "staff": 4, "admin": 4},
- "canPlayVideo": {"guest": 0, "member": 1, "friend": 3, "staff": 4, "admin": 4},
+ "canPlayClips": {"guest": 2, "member": 2, "friend": 3, "staff": 4, "admin": 4},
+ "canPlayVideo": {"guest": 1, "member": 1, "friend": 3, "staff": 4, "admin": 4},
"canReloadMetadata": {"staff": true, "admin": true},
"canSeeDebugMenu": {"admin": true},
"canSeeFiles": {"staff": true, "admin": true},
- "canSeeItem": {"guest": 2, "member": 2, "friend": 3, "staff": 4, "admin": 4},
- "canSeeNotes": {"staff": true, "admin": true},
+ "canSeeItem": {"guest": 3, "member": 3, "friend": 3, "staff": 4, "admin": 4},
"canSeeExtraItemViews": {"friend": true, "staff": true, "admin": true}
},
/*
@@ -528,11 +527,11 @@
],
"rightsLevel": {"member": 5, "staff": 4, "admin": 3},
"rightsLevels": [
- {"name": "Public", "color": [0, 255, 0], "description": "Everyone can see and play."},
- {"name": "Relaxed", "color": [128, 255, 0], "description": "Guests can't play video."},
- {"name": "Regular", "color": [255, 255, 0], "description": "Guests can't play clips, members can't play video."},
- {"name": "Restricted", "color": [255, 128, 0], "description": "Only staff and admin can see and play."},
- {"name": "Private", "color": [255, 0, 0], "description": "Only admins can see and play."}
+ {"name": "Public", "color": [128, 255, 128], "description": "Everyone can see and play."},
+ {"name": "Relaxed", "color": [192, 255, 128], "description": "Guests can't play video."},
+ {"name": "Regular", "color": [255, 255, 128], "description": "Guests can't play clips, members can't play video."},
+ {"name": "Restricted", "color": [255, 192, 128], "description": "Only friend, staff and admin can see and play."},
+ {"name": "Private", "color": [255, 128, 128], "description": "Only staff and admin can see and play."}
],
"sendReferrer": false,
"site": {
diff --git a/static/js/pandora/ui/clipList.js b/static/js/pandora/ui/clipList.js
index 864facf23..2500dfea1 100644
--- a/static/js/pandora/ui/clipList.js
+++ b/static/js/pandora/ui/clipList.js
@@ -132,12 +132,15 @@ pandora.ui.clipList = function(videoRatio) {
width = fixedRatio > 1 ? size : Math.round(size * fixedRatio);
height = fixedRatio > 1 ? Math.round(size / fixedRatio) : size;
}
- pandora.api.get({id: item, keys: ['durations']}, function(result) {
+ pandora.api.get({id: item, keys: ['durations', 'rightsLevel']}, function(result) {
var points = [that.value(id, 'in'), that.value(id, 'out')],
partsAndPoints = pandora.getVideoPartsAndPoints(
result.data.durations, points
),
$player = Ox.VideoPlayer({
+ censored: pandora.site.capabilities.canPlayClips[pandora.user.level] < result.data.rightsLevel
+ ? [{'in': partsAndPoints.points[0], out: partsAndPoints.points[1]}]
+ : [],
height: height,
'in': partsAndPoints.points[0],
out: partsAndPoints.points[1],
diff --git a/static/js/pandora/ui/infoView.js b/static/js/pandora/ui/infoView.js
index 157a72357..3a0e33074 100644
--- a/static/js/pandora/ui/infoView.js
+++ b/static/js/pandora/ui/infoView.js
@@ -358,7 +358,24 @@ pandora.ui.infoView = function(data) {
.append(Ox.formatColor(data[key] || 0, key))
.appendTo($statistics);
});
-
+
+ var rightsLevel = pandora.site.rightsLevels[data['rightsLevel']];
+ $('
')
+ .css({marginBottom: '4px'})
+ .append(formatKey('Rights Level', true))
+ .append(
+ $('
')
+ .css({
+ paddingLeft: '3px',
+ borderRadius: '4px',
+ backgroundColor: 'rgb(' + rightsLevel.color.map(function(value) {
+ return value - 128;
+ }).join(', ') + ')',
+ color: 'rgb(' + rightsLevel.color.join(', ') + ')'
+ })
+ .html(rightsLevel.name)
+ )
+ .appendTo($statistics);
if (canEditIcons) {
$icon.bindEvent({
diff --git a/static/js/pandora/ui/item.js b/static/js/pandora/ui/item.js
index 903032370..2b4d749bc 100644
--- a/static/js/pandora/ui/item.js
+++ b/static/js/pandora/ui/item.js
@@ -6,8 +6,8 @@ pandora.ui.item = function() {
pandora.api.get({
id: pandora.user.ui.item,
- keys: ['video', 'timeline'].indexOf(pandora.user.ui.itemView)>-1 ?
- [ 'cuts', 'duration', 'layers', 'parts', 'rendered', 'size', 'title', 'videoRatio'] : []
+ keys: ['video', 'timeline'].indexOf(pandora.user.ui.itemView) > -1 ?
+ [ 'cuts', 'duration', 'layers', 'parts', 'rendered', 'rightsLevel', 'size', 'title', 'videoRatio'] : []
}, pandora.user.level == 'admin' && pandora.user.ui.itemView == 'info' ? 0 : -1, function(result) {
if (result.status.code == 200) {
@@ -27,9 +27,39 @@ pandora.ui.item = function() {
);
}*/
+ if (['video', 'timeline'].indexOf(pandora.user.ui.itemView) > -1) {
+ var subtitles = result.data.layers.subtitles
+ ? result.data.layers.subtitles.map(function(subtitle) {
+ return {'in': subtitle['in'], out: subtitle.out, text: subtitle.value};
+ })
+ : [],
+ canPlayClips = pandora.site.capabilities.canPlayClips[pandora.user.level] >= result.data.rightsLevel,
+ canPlayVideo = pandora.site.capabilities.canPlayVideo[pandora.user.level] >= result.data.rightsLevel,
+ censored = canPlayVideo ? []
+ : canPlayClips ? (
+ subtitles.length
+ ? Ox.merge(
+ subtitles.map(function(subtitle, i) {
+ return {
+ 'in': i == 0 ? 0 : subtitles[i - 1].out,
+ out: subtitle['in']
+ };
+ }),
+ [{'in': Ox.last(subtitles).out, out: result.data.duration}]
+ )
+ : Ox.range(0, result.data.duration - 5, 60).map(function(position) {
+ return {
+ 'in': position + 5,
+ out: Math.max(position + 60, result.data.duration)
+ };
+ })
+ )
+ : [{'in': 0, out: result.data.duration}];
+ }
+
if (!result.data.rendered && [
'clips', 'map', 'video', 'timeline'
- ].indexOf(pandora.user.ui.itemView)>-1) {
+ ].indexOf(pandora.user.ui.itemView) > -1) {
pandora.$ui.contentPanel.replaceElement(1,
Ox.Element()
.css({marginTop: '32px', fontSize: '12px', textAlign: 'center'})
@@ -120,6 +150,7 @@ pandora.ui.item = function() {
//
pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.player = Ox.VideoPanelPlayer({
annotationsSize: pandora.user.ui.annotationsSize,
+ censored: censored,
cuts: result.data.cuts || [],
duration: result.data.duration,
find: isClipsQuery ? clipsQuery.conditions[0].value : '',
@@ -134,10 +165,7 @@ pandora.ui.item = function() {
scaleToFill: pandora.user.ui.videoScale == 'fill',
showAnnotations: pandora.user.ui.showAnnotations,
showControls: pandora.user.ui.showControls,
- subtitles: result.data.layers.subtitles ?
- result.data.layers.subtitles.map(function(subtitle) {
- return {'in': subtitle['in'], out: subtitle.out, text: subtitle.value};
- }) : [],
+ subtitles: subtitles,
tooltips: true,
timeline: '/' + pandora.user.ui.item + '/timeline16p.png',
video: video,
@@ -186,6 +214,7 @@ pandora.ui.item = function() {
});
pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.editor = Ox.VideoEditor({
annotationsSize: pandora.user.ui.annotationsSize,
+ censored: censored,
cuts: result.data.cuts || [],
duration: result.data.duration,
find: isClipsQuery ? clipsQuery.conditions[0].value : '',
@@ -209,10 +238,7 @@ pandora.ui.item = function() {
showAnnotations: pandora.user.ui.showAnnotations,
showLargeTimeline: true,
// fixme: layers have value, subtitles has text?
- subtitles: result.data.layers.subtitles ?
- result.data.layers.subtitles.map(function(subtitle) {
- return {'in': subtitle['in'], out: subtitle.out, text: subtitle.value};
- }) : [],
+ subtitles: subtitles,
tooltips: true,
video: video,
videoRatio: result.data.videoRatio,
diff --git a/static/js/pandora/ui/itemClips.js b/static/js/pandora/ui/itemClips.js
index 414216dc8..8b835e1f1 100644
--- a/static/js/pandora/ui/itemClips.js
+++ b/static/js/pandora/ui/itemClips.js
@@ -75,11 +75,14 @@ pandora.ui.itemClips = function(options) {
$img = $item.find('.OxIcon > img');
points = [$item.data('in'), $item.data('out')];
if ($img.length) {
- pandora.api.get({id: self.options.id, keys: ['durations']}, function(result) {
+ pandora.api.get({id: self.options.id, keys: ['durations', 'rightsLevel']}, function(result) {
var partsAndPoints = pandora.getVideoPartsAndPoints(
result.data.durations, points
),
$player = Ox.VideoPlayer({
+ censored: pandora.site.capabilities.canPlayClips[pandora.user.level] < result.data.rightsLevel
+ ? [{'in': partsAndPoints.points[0], out: partsAndPoints.points[1]}]
+ : [],
enableMouse: true,
height: self.height,
'in': partsAndPoints.points[0],