OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Plugin Development

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.

Plugin Development

Postby mark » Mon Nov 10, 2008 12:30 pm

I've read the OJS Technical Reference (2.1) file but have a couple of questions about developing plugins for OJS.

- I take it that plugins can create database tables
- All plugin code (any new classes, etc.) is installed in the plugin/ directory.

One thing I don't understand is why so many hooks are in the classes/ directory (243) rather than the pages/ directory (only 2). I would have thought more would be in pages/ because that's where all the application layer logic is. classes/ only holds the model classes. Could some explain something of the logic that drives the plugin architecture forward?

Also, could someone tell me where is the code that reads in the plugins? I've created an example plugin by putting it into the plugin directory. I'm guessing there's some OJS code that reads in the plugin's index.php. But I have no idea what line of OJS is coming by and picking it up.
mark
 
Posts: 31
Joined: Fri Jul 11, 2008 10:57 am

Re: Plugin Development

Postby asmecher » Mon Nov 10, 2008 5:20 pm

Hi Mark,

The code that loads plugins is found in classes/plugins/PluginRegistry.inc.php; the various plugin categories are loaded at different times, e.g. the "generic" plugin category is loaded in includes/driver.inc.php (which is called for basically any request). The specific line of code that picks up the index.php in each plugin's directory is in the loadCategory function of the PluginRegistry.

The current set of hooks have served well for a wide variety of plugins, though of course we're open to expanding the set. Can you describe what you're working on? I might be able to recommend an approach.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8321
Joined: Wed Aug 10, 2005 12:56 pm

Re: Plugin Development

Postby mark » Mon Nov 10, 2008 5:44 pm

I'm thinking about developing a plugin that would add a new menu item to all user's home page (at some point I may limit this to a particular role, e.g., reader, authors; but at this point its all). For ease of explanation I'll use a example I've written about in other posts: curriculum developer. So every author/reader/reviewer/journal manager, etc. is given a menu item on their home page (call it "My Readings"; it would be above "My Journals") that takes them to a page that lists a set of reading about journal publishing, reviewing, etc. Once they have read through the material they can then go back to their homepage and proceed with going to their "My Journal" items and continue with reviewing, editing, managing etc.

So I'd like to have the plugin be hooked into the logic that displays the user's home page and then add html code that leads to the new interface. Possible?
mark
 
Posts: 31
Joined: Fri Jul 11, 2008 10:57 am

Re: Plugin Development

Postby asmecher » Tue Nov 11, 2008 9:29 am

Hi Mark,

Dropping content into an arbitrary place on a template is a tricky one. The "User Home" page currently has a number of hooks in it -- "Templates::User::Index::Site", "Templates::User::Index::Journal", and "Templates::Admin::Index::MyAccount" (see templates/user/index.php). If none of these suits, I'd suggest dropping a new one in.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8321
Joined: Wed Aug 10, 2005 12:56 pm


Return to OJS Development

Who is online

Users browsing this forum: No registered users and 6 guests