OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



DTD preventing embedded PDFs displaying in OJS 2.3.4

Are you responsible for making OCS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, michael, John

Forum rules
What to do if you have a technical problem with OCS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved. Please note that this FAQ is OJS-centric, but most issues are applicable to both platforms.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OCS Conference Support and Discussion subforum; if you have a development question, try the OCS Development subforum.

DTD preventing embedded PDFs displaying in OJS 2.3.4

Postby djbduncan » Thu Feb 24, 2011 3:45 pm

Hi

After we upgraded to OJS 2.3.4 we found that articles were not displaying as embedded PDFs. The embedded PDF object was loading correctly, but neither Firefox nor IE8 would display it.

It looks as though this is a problem with the article Document Type Description, and one workaround is to comment out the DTD at the top of templates/article/header.tpl:

Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!--
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-->
<html xmlns="http://www.w3.org/1999/xhtml">


Still, I'm not sure that this is a very elegant solution. Does anyone have any better ideas?

Thanks
Dennis Duncan
http://dandelionjournal.org
djbduncan
 
Posts: 8
Joined: Mon Feb 21, 2011 9:18 am

Re: DTD preventing embedded PDFs displaying in OJS 2.3.4

Postby djbduncan » Fri Feb 25, 2011 1:03 am

Apologies - this should be on the OJS Technical Support forum, not OCS. Will repost...
djbduncan
 
Posts: 8
Joined: Mon Feb 21, 2011 9:18 am

Re: DTD preventing embedded PDFs displaying in OJS 2.3.4

Postby jmacgreg » Mon Feb 28, 2011 3:35 pm

Hi Dennis,

I haven't seen this appear in the OJS technical support forum, so I'll post here and move the thread to the appropriate forum. That's a strange, but not necessarily bad solution. Could you check to see whether your install includes the fixes posted here: http://pkp.sfu.ca/bugzilla/show_bug.cgi?id=6052 as well?

Cheers,
James
jmacgreg
 
Posts: 4181
Joined: Tue Feb 14, 2006 10:50 am

Re: DTD preventing embedded PDFs displaying in OJS 2.3.4

Postby djbduncan » Mon Feb 28, 2011 4:31 pm

Hi James

The build I was using (2.3.4) did include those bug fixes, so I guess it wasn't to do with that.

In fact, that workaround - removing the DTD - didn't work in IE8 so I had to think again. I ended up getting rid of embedded PDFs completely by adding the following IF structure to /pages/article/articleHandler.inc.php (round about line 229):

Code: Select all
if ($galley && $galley->isPdfGalley()) {
   $templateMgr->display('article/PDFInterstitial.tpl');         
} else {
   $templateMgr->display('article/article.tpl');
}


and then uploading the old /templates/article/PDFInterstitial.tpl from an earlier build (e.g. OJS 2.3.2.1).

Would anybody be able to tell me how to get the templateMgr to open the PDF in a new browser tab/window?

[UPDATE: D'oh! Ignore that last question. Just put target="_blank" attributes in the template/issue/issue.tpl and the Abstract part of template/article/article.tpl]

Dennis
djbduncan
 
Posts: 8
Joined: Mon Feb 21, 2011 9:18 am

Re: DTD preventing embedded PDFs displaying in OJS 2.3.4

Postby aleskl » Mon Jun 20, 2011 6:42 am

Thank you Dennis for your help with PDF displaying in new tab! I'll just summarize the fix here (you need to add target="_blank" and change article display method to op="viewFile"):

in /templates/article/article.tpl (line 106):
Code: Select all
<a href="{url page="article" op="viewFile" path=$article->getBestArticleId($currentJournal)|to_array:$galley->getBestGalleyId($currentJournal)}" class="file {$galley->getGalleyLabel()|escape}" target="_blank">{$galley->getGalleyLabel()|escape}</a>


in /templates/issue/issue.tpl (line 45):
Code: Select all
<a href="{url page="article" op="viewFile" path=$articlePath|to_array:$galley->getBestGalleyId($currentJournal)}" class="file" target="_blank">{$galley->getGalleyLabel()|escape}</a>


However, it seems that in our installation the PDF loads without the preceding message "PDF will load in that window etc. etc.": http://862.gvs.arnes.si/ojs/IAS/article ... le/761/664

Here is the example how this PDF loading message should look: http://dandelionjournal.org/index.php/d ... view/32/62

Oh, I see the problem. The PDF link should use the method op="view" not "viewFile". The latter should be called by the former. But if I use the method op="view", the PDF galley opens in a div that is too small for viewing PDF easily (because I'm using a fixed layout stylesheet).

Also when looking through ArticleHandler.inc.php I saw that there should be an interstitial page for displaying PDF in templates/article/pdfInterstitial.tpl, but in my installation there is no such template file.

At this point I got lost, and I don't know what would be the best way to display PDF in a new tab and showing the message about PDF loading before the actual PDF is shown.

-Ales
aleskl
 
Posts: 96
Joined: Mon Apr 11, 2011 7:08 am

Re: DTD preventing embedded PDFs displaying in OJS 2.3.4

Postby djbduncan » Mon Jun 20, 2011 10:11 am

Hi Ales

I just grabbed PDFInterstitial.tpl from an earlier build of OJS, e.g. 2.3.2.1, then put it in the /templates/article folder.

Dennis
djbduncan
 
Posts: 8
Joined: Mon Feb 21, 2011 9:18 am

Re: DTD preventing embedded PDFs displaying in OJS 2.3.4

Postby aleskl » Tue Jun 21, 2011 4:17 am

Thanks, I got it to work as I want now. I got pdfInterstitial.tpl from OJS 2.3.2-1, put it in /templates/article, and then changed display method to op="viewPDFInterstitial" in /templates/article/article.tpl and /templates/issue/issue.tpl

Another thing I needed to do is to add the message about PDF loading in locale/en_US/locale.xml:

Code: Select all
   <message key="article.pdf.note"><![CDATA[<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://get.adobe.com/reader/">Adobe Reader</a>). Alternatively, the PDF file will download to your computer, where it can be opened using a PDF reader.</p>]]></message>
aleskl
 
Posts: 96
Joined: Mon Apr 11, 2011 7:08 am


Return to OCS Technical Support

Who is online

Users browsing this forum: No registered users and 1 guest