OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Adding custom handler for new galley type

OJS development discussion, enhancement requests, third-party patches and plug-ins.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
Developer Resources:

Documentation: The OJS Technical Reference and the OJS API Reference are both available from the OJS Documentation page.

Git: You can access our public Git Repository here. Comprehensive Git usage instructions are available on the wiki.

Bugzilla: You can access our Bugzilla report tracker here.

Search: You can use our Google Custom Search to search across our main website, the support forum, and Bugzilla.

Questions and discussion are welcome, but if you have a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a technical support question, try the OJS Technical Support subforum.

Adding custom handler for new galley type

Postby ItsDan » Fri Nov 07, 2008 9:06 pm

We're exploring using FlashPaper to publish our articles which is basically converting a pdf to a flash compatible format. I haven't yet looked around in the code but I was just hoping for an experienced person's suggestion on where I would insert a template and accompanying code to have OJS handle that particular galley type with a particular template, same as it handles pdf, abstracts, etc differently.
ItsDan
 
Posts: 54
Joined: Wed Jun 13, 2007 8:55 am

Re: Adding custom handler for new galley type

Postby ItsDan » Fri Nov 07, 2008 9:23 pm

Perhaps I should have looked sooner. It would seem to me that I need to make 2 main changes:

1. In ArticleGalley.inc.php I should mimic the existing functionality of function isPdfGalley() to create an isFlashGalley() function.

2.In ArticleHandler.inc.php I should then inject the logic into the view() function similar to:

else if ($galley->isPdfGalley()) return ArticleHandler::viewPDFInterstitial($args, $galley);

by adding an ArticleHandler::viewFlashPage() routine.


Comments?
ItsDan
 
Posts: 54
Joined: Wed Jun 13, 2007 8:55 am

Re: Adding custom handler for new galley type

Postby jalperin » Sat Nov 08, 2008 5:49 am

ItsDan,

Your idea sounds basically right to me, although I would suggest a slightly different approach so you don't run into problems when trying to upgrade.

Instead of modifying the code itself, you could write a plugin that lets you achieve the same result. You'd have to register against the LoadHandler class and 'intercept' an article page view. In there, you can check if the galley type is a Flash type (you wouldn't have a method, but you can check by looking at the file type) and if it is, you can then serve the page (you'd have a "FlashArticleHandler" or something of this sort in your plugin).

Be mindful of whether your LoadHandler callback returns "true" or "false", depending on whether it found a flash galley type or not. You'll see what I mean with this when you start your coding.

You can look at the xmlGalley plugin (in the generic category) as an example. It is slightly more complex than what you'll be doing, but if I remember correctly, it has all the right components to guide you.
jalperin
 
Posts: 154
Joined: Thu Jul 06, 2006 1:03 pm
Location: Buenos Aires

Re: Adding custom handler for new galley type

Postby ItsDan » Sun Nov 09, 2008 7:14 am

Excellent, I'll take a look at that plugin. I've already made a handful of changes to our source so we are already fearful of upgrading, but it would be nice to end that trend and begin creating upgrad-safe code.
ItsDan
 
Posts: 54
Joined: Wed Jun 13, 2007 8:55 am

Re: Adding custom handler for new galley type

Postby tarjelavik » Tue Jan 27, 2009 10:32 am

Hi! I would like to do the same modification. Do you think i could take a look at your code/plugin? Sincerly Tarje Lavik, University of Bergen Library
tarjelavik
 
Posts: 11
Joined: Thu Oct 09, 2008 6:29 am


Return to OJS Development

Who is online

Users browsing this forum: Google [Bot] and 2 guests