});
});
}
+
+
+ $(document).on('click', '.mview[data-menu="pdfform"] .fonctions a.submit', function () {
+ let linkId = $(this).closest('.mview').data('linkid');
+ let doc = $('.mview[data-menu="pdfform"] iframe').get(0).contentDocument;
+ let fields = {};
+ $(doc).find('select,textarea,input').each(function () {
+ if (!$(this).is(':visible')) {
+ return;
+ }
+ let type = $(this).prop('tagName').toLowerCase();
+ if (type === "input") {
+ type = $(this).attr('type');
+ }
+
+ let name = $(this).attr('name');
+ if ((type !== 'checkbox' && type !== 'radio')) {
+ fields[name] = $(this).val();
+ } else if ($(this).is(':checked')) {
+ fields[name] = ':checked:' + $(this).val();
+ }
+ });
+ let data = {fields: fields};
+ data.linkid = linkId;
+ $this.fluidbook.service.call('pdfform', data, function (data) {
+ }, undefined, 'POST');
+ return false;
+ });
},
viewMode: function () {
this.openDownload(cb);
} else if (view === 'pdf') {
this.openPDF(param1, cb);
+ } else if (view === 'pdfform') {
+ this.openPDFForm(param1, cb);
} else if (view === 'o3d') {
this.openObject3D(param1, cb);
} else if (view === 'article') {
this.fluidbook.articles.openArticle(param1, cb);
- } else if(view==='accessibility'){
+ } else if (view === 'accessibility') {
this.fluidbook.accessibility.openMenu(cb);
- }else {
+ } else {
this['open' + camelView](param1, param2, cb);
}
this.fluidbook.displayLoader();
},
+ openPDFForm: function (uid, callback) {
+ let $this = this;
+ var infos = this.fluidbook.settings.pdfLinks[uid];
+ let c = this.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.l10n.__('send') + '</a>';
+ c += '</div>';
+ c += '</div>';
+ this.viewWrap(c, 'pdfform', 'data-linkid="' + uid + '"', 'pdfform');
+ if (callback != undefined) {
+ callback();
+ }
+
+ $('iframe.pdf.view').each(function () {
+ relayIframeScrollToView($(this));
+ });
+
+ this.fluidbook.displayLoader();
+ },
+
openingView: function (callback, view) {
var $this = this;
var contentHeight = null;
var fullscreen = m.data('fullscreen') === '1';
var nw, nh;
+ let seamless, offsetw;
var maxWidth = 100000;
if (m.data('max-width')) {
fullscreen = true;
break;
case 'accessibility':
- w=900;
+ w = 900;
h = hh * 0.9;
break;
case 'share':
case 'pdf':
this.initPDFViewer();
iframe = m.find('iframe');
- let seamless = iframe.hasClass('seamless');
+ seamless = iframe.hasClass('seamless');
+ var pw = iframe.data('width') * 2;
+ var th = iframe.data('total-height') * 2;
+
+ w = Math.min(pw, ww)
+ fullscreen = (w === ww);
+ ratio = pw / th;
+ ih = w / ratio;
+ h = Math.min(ih, fullscreen ? hh : hh * 0.9);
+
+ offsetw = seamless ? 40 : 0;
+
+ iframe.css('height', seamless ? ih : h).css('width', w + offsetw);
+ 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;
ih = w / ratio;
h = Math.min(ih, fullscreen ? hh : hh * 0.9);
- let offsetw = seamless ? 40 : 0;
+ offsetw = seamless ? 40 : 0;
iframe.css('height', seamless ? ih : h).css('width', w + offsetw);
break;