eprints / eprints3.4

EPrints 3.4 core and releases
http://www.eprints.org/uk/index.php/eprints-3-4/
GNU Lesser General Public License v3.0
31 stars 28 forks source link

Allow namedset to use vary using function #389

Closed drn05r closed 4 months ago

drn05r commented 5 months ago

It may be the case that you want to present a different set of options for a field based on the values already set for an existing field (e.g. an eprint's type). At the moment this cannot be done. However, as subject fields can set set their top to a function (#249) it should be possible to do something similar for set_name

drn05r commented 4 months ago

There is a potential for this to break or at least make the output from /cgi/schema inaccurate. I would advise that if such a function is used the default return value should be one that encompasses all possible options.

drn05r commented 4 months ago

This can be done by configuring the workflow as follows:

<epc:choose>
    <epc:when test="type = 'article'">
        <field ref="license" set_name="licenses_for_article"/>
     </epc:when>
     <epc:otherwise>
         <field ref="license"/>
     </epc:otherwise>
</epc:choose>

It does mean you need to define a separate set of phrases for licenses_for_article. You should probably do something like the following to make sure license typename phrases are consistent:

<epp:phrase id="licenses_for_article_typename_cc_by_nd_4" ref="licenses_typename_cc_by_nd_4"/>

You need not for the licence description phrases (e.g. licenses_for_article_description_cc_by_nd_4) as it will not know what namedset was used it will just assume the one in the field configuration, so it is important that those license description phrases are present.