[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EP-tech] Modifying Details.pm/Overwriting module



Hi John,

Ahhh this would have been ideal. I did try searching for "overwrite EPrints
plugin" and couldn't find anything. I'll give this a read and try to apply
it.

You are correct; it was the render function that had to be altered. Our
repository team have a select few fields that they need to check that are
near the bottom of the details screen so it was my task to duplicate a few
fields at the top of the page.

Thanks,
James

On Wed, Jan 30, 2019 at 11:09 AM John Salter via Eprints-tech <
eprints-tech at ecs.soton.ac.uk> wrote:

> Hi James,
>
> This handy guide might help too:
>
> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwiki.eprints.org%2Fw%2FInstructions_for_local_plugins&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C83e0c1b23e32489bf5d008d686a61359%7C4a5378f929f44d3ebe89669d03ada9d8%7C1&amp;sdata=s6O%2Fp9hw6lTbrg7Pr%2BTLgu3rLeQ16c%2FndiwFDaJM3N4%3D&amp;reserved=0
> <https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwiki.eprints.org%2Fw%2FInstructions_for_local_plugins&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C83e0c1b23e32489bf5d008d686a61359%7C4a5378f929f44d3ebe89669d03ada9d8%7C1&amp;sdata=s6O%2Fp9hw6lTbrg7Pr%2BTLgu3rLeQ16c%2FndiwFDaJM3N4%3D&amp;reserved=0>
>
>
>
> From your original email it sounds like you want to change a small part of
> 'Details' - maybe just the 'render' method.
>
> Following the instructions on the page above, you'll basically sub-class
> the EPrints::Plugin::Screen::EPrint::Details to
> EPrints::Plugin::Screen::EPrint::MyDetails.
>
> In the MyDetails file, you can then specify your new render method, and
> then do the 'plugin alias' - and you're there.
>
>
>
> Cheers,
>
> John
>
>
>
> *From:* eprints-tech-bounces at ecs.soton.ac.uk [mailto:
> eprints-tech-bounces at ecs.soton.ac.uk] *On Behalf Of *Alan.Stiles via
> Eprints-tech
> *Sent:* 30 January 2019 08:35
> *To:* eprints-tech at ecs.soton.ac.uk
> *Subject:* Re: [EP-tech] Modifying Details.pm/Overwriting module
>
>
>
> James,
>
> Have a look at plugins.pl in cfg.d , specifically the section starting at
> line 46 :
> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Feprints%2Feprints%2Fblob%2F3.3%2Flib%2Fdefaultcfg%2Fcfg.d%2Fplugins.pl%23L46&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C83e0c1b23e32489bf5d008d686a61359%7C4a5378f929f44d3ebe89669d03ada9d8%7C1&amp;sdata=P2lat%2FaAyhOVg%2FpZ2i2iEzBxTZ%2Bjn6Azf6CMB6lSLQ8%3D&amp;reserved=0
> <https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Feprints%2Feprints%2Fblob%2F3.3%2Flib%2Fdefaultcfg%2Fcfg.d%2Fplugins.pl%23L46&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C83e0c1b23e32489bf5d008d686a61359%7C4a5378f929f44d3ebe89669d03ada9d8%7C1&amp;sdata=P2lat%2FaAyhOVg%2FpZ2i2iEzBxTZ%2Bjn6Azf6CMB6lSLQ8%3D&amp;reserved=0>
>
>
>
> This shows how to tell eprints to replace the existing function with the
> new one, and not create duplicates or fill your server log with ?redefined?
> warnings.
>
>
>
> Alan
>
>
>
>
>
>
>
> *From:* eprints-tech-bounces at ecs.soton.ac.uk [
> mailto:eprints-tech-bounces at ecs.soton.ac.uk
> <eprints-tech-bounces at ecs.soton.ac.uk>] *On Behalf Of *James Kerwin via
> Eprints-tech
> *Sent:* 30 January 2019 07:59
> *To:* eprints-tech at ecs.soton.ac.uk
> *Subject:* Re: [EP-tech] Modifying Details.pm/Overwriting module
>
>
>
> Apologies, ignore the previous email. I think I've done it.
>
>
>
> It seems if I put the file in the suitable archive location and keep this
> line the same:
>
>
>
> package EPrints::Plugin::Screen::EPrint::Details;
>
>
>
> If I change the file name to something different (e.g. Detailz.pm) it
> appears to overwrite the original Details.pm.
>
>
>
> Previously I was changing both the package name and the filename and it
> was including both.
>
>
>
> Thanks,
>
> James
>
>
>
> On Wed, Jan 30, 2019 at 7:50 AM James Kerwin <jkerwin2101 at gmail.com>
> wrote:
>
> Hi All,
>
>
>
> Could somebody please tell me how to overwrite an existing Perl module in
> EPrints?
>
>
>
> I recently made some changes to Details.pm. I know better than to modify
> it in-situ, so I took a copy and moved it to my specific EPrint archive.
>
>
>
> Original:
>
> eprints3/perl_lib/EPrints/Plugin/Screen/EPrint/Details.pm
>
>
>
> New edited version:
>
>
> eprints3/archives/uolrepo/cfg/plugins/EPrints/Plugin/Screen/EPrint/Details.pm
>
>
>
> EPrints didn't pick up my changes (even after a server restart) unless I
> named the edited module something different so I called it:
>
>
>
> Detailz.pm (package EPrints::Plugin::Screen::EPrint::Detailz;)
>
>
>
> I've made the changes to how the page renders, but my problem now is I
> have a "Details" and "Details2" tab on the staff view of an EPrint. I want
> only my new Details.pm module to be brought in. I did follow Adam Field's
> YouTube video that touched on this, but it wasn't quite the same problem
> and didn't work.
>
>
>
> Thanks,
>
> James
>
>
>
>
>
> -- The Open University is incorporated by Royal Charter (RC 000391), an
> exempt charity in England & Wales and a charity registered in Scotland (SC
> 038302). The Open University is authorised and regulated by the Financial
> Conduct Authority in relation to its secondary activity of credit broking.
> *** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
> *** Archive: https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.eprints.org%2Ftech.php%2F&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C83e0c1b23e32489bf5d008d686a61359%7C4a5378f929f44d3ebe89669d03ada9d8%7C1&amp;sdata=7%2FegbIh1mDc743A%2BoJKc%2B89ddRA9VaeuAlosUqon0ZA%3D&amp;reserved=0
> *** EPrints community wiki: https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwiki.eprints.org%2F&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C83e0c1b23e32489bf5d008d686a61359%7C4a5378f929f44d3ebe89669d03ada9d8%7C1&amp;sdata=MfVJwvIOgm8PQ0S1bUhjIZ8p%2FlTFc6ARLp17OQyv%2B6U%3D&amp;reserved=0
> *** EPrints developers Forum: https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fforum.eprints.org%2F&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C83e0c1b23e32489bf5d008d686a61359%7C4a5378f929f44d3ebe89669d03ada9d8%7C1&amp;sdata=5mE2y%2FI1z%2FXBTmbL2HwI2X8U4E3xkBPUP%2FRsyiovXdY%3D&amp;reserved=0
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20190130/548558f7/attachment-0001.html