prepare public api

This commit is contained in:
j 2019-01-17 16:00:22 +05:30
commit dd0e22a979
18 changed files with 237 additions and 94 deletions

View file

@ -270,9 +270,10 @@ oml.ui.infoView = function(externalData, isMixed) {
items: [
{id: 'read', title: Ox._('Read in Open Media Libary')},
{id: 'open', title: Ox._('Open in External Reader')},
].concat(oml.readOnly ? [] : [
{},
{id: 'show', title: Ox._('Show File')}
],
]),
overlap: 'left',
style: 'squared',
title: 'select',
@ -284,7 +285,11 @@ oml.ui.infoView = function(externalData, isMixed) {
if (data_.id == 'read') {
oml.UI.set({itemView: 'book'});
} else if (data_.id == 'open') {
oml.api.openFile({id: oml.user.ui.item});
if (oml.readOnly) {
document.location.href = '/' + oml.user.ui.item + '/get/'
} else {
oml.api.openFile({id: oml.user.ui.item});
}
} else {
oml.api.openFolder({id: oml.user.ui.item});
}
@ -382,9 +387,9 @@ oml.ui.infoView = function(externalData, isMixed) {
Ox.print('BOOK DATA', data)
var $div,
isEditable = isMultiple || (
isEditable = !oml.readOnly && (isMultiple || (
data.mediastate == 'available' && !externalData
),
)),
src = !externalData
? '/' + data.id + '/' + ui.icons + '512.jpg?' + data.modified
: data.cover,
@ -751,28 +756,29 @@ oml.ui.infoView = function(externalData, isMixed) {
].join(', ')
)
.appendTo($data);
if (!oml.readOnly) {
renderIdentifyButton(data).appendTo($data);
renderIdentifyButton(data).appendTo($data);
['accessed', 'modified', 'added', 'created'].forEach(function(id) {
var title;
if (data[id]) {
title = Ox.getObjectById(oml.config.itemKeys, id).title;
$('<div>')
.css({
marginTop: '8px',
fontWeight: 'bold'
})
.text(title)
.appendTo($data);
$('<div>')
.text(Ox.formatDate(data[id], '%B %e, %Y'))
.appendTo($data);
}
});
['accessed', 'modified', 'added', 'created'].forEach(function(id) {
var title;
if (data[id]) {
title = Ox.getObjectById(oml.config.itemKeys, id).title;
$('<div>')
.css({
marginTop: '8px',
fontWeight: 'bold'
})
.text(title)
.appendTo($data);
$('<div>')
.text(Ox.formatDate(data[id], '%B %e, %Y'))
.appendTo($data);
if (data.mediastate == 'available') {
renderShareButton(data).appendTo($data);
}
});
if (data.mediastate == 'available') {
renderShareButton(data).appendTo($data);
}
$('<div>').css({height: '16px'}).appendTo($data);