Altering the 'Request a copy' function
The Request a copy function allows for some restricted items to be requested by a visitor to the repository.
If you want someone requesting an item to provide more information that the default email address and reason, you can add additional fields to the request form using the methods outlined below.
Contents
Adding additional fields to the request dataset
The 'requests' are dataobjects - very similar to an eprint, or a user, so you can add fields in the same way.
Add configuration for new fields
In a config file e.g. [EPRINTS_ROOT]/archives/[ARCHIVE_ID]/cfg/cfg.d/z_request_fields.pl
## Additional fields for 'Request a copy'
push @{$c->{fields}->{request}},
{
name => "contact_num",
type => "text",
},
{
name => "id_num",
type => "text",
};
After adding this file, test the config is OK (avoid syntax errors):
> [EPRINTS_ROOT]/bin/epadmin test [ARCHIVE_ID]
Add phrases for new fields
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>
</epp:phrases>
Then run:
> [EPRINTS_ROOT]/bin/epadmin update [ARCHIVE_ID]
This will add the columns to the database.
Adding fields to the workflow
By default the workflow is in the global configuration. It can be customised by copying 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
Reload Apache
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 should have added the fields to the 'Request a copy' workflow.
Altering the email sent to the contact_email
address
UNDER CONSTRUCTION!