The problem I'm having is with the PDF embedding in the 2.3.3-1 release. It doesn't work (well not without some changes). Having some experience with developing, I tried to find out the problem and I think I found it, but couldn't resolve it properly yet. Maybe some of you can help out?
The problem is to be found in /templates/article/article.tpl from line 19-39.
- Code: Select all
<script type="text/javascript">{literal}
$(document).ready(function(){
if ($.browser.webkit) { // PDFObject does not correctly work with safari's built-in PDF viewer
var embedCode = "<object id='pdfObject' type='application/pdf' data='{/literal}{$pdfUrl}{literal}' width='99%' height='99%'><div id='pluginMissing'>{/literal}{$noPluginKey}{literal}</div></object>";
$("#articlePdf").html(embedCode);
if($("#pluginMissing").is(":hidden")) {
$('#fullscreenShow').show();
$("#articlePdf").resizable({ containment: 'parent', handles: 'se' });
} else { // Chrome Mac hides the embed object, obscuring the text. Reinsert.
$("#articlePdf").html('{/literal}{$noPluginText}{literal}');
}
} else {
var success = new PDFObject({ url: "{/literal}{$pdfUrl}{literal}" }).embed("articlePdf");
if (success) {
// PDF was embedded; enbale fullscreen mode and the resizable widget
$('#fullscreenShow').show();
$("#articlePdfResizer").resizable({ containment: 'parent', handles: 'se' });
}
}
});
{/literal}</script>
What I've already found out, is that the problem probably is to probably to be found in a syntax error after line 22. Because after some fiddling with the syntax I found out that the following syntax, where I filled in the variables $pdfUrl and $noPluginText and removed all literal-tags after the closing of the object-tag on line 22, actually works:
- Code: Select all
<script type="text/javascript">{literal}
$(document).ready(function(){
if ($.browser.webkit) { // PDFObject does not correctly work with safari's built-in PDF viewer
var embedCode = "<object id='pdfObject' type='application/pdf' data='{/literal}{$pdfUrl}{literal}' width='99%' height='99%'><div id='pluginMissing'>{/literal}{$noPluginKey}{literal}</div></object>";
$("#articlePdf").html(embedCode);
if($("#pluginMissing").is(":hidden")) {
$('#fullscreenShow').show();
$("#articlePdf").resizable({ containment: 'parent', handles: 'se' });
} else { // Chrome Mac hides the embed object, obscuring the text. Reinsert.
$("#articlePdf").html('<p>The PDF file you selected should load here if your Web browser has a PDF reader plug-in installed (for example, a recent version of <a href="http://www.adobe.com/products/acrobat/readstep2.html">Adobe Acrobat Reader</a>).</p> <p>Alternatively, you can also download the PDF file directly to your computer, from where it can be opened using a PDF reader. To download the PDF, click the Download link below.</p> <p>If you would like more information about how to print, save, and work with PDFs, Highwire Press provides a helpful <a href="http://highwire.stanford.edu/help/pdf-faq.dtl">Frequently Asked Questions about PDFs</a>.</p>');
}
} else {
var success = new PDFObject({ url: "http://wt.advn20.be/index.php/wt/article/viewFile/1/1" }).embed("articlePdf");
if (success) {
// PDF was embedded; enbale fullscreen mode and the resizable widget
$('#fullscreenShow').show();
$("#articlePdfResizer").resizable({ containment: 'parent', handles: 'se' });
}
}
});
{/literal}</script>
For me, it is solved for now, but not in a very clean way. OJS deserves a better solution
