OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



[SOLVED] Building "autoAuthor" plugin: Getting use

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.

[SOLVED] Building "autoAuthor" plugin: Getting use

Postby mbria » Sat Dec 23, 2006 6:53 am

Merry xmas and a happy new year !! :-)

I need to start my post saying that OJS is EXTREMELY well coded: object oriented, really well structured layers, based on patterns... so it's a complete joy working on it. More than this, although as a coder I must be ashamed saying this but... I'm learning how to code well reading OJS core.

If you are new to OJS, believe me: I work daily with drupal, moodle and other free software projects and I can say -without fear of been laying- that none of them is as well coded as OJS, so thanks a looot to make my developer's live easier. And I forget to mention the great documentation and wonderful support. Dudes, you are like my xmas present. :-P

Ok, enough publicity and let's work: ;-)

Before working on my "normal-workflow plugin" (that I commented in former posts) my fellows requested me to build a new generic plugin to allow any non-author user upgrade him/herself to Author.

As far as I know, in OJS user's can select their role at registration time, but after this they can not change it without admin's help... My new plugin will add a extra link to the menu so if you are an Author you will get a shortcut redirected to article's submissions, otherwise your will be able to upgrade to Author (and then redirected to submissions).

¿My question? ... yes. I have my plugin quite finished, but I need to know what roles "own" the active user and obviously I can DAO but I suspect this data is available for the plugin without reaching the DB.

Am I wrong? How could I get this info without a DB query?

Thanks in advance for your help,

m.

PD-NEWS: I'm in contact with RACO's people that 90% completed a catalan translation of OJS, so probably after Christmas I can finish this translation so we could contribute to this project with a new translation.
Last edited by mbria on Sat Dec 23, 2006 1:27 pm, edited 2 times in total.
mbria
 
Posts: 321
Joined: Wed Dec 14, 2005 4:15 am

silly me...

Postby mbria » Sat Dec 23, 2006 10:52 am

After RTFM and greping into OJS code, I answer myself. :oops:

This looks like the usual way to perform user's role validation in a plugin:

Code: Select all
    $journal = &Request::getJournal();
    $isAuthor=Validation::isAuthor($journal->getJournalId());

    //Output:
    print ('Is this user an author in this journal? ' . $isAuthor)


Simple and clean, without the annoyance (and the insecurity) of maintaining session variables with user's roles.

Now, let's see how to add a new role for the active user.
UserDAO or RoleDAO seams the right classes to explore.

Cheers,

m.
mbria
 
Posts: 321
Joined: Wed Dec 14, 2005 4:15 am

Done :-)

Postby mbria » Sat Dec 23, 2006 1:25 pm

I'm happy to announce that I finished the "autoAuthor" plugin. :-D

This plugins adds a new link labeled as "SEND" to your journal menu. If the user is an Author this links is just a shortcut to the article's sending form, otherwise the registered user is allowed to become an author (with a single click), and then redirected to submit a new article.


It will be useful in our journal to let every Reader become and author whenever they want to send a new article, instead just in the moment they get registered.

We are still testing it to be sure it works fine, but looks like quite stable so if you like you can download it first release at:

http://www.comunitic.net/OJS/autoAuthor/autoAuthor.tar.gz

Now is when asmecher comes and say: "Nice, but you can accomplish exactly the same with the X feature included in OJS out off the box". :-P

If it happens (please asmecher, be confident), I advice I really don't mind :-) because this plugin it's just a test to discover how difficult (o better said, how easy) was extending OJS with new features. My conclusion is clear: I love OJS !! Thanks you all, guys.

After xmas, I will follow with the Catalan translation and the "email validation plugin" developed to be sure each register user has a valid mail before letting them play with the system.

Live long and prosper,

Marc.

PD: In my posts is clear English is not my mother tongue, so any help translating the messages (just a few lines) of this plugin is welcome.
mbria
 
Posts: 321
Joined: Wed Dec 14, 2005 4:15 am

Postby asmecher » Sat Dec 30, 2006 11:52 am

Hi Marc,

Fantastic -- thanks for your comments! We shy away from comparisons to other projects, particularly projects that are much more widely used than OJS, but we're always delighted to have another developer working away on OJS. Feedback makes us better.

This particular feature has been a sticking point for us; it's long been too difficult for users to promote themselves with new roles. Previously, this was possible following these steps:
  • Log out.
  • Click "Register" from the top nav bar.
  • Follow the "Click here if you are already registered..." link
  • Follow the instructions on the screen.
Needless to say, this is not obvious.

In the current CVS tree (which will be released as OJS 2.2 early in the new year), it's possible to add roles by going to your Profile page. However, none of this probably suits your needs as well as your own plugin does, so -- please use it!

Regards,
Alec Smecher
Open Journal Systems Team
---
Don't miss the First International PKP Scholarly Publishing Conference
July 11 - 13, 2007, Vancouver, BC, Canada
http://ocs.sfu.ca/pkp2007/
asmecher
 
Posts: 9214
Joined: Wed Aug 10, 2005 12:56 pm

shy away?

Postby mbria » Mon Jan 08, 2007 9:06 am

Thanks for the gentle words. :-)

I code sometimes but my developments are always like "patchwork" cutting, pasting, hacking... but nothing so big and thought as OJS, so let's reserve the word "developer" for your guys. ;-)

We shy away from comparisons to other projects, particularly projects that are much more widely used than OJS, but we're always delighted to have another developer working away on OJS.


shy away? It's true that both projects are much more extended (their target is wider) but you all don't need to be.

May be Drupal documentation is more detailed than OJS one and you can find tones of examples, but your code is far away better and still could not be compared to moodle, that is also a great development but is pure spaghetti.

Please, keep your work on OJS as know. Simply rooks.

Happy new year,

m.
mbria
 
Posts: 321
Joined: Wed Dec 14, 2005 4:15 am

Postby yaliang » Mon Feb 26, 2007 8:44 pm

Dear mbria,

Thanks for your idea and effort, this plugin is great to reduce the journal manager’s work to modify the user’s setting. However, the added “SUBMITâ€
yaliang
 
Posts: 82
Joined: Tue Jul 11, 2006 1:11 am

May be I'm wrong...

Postby mbria » Tue Feb 27, 2007 8:26 am

I don't remember where I read it but I think was Alec that said new OJS release includes this new feature exactly as you describe it.

About duplicities, may be you are right and the "natural" place to change user's role is each user's page. My development was just what my fellows request me and they wanted to make it very visible in their magazine.

I'm sure Alec will read us and clarify this point... otherwise, take a look to the CVS because I feel like right now what you need is implemented.

Cheers,

m.
mbria
 
Posts: 321
Joined: Wed Dec 14, 2005 4:15 am

Postby asmecher » Tue Feb 27, 2007 9:46 am

Hi all,

I think you're referring to the ability to self-register for reviewer, reader, and author roles (if enabled) without going back to the registration page. The CVS version of OJS places these three checkboxes on the Profile page -- you can enroll and un-enroll yourself from there.

Regards,
Alec Smecher
Open Journal Systems Team
---
Don't miss the First International PKP Scholarly Publishing Conference
July 11 - 13, 2007, Vancouver, BC, Canada
http://ocs.sfu.ca/pkp2007/
asmecher
 
Posts: 9214
Joined: Wed Aug 10, 2005 12:56 pm


Return to OJS Development

Who is online

Users browsing this forum: No registered users and 3 guests