[EP-tech] How to add form in "Request a copy"

John Salter J.Salter at leeds.ac.uk
Thu Aug 2 09:48:10 BST 2018

For info, I've put the info below onto a wiki page:

The 'altering emails' bit will be added in a couple of hours, but will follow this:
for the Screen::Public::RequestCopy plugin, overriding the 'action_request' method.


From: eprints-tech-bounces at ecs.soton.ac.uk [mailto:eprints-tech-bounces at ecs.soton.ac.uk] On Behalf Of John Salter
Sent: 02 August 2018 09:11
To: eprints-tech at ecs.soton.ac.uk
Subject: Re: [EP-tech] How to add form in "Request a copy"

Hi Izwan,

The 'requests' are dataobject - very similar to an EPrint, or a User, so you can add fields in the same way:

In a config file e.g. [EPRINTS_ROOT]/archives/[ARCHIVE_ID]/cfg/cfg.d/z_request_fields.pl

push @{$c->{fields}->{request}},
        name => "contact_num",
        type => "text",
        name => "id_num",
        type => "text",

Test the config is OK:
> [EPRINTS_ROOT]/bin/epadmin test [ARCHIVE_ID]

Add the phrases to e.g. [EPRINTS_ROOT]/archives/[ARCHIVE_ID]/cfg/lang/en/phrases/z_request_fields.xml:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE phrases SYSTEM "entities.dtd">
<epp:phrases xmlns="http://www.w3.org/1999/xhtml" xmlns:epp="http://eprints.org/ep3/phrase" xmlns:epc="http://eprints.org/ep3/control">
  <epp:phrase id="request_fieldname_contact_num">Contact number</epp:phrase>
  <epp:phrase id="request_fieldhelp_contact_num">A number that we can contact you on to discuss your request if necessary </epp:phrase>

  <epp:phrase id="request_fieldname_id_num">ID number</epp:phrase>
  <epp:phrase id="request_fieldhelp_id_num">The identification number from your staff/student card</epp:phrase>

Then run:
> [EPRINTS_ROOT]/bin/epadmin update [ARCHIVE_ID]
This will add the columns to the database

Finally, copy the default request workflow to the repository config:
> mkdir [EPRINTS_ROOT]/archives/[ARCHIVE_ID]/cfg/workflows/request
> cp [EPRINTS_ROOT]/lib/workflows/request/default.xml [EPRINTS_ROOT]/archives/[ARCHIVE_ID]/cfg/workflows/request/

Test the config again:
> [EPRINTS_ROOT]/bin/epadmin test [ARCHIVE_ID]

Restart Apache (this command depends on which operating system you use - you may need to do something slightly different!)
> sudo service httpd graceful

This will get you to a point where the data can be submitted into your system.
The next part you probably want to do is to include this information in the email sent to the contact_email address.

To do this, you need to create a local version (subclass) of the EPrints::Plugin::Screen::Public::RequestCopy module.
I'm still working out exactly what you need to do for this part. I'll write it up as a wiki page!


From: eprints-tech-bounces at ecs.soton.ac.uk<mailto:eprints-tech-bounces at ecs.soton.ac.uk> [mailto:eprints-tech-bounces at ecs.soton.ac.uk] On Behalf Of Mohd Izwan Salim
Sent: 02 August 2018 06:21
To: EPrints Tech Team <eprints-tech at ecs.soton.ac.uk<mailto:eprints-tech at ecs.soton.ac.uk>>
Subject: [EP-tech] How to add form in "Request a copy"

Dear Eprints Community

Can some one guide me on how to add a new form
- Contact Num.
- ID Num
in Request a copy page.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20180802/9df3c6a1/attachment-0001.html 

More information about the Eprints-tech mailing list