Difference between revisions of "Limiting names shown"

From EPrints Documentation
Jump to: navigation, search
m (link to github's commit added)
m
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
=== To Be Written ===
+
Although all names should be shown for exports, sometimes an EPrint has so many creators or editors it is really not useful to display then all without user prompting.  Therefore, a render function (in '''lib/cfg.d/[[limit_names_shown.pl]]''') has been written for '''EPrints 3.4.2+''' to allow some names to be hidden and then displayed when a link on "et al" is clicked. Below describes how you can make good use of the render function:
This page will contain information on how citations can be made to limit the number of authors shown but be expandable with a single click.
 
  
In the meantime look at [https://github.com/eprints/eprints3.4/commit/10b90d2a1cb3ede4ae6dc1dc62d9f6524c1b626a commit@github]
+
 
 +
1. Edit your archive's '''cfg/cfg.d/eprint_fields.pl''' and create a virtual field replica of the name field on which you want to be able to limit authors.  The example bellow will limit the number of creators display to 10 before showing an "et al" so you can display the rest.
 +
{
 +
        name => 'creators_name_limited',
 +
        type => 'name',
 +
        virtual => 1,
 +
        render_value => 'limit_names_shown',
 +
        render_limit => 10,
 +
        render_dynamic => 1,
 +
},
 +
<code>render_dynamic</code> determines whether the "et al" gets made into a link that will reveal the other names.  If it is not included or set to 0, the et al will not be a link and remaining names will not be displayable.
 +
 
 +
2. Copy your archive's '''cfg/citations/eprint/default.xml''' (or '''cfg/citations/eprint/default_for_summary_page.xml''' if it exists) to '''cfg/citations/eprint/display.xml'''.
 +
 
 +
 
 +
3. Edit '''cfg/citations/eprint/display.xml''' adding '''_limited''' to all the name fields you want to limit the number of names initially displayed.
 +
 
 +
 
 +
4. Edit your archive's '''cfg/citations/eprint/summary_page.xml''' and '''cfg/citations/eprint/result.xml''' replace '''item.citation('default')''' (or  '''item.citation('default_for_summary_page')''') with '''item.citation('display')'''.  (N.B. you may need to modify other citation styles if they have been created for your archive).  If the '''summary_page.xml''' and '''result.xml''' do not already exists in you archive, you need to copy these from '''flavours/pub_lib/citations/eprint/''' to you archive and then edit these files within the archive's '''cfg/citations/eprint/''' directory.
 +
 
 +
 
 +
5. Refresh abstract pages.  Either by clicking the '''Refresh Abstracts''' button in the '''Config. Tools'' tab of the '''Admin''' page or by running the following command as the '''eprints''' user (substituting ''''EPRINTS_PATH''' and '''ARCHIVEID''' appropriately):
 +
EPRINTS_PATH/bin/epadmin refresh_abstracts ARCHIVEID
 +
 
 +
 +
6. Reload the webserver, using the appropriate command for your particular Linux operating system. E.g.
 +
root@redhat> apachectl graceful
 +
root@ubuntu> apache2ctl graceful
 +
 
 +
 
 +
If you want to use limited names citations for search results and browse views, then you will need to make similar changes to ''cfg/citations/eprint/default.xml'' and ''cfg/citations/eprint/result.xml'''.  Like for updating abstract pages, you will need to click '''Refresh Views''' button in the '''Config. Tools'' tab of the '''Admin''' page or by running the following command as the '''eprints''' user (substituting ''''EPRINTS_PATH''' and '''ARCHIVEID''' appropriately):
 +
EPRINTS_PATH/bin/epadmin refresh_abstracts ARCHIVEID
 +
If you have updated either browse view or search result citations, you will also need to reload the webserver (see step 6 above).
 +
 
 +
 
 +
If you want to update all citations, then technically you need only modify (like described in step 3) the ''cfg/citations/eprint/result.xml''' and ''cfg/citations/eprint/default.xml''' (and ''cfg/citations/eprint/default_for_summary_page.xml''') citation files and need not create a '''cfg/citations/eprint/display.xml''' nor modify '''cfg/citations/eprint/summary_page.xml''' (steps 2 and 4).  However, you will still need to run refresh abstracts, refresh views and reload the webserver.

Latest revision as of 00:34, 6 March 2022

Although all names should be shown for exports, sometimes an EPrint has so many creators or editors it is really not useful to display then all without user prompting. Therefore, a render function (in lib/cfg.d/limit_names_shown.pl) has been written for EPrints 3.4.2+ to allow some names to be hidden and then displayed when a link on "et al" is clicked. Below describes how you can make good use of the render function:


1. Edit your archive's cfg/cfg.d/eprint_fields.pl and create a virtual field replica of the name field on which you want to be able to limit authors. The example bellow will limit the number of creators display to 10 before showing an "et al" so you can display the rest.

{
        name => 'creators_name_limited',
        type => 'name',
        virtual => 1,
        render_value => 'limit_names_shown',
        render_limit => 10,
        render_dynamic => 1,
},

render_dynamic determines whether the "et al" gets made into a link that will reveal the other names. If it is not included or set to 0, the et al will not be a link and remaining names will not be displayable.

2. Copy your archive's cfg/citations/eprint/default.xml (or cfg/citations/eprint/default_for_summary_page.xml if it exists) to cfg/citations/eprint/display.xml.


3. Edit cfg/citations/eprint/display.xml adding _limited to all the name fields you want to limit the number of names initially displayed.


4. Edit your archive's cfg/citations/eprint/summary_page.xml and cfg/citations/eprint/result.xml replace item.citation('default') (or item.citation('default_for_summary_page')) with item.citation('display'). (N.B. you may need to modify other citation styles if they have been created for your archive). If the summary_page.xml and result.xml do not already exists in you archive, you need to copy these from flavours/pub_lib/citations/eprint/ to you archive and then edit these files within the archive's cfg/citations/eprint/ directory.


5. Refresh abstract pages. Either by clicking the Refresh Abstracts button in the Config. Tools tab of the Admin page or by running the following command as the eprints user (substituting ''EPRINTS_PATH and ARCHIVEID appropriately):

EPRINTS_PATH/bin/epadmin refresh_abstracts ARCHIVEID


6. Reload the webserver, using the appropriate command for your particular Linux operating system. E.g.

root@redhat> apachectl graceful
root@ubuntu> apache2ctl graceful


If you want to use limited names citations for search results and browse views, then you will need to make similar changes to cfg/citations/eprint/default.xml and cfg/citations/eprint/result.xml. Like for updating abstract pages, you will need to click Refresh Views button in the Config. Tools tab of the Admin page or by running the following command as the eprints user (substituting 'EPRINTS_PATH and ARCHIVEID appropriately):

EPRINTS_PATH/bin/epadmin refresh_abstracts ARCHIVEID

If you have updated either browse view or search result citations, you will also need to reload the webserver (see step 6 above).


If you want to update all citations, then technically you need only modify (like described in step 3) the cfg/citations/eprint/result.xml' and cfg/citations/eprint/default.xml (and cfg/citations/eprint/default_for_summary_page.xml) citation files and need not create a cfg/citations/eprint/display.xml nor modify cfg/citations/eprint/summary_page.xml (steps 2 and 4). However, you will still need to run refresh abstracts, refresh views and reload the webserver.