From 71311b323eeb2e5815b9c25c83706ce964d08c4b Mon Sep 17 00:00:00 2001 From: j Date: Fri, 16 Nov 2018 14:23:18 +0000 Subject: [PATCH] better documents embed --- static/js/embedDialog.js | 43 ++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/static/js/embedDialog.js b/static/js/embedDialog.js index 3348e705..1142cddb 100644 --- a/static/js/embedDialog.js +++ b/static/js/embedDialog.js @@ -212,11 +212,40 @@ pandora.ui.embedDialog = function(/*[url, ]callback*/) { }).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() { - 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 = ''; + } + return '' + value + ''; + } return type == 'link' ? '' + $input.link.value() + + '">' + value + '' : '