[EP-tech] Link from Abstract/Summary creator to /views/creators/{creator encoded}.html

Alan.Stiles alan.stiles at open.ac.uk
Fri Jan 26 10:50:58 GMT 2018


Thanks Matt,
That looks like a better option for avoiding the issues with feeds / exporters.  Another item on my list of things to sort, later!
Cheers,
Alan

-----Original Message-----
From: eprints-tech-bounces at ecs.soton.ac.uk [mailto:eprints-tech-bounces at ecs.soton.ac.uk] On Behalf Of Matthew Kerwin
Sent: 26 January 2018 10:12
To: eprints-tech at ecs.soton.ac.uk
Subject: Re: [EP-tech] Link from Abstract/Summary creator to /views/creators/{creator encoded}.html

Ah, that's how ours is different.  We *didn't* put a special renderer in the sub-field, instead we explicitly invoke renderers in the various citations.  For example, in citations/eprint/default.xml we do something like this:

~~~xml
<choose>
  <when test="is_set(creators)">
    <print expr="$item.render_value_special( 'QUT::EPrints::Utils::render_names_with_person_link', 'creators' )" />
  </when>
  <when test="type.one_of('book') and is_set(editors)">
    <print expr="$item.render_value_special( 'QUT::EPrints::Utils::render_names_with_person_link', 'editors' )" /> (Ed<if test="length(editors_name) gt 1">s</if>.)
  </when>
</choose>
~~~

... where the custom render_names_with_person_link subroutine does the <A> and URL generation.  Then we also have a second citation, .../abbrev.xml, which just does the usual:

~~~xml
<choose>
  <when test="is_set(creators_name)">
    <print expr="creators_name" />
  </when>
  <when test="type.one_of('book') and is_set(editors_name)">
    <print expr="editors_name" /> (Ed<if test="length(editors_name) gt
1">s</if>.)
  </when>
</choose>
~~~

...so we can choose between linked or non-linked citations.

~~~xml
<epc:print expr="$item.citation('abbrev')" /> ~~~

It's worth noting that, deep down, our render_names_with_person_link subroutine uses `EPrints::Utils::escape_filename` to convert the id field to a usable URL.

Cheers


On 26 January 2018 at 18:37, Alan.Stiles <alan.stiles at open.ac.uk> wrote:
> Hi Brian,
>
> We also have a similar thing, e.g. http://oro.open.ac.uk/35731/
> (currently
> v3.3.15 plus local customisations)
>
> It is a custom local_author_render function defined in
> cfg.d/eprints_render.pl which checks each author entry for a value in
> author_id (as per Matthew’s system) and, if that exists, uses it to
> render the name as a link to the author view based on that id,
> otherwise just renders the author name.
>
> It is defined as a render_value in eprint_fields.pl
>
>
>
> $c->{fields}->{eprint} = [
>
>
>
>           {
>
>             'name' => 'creators',
>
>             'type' => 'compound',
>
>             'multiple' => 1,
>
>             'fields' => [
>
>                           {
>
>                             'sub_name' => 'name',
>
>                             'type' => 'name',
>
>                             'hide_honourific' => 1,
>
>                             'hide_lineage' => 1,
>
>                             'family_first' => 1,
>
>                             'render_value' => \&local_author_render,
>
>
>
>                           },
>
>                           {
>
>                             'sub_name' => 'id',
>
>                             'type' => 'authorid',
>
>                             'input_cols' => 20,
>
>                             'allow_null' => 1,
>
>                           },
>
>>
>                 ]}];
>
>
>
> NOTE: It will probably have knock on effects in how the author name is
> rendered elsewhere though – like in exports and coversheet renderers!
>
>
>
> Regards,
>
> Alan
>
>
>
> From: eprints-tech-bounces at ecs.soton.ac.uk
> [mailto:eprints-tech-bounces at ecs.soton.ac.uk] On Behalf Of Matthew
> Kerwin
> Sent: 26 January 2018 01:17
> To: eprints-tech at ecs.soton.ac.uk
> Subject: Re: [EP-tech] Link from Abstract/Summary creator to
> /views/creators/{creator encoded}.html
>
>
>
>
>
>
>
> On 26 Jan. 2018 03:50, "Brian D. Gregg" <bdgregg at pitt.edu> wrote:
>
> All,
>
>
>
> Has anyone looked into linking creators from an Abstract/Summary page
> to the /views/creators/{creator encoded}.html page?  If so, can you
> explain how you did so?  We have a request to provide that link and
> I've not come up with what I feel is a good solution yet so I'm asking the group here.
>
>
>
> I suspect that this would be a custom render function to alter the
> displayed list of the creators.  But in addition, is there an existing
> function that takes the creators name and translates it to the
> /views/creators/{creator encoded}.html value that we can just use just to create the link?
>
>
>
> Thanks,
>
> -Brian
>
>
>
> We have those sorts of links in the citation (eg.
> https://eprints.qut.edu.au/115171/ )
>
>
>
> It's a public holiday here today so I'll have to get back to you on
> exactly how it's set up, but from memory it's a custom renderer inside
> the eprint_creators field. I can't remember for sure how it's invoked
> from the citation.
>
>
>
> Since the 'creators' view is not vanilla, it's necessarily one you
> built yourself, so no one else can tell you how the mapping from
> creator to encoded view key works. In our case eprint_creators has an
> 'id' subfield, alongside name and all that.
>
>
>
> Cheers
>
> --
>
> Matthew Kerwin
>
> -- The Open University is incorporated by Royal Charter (RC 000391),
> an exempt charity in England & Wales and a charity registered in
> Scotland (SC 038302). The Open University is authorised and regulated
> by the Financial Conduct Authority in relation to its secondary activity of credit broking.
>
> *** 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/
>



--
  Matthew Kerwin
  http://matthew.kerwin.net.au/

*** 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/
-- The Open University is incorporated by Royal Charter (RC 000391), an exempt charity in England & Wales and a charity registered in Scotland (SC 038302). The Open University is authorised and regulated by the Financial Conduct Authority in relation to its secondary activity of credit broking.



More information about the Eprints-tech mailing list