EPrints Technical Mailing List Archive

See the EPrints wiki for instructions on how to join this mailing list and related information.

Message: #02697


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

[EP-tech] Re: Addressing a specific creator


Hi,
You should be able to set a 'render_value' on the field, and define a local function to do the rendering.
I've included more of the config below to clarify where the render_value option goes:
{
        name => 'creators',
        type => 'compound',
        multiple => 1,
        fields => [
                {
                        sub_name => 'name',
                        type => 'name',
                        hide_honourific => 1,
                        hide_lineage => 1,
                        family_first => 1,
                },
                {
                        sub_name => 'id',
                        type => 'text',
                        input_cols => 20,
                        allow_null => 1,
                },
                 {
                         sub_name => 'ubt',
                         type => 'set',
                         options => [
                                 'yes',
                                 'no'
                         ],
	}

        ],
        input_boxes => 4,
        render_value => 'local_render_ubt_authors',
},

In another config file for the archive e.g. ~/archives/ARCHIVEID/cfg/cfg.d/z_local_render_ubt_authors.pl
###########################################################
$c->{local_render_ubt_authors} = sub {
    my( $session , $field , $value ) = @_;

    my $frag = $session->make_doc_fragment;

    my $ul = $session->make_element( "ul", class=>"ubt_authors" );
#
# do something sensible with the $value - e.g. append a 'li' to $ul, possibly with some 'bold' - perhaps using a class="ubt_author"?
# see: http://wiki.eprints.org/w/Accessing_Metdata_Fields#The_Structure_of_Values 
# for details about the structure to expect in $value 
#
    $frag->appendChild( $ul );
    return $frag;
};
###########################################################

For more info, see:
http://www.eprints.org/tech.php/17392.html

This might not be the best way of doing this - but it should work. Anyone else got other suggestions?

Cheers,
John

-----Original Message-----
From: eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk] On Behalf Of Verena Mattes
Sent: 03 March 2014 07:57
To: eprints-tech@ecs.soton.ac.uk
Cc: Andreas.weber@uni-bayreuth.de
Subject: [EP-tech] Addressing a specific creator

Hello,

we're just starting with our two EPrints archives here in Bayreuth and 
now have requests from some of the University's members to change the 
display of our views and individual items in such a way as to 
distinguish between authors from Bayreuth and other authors.

So far I've added additional subfields to the creators, contributors and 
editors compound fields to select whether an author is a member of the 
University or not:

                 {
                         sub_name => 'ubt',
                         type => 'set',
                         options => [
                                 'yes',
                                 'no'
                  ],
                         input_style => 'medium',
                         show_in_fieldlist => 0,

However, I've not found a way to use this field as I cannot address a 
specific author. Is there a way to query the 3 tables 
(eprint_creators_name, eprint_creators_id, eprint_creators_ubt) and use 
the result in the citation format default.xml? The goal is to have the 
local authors (eprint_creators_ubt="yes") printed in bold.

Thanks for your help!

Verena Mattes
Dep. Digital Library
University Library of Bayreuth
95440 Bayreuth
GERMANY
*** 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/