forked from 0x2620/pandora
update video editor
This commit is contained in:
parent
ed37cd6924
commit
84cdd2ebf5
13 changed files with 155 additions and 44 deletions
|
|
@ -7,9 +7,7 @@ pandora.ui.clipList = function(videoRatio) {
|
|||
var ui = pandora.user.ui,
|
||||
fixedRatio = !ui.item ? 16/9 : videoRatio,
|
||||
isClipView = !ui.item ? ui.listView == 'clip' : ui.itemView == 'clips',
|
||||
textKey = Ox.getObjectById(pandora.site.layers, 'subtitles')
|
||||
? 'subtitles'
|
||||
: 'annotations',
|
||||
textKey = pandora.getClipTextKey(),
|
||||
that = Ox.IconList({
|
||||
fixedRatio: fixedRatio,
|
||||
item: function(data, sort, size) {
|
||||
|
|
|
|||
|
|
@ -4,9 +4,7 @@
|
|||
|
||||
pandora.ui.clipsView = function(videoRatio) {
|
||||
|
||||
var textKey = Ox.getObjectById(pandora.site.layers, 'subtitles')
|
||||
? 'subtitles'
|
||||
: 'annotations',
|
||||
var textKey = pandora.getClipTextKey(),
|
||||
that = Ox.SplitPanel({
|
||||
elements: [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -203,6 +203,20 @@ pandora.ui.filesView = function(options, self) {
|
|||
});
|
||||
}
|
||||
},
|
||||
'delete': function(data) {
|
||||
var ids = data.ids.filter(function(id) {
|
||||
return self.$filesList.value(id, 'instances').length == 0;
|
||||
});
|
||||
if(ids.length>0 && pandora.user.level == 'admin') {
|
||||
Ox.print('delete', ids);
|
||||
pandora.api.removeFiles({
|
||||
ids: ids
|
||||
}, function(result) {
|
||||
Ox.Request.clearCache();
|
||||
self.$filesList.reloadList();
|
||||
});
|
||||
}
|
||||
},
|
||||
init: function(data) {
|
||||
self.numberOfItems = data.items;
|
||||
},
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@ pandora.ui.infoView = function(data) {
|
|||
// when collapsing the movies browser, the info view should become a split panel
|
||||
|
||||
var ui = pandora.user.ui,
|
||||
canEdit = pandora.site.capabilities.canEditMetadata[pandora.user.level],
|
||||
descriptions = [],
|
||||
canEdit = pandora.site.capabilities.canEditMetadata[pandora.user.level] || data.editable,
|
||||
css = {
|
||||
marginTop: '4px',
|
||||
textAlign: 'justify',
|
||||
|
|
@ -108,7 +109,6 @@ pandora.ui.infoView = function(data) {
|
|||
.appendTo($reflection),
|
||||
|
||||
$text = Ox.Element({
|
||||
tooltip: canEdit && !isEditable ? 'Doubleclick to reload metadata' : ''
|
||||
})
|
||||
.css({
|
||||
position: 'absolute',
|
||||
|
|
@ -117,9 +117,6 @@ pandora.ui.infoView = function(data) {
|
|||
right: margin + statisticsWidth + margin + 'px',
|
||||
//background: 'green'
|
||||
})
|
||||
.bindEvent(canEdit && !isEditable ? {
|
||||
doubleclick: reloadMetadata
|
||||
} : {})
|
||||
.appendTo($data.$element),
|
||||
|
||||
$statistics = $('<div>')
|
||||
|
|
@ -252,7 +249,8 @@ pandora.ui.infoView = function(data) {
|
|||
Ox.Editable({
|
||||
clickLink: pandora.clickLink,
|
||||
placeholder: formatLight('unknown'),
|
||||
tooltip: 'Doubleclick to edit',
|
||||
editable: isEditable,
|
||||
tooltip: isEditable ? 'Doubleclick to edit' : '',
|
||||
type: 'textarea',
|
||||
value: data.description || ''
|
||||
})
|
||||
|
|
@ -267,14 +265,14 @@ pandora.ui.infoView = function(data) {
|
|||
var list_keys = ['language', 'topic', 'director', 'cinematographer', 'features', 'groups'];
|
||||
$('<div>').html('<br>').appendTo($text);
|
||||
[
|
||||
'source',
|
||||
'project',
|
||||
'date',
|
||||
'location',
|
||||
'director',
|
||||
'cinematographer',
|
||||
'features',
|
||||
'language',
|
||||
'source',
|
||||
'project',
|
||||
'topic',
|
||||
'user',
|
||||
].forEach(function(key) {
|
||||
|
|
@ -291,11 +289,16 @@ pandora.ui.infoView = function(data) {
|
|||
clickLink: pandora.clickLink,
|
||||
format: function(value) {
|
||||
return list_keys.indexOf(key) >= 0
|
||||
? formatValue(value.split(', '), key)
|
||||
? formatValue(value.split(', '), {
|
||||
'director': 'name',
|
||||
'cinematographer': 'name',
|
||||
'features': 'name',
|
||||
}[key] || key)
|
||||
: value;
|
||||
},
|
||||
placeholder: formatLight('unknown'),
|
||||
tooltip: 'Doubleclick to edit',
|
||||
editable: isEditable,
|
||||
tooltip: isEditable ? 'Doubleclick to edit' : '',
|
||||
value: list_keys.indexOf(key) >= 0
|
||||
? (data[key] || []).join(', ')
|
||||
: data[key] || ''
|
||||
|
|
@ -306,6 +309,31 @@ pandora.ui.infoView = function(data) {
|
|||
}
|
||||
})
|
||||
.appendTo($div);
|
||||
if(pandora.site.itemKeys.filter(function(item) {
|
||||
if (item.id == key)
|
||||
return item.description
|
||||
}).length > 0) {
|
||||
$('<div>')
|
||||
.append(
|
||||
descriptions[key] = Ox.Editable({
|
||||
clickLink: pandora.clickLink,
|
||||
placeholder: formatLight(Ox.toTitleCase(key) + ' Description'),
|
||||
editable: isEditable,
|
||||
tooltip: isEditable ? 'Doubleclick to edit' : '',
|
||||
type: 'textarea',
|
||||
value: data[key + 'description']|| ''
|
||||
})
|
||||
.bindEvent({
|
||||
submit: function(event) {
|
||||
editMetadata(key + 'description', event.value);
|
||||
}
|
||||
})
|
||||
).css({
|
||||
'padding-top': '4px',
|
||||
'padding-bottom': '4px'
|
||||
})
|
||||
.appendTo($div);
|
||||
}
|
||||
});
|
||||
|
||||
$('<div>').css({height: '16px'}).appendTo($text);
|
||||
|
|
@ -348,9 +376,10 @@ pandora.ui.infoView = function(data) {
|
|||
.appendTo($statistics);
|
||||
renderRightsLevel();
|
||||
|
||||
// Notes -------------------------------------------------------------------
|
||||
// Groups, Notes ---------------------------------------------------------
|
||||
|
||||
if (canEdit) {
|
||||
|
||||
$('<div>')
|
||||
.css({marginBottom: '4px'})
|
||||
.append(formatKey('Groups', true))
|
||||
|
|
@ -403,6 +432,11 @@ pandora.ui.infoView = function(data) {
|
|||
edit[key] = value;
|
||||
}
|
||||
pandora.api.edit(edit, function(result) {
|
||||
data[key] = value;
|
||||
descriptions[key] && descriptions[key].options({
|
||||
value: result.data[key+'description']
|
||||
});
|
||||
|
||||
Ox.Request.clearCache(); // fixme: too much? can change filter/list etc
|
||||
if (result.data.id != data.id) {
|
||||
pandora.UI.set({item: result.data.id});
|
||||
|
|
@ -445,21 +479,6 @@ pandora.ui.infoView = function(data) {
|
|||
);
|
||||
}
|
||||
|
||||
function reloadMetadata() {
|
||||
var item = ui.item;
|
||||
// fixme: maybe there's a better method name for this?
|
||||
pandora.api.updateExternalData({
|
||||
id: ui.item
|
||||
}, function(result) {
|
||||
Ox.Request.clearCache(item);
|
||||
if (ui.item == item && ui.itemView == 'info') {
|
||||
pandora.$ui.contentPanel.replaceElement(
|
||||
1, pandora.$ui.item = pandora.ui.item()
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function renderCapabilities(rightsLevel) {
|
||||
var capabilities = Ox.merge(
|
||||
canEdit ? [{name: 'canSeeItem', symbol: 'Find'}] : [],
|
||||
|
|
|
|||
|
|
@ -278,8 +278,9 @@ pandora.ui.item = function() {
|
|||
out: data.out,
|
||||
value: data.value,
|
||||
}, function(result) {
|
||||
result.data.editable = true;
|
||||
// fixme: both should come from backend
|
||||
result.data.duration = result.data.out - result.data['in'];
|
||||
result.data.editable = true;
|
||||
pandora.$ui.editor.addAnnotation(data.layer, result.data);
|
||||
});
|
||||
},
|
||||
|
|
@ -295,6 +296,10 @@ pandora.ui.item = function() {
|
|||
annotationssort: function(data) {
|
||||
pandora.UI.set({annotationsSort: data.sort});
|
||||
},
|
||||
define: function(data) {
|
||||
pandora.$ui.placesDialog && pandora.$ui.placesDialog.remove();
|
||||
pandora.$ui.placesDialog = pandora.ui.placesDialog(data).open();
|
||||
},
|
||||
editannotation: function(data) {
|
||||
Ox.Log('', 'editAnnotation', data);
|
||||
//fixme: check that edit was successfull
|
||||
|
|
@ -304,9 +309,11 @@ pandora.ui.item = function() {
|
|||
out: data.out,
|
||||
value: data.value,
|
||||
}, function(result) {
|
||||
Ox.Log('', 'editAnnotation result', result);
|
||||
Ox.print('', 'editAnnotation result', result);
|
||||
// fixme: both should come from backend
|
||||
result.data.duration = result.data.out - result.data['in'];
|
||||
pandora.$ui.editor.updateAnnotation(data.layer, result.data);
|
||||
result.data.editable = true;
|
||||
pandora.$ui.editor.updateAnnotation(result.data);
|
||||
});
|
||||
},
|
||||
find: function(data) {
|
||||
|
|
|
|||
|
|
@ -2,16 +2,12 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
pandora.ui.placesDialog = function() {
|
||||
pandora.ui.placesDialog = function(options) {
|
||||
// options can be {id: '...'} or {name: '...'}
|
||||
var height = Math.round((window.innerHeight - 48) * 0.9),
|
||||
width = Math.round(window.innerWidth * 0.9),
|
||||
$content = Ox.ListMap({
|
||||
height: height - 48,
|
||||
places: function(data, callback) {
|
||||
return pandora.api.findPlaces(Ox.extend({
|
||||
query: {conditions: [], operator: ''}
|
||||
}, data), callback);
|
||||
},
|
||||
addPlace: function(place, callback) {
|
||||
pandora.api.addPlace(place, function(result) {
|
||||
Ox.Request.clearCache(); // fixme: remove
|
||||
|
|
@ -45,12 +41,23 @@ pandora.ui.placesDialog = function() {
|
|||
callback(result.data.items);
|
||||
});
|
||||
},
|
||||
names: pandora.hasPlacesLayer ? function(callback) {
|
||||
pandora.api.getPlaceNames(function(result) {
|
||||
callback(result.data.items);
|
||||
});
|
||||
} : null,
|
||||
places: function(data, callback) {
|
||||
return pandora.api.findPlaces(Ox.extend({
|
||||
query: {conditions: [], operator: ''}
|
||||
}, data), callback);
|
||||
},
|
||||
removePlace: function(place, callback) {
|
||||
pandora.api.removePlace(place, function(result) {
|
||||
Ox.Request.clearCache(); // fixme: remove
|
||||
callback(result);
|
||||
});
|
||||
},
|
||||
selected: options ? options.id : void 0,
|
||||
showControls: pandora.user.ui.showMapControls,
|
||||
showLabels: pandora.user.ui.showMapLabels,
|
||||
showTypes: true,
|
||||
|
|
|
|||
|
|
@ -495,6 +495,12 @@ pandora.getClipsQuery = function() {
|
|||
return clipsQuery;
|
||||
};
|
||||
|
||||
pandora.getClipTextKey = function() {
|
||||
return Ox.getObjectById(pandora.site.layers, 'subtitles')
|
||||
? 'subtitles'
|
||||
: 'annotations';
|
||||
};
|
||||
|
||||
(function() {
|
||||
var itemTitles = {};
|
||||
pandora.getDocumentTitle = function(itemTitle) {
|
||||
|
|
@ -820,11 +826,23 @@ pandora.hasDialogOrScreen = function() {
|
|||
|| $('.OxScreen').length;
|
||||
};
|
||||
|
||||
pandora.hasEventsLayer = function() {
|
||||
return pandora.site.layers.some(function(layer) {
|
||||
return layer.type == 'event';
|
||||
});
|
||||
};
|
||||
|
||||
pandora.hasFocusedInput = function() {
|
||||
var focused = Ox.Focus.focused();
|
||||
return focused && Ox.UI.elements[focused].is('.OxInput');
|
||||
};
|
||||
|
||||
pandora.hasPlacesLayer = function() {
|
||||
return pandora.site.layers.some(function(layer) {
|
||||
return layer.type == 'place';
|
||||
});
|
||||
};
|
||||
|
||||
pandora.isClipView = function(view, item) {
|
||||
if (arguments.length == 0) {
|
||||
item = pandora.user.ui.item;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue