Hi Gary,

> Is it possible to have the "Request a copy" button send to a DSpace
> administrator email address only, rather than to the item owner? If so, where
> would I configure/code/hack this?

I've done something similar with our DSpace v4.1/JSPUI - Amongst other changes 
to our Embargo/Request a copy handling, I hacked our "Request a copy" 
implementation to send the Request email to an email address specified in the 
item's metadata (rather than always sending to the submitter), and I added a 
config option to dspace.cfg to specify the metadata field that held that 
address (which is "dc.author.email" in our case). 

To achieve this, I hacked "RequestItemServlet.java" (src in 
/usr/src/dspace-4.1-src-release/dspace-jspui/src/main/java/org/dspace/app/webui/servlet
 IIRC), and I've attached my hacked version in case it is of use or help to you 
(I'm guessing the mailing list will strip this, though, so if anyone else is 
interested in this, just let me know). If you search for "MW" in this file, 
you'll see the places where I've added/hacked the code (all my hacks (should!) 
have comments with my initials and the date) . . .

Basically, if you want to control where the email goes, I think you need to 
affect the email address that is passed into this line (it was a while ago I 
did this!):

        email.addRecipient(emailRequest);

- which occurs in the processForm and processAdmin functions I think . . . 

So, if you wanted to hard code it, you could simply put the email address in 
there (probably pulled from the config using 
ConfigurationManager.getProperty("mail.admin")  rather hard coding the actual 
address) . . . 

Alternatively, I note that just above the "addRecipient" line, the code checks 
if emailRequest is empty, and if it is, populates it with the Admin email 
address instead (I THINK this is in the original, and isn't something I have 
added!?):

        if (emailRequest == null) {
                emailRequest = ConfigurationManager
                        .getProperty("mail.admin");
                }

So, you could hack this test to get the change you want?

If it were me, I'd probably add a flag to the config file (a key with a value 
of true or false) and add a test for that value to the if statement above, that 
way you could toggle between sending emails to the Admin or to the "expected" 
email address simply by changing the config option - so, for example (off the 
top of my head, and NOT TESTED!), in dspace.cfg, add:

request.item.adminemail = true

- and then hack the above to something like:

        if ((emailRequest == null) || 
                
("true".equalsIgnoreCase(ConfigurationManager.getProperty("request.item.adminemail
 ")))  {
                emailRequest = ConfigurationManager
                        .getProperty("mail.admin");
        }

[Not sure if you actually need to test against "true", or if the value in 
"request.item.adminemail" can be used as a Boolean "as is" (without a 
comparison) - so you may be able to clean that up a little!]

The above may not be the best way to achieve what you want (and others are 
welcome to correct me or offer other/better solutions!), but would probably get 
you where you want to go!

I hope this is of some use.

Regards,

Mike

Michael White 
eLearning Liaison and Development (eLD)
Information Services
S8, Library
University of Stirling 
Stirling SCOTLAND 
FK9 4LA 
Email: michael.wh...@stir.ac.uk 
Tel: +44 (0) 1786 466877 
Fax: +44 (0) 1786 466880
http://www.stir.ac.uk/is/staff/about/teams/aldt/#eld

> 
> Message: 5
> Date: Tue, 2 Sep 2014 06:58:59 +0000
> From: Gary Browne <gary.bro...@sydney.edu.au>
> Subject: [Dspace-tech] Request a copy
> To: dspace-tech Tech <dspace-tech@lists.sourceforge.net>
> Message-ID: <23DF3A1C5648DD43BCAE0666B5AFAD119405096A@ex-mbx-
> pro-02>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> Hi all,
> 
> DSpace version: 4.1
> UI: JSP
> Servlet container: Tomcat 7
> Server: RHEL 6.5 64-bit
> Java: OpenJDK 1.7
> 
> Is it possible to have the "Request a copy" button send to a DSpace
> administrator email address only, rather than to the item owner? If so, where
> would I configure/code/hack this?
> 
> Thanks,
> Gary
> 
> GARY BROWNE?| Development Programmer
> Library IT Services | Fisher Library F03?
> 
> THE UNIVERSITY OF SYDNEY
> 
> T +61 2 9351 5946  | M +61 405 647 868 ?
> E gary.bro...@sydney.edu.au  | W http://sydney.edu.au Sent from my plain
> old desktop computer.
> 
> CRICOS 00026A
> This email plus any attachments to it are confidential. Any unauthorised use 
> is
> strictly prohibited. If you receive this email in error, please delete it and 
> any
> attachments.
> Please think of our environment and only print this e-mail if necessary.
> 
> 


-- 
The University of Stirling has been ranked in the top 12 of UK universities for 
graduate employment*.
94% of our 2012 graduates were in work and/or further study within six months 
of graduation.
*The Telegraph
The University of Stirling is a charity registered in Scotland, number SC 
011159.

Attachment: RequestItemServlet.java
Description: RequestItemServlet.java

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
DSpace-tech mailing list
DSpace-tech@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspace-tech
List Etiquette: https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette

Reply via email to