forked from 0x2620/pandora
better documents embed
This commit is contained in:
parent
7504d92230
commit
71311b323e
1 changed files with 32 additions and 11 deletions
|
@ -212,11 +212,40 @@ pandora.ui.embedDialog = function(/*[url, ]callback*/) {
|
||||||
}).join(find.operator);
|
}).join(find.operator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getData() {
|
||||||
|
var type = $input.type.value(),
|
||||||
|
view = $list.options('selected')[0];
|
||||||
|
return Ox.map($input, function($element, key) {
|
||||||
|
return Ox.contains(Ox.getObjectById(views, view).inputs, key)
|
||||||
|
&& (
|
||||||
|
!Ox.contains(['map', 'calendar'], view)
|
||||||
|
|| ($input.mapMode.value() == 'item' && key != 'find')
|
||||||
|
|| ($input.mapMode.value() == 'find' && key != 'item')
|
||||||
|
)
|
||||||
|
&& $element.value ? $element.value() : void 0;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function formatHTML() {
|
function formatHTML() {
|
||||||
var type = $input.type.value();
|
var type = $input.type.value(),
|
||||||
|
view = $list.options('selected')[0],
|
||||||
|
value = $input.link.value(),
|
||||||
|
data = getData();
|
||||||
|
if (view == 'document') {
|
||||||
|
var prefix = type == 'iframe'
|
||||||
|
? (pandora.site.site.https ? 'https' : 'http')
|
||||||
|
+ '://' + pandora.site.site.url + '/'
|
||||||
|
: '/',
|
||||||
|
page = type == 'iframe' ? 'documents' : 'document',
|
||||||
|
resolution = 480;
|
||||||
|
if (value == '...' || !value.length) {
|
||||||
|
value = '<img src="' + prefix + 'documents/' + data.document + '/' + resolution + 'p.jpg">';
|
||||||
|
}
|
||||||
|
return '<a href="' + prefix + page + '/' + data.document + '">' + value + '</a>';
|
||||||
|
}
|
||||||
return type == 'link'
|
return type == 'link'
|
||||||
? '<a href="' + formatURL()
|
? '<a href="' + formatURL()
|
||||||
+ '">' + $input.link.value()
|
+ '">' + value
|
||||||
+ '</a>'
|
+ '</a>'
|
||||||
: '<iframe src="' + formatURL()
|
: '<iframe src="' + formatURL()
|
||||||
+ '" width="' + $input.width.value()
|
+ '" width="' + $input.width.value()
|
||||||
|
@ -227,15 +256,7 @@ pandora.ui.embedDialog = function(/*[url, ]callback*/) {
|
||||||
function formatURL() {
|
function formatURL() {
|
||||||
var type = $input.type.value(),
|
var type = $input.type.value(),
|
||||||
view = $list.options('selected')[0],
|
view = $list.options('selected')[0],
|
||||||
data = Ox.map($input, function($element, key) {
|
data = getData(),
|
||||||
return Ox.contains(Ox.getObjectById(views, view).inputs, key)
|
|
||||||
&& (
|
|
||||||
!Ox.contains(['map', 'calendar'], view)
|
|
||||||
|| ($input.mapMode.value() == 'item' && key != 'find')
|
|
||||||
|| ($input.mapMode.value() == 'find' && key != 'item')
|
|
||||||
)
|
|
||||||
&& $element.value ? $element.value() : void 0;
|
|
||||||
}),
|
|
||||||
options = Ox.serialize({
|
options = Ox.serialize({
|
||||||
title: data.title || void 0,
|
title: data.title || void 0,
|
||||||
showTimeline: data.showTimeline || void 0,
|
showTimeline: data.showTimeline || void 0,
|
||||||
|
|
Loading…
Reference in a new issue