rightslevel

This commit is contained in:
rolux 2011-10-25 13:59:27 +00:00
commit 389619feaf
8 changed files with 126 additions and 49 deletions

View file

@ -132,13 +132,13 @@ 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', 'rightsLevel']}, 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
censored: pandora.site.capabilities.canPlayClips[pandora.user.level] < result.data.rightslevel
? [{'in': partsAndPoints.points[0], out: partsAndPoints.points[1]}]
: [],
height: height,

View file

@ -416,9 +416,9 @@ pandora.ui.infoView = function(data) {
.appendTo($text);
});
$('<div>').css({height: '8px'}).appendTo($text);
$('<div>').css({height: '16px'}).appendTo($text);
//pandora.createLinks($text);
// Hue, Saturation, Lightness, Volume --------------------------------------
['hue', 'saturation', 'lightness', 'volume'].forEach(function(key) {
$('<div>')
@ -428,6 +428,8 @@ pandora.ui.infoView = function(data) {
.appendTo($statistics);
});
// Rights Level ------------------------------------------------------------
var $rightsLevel = $('<div>');
$('<div>')
.css({marginBottom: '4px'})
@ -436,6 +438,43 @@ pandora.ui.infoView = function(data) {
.appendTo($statistics);
renderRightsLevel();
// Notes -------------------------------------------------------------------
if (canEdit) {
Ox.print('DATA', data)
$('<div>')
.css({marginBottom: '4px'})
.append(formatKey('Notes', true))
.append(
Ox.Editable({
format: function(value) {
return value || formatLight('No notes');
},
height: 128,
placeholder: formatLight('No notes'),
tooltip: 'Doubleclick to edit',
type: 'textarea',
value: data.notes,
width: 128
})
.bindEvent({
submit: function(event) {
pandora.api.edit({
id: data.id,
notes: event.value
}, function(result) {
// ...
});
}
})
)
.appendTo($statistics);
}
$('<div>').css({height: '16px'}).appendTo($statistics);
if (canEdit) {
$icon.bindEvent({
doubleclick: function() {
@ -587,21 +626,23 @@ pandora.ui.infoView = function(data) {
marginBottom: '4px'
})
.appendTo($capabilities);
Ox.Label({
textAlign: 'center',
title: canEdit ? Ox.toTitleCase(userLevel) : pandora.site.rightsLevels[data.rightsLevel].name,
width: canEdit ? 48 : 68
})
.css(Ox.extend(
{
float: 'left',
paddingTop: '2px',
height: '12px',
fontSize: '8px'
},
canEdit ? getUserLevelCSS(userLevel) : getRightsLevelCSS(data.rightsLevel)
))
.appendTo($line);
if (canEdit) {
Ox.Label({
textAlign: 'center',
title: Ox.toTitleCase(userLevel),
width: 48
})
.css(Ox.extend(
{
float: 'left',
paddingTop: '2px',
height: '12px',
fontSize: '8px'
},
getUserLevelCSS(userLevel)
))
.appendTo($line);
}
capabilities.forEach(function(capability) {
var hasCapability = pandora.site.capabilities[capability.name][userLevel] >= rightsLevel;
Ox.Button({
@ -613,11 +654,24 @@ pandora.ui.infoView = function(data) {
title: capability.symbol,
type: 'image'
})
.css(Ox.extend({
marginLeft: '4px'
}, getCapabilityCSS(hasCapability)))
.css(getCapabilityCSS(hasCapability))
.css('margin' + (canEdit ? 'Left' : 'Right'), '4px')
.appendTo($line);
});
if (!canEdit) {
Ox.Button({
title: 'Help',
tooltip: 'About Rights',
type: 'image'
})
.css({marginLeft: '52px'})
.bindEvent({
click: function() {
pandora.URL.push('/rights');
}
})
.appendTo($line);
}
});
}
@ -724,13 +778,13 @@ pandora.ui.infoView = function(data) {
}
function renderRightsLevel() {
var $capabilites, $rightsLevelSelect,
rightsLevelCSS = getRightsLevelCSS(data.rightsLevel);
var $capabilites, $rightsLevelLabel, $rightsLevelSelect,
rightsLevelCSS = getRightsLevelCSS(data.rightslevel);
$rightsLevel.empty();
if (canEdit) {
$rightsLevelSelect = Ox.Select({
items: pandora.site.rightsLevels.map(function(rightsLevel, i) {
return {id: i, title: rightsLevel.name, checked: i == data.rightsLevel};
return {id: i, title: rightsLevel.name, checked: i == data.rightslevel};
}),
width: 128
})
@ -742,15 +796,24 @@ pandora.ui.infoView = function(data) {
var rightsLevel = event.selected[0].id;
$rightsLevelSelect.css(getRightsLevelCSS(rightsLevel));
renderCapabilities(rightsLevel);
pandora.api.edit({id: data.id, rightsLevel: rightsLevel}, function(result) {
pandora.api.edit({id: data.id, rightslevel: rightsLevel}, function(result) {
// ...
});
}
})
.appendTo($rightsLevel);
} else {
$rightsLevelLabel = Ox.Label({
title: pandora.site.rightsLevels[data.rightslevel].name,
width: 128
})
.css(Ox.extend({
marginBottom: '4px'
}, rightsLevelCSS))
.appendTo($rightsLevel);
}
$capabilities = $('<div>').appendTo($rightsLevel);
renderCapabilities(data.rightsLevel);
renderCapabilities(data.rightslevel);
}
function toggleIconSize() {

View file

@ -7,7 +7,7 @@ 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', 'rightsLevel', 'size', 'title', 'videoRatio'] : []
[ '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) {
@ -34,8 +34,8 @@ pandora.ui.item = function() {
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,
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

View file

@ -75,12 +75,12 @@ 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', 'rightsLevel']}, 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
censored: pandora.site.capabilities.canPlayClips[pandora.user.level] < result.data.rightslevel
? [{'in': partsAndPoints.points[0], out: partsAndPoints.points[1]}]
: [],
enableMouse: true,