$(document).on(this.fluidbook.input.clickEvent, "#viewOverlay", function (e) {
// Don't close if a interactive multimedia popup is currently displayed
- let close = $(".mview[data-menu=multimedia] .multimediaScale div.multimedia:not(.notinteractive) iframe").length === 0;
+ let close = $(".mview[data-menu=multimedia] .multimediaScale div.multimedia:not(.notinteractive) iframe, .mview.pdfform").length === 0;
return handleCloseView(e, close);
});
break;
case 'pdfform':
this.initPDFViewer();
+
iframe = m.find('iframe');
- seamless = iframe.hasClass('seamless');
- var pw = iframe.data('width') * 2;
- var th = iframe.data('total-height') * 2;
+ if ($(iframe).length > 0) {
+ seamless = iframe.hasClass('seamless');
+ var pw = iframe.data('width') * 2;
+ var th = iframe.data('total-height') * 2;
+ w = Math.min(pw, ww)
+ ratio = pw / th;
+ } else {
+ w = 500;
+ ratio=1;
+ }
- w = Math.min(pw, ww)
fullscreen = (w === ww);
- ratio = pw / th;
+
ih = w / ratio;
h = Math.min(ih, fullscreen ? hh : hh * 0.9);
if (maxWidth > 0) {
w = Math.min(maxWidth, w);
}
+ console.log(maxWidth, w);
css = {};
var ccss = {};
FluidbookPDFForm.prototype = {
init: function () {
- $(document).on('click', '.mview[data-menu="pdfform"] .fonctions a.submit', function () {
+ let $this = this;
+ $(document).on('click', '.mview.pdfform .fonctions a.submit', function () {
let linkId = $(this).closest('.mview').data('linkid');
let doc = $('.mview[data-menu="pdfform"] iframe').get(0).contentDocument;
let fields = {};
let data = {fields: fields};
data.linkid = linkId;
$this.fluidbook.service.call('pdfform', data, function (data) {
+ $this.confirmation();
}, undefined, 'POST');
return false;
});
},
+ confirmation: function () {
+ $('.mview.pdfform .content').html('<div class="confirmation">' + this.fluidbook.settings.pdfform_confirm + '</div>');
+ $('.mview.pdfform').attr('data-max-width', 500);
+ this.fluidbook.resize.resize();
+ },
+
open: function (uid, callback) {
let $this = this;
var infos = this.fluidbook.settings.pdfLinks[uid];
- let c = this.getCaption('', 'nocaption', 'nocaption');
+ let c = this.fluidbook.menu.getCaption('', 'nocaption', 'nocaption');
c += '<div class="content">';
c += '<div class="pdf-holder"><iframe class="pdf view ' + infos.interface + '" data-width="' + infos.width + '" data-height="' + infos.height + '" data-total-height="' + infos.totalHeight + '" frameborder="0" scrolling="no" src="pdfjs/web/viewer.' + this.fluidbook.settings.htmlExtension + '?&file=../../data/links/' + infos.file + '#zoom=page-width"></iframe></div>';
c += '<div class="fonctions">';
c += '<a role="button" class="submit" href="#">' + (this.fluidbook.settings.pdfform_button ? this.fluidbook.settings.pdfform_button : this.fluidbook.l10n.__('send')) + '</a>';
c += '</div>';
c += '</div>';
- this.viewWrap(c, 'pdfform', 'data-linkid="' + uid + '"', 'pdfform ' + this.fluidbook.settings.pdfform_style);
+ this.fluidbook.menu.viewWrap(c, 'pdfform', 'data-linkid="' + uid + '"', 'pdfform ' + this.fluidbook.settings.pdfform_style);
if (callback != undefined) {
callback();
}