81 lines
2.3 KiB
JavaScript
81 lines
2.3 KiB
JavaScript
'use strict';
|
|
|
|
oml.ui.annotationPanel = function() {
|
|
|
|
var $bar = Ox.Bar({size: 16});
|
|
|
|
var $button = Ox.Button({
|
|
disabled: true,
|
|
style: 'symbol',
|
|
title: 'add',
|
|
tooltip: Ox._('Add Quote'),
|
|
type: 'image'
|
|
}).bindEvent({
|
|
click: function() {
|
|
oml.$ui.viewer.postMessage('addAnnotation', {})
|
|
}
|
|
}).appendTo($bar);
|
|
|
|
var $menuButton = Ox.MenuButton({
|
|
items: [
|
|
{id: 'showAnnotations', title: Ox._('Show Annotations'), disabled: true},
|
|
{group: 'sort', min: 1, max: 1, items: [
|
|
{id: 'all', title: Ox._('All Annotations'), checked: true},
|
|
{id: 'my', title: Ox._('My Annotations'), checked: false},
|
|
]},
|
|
{},
|
|
{id: 'sortAnnotations', title: Ox._('Sort Annotations'), disabled: true},
|
|
{group: 'sort', min: 1, max: 1, items: [
|
|
{id: 'position', title: Ox._('By Position'), checked: true},
|
|
{id: 'quote', title: Ox._('By Quote Text'), checked: false},
|
|
{id: 'note', title: Ox._('By Note Text'), checked: false},
|
|
{id: 'date', title: Ox._('By Date Added'), checked: false}
|
|
]},
|
|
{},
|
|
{id: 'exportAnnotations', title: Ox._('Export Annotations')},
|
|
],
|
|
style: 'square',
|
|
title: 'set',
|
|
type: 'image',
|
|
width: 16
|
|
}).css({
|
|
// borderColor: 'transparent',
|
|
float: 'right'
|
|
}).appendTo($bar)
|
|
.bindEvent({
|
|
click: function(data) {
|
|
var id = data.id;
|
|
if (id == 'exportAnnotations') {
|
|
oml.api.get({
|
|
id: oml.user.ui.item,
|
|
keys: []
|
|
}, function(result) {
|
|
oml.ui.exportAnnotationsDialog(result.data).open()
|
|
})
|
|
}
|
|
}
|
|
});
|
|
|
|
var ui = oml.user.ui;
|
|
var that = Ox.SplitPanel({
|
|
elements: [
|
|
{
|
|
element: $bar,
|
|
size: 16
|
|
},
|
|
{
|
|
element: oml.$ui.annotationFolder = oml.ui.annotationFolder()
|
|
}
|
|
],
|
|
orientation: 'vertical'
|
|
});
|
|
|
|
that.updateSelection = function(selection) {
|
|
$button.options({
|
|
disabled: !selection
|
|
})
|
|
}
|
|
|
|
return that;
|
|
|
|
};
|