EPrints Technical Mailing List Archive

Message: #07490


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

Re: [EP-tech] EPScript - Author Limit


Hi James,

I will put up a page at https://wiki.eprints.org/w/Limiting_names_shown
 as it requires an explanation that is a bit long to put in an email an
would probably require attachments.  May take me a day or two to get
round to writing it.

Regards

David Newman


On Wed, 2018-09-19 at 10:45 +0100, James Kerwin wrote:
> Hi David,
> 
> I'm very jealous; that's exactly what I'm going for, even the
> clickable "et al" (I thought I might have had an original idea up
> until I saw that).
> 
> Any guidance you can give me would be brilliant. I may hold off
> jumping in and editing that file for the time being and do some more
> investigating.
> 
> Thanks,
> James
> 
> On Wed, Sep 19, 2018 at 9:58 AM David R Newman <drn@ecs.soton.ac.uk>
> wrote:
> > Hi James,
> > 
> > This is what I did for one of the repository I help maintain: 
> > 
> > http://researchonline.ljmu.ac.uk/7570/
> > 
> > I should be able to share the code if I can extract it from the
> > rest of
> > the codebase, as it requires edits to 3-4 files, if I remember
> > correctly.  Also, if you have other features like
> > people_with_orcids
> > that modifies the list of authors in the citation in some way (i.e.
> > in
> > this case add little ORCID buttons to click), then it may require a
> > bit
> > more of an effort to merge.
> > 
> > Regards
> > 
> > David Newman
> > 
> > On Wed, 2018-09-19 at 09:36 +0100, James Kerwin via Eprints-tech
> > wrote:
> > > Hi All,
> > > 
> > > I have been tasked with limiting the number of authors that
> > display
> > > in any given EPrint Abstract page as when there are many
> > > authors/creators associated with an EPrint it ruins the abstract
> > > page.
> > > 
> > > I have edited default.xml in citations and can make it show ten
> > > authors and add an "et al" to the end if there are more than ten
> > > authors. 
> > > 
> > > However, previously the creators/authors list was generated via:
> > > 
> > > <print expr="people_with_orcids(creators)" />
> > > 
> > > I wasn't able to iterate through this so I instead used:
> > > 
> > > <epc:foreach expr="creators_name" iterator="name" limit="10">
> > > <print expr="$name" />
> > > 
> > > If I wanted to change the behaviour of
> > "people_with_orcids(creators)
> > > how would I do this? I don't need detailed instruction, just a
> > nudge
> > > towards which file(s) control this if anybody knows.
> > > 
> > > My suspicion is that I need to change the sub
> > > "run_people_with_orcids" in a file named z_orcid_support.pl in
> > > ../[Archive_Id]/cfg/cfg.d, but I'm not super excited about
> > chopping
> > > and changing things without fully knowing if I should (sub
> > snippet
> > > below).
> > > 
> > > Thanks,
> > > James
> > > 
> > > #Rendering ORCIDs
> > > {
> > > package EPrints::Script::Compiled;
> > > use strict;
> > >  
> > > sub run_people_with_orcids
> > > {
> > >       my( $self, $state, $value ) = @_;
> > >  
> > >       my $session = $state->{session};
> > >       my $r = $state->{session}->make_doc_fragment;
> > >  
> > >       my $creators = $value->[0];
> > >  
> > >       foreach my $i (0..$#$creators)
> > >       {
> > >  
> > >               my $creator = @$creators[$i];
> > >  
> > >               if( $i > 0 )
> > >               {
> > >                       #not first item (or only one item)
> > >                       if( $i == $#$creators )
> > >                       {
> > >                               #last item
> > >                               $r->appendChild( $session-
> > >make_text( "
> > > and " ) );
> > >                       }
> > >                       else
> > >                       {
> > >                               $r->appendChild( $session-
> > >make_text(
> > > ", " ) );
> > >                       }
> > >               }
> > > 
> > > *** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/epri
> > nts-
> > > tech
> > > *** Archive: http://www.eprints.org/tech.php/
> > > *** EPrints community wiki: http://wiki.eprints.org/
> > > *** EPrints developers Forum: http://forum.eprints.org/
> >