OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Plugin for Modifying Step 2 of Submission

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 for Modifying Step 2 of Submission

Postby spoonstein » Tue Sep 01, 2009 8:09 am

Howdy,

I'm working on writing a plugin that modifies Step 2 of the Submission process. I've read up enough to understand how to modify the template with locale information and am now working through the data management portion for those fields that I've added.

Based on this thread viewtopic.php?f=9&t=2028&p=6737&hilit=handling+input#p6737 it looks as though I have to modify the core files for OJS (AuthorSubmitStep2Form.inc.php and its related form class). Is this true, or is there a better way to hook into the call stack for the second step of the submission?
spoonstein
 
Posts: 7
Joined: Tue Sep 01, 2009 8:00 am

Re: Plugin for Modifying Step 2 of Submission

Postby asmecher » Fri Sep 04, 2009 8:03 am

Hi Joey,

That depends on the type of modification you want to make to that form. If you could describe it further, I can give more details.

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

Re: Plugin for Modifying Step 2 of Submission

Postby spoonstein » Tue Sep 08, 2009 9:18 am

Alec,

I'm going to add in three new meta data fields for the step 2 of the submission process. They are all text fields.

I'm modifying the templates/author/submit/step2.tpl to hold these three new fields and reference their locale data via my plugin directories.

In addition to modifying the template, I'll also be modifying class/author/form/submit/AuthorSubmitStep2Form.inc.php to include the storage and retrieval of the three new fields.

Is this the most effective way to modify the code to get three new fields into OJS?

Thanks,
Joey
spoonstein
 
Posts: 7
Joined: Tue Sep 01, 2009 8:00 am

Re: Plugin for Modifying Step 2 of Submission

Postby spoonstein » Tue Sep 08, 2009 9:39 am

Hey Alec,

I did some more work and realize that I'll need to setup my own metadata object and it's related DAO object. I'm guessing based on what I've seen, that I'll use a hook to insert/update/display the metadata from my plugin. This way my logic is separate from the core of OJS (which is my true goal for the plugin) except for the Step2 template itself.

Thanks,
Joey
spoonstein
 
Posts: 7
Joined: Tue Sep 01, 2009 8:00 am

Re: Plugin for Modifying Step 2 of Submission

Postby spoonstein » Tue Sep 08, 2009 10:25 am

Alec,

Thank you for reading my multiple posts. I think I'm 90% the way there now. My goal is to write a plugin that adds in an option for some metadata fields the are proprietary to my employer's needs.

My design involves setting up a table for metadata via the "enable" verb parameter and also replacing the Step 2 template to include the metadata fields needed. I'm assuming that in the documentation for OJS, I'll find a hook that I can attach to that will allow me to determine when I'll need to call my plugin code to update/retrieve the metadata. I'm modeling the work I've seen in OJS so that I'll have a metadataDAO and metadata class object. My plugin will call the DAO object to get/set what data is needed depending on what step I'm in.

That's what I've learned so far. I believe I'll need to do some more reading up on AuthorSubmitStep2Form.inc.php.

Thanks again for all your help. My hope is that this is something that hopefully everyone will be able to use in time.

-Joey
spoonstein
 
Posts: 7
Joined: Tue Sep 01, 2009 8:00 am

Re: Plugin for Modifying Step 2 of Submission

Postby asmecher » Tue Sep 08, 2009 11:22 am

Hi Joey,

Sounds good -- let me know if you run into any specific questions.

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

Re: Plugin for Modifying Step 2 of Submission

Postby spoonstein » Tue Sep 29, 2009 9:26 am

Alec,

I'm still running into a few bumps and would appreciate some clarification on the approach I should take.

1. Should I insert a HookRegistry call in AuthorSubmitStep2Form.inc.php Display() and Execute() to display and store my article metadata?
2. If 1 is true, then how do I go about registering my DAO? I've tried using the DAORegistry::registerDAO function and I'm not getting anywhere good with that so far.

Thanks,
Joey
spoonstein
 
Posts: 7
Joined: Tue Sep 01, 2009 8:00 am

Re: Plugin for Modifying Step 2 of Submission

Postby asmecher » Tue Sep 29, 2009 3:35 pm

Hi Joey,

There are a number of approaches you could use. I think the best is to try to avoid inserting your own hook calls into the OJS source code, because that way you won't need to maintain them during upgrades. I'd suggest using the LoadHandler hook to intercept when requests come in for page 2 of the author's submission progress, and instead bring up your own subclass of the AuthorSubmitForm (or even the AuthorSubmitStep2Form).

If you can describe the trouble you're having with DAORegistry::registerDAO(...), I might be able to help.

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

Re: Plugin for Modifying Step 2 of Submission

Postby spoonstein » Fri Oct 02, 2009 11:17 am

Alec,

Thanks for the tip. I'll use that LoadHandler hook over the weekend to get my code hooked in.

For the DAO question, I tried using $articleMetaDataDao = &DAORegistry::getDAO('ArticleMetaDataDAO'); and OJS resopnds with an error that it can't find the ArticleMetaDataDAO. This might be because my DAO class isn't setup properly to identify itself? I've included a basic constructor and set of methods modeled after the ArticleDAO class.

Thanks again for your help.
spoonstein
 
Posts: 7
Joined: Tue Sep 01, 2009 8:00 am

Re: Plugin for Modifying Step 2 of Submission

Postby asmecher » Fri Oct 02, 2009 11:45 am

Hi Joey,

Yes, it sounds like you're trying to get the DAO before it's been registered with the DAORegistry. I'd suggest registering your DAOs in the plugin's "register" function; OTOH there should be an example or two of this in the plugins that ship with OJS.

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

Re: Plugin for Modifying Step 2 of Submission

Postby spoonstein » Sun Oct 04, 2009 6:02 pm

Hi Alec,

I'm using the ThesisPlugin as my reference for Handler and such. I'm guessing I'll have to write my own handler which calls my own class that is a subclass of the SubmitStep2Form.inc.php and in that class, I'll reference my DAO and such.

Have a good evening,
Joey
spoonstein
 
Posts: 7
Joined: Tue Sep 01, 2009 8:00 am


Return to OJS Development

Who is online

Users browsing this forum: jalperin, smanaer and 3 guests