OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Creating New Plugins etc.

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.

Creating New Plugins etc.

Postby spatialguru » Fri Feb 08, 2008 2:08 pm

I would like to learn to copy and modify existing plugins and other core functions to make new features in my install. Hopefully this would be useful to the broader community as well. The Accommodations features that are currently in CVS are really close to want I'd like to mimic. If you have any pointers to other threads in the forums for doing this, please point them out to me here. Otherwise, I will chronicle my efforts (read: failures :) ) here.

I guess I should also search the website for a developers guide...
spatialguru
 
Posts: 112
Joined: Mon Jun 25, 2007 1:23 pm
Location: British Columbia, Canada

Re: Creating New Plugins etc.

Postby jmacgreg » Sat Feb 09, 2008 2:22 pm

Hi Spatialguru,

Community development efforts are always most welcome! We don't currently have an OCS technical reference, but we do have one for OJS available here:

http://pkp.sfu.ca/ojs_documentation

It's definitely worth a read, as development between the two packages follows the same general outlines. The OJS technical reference is currently one version behind (last updated for 2.1), but should be up-to-date enough for you to get an idea on what's going on, combined with the poking around you've already done. We'll hopefully have the document caught up soon. We'll also be looking at writing more OCS documentation after the next version has been released.

You may already be aware of our bugzilla and cvsweb resources, but I'll point them out to you as well:

http://pkp.sfu.ca/cvs/cvsweb.cgi/ocs2/
http://pkp.sfu.ca/bugzilla/

Questions are welcome, and details of your progress, for us and others, is especially appreciated.

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

Re: Creating New Plugins etc.

Postby spatialguru » Wed Feb 13, 2008 2:53 pm

Thanks James,
I'll post a brief summary of what I did to try to clone the accommodation classes, pages and template. I have one problem that I need help with - see the end. I'm taking the brute force copycat approach by finding all files that refer to accommodation and copying them into new files/settings called transportation. This is simply for educational purposes.

Details of my progress are available in this wiki: http://wiki.osgeo.org/index.php/SAC:Setup_OCS_Custom_Additions

Here is the summary.
  • Copy and rename these files, while replace name of old files with new name (e.g. AccommodationSettingsForm.inc.php becomes TransportationSettingsForm.inc.php):
    Code: Select all
    /classes/manager/form/AccommodationSettingsForm.inc.php
    /pages/manager/ManagerAccommodationHandler.inc.php
    /templates/manager/accommodationSettings.tpl
    /templates/schedConf/accommodation.tpl
  • Then replace all occurrences of Accommodation or accommodation with the words Transportation or transportation. I used a simple sed command to do this automatically, for example:
    Code: Select all
    sed -i .bak 's/Accommodation/Transportation/g' TransportationSettingsForm.inc.php
  • Only two files needed to be manually edited:
    • locale.xml - 3 individual lines throughout the file, and one larger section:
      Code: Select all
      locale/en_US/locale.xml:
        <message key="schedConf.accommodation">Accommodation</message>
        <message key="schedConf.accommodation.title">{$schedConfAbbrev} Accommodation</message>
         <message key="manager.accommodation">Accommodation</message>
        <!-- Accommodation settings -->
        ..... a larger section
    • ManagerHandler.inc.php - a settings section specifically for 2 functions to be copied
      Code: Select all
      pages/manager/ManagerHandler.inc.php:
              //
              // Accommodation
              //
              ... entire section (2 functions)

I was quite happy with this progress. I only have one problem - I can't get the Transportation option to show under the manager page (http://localhost/ocs2/index.php/coolevent/2008/manager), but I can enter it manually in the URL (http://localhost/ocs2/index.php/cooleve ... sportation) and it seems to work great! :) I have tried clearing the cache, but it didn't help.

Suggestions for changes to the above or how to solve my trouble?

Best wishes,
Tyler
spatialguru
 
Posts: 112
Joined: Mon Jun 25, 2007 1:23 pm
Location: British Columbia, Canada

Re: Creating New Plugins etc.

Postby smiri » Wed Feb 13, 2008 8:10 pm

Hi Tyler,

just to double check, have you clicked on the "System Plugins" link on the conference manager page? The url you mentioned takes you to the conference manager page. You would have to click on the "System Plugins" link to see available plugins.

Regards,
smiri
 
Posts: 183
Joined: Thu Sep 06, 2007 7:01 pm

Re: Creating New Plugins etc.

Postby spatialguru » Wed Feb 13, 2008 8:45 pm

Thanks Siavash, but I don't think that applies. I see that I have mislabelled this thread because I'm not actually working on a plugin. I only want to copy and modify Accommodations features - is that called a OCS core class?

Tyler
spatialguru
 
Posts: 112
Joined: Mon Jun 25, 2007 1:23 pm
Location: British Columbia, Canada

Re: Creating New Plugins etc.

Postby smiri » Wed Feb 13, 2008 8:52 pm

Hi Tyler,

I see what you want now. I think your problem could be solved by simply editing this page: templates/manager/index.tpl

the link to accommodation as well as all other links are in this template. You probably just have to add your new link in this page.

Regards,
smiri
 
Posts: 183
Joined: Thu Sep 06, 2007 7:01 pm

Re: Creating New Plugins etc.

Postby spatialguru » Wed Feb 13, 2008 9:40 pm

smiri wrote:I see what you want now. I think your problem could be solved by simply editing this page: templates/manager/index.tpl


Perfect suggestion - thank you very much! I don't know how I missed that one :) Now it is working and seems to be an excellent addition. Would you say this is a "core feature" that I made? It's obviously not a plugin is it?

Based on changes can anyone recommend improvements or note how this might be different in the 2.0 release? I've been working out of CVS and am thinking about back porting this.

Maybe I'll try doing a plugin next. Could I do the same thing via plugins? I certainly want to try some custom blocks as well.

Tyler
spatialguru
 
Posts: 112
Joined: Mon Jun 25, 2007 1:23 pm
Location: British Columbia, Canada

Re: Creating New Plugins etc.

Postby asmecher » Thu Feb 14, 2008 10:29 pm

Hi Tyler,

This will probably back-port into OCS 2.0 without much trouble -- generate a patch file and try applying it to OCS 2.0 using the --dry-run option to the patch tool. There will probably be a few minor conflicts but I wouldn't expect anything major.

This kind of change is definitely possible as a plugin, but a little trickier, as you'll be working with hooks. Are you working with OJS as well as OCS? OJS currently has a few good examples of generic plugins that accomplish this sort of thing.

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

Re: Creating New Plugins etc.

Postby hda.lib@cbs.dk » Thu Mar 19, 2009 9:43 am

In order to get this to work you also have to edit the following files:
- /templates/manager/index.tpl
- /pages/schedConf/SchedConfHandler.inc.php
- /templates/schedConf/index.tpl
- plugins/blocks/navigation/blocks.tpl
It is obvious what needs to be changed...
Just to make sure use "grep" to find all instances of "accommodation" to make sure that you didn't miss anything (grep -irl "accommodation" /your ocs path).
I wonder about a few files, e.g. /plugins/generic/tinymce/TinyMCEPlugin.inc.php In this file there is an entry about accommodation but it does not seem to be necessary to add anything about new menupoints
Code: Select all
                        case 'manager/accommodation':
                        case 'manager/saveAccommodationSettings':
                                $fields[] = 'accommodationDescription';
                                break;

In this way it is possible to create new menupoints with related "pages". But it is rather tiresome to have to change so many lines manually in so many files. If everything was collected into a plugin that could just be copied it would be a lot easier... But the biggest problem is that these menupoints now have to be used for all conferences, not just for a singe conference.
hda.lib@cbs.dk
 
Posts: 16
Joined: Tue May 06, 2008 1:28 am

Re: Creating New Plugins etc.

Postby hda.lib@cbs.dk » Thu Apr 16, 2009 7:44 am

OK now I realised what the file /plugins/generic/tinymce/TinyMCEPlugin.inc.php should be changed - otherwise you do not get the editor working on your new menupoints.....
hda.lib@cbs.dk
 
Posts: 16
Joined: Tue May 06, 2008 1:28 am


Return to OCS Development

Who is online

Users browsing this forum: No registered users and 1 guest