OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



make a new block plugin

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.

make a new block plugin

Postby alexlds » Fri Jun 03, 2011 6:53 am

Hi, I'm trying to make a new block plugin for a visit counter,I copy from information block plugin code, I used all its files, I' sure to modify the files igree to my plugin, but I have a problem, my visit counter plugin only shows in manager->configuration->appearance and manager->system_plugins, in the other sections don't shows.

I don't know what to do to fix it.
any suggestions?

Another question.
My visit counter plugin needs make a new table in the ojs database, there are somehow to do this table automatically???
Actually i'm making this manually.
alexlds
 
Posts: 6
Joined: Wed Jun 01, 2011 9:59 am

Re: make a new block plugin

Postby alexlds » Fri Jun 03, 2011 8:05 am

Ok, I got it.
I have been added manually a entry on the table "versions" with my new plugin data , and it works perfectly.

If somebody knows how to added it automatically and too the table that requires the plugin....
alexlds
 
Posts: 6
Joined: Wed Jun 01, 2011 9:59 am

Re: make a new block plugin

Postby alexlds » Tue Jun 07, 2011 7:31 am

Hi.
Again I have the same problem, because I need the plugin works in the 2.2.4 OJS version, and in that version the table "versions" is different to 2.3.4 OJS table "verion". Then in the 2.3.4 version its works perfectly; but I used that version to prove the plugin, in my workplace we use the 2.2.4 version and is over this that I have to run the visit counter plugin.

I try added the next 3 entries for the table "plugin_settings" whit my plugin data:
1. Visitas 0 context 2 int
2. Visitas 0 seq 8 int
3. Visitas 0 enabled 1 bool.

But don't works.
Any suggestion??
alexlds
 
Posts: 6
Joined: Wed Jun 01, 2011 9:59 am

Re: make a new block plugin

Postby jmacgreg » Tue Jun 07, 2011 11:12 am

Hi alexlds,

OJS' plugin infrastructure has changed between 2.2.x and 2.3.x. In 2.3.x, plugin version information is registered in the database's versions table. This information is gleaned from a version.xml file that should be included in the plugin directory. You should be able to take a look at any 2.3.x plugin for a demonstration version.xml file -- I would recommend looking at a block plugin's version.xml if you are creating a block plugin. You may also want to take a look at the following tutorial: http://pkp.sfu.ca/wiki/index.php/Writing_a_Block_Plugin.

Cheers,
James
jmacgreg
 
Posts: 4190
Joined: Tue Feb 14, 2006 10:50 am

Re: make a new block plugin

Postby alexlds » Fri Jun 10, 2011 9:01 am

Thanks jmacgreg!

But the problem is that I'm bound to work under 2.2.X version; how I said before, the plugin works fine in the 2.3.4 OJS version.
My need is that the plugin works over the 2.2.4 version, and how you said, the version table here is different to de version table of 2.3.4 version, however...what I need to do for register my plugin in the 2.2.4 version or the plugin run on this version???
alexlds
 
Posts: 6
Joined: Wed Jun 01, 2011 9:59 am

Re: make a new block plugin

Postby jmacgreg » Mon Jun 13, 2011 8:25 pm

Hi alexlds,

It's been a long time since I've run a 2.2.x instance of OJS. I don't believe plugin version information was stored within the database at all, and I don't think there was any such thing as a version.xml file -- you should just have to upload the plugin itself, without a version.xml file, and it should work -- provided of course that there is no code in the plugin that is incompatible with OJS 2.2.x.

Cheers,
James
jmacgreg
 
Posts: 4190
Joined: Tue Feb 14, 2006 10:50 am

Re: make a new block plugin

Postby alexlds » Fri Jun 17, 2011 6:50 am

Ok, I resolved the problem updating the database, and my plugin cuold be loaded.
I just have a question...
My plgin need create a table in the db, how I can make this table automatically??, namely, I can write the statement in some file and it be loaded when I update the db?.
thanks.
alexlds
 
Posts: 6
Joined: Wed Jun 01, 2011 9:59 am

Re: make a new block plugin

Postby jmacgreg » Fri Jun 17, 2011 3:03 pm

Hi Alexlds,

You should only have to add a schema.xml file defining your new table, and the table will be created when you install/upgrade the plugin. You can look at various plugins that do this already for an idea on how to write the schema.xml file -- see plugins/generic/counter/schema.xml, and others, for an example.

Cheers,
James
jmacgreg
 
Posts: 4190
Joined: Tue Feb 14, 2006 10:50 am

Re: make a new block plugin

Postby alexlds » Tue Jun 21, 2011 7:19 am

Thanks jmacgreg

That's the way, now all works perfectly.
alexlds
 
Posts: 6
Joined: Wed Jun 01, 2011 9:59 am


Return to OJS Development

Who is online

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