OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Looking for guidance on modifying an update from a plugin

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

Moderators: jmacgreg, michael

Forum rules
Developer Resources:

Documentation: The OJS Technical Reference and the OJS API Reference are both available from the OJS Documentation page. While these are OJS-specific, the OCS codebase is similar enough to OJS they should be of help. There is also an [url=http://pkp.sfu.ca/ocs_documentation[/url]OCS Documentation[/url] page with some more general documentation that might also be of interest.

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 OCS Conference Support and Discussion subforum; if you have a technical support question, try the OCS Technical Support subforum.

Looking for guidance on modifying an update from a plugin

Postby claywhipkey » Fri Apr 10, 2009 3:26 pm

I'm working on a plugin that will theoretically add the ability to attach a few more settings to both a conference and a paper. Specifically, I am creating a plugin that will include Twitter chats based on hashtag, Flickr photostream based on tag, and links to blog articles based on a Google blog search RSS feed. What I want to do is allow a scheduled conference to have its own set, and also allow each presentation (paper) to have unique streams as well. I'll use the paper as an example:

I have already got the plugin responding on the screen in the appropriate place for both the conference home and the paper view page (had to drop custom hooks into those templates). I will be off to the races once I am able to retrieve the twitter/flickr/blog settings from within either the conference home template or paper template. My targeted solution is to have those values saved as additional conference_settings or paper_settings.

I have been able to insert some additional form fields into the "edit metadata" screen of a submission (paper). I *think* what I need to do is somehow trigger my plugin to intercept the execute() method in MetadataForm.inc.php, and somehow add my extra settings to the paper object before it gets saved. That appears to be where the update of the paper's settings begins. My problem is that I'm not sure if there are any hooks available in the process which would make that simple. My goal is to make the plugin as self-contained as possible, without having to patch the core files (custom template hooks notwithstanding).

Obviously, after getting the paper settings worked out, I would need to do something similar for the conference itself. I'm thinking probably adding the settings onto the Scheduled Conference Setup > Details screen. Input on that would be good, too.

I have to get this functionality working by our conference (in two weeks), so I will continue to work on this, but any insight from those with more OCS knowledge would be mighty helpful.

cheers,
Clay
claywhipkey
 
Posts: 5
Joined: Fri Apr 03, 2009 7:56 am

Re: Looking for guidance on modifying an update from a plugin

Postby claywhipkey » Mon Apr 13, 2009 10:24 am

UPDATE:

I have now successfully figured out how to save my custom settings to the paper_settings table. Unfortunately, I can't make the plugin completely without mods to core files. It requires adding some custom hooks to templates, but also in a class file. I also had to modify the getLocaleFieldNames() method in the PaperDAO.inc.php file because it contains a hard-coded array of the paper_settings to include in updates.

I'll update again once I finish adding the scheduled conference settings.
claywhipkey
 
Posts: 5
Joined: Fri Apr 03, 2009 7:56 am

Re: Looking for guidance on modifying an update from a plugin

Postby mcrider » Tue Apr 14, 2009 5:50 pm

Hi Clay,

Interesting plugin idea, and we'd be appreciative to see your final product! One suggestion I can think of to make your plugin more self-reliant is to associate the hashtags and other data outside of the paper's metadata page, and within the plugin's own interface, and store the data in a table specific to the plugin (see the static pages plugin for an example of how to get a table unique to the plugin into the database), or even just in the paper_settings table. In the plugin's settings page, you could list each paper and allow the option to enter tags respective to that paper, which when saved will store the paper ID and tags in the plugin's table. This table can then be accessed (probably by another plugin) in the reading tools for each paper by looking up the paper ID and pretty printing the rest of the row.

I appreciate the complexity of that solution, but I'm not certain of an easier way without modifying templates and code. FYI, this type of enhancement has been marked as a feature suggestion for the next major version of our software.

Let us know if you have any further questions and what your final solution is.

Cheers,
Matt
mcrider
 
Posts: 952
Joined: Mon May 05, 2008 10:29 am
Location: Vancouver, BC


Return to OCS Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron