EPrints Technical Mailing List Archive

Message: #04943


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

[EP-tech] Re: Use as Template


Two emails in a row with “Might work, not sure if it’s a good idea!” or variations thereof! J

 

I’ll speak internally and see if it’s so pressing that we do this – if not I’d rather err on the side of caution given the fragile nature of our repo as is!

 

 

From: eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk] On Behalf Of Adam Field
Sent: 15 October 2015 16:13
To: eprints-tech@ecs.soton.ac.uk
Subject: [EP-tech] Re: Use as Template

 

Ooohhh, once again, John has spotted the issue.

 

I wonder if you can set the can_clone property on the fly by subclassing the UseAsTemplate class:

 

 

package EPrints::Plugin::Screen::EPrint::TemplateWithContactEmail;

 

use strict;

use warnings;

use EPrints::Plugin::Screen::EPrint::UseAsTemplate;

 

sub action_use_as_template

{

            my ($self) = @_;

 

            my $field = $self->repository->dataset('eprint')->metafield('contact_email);

 

            my $p = field->get_property('can_clone');

            $metafield->set_property('can_clone', 1);

            $self::SUPER->action_use_as_template;

            $metafield->set_property('can_clone', $p);

}

 

...then use the settings in plugins.pl to disable the default plugin and mask the new one as that.

 

I've no idea if this will work, or even if it's a good idea.

 

--
Adam Field
Business Relationship Manager and Community Lead
EPrints Services

 

 

 

On 15 Oct 2015, at 14:58, John Salter <J.Salter@leeds.ac.uk> wrote:



Hi,
In addition to Adams email, you need to look at this:
https://github.com/eprints/eprints/blob/3.3/perl_lib/EPrints/DataObj/EPrint.pm#L174
- the 'contact_email' is set not to clone.

This means you have to do a bit more work - copying the core field definition, and changing that flag.
I *think* this might work - but there may be a better way to adjust that one value of the field definition...

$c->add_dataset_field( "eprint", {
   name=>"contact_email",
   type=>"email",
   required=>0,
   can_clone=>1, #now allows copying of field in 'clone'
   replace_core=>1 #this flag must be used with EXTREME caution, it makes is very easy to break things
},
 reuse => 1 #if field exists, reuse it
);

Cheers,
John


-----Original Message-----
From: eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk] On Behalf Of Field A.N.
Sent: 15 October 2015 14:43
To: eprints-tech@ecs.soton.ac.uk
Subject: [EP-tech] Re: Use as Template

The code that runs is here:

https://github.com/eprints/eprints/blob/3.3/perl_lib/EPrints/Plugin/Screen/EPrint/UseAsTemplate.pm#L44

..which calls the clone function here:

https://github.com/eprints/eprints/blob/3.3/perl_lib/EPrints/DataObj/EPrint.pm#L640

I see no reason why contact email wouldn't come across...  Or have I misread the code?

--
Adam Field
Business Relationship Manager and Community Lead
EPrints Services
+44 (0)23 8059 8814





On 15 Oct 2015, at 13:50, Andrew Beeken wrote:


Hello all,

Regarding the Use As Template option on records, we’ve noticed that this doesn’t populate the Contact Email Address field on a copy. I don’t know if this is a field that we’ve added to our particular EPrints repository; either way, is it possible/easy to have the Use As Template include this content when it copies the record?

Andrew

The University of Lincoln, located in the heart of the city of Lincoln, has established an international reputation based on high student satisfaction, excellent graduate employment and world-class research.

The information in this e-mail and any attachments may be confidential. If you have received this email in error please notify the sender immediately and remove it from your system. Do not disclose the contents to another person or take copies.

Email is not secure and may contain viruses. The University of Lincoln makes every effort to ensure email is sent without viruses, but cannot guarantee this and recommends recipients take appropriate precautions.

The University may monitor email traffic data and content in accordance with its policies and English law. Further information can be found at: http://lincoln.ac.uk/legal.

*** 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/



*** 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/

*** 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/