EPrints Technical Mailing List Archive

Message: #07887


< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

Re: [EP-tech] Adding Buttons to Admin Screen


Hi Yuri,

Thank you so much for your advice. I realised my wrong assumption on what "regen_abstracts" was doing, but was still confused as to how the abstracts were being generated and how to call a script etc.

I spent all day trying to get it working yesterday and it did in the end. I had to add my "config/aam_update" (In: return $self->allow( "config/aam_update" );) to my core Users.pm because I couldn't get user_roles.pl or a local Users.pm to work, but it's only on the Test server for the time being.

Now to wrestle with the google docs API to finish!

Thanks,
James

On Mon, Jun 17, 2019 at 8:00 AM Yuri via Eprints-tech <eprints-tech@ecs.soton.ac.uk> wrote:
It is a default permission for the Admin role:

perl_lib/EPrints/DataObj/User.pm

         "admin" =>
         [
                 [...]
                 "config/regen_abstracts",

                 [...]

         ]

You've to create a new one and grant it to a user.

Looking at the plugin, the important call is:

$session->expire_abstracts()

defined in:

perl_lib/EPrints/Repository.pm:

which just set a variable on expiring date. So, when viewed, the
abstract will be recreated.

If you need to run a script, just create an event when the button is
pressed and epindexer will run it. You can find an example in the same
Datacite plugin, on the MintDoi part.

Il 14/06/19 16:46, James Kerwin via Eprints-tech ha scritto:
> Hi All,
>
> I have a script that I run every two weeks for AAM updates. I'm away
> when the next update is due so I've decided to create a new button on
> the Admin screen that runs the script (inspired by the MintDOI button
> in the DataCite plugin):
>
> image.png
> (I know it should say "an AAM").
>
> I'm using RegenAbstracts.pm
> (EPrints::Plugin::Screen::Admin::RegenAbstracts;) as a rough guide.
>
> I had assumed that this would call "generate_abstracts" but it appears
> to look at "config/regen_abstracts":
>
>                 sub allow_regen_abstracts
>
>                 {
>
>                 my( $self ) = @_;
>
>
>                 return $self->allow( "config/regen_abstracts" );
>
>                 }
>
> Does anybody know how I can get it to point at my script? I must admit
> that I'm not sure where "config/regen_abstracts" is pointing and I've
> done so many greps to find it. If I could find how looking to that
> causes the abstracts to be generated I could copy that approach.
>
> Thanks,
> James
>
>
>
> *** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
> *** Archive: https://eur03.safelinks.protection.outlook.com/?url="">
> *** EPrints community wiki:
https://eur03.safelinks.protection.outlook.com/?url="">
> *** EPrints developers Forum:
https://eur03.safelinks.protection.outlook.com/?url="">

*** Options:
http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/