Compare commits
No commits in common. "c64b13537b395d917c69aef99d7632c165d8cf90" and "addce753236ef4ecd285a21a5696c1834d3b8e76" have entirely different histories.
c64b13537b
...
addce75323
4 changed files with 124 additions and 75 deletions
|
|
@ -186,17 +186,6 @@ def load_config(init=False):
|
||||||
if level not in config[key]:
|
if level not in config[key]:
|
||||||
config[key] = default.get(key, 0)
|
config[key] = default.get(key, 0)
|
||||||
|
|
||||||
config['user']['ui']['documentsSort'] = [
|
|
||||||
s for s in config['user']['ui']['documentsSort']
|
|
||||||
if get_by_id(config['documentKeys'], s['key'])
|
|
||||||
]
|
|
||||||
if not config['user']['ui']['documentsSort']:
|
|
||||||
sort_key = [k for k in config['documentKeys'] if k['id'] != '*'][0]
|
|
||||||
config['user']['ui']['documentsSort'] = [{
|
|
||||||
"key": sort_key['id'],
|
|
||||||
"operator": sort_key.get('operator', '+')
|
|
||||||
}]
|
|
||||||
|
|
||||||
for key in ('language', 'importMetadata'):
|
for key in ('language', 'importMetadata'):
|
||||||
if key not in config:
|
if key not in config:
|
||||||
sys.stderr.write("adding default value:\n\t\"%s\": %s,\n\n" % (key, json.dumps(default[key])))
|
sys.stderr.write("adding default value:\n\t\"%s\": %s,\n\n" % (key, json.dumps(default[key])))
|
||||||
|
|
|
||||||
|
|
@ -201,7 +201,8 @@ pandora.ui.documentDialog = function(options) {
|
||||||
zoom: 'fit'
|
zoom: 'fit'
|
||||||
})
|
})
|
||||||
: item.extension == 'html'
|
: item.extension == 'html'
|
||||||
? pandora.$ui.textPanel = pandora.ui.textPanel(item)
|
? pandora.ui.textPanel(item).css({
|
||||||
|
})
|
||||||
: Ox.ImageViewer({
|
: Ox.ImageViewer({
|
||||||
area: pandora.user.ui.documents[item.id]
|
area: pandora.user.ui.documents[item.id]
|
||||||
? pandora.user.ui.documents[item.id].position
|
? pandora.user.ui.documents[item.id].position
|
||||||
|
|
@ -242,7 +243,7 @@ pandora.ui.documentDialog = function(options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setTitle() {
|
function setTitle() {
|
||||||
that.options({title: item.title + (item.extension == 'html' ? '' : '.' + item.extension)});
|
that.options({title: item.title + '.' + item.extension});
|
||||||
}
|
}
|
||||||
|
|
||||||
that.getItems = function() {
|
that.getItems = function() {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,107 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
pandora.documentColumns = [
|
||||||
|
{
|
||||||
|
id: 'title',
|
||||||
|
operator: '+',
|
||||||
|
title: Ox._('Title'),
|
||||||
|
find: true,
|
||||||
|
visible: true,
|
||||||
|
width: 256
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'id',
|
||||||
|
operator: '+',
|
||||||
|
title: Ox._('ID'),
|
||||||
|
visible: true,
|
||||||
|
width: 64
|
||||||
|
},
|
||||||
|
{
|
||||||
|
format: function(value) {
|
||||||
|
return value.toUpperCase();
|
||||||
|
},
|
||||||
|
id: 'extension',
|
||||||
|
operator: '+',
|
||||||
|
title: Ox._('Extension'),
|
||||||
|
find: true,
|
||||||
|
visible: true,
|
||||||
|
width: 64
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'right',
|
||||||
|
format: function(value, data) {
|
||||||
|
return Ox.isArray(value)
|
||||||
|
? Ox.formatDimensions(value, 'px')
|
||||||
|
: Ox.formatCount(value, (data && data.extension == 'html') ? 'word' : 'page');
|
||||||
|
},
|
||||||
|
id: 'dimensions',
|
||||||
|
operator: '-',
|
||||||
|
title: Ox._('Dimensions'),
|
||||||
|
visible: true,
|
||||||
|
width: 128
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'right',
|
||||||
|
format: function(value) {
|
||||||
|
return Ox.formatValue(value, 'B');
|
||||||
|
},
|
||||||
|
id: 'size',
|
||||||
|
operator: '-',
|
||||||
|
title: Ox._('Size'),
|
||||||
|
visible: true,
|
||||||
|
width: 64
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'description',
|
||||||
|
operator: '+',
|
||||||
|
title: Ox._('Description'),
|
||||||
|
find: true,
|
||||||
|
visible: true,
|
||||||
|
width: 256
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'right',
|
||||||
|
id: 'matches',
|
||||||
|
operator: '-',
|
||||||
|
title: Ox._('Matches'),
|
||||||
|
visible: true,
|
||||||
|
width: 64
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'user',
|
||||||
|
operator: '+',
|
||||||
|
title: Ox._('User'),
|
||||||
|
find: true,
|
||||||
|
visible: true,
|
||||||
|
width: 128
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'right',
|
||||||
|
format: function(value) {
|
||||||
|
return Ox.formatDate(value, '%F %T');
|
||||||
|
},
|
||||||
|
id: 'created',
|
||||||
|
operator: '-',
|
||||||
|
title: Ox._('Created'),
|
||||||
|
visible: true,
|
||||||
|
width: 144
|
||||||
|
},
|
||||||
|
{
|
||||||
|
align: 'right',
|
||||||
|
format: function(value) {
|
||||||
|
return Ox.formatDate(value, '%F %T');
|
||||||
|
},
|
||||||
|
id: 'modified',
|
||||||
|
operator: '-',
|
||||||
|
title: Ox._('Modified'),
|
||||||
|
visible: true,
|
||||||
|
width: 144
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
pandora.ui.documentSortSelect = function() {
|
pandora.ui.documentSortSelect = function() {
|
||||||
var ui = pandora.user.ui,
|
var ui = pandora.user.ui,
|
||||||
$orderButton = Ox.Button({
|
$orderButton = Ox.Button({
|
||||||
overlap: 'left',
|
overlap: 'left',
|
||||||
title: getOrderButtonTitle(),
|
title: getOrderButtonTitle(),
|
||||||
tooltip: getOrderButtonTooltip(),
|
tooltip: getOrderButtonTooltip(),
|
||||||
|
|
@ -17,9 +116,7 @@ pandora.ui.documentSortSelect = function() {
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
$sortSelect = Ox.Select({
|
$sortSelect = Ox.Select({
|
||||||
items: pandora.site.documentKeys.filter(function(key) {
|
items: pandora.documentColumns.map(function(column) {
|
||||||
return key.sort;
|
|
||||||
}).map(function(column) {
|
|
||||||
return {
|
return {
|
||||||
id: column.id,
|
id: column.id,
|
||||||
title: Ox._('Sort by {0}', [column.title])
|
title: Ox._('Sort by {0}', [column.title])
|
||||||
|
|
@ -33,7 +130,7 @@ pandora.ui.documentSortSelect = function() {
|
||||||
var key = data.value;
|
var key = data.value;
|
||||||
pandora.UI.set({documentsSort: [{
|
pandora.UI.set({documentsSort: [{
|
||||||
key: key,
|
key: key,
|
||||||
operator: Ox.getObjectById(pandora.site.documentKeys, key).operator
|
operator: Ox.getObjectById(pandora.documentColumns, key).operator
|
||||||
}]});
|
}]});
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
@ -764,46 +861,21 @@ pandora.ui.documentsPanel = function(options) {
|
||||||
|
|
||||||
function renderList() {
|
function renderList() {
|
||||||
var options = {
|
var options = {
|
||||||
items: pandora.api.findDocuments,
|
items: pandora.api.findDocuments,
|
||||||
keys: ['description', 'dimensions', 'extension', 'id', 'title', 'ratio', 'size', 'user', 'entities', 'modified'],
|
keys: ['description', 'dimensions', 'extension', 'id', 'title', 'ratio', 'size', 'user', 'entities', 'modified'],
|
||||||
query: {
|
query: {
|
||||||
conditions: isItemView ? [{ key: 'item', value: ui.item, operator: '==' }] : [],
|
conditions: isItemView ? [{ key: 'item', value: ui.item, operator: '==' }] : [],
|
||||||
operator: '&'
|
operator: '&'
|
||||||
},
|
},
|
||||||
selected: ui.documentsSelection[isItemView ? ui.item : ''] || [],
|
selected: ui.documentsSelection[isItemView ? ui.item : ''] || [],
|
||||||
sort: ui.documentsSort.concat([
|
sort: ui.documentsSort.concat([
|
||||||
{key: 'extension', operator: '+'},
|
{key: 'extension', operator: '+'},
|
||||||
{key: 'title', operator: '+'}
|
{key: 'title', operator: '+'}
|
||||||
]),
|
]),
|
||||||
unique: 'id'
|
unique: 'id'
|
||||||
};
|
};
|
||||||
return (ui.documentsView == 'list' ? Ox.TableList(Ox.extend(options, {
|
return (ui.documentsView == 'list' ? Ox.TableList(Ox.extend(options, {
|
||||||
columns: pandora.site.documentSortKeys.filter(function(key) {
|
columns: pandora.documentColumns,
|
||||||
return (!key.capability
|
|
||||||
|| pandora.hasCapability(key.capability)) && key.columnWidth;
|
|
||||||
}).map(function(key) {
|
|
||||||
var position = ui.collectionColumns.indexOf(key.id);
|
|
||||||
return {
|
|
||||||
addable: key.id != 'random',
|
|
||||||
align: ['string', 'text'].indexOf(
|
|
||||||
Ox.isArray(key.type) ? key.type[0]: key.type
|
|
||||||
) > -1 ? 'left' : key.type == 'list' ? 'center' : 'right',
|
|
||||||
defaultWidth: key.columnWidth,
|
|
||||||
format: (function() {
|
|
||||||
return function(value, data) {
|
|
||||||
return pandora.formatDocumentKey(key, data);
|
|
||||||
}
|
|
||||||
})(),
|
|
||||||
id: key.id,
|
|
||||||
operator: pandora.getDocumentSortOperator(key.id),
|
|
||||||
position: position,
|
|
||||||
removable: !key.columnRequired,
|
|
||||||
title: Ox._(key.title),
|
|
||||||
type: key.type,
|
|
||||||
visible: position > -1,
|
|
||||||
width: ui.collectionColumnWidth[key.id] || key.columnWidth
|
|
||||||
};
|
|
||||||
}),
|
|
||||||
columnsVisible: true,
|
columnsVisible: true,
|
||||||
scrollbarVisible: true,
|
scrollbarVisible: true,
|
||||||
})) : Ox.IconList(Ox.extend(options, {
|
})) : Ox.IconList(Ox.extend(options, {
|
||||||
|
|
@ -811,7 +883,7 @@ pandora.ui.documentsPanel = function(options) {
|
||||||
var sortKey = sort[0].key,
|
var sortKey = sort[0].key,
|
||||||
infoKey = sortKey == 'title' ? 'extension' : sortKey,
|
infoKey = sortKey == 'title' ? 'extension' : sortKey,
|
||||||
info = (
|
info = (
|
||||||
Ox.getObjectById(pandora.site.documentKeys, infoKey).format || Ox.identity
|
Ox.getObjectById(pandora.documentColumns, infoKey).format || Ox.identity
|
||||||
)(data[infoKey]),
|
)(data[infoKey]),
|
||||||
size = size || 128;
|
size = size || 128;
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,16 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
pandora.ui.textPanel = function(text, $toolbar) {
|
pandora.ui.textPanel = function(text, $toolbar) {
|
||||||
if (Ox.isUndefined(text.text)) {
|
|
||||||
var that = Ox.Element().append(Ox.LoadingScreen().start())
|
|
||||||
pandora.api.getDocument({
|
|
||||||
id: text.id,
|
|
||||||
keys: ['text']
|
|
||||||
}, function(result) {
|
|
||||||
text.text = result.data.text
|
|
||||||
if (text.text) {
|
|
||||||
pandora.$ui.textPanel.replaceWith(pandora.$ui.textPanel = pandora.ui.textPanel(text, $toolbar))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return that;
|
|
||||||
}
|
|
||||||
|
|
||||||
var textElement,
|
var textElement,
|
||||||
textEmbed,
|
textEmbed,
|
||||||
embedURLs = getEmbedURLs(text.text),
|
embedURLs = getEmbedURLs(text.text),
|
||||||
that = Ox.SplitPanel({
|
that = Ox.SplitPanel({
|
||||||
elements: [
|
elements: [
|
||||||
{
|
{
|
||||||
element: textElement = pandora.ui.textHTML(text)
|
element: textElement = pandora.$ui.textElement = pandora.ui.textHTML(text)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
element: textEmbed = pandora.ui.textEmbed(),
|
element: textEmbed = pandora.ui.textEmbed(textElement),
|
||||||
collapsed: !embedURLs.length,
|
collapsed: !embedURLs.length,
|
||||||
size: pandora.user.ui.embedSize,
|
size: pandora.user.ui.embedSize,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
|
|
@ -138,6 +124,7 @@ pandora.ui.textPanel = function(text, $toolbar) {
|
||||||
0),
|
0),
|
||||||
position = 100 * scrollTop / Math.max(1, textElement[0].scrollHeight);
|
position = 100 * scrollTop / Math.max(1, textElement[0].scrollHeight);
|
||||||
textElement.scrollTo(position);
|
textElement.scrollTo(position);
|
||||||
|
window.text = textElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
that.selectEmbed = function(index, scroll) {
|
that.selectEmbed = function(index, scroll) {
|
||||||
|
|
@ -444,7 +431,7 @@ pandora.ui.textHTML = function(text) {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pandora.ui.textEmbed = function(textEmbed) {
|
pandora.ui.textEmbed = function(textElement) {
|
||||||
|
|
||||||
var that = Ox.Element()
|
var that = Ox.Element()
|
||||||
.bindEvent({
|
.bindEvent({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue