Compare commits

..

No commits in common. "c64b13537b395d917c69aef99d7632c165d8cf90" and "addce753236ef4ecd285a21a5696c1834d3b8e76" have entirely different histories.

4 changed files with 124 additions and 75 deletions

View file

@ -186,17 +186,6 @@ def load_config(init=False):
if level not in config[key]:
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'):
if key not in config:
sys.stderr.write("adding default value:\n\t\"%s\": %s,\n\n" % (key, json.dumps(default[key])))

View file

@ -201,7 +201,8 @@ pandora.ui.documentDialog = function(options) {
zoom: 'fit'
})
: item.extension == 'html'
? pandora.$ui.textPanel = pandora.ui.textPanel(item)
? pandora.ui.textPanel(item).css({
})
: Ox.ImageViewer({
area: pandora.user.ui.documents[item.id]
? pandora.user.ui.documents[item.id].position
@ -242,7 +243,7 @@ pandora.ui.documentDialog = function(options) {
}
function setTitle() {
that.options({title: item.title + (item.extension == 'html' ? '' : '.' + item.extension)});
that.options({title: item.title + '.' + item.extension});
}
that.getItems = function() {

View file

@ -1,5 +1,104 @@
'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() {
var ui = pandora.user.ui,
$orderButton = Ox.Button({
@ -17,9 +116,7 @@ pandora.ui.documentSortSelect = function() {
}
}),
$sortSelect = Ox.Select({
items: pandora.site.documentKeys.filter(function(key) {
return key.sort;
}).map(function(column) {
items: pandora.documentColumns.map(function(column) {
return {
id: column.id,
title: Ox._('Sort by {0}', [column.title])
@ -33,7 +130,7 @@ pandora.ui.documentSortSelect = function() {
var key = data.value;
pandora.UI.set({documentsSort: [{
key: key,
operator: Ox.getObjectById(pandora.site.documentKeys, key).operator
operator: Ox.getObjectById(pandora.documentColumns, key).operator
}]});
}
}),
@ -778,32 +875,7 @@ pandora.ui.documentsPanel = function(options) {
unique: 'id'
};
return (ui.documentsView == 'list' ? Ox.TableList(Ox.extend(options, {
columns: pandora.site.documentSortKeys.filter(function(key) {
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
};
}),
columns: pandora.documentColumns,
columnsVisible: true,
scrollbarVisible: true,
})) : Ox.IconList(Ox.extend(options, {
@ -811,7 +883,7 @@ pandora.ui.documentsPanel = function(options) {
var sortKey = sort[0].key,
infoKey = sortKey == 'title' ? 'extension' : sortKey,
info = (
Ox.getObjectById(pandora.site.documentKeys, infoKey).format || Ox.identity
Ox.getObjectById(pandora.documentColumns, infoKey).format || Ox.identity
)(data[infoKey]),
size = size || 128;
return {

View file

@ -1,30 +1,16 @@
'use strict';
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,
textEmbed,
embedURLs = getEmbedURLs(text.text),
that = Ox.SplitPanel({
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,
size: pandora.user.ui.embedSize,
resizable: true,
@ -138,6 +124,7 @@ pandora.ui.textPanel = function(text, $toolbar) {
0),
position = 100 * scrollTop / Math.max(1, textElement[0].scrollHeight);
textElement.scrollTo(position);
window.text = textElement;
}
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()
.bindEvent({