EPrints Technical Mailing List Archive

Message: #01910


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

[EP-tech] Re: enabling new field "eprint_contributors"


On Mon, 2013-04-29 at 15:56 -0400, Nault, Pierre wrote:
> Hi,
> 
>  
> 
>                 I’m posting this one again to see if we can get any
> answer.
> 
>  
> 
>                 I’ve just enable the field “contributors”
> in /workflow/eprint/default.xml. The field is a combination of 3
> fields : contributors_type; contributors_name and contributors_id. In
> input area of the field  contributors_type, I have an error message :
> “[pin missing : fieldname]”. Even with this error message, I still
> have access to the drop list of all types of contributors. Any idea
> where I can find or put the missing pin ?

As an admin, you should have an 'edit pages phrases' at the top of the
page. Clicking that should allow you to set the missing phrase.

> Also, I want the value of this field to be default to a certain value
> in the list of contributors type. I tried something in
> eprint_field_default.pl :
> 
>  
> 
> $data->{contributor_type_typename} = "Thesis advisor";
> 
>  
> 
> But It doesn’t work. How can I default the value of the field
> contributor_type_typename ?

Do you want to set this value in front of the user or is it ok to set
that only on write (i.e. if the user hasn't explicitly chosen a value,
then set it?)?

For the latter, you want to use eprint_fields_automatic.pl, with
something like (untested):

my @contributors = @{$eprint->value('contributors')};
foreach my $contributor (@contributors)
{
$contributor->{type} = 'advisor' if !
EPrints::Utils::is:set($contributor->{type});
}
$eprint->set_value('contributors', \@contributors);


To show a default in the workflow is more complex. I would use some
Javascript to modify the page when it's displayed ... because you need
to set the value only when the user has added a name, which means using
dynamic (not server-side) behaviour.

-- 
All the best,
Tim

Attachment: signature.asc
Description: This is a digitally signed message part