<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>To flesh that out a bit more. There's a bit of code I wrote that
lets you get a single property from a "compound" field. This lets
you loop over a field like creator and set how it renders each
item in the loop. However, this only changes how it renders on the
summary (or citation). The solution with DOM hacking in perl is
required to change the way it renders throughout the system. <br>
</p>
<p>example for the citations/eprints/summary_page.xml file;<br>
</p>
<pre> <epc:foreach expr="$item{dates}" iterator="date">
<div class='uos-eprints-dv'><span
class='uos-eprints-dv-label'><epc:print
expr="$date.subproperty('date_type')" /> date:</span> <epc:print
expr="$date.subproperty('date')" /></div>
</epc:foreach>
(you'd have to tweak this to loop over creators and render the subproperties how you like)
Add this Code to eprint_render.pl:
sub EPrints::Script::Compiled::run_subproperty
{
my( $self, $state, $objvar, $value ) = @_;
if( !defined $objvar->[0] )
{
$self->runtime_error( "can't get a property
{".$value->[0]."} from undefined value" );
}
my $ref = ref($objvar->[1]);
if( $ref !~ m/::/ || ! $objvar->[1]->isa(
"EPrints::MetaField::Compound" ) )
{
$self->runtime_error( "can't get a subproperty from
anything except a compound field value, when trying to get
".$value->[0]." from a $ref" );
}
my $field = $objvar->[1];
if( $field->get_property( "multiple" ) )
{
$self->runtime_error( "can't get a subproperty from a
multiple field." );
}
my $fc = $field->get_property( "fields_cache" );
my $sub_field;
my @ok = ();
foreach my $a_sub_field ( @{$fc} )
{
push @ok, $a_sub_field->{sub_name};
if( $a_sub_field->{sub_name} eq $value->[0] )
{
$sub_field = $a_sub_field;
}
}
if( !defined $sub_field ) {
$self->runtime_error( "unknown sub-field of a compound:
".$value->[0].". OK values: ".join( ", ", @ok )."." );
}
$sub_field->set_property( "multiple", 0 );
return [
$objvar->[0]->{ $value->[0] },
$sub_field ];
};</pre>
<br>
<div class="moz-cite-prefix">On 12/07/2017 12:22, Christopher
Gutteridge wrote:<br>
</div>
<blockquote type="cite"
cite="mid:EMEW3|e258ee352c6a185242eeb7cf0a19d31fy6BClJ14eprints-tech-bounces|ecs.soton.ac.uk|5dbc56dd-739c-4db3-8810-e3bcace0406f@email.android.com">
<div dir="auto">See my recent post about adding a subproperty
method... It means you can style creators display in the summary
page file... If I've understood correctly. </div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On 12 Jul 2017 10:28 am, Andrew Beeken
<a class="moz-txt-link-rfc2396E" href="mailto:anbeeken@lincoln.ac.uk"><anbeeken@lincoln.ac.uk></a> wrote:<br type="attribution">
<blockquote class="quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div>
<p>Hello all,</p>
<p> </p>
<p>I’m trying to alter the output on the “Creators”
section on the EPrints workflow however I’m not sure
how to go about doing this. I’ve added, to my new
installation, a field for Internal ID to handle a
lookup for the new LDAP based user management. This
appears at the end of the available fields in the
Creator View which is comprised of:</p>
<p> </p>
<p>Family Name</p>
<p>Given Name</p>
<p>Unique ID (I think that this a field added by some
previous system alterations)</p>
<p>Role (Dropdown)</p>
<p>Internal ID (New field)</p>
<p> </p>
<p> </p>
<p>What I’d like to do is get rid of the Unique ID field
and move the Internal ID field so that it looks like:</p>
<p> </p>
<p>Family Name</p>
<p>Given Name</p>
<p>Internal ID</p>
<p>Role</p>
<p> </p>
<p> </p>
<p>Any thoughts?</p>
<p> </p>
<p>Andrew</p>
</div>
<div><font face="Times New Roman" size="2"><br>
<b>The University of Lincoln, located in the heart of
the city of Lincoln, has established an
international reputation based on high student
satisfaction, excellent graduate employment and
world-class research.</b></font></div>
<div><font face="Arial" size="1"><br>
The information in this e-mail and any attachments may
be confidential. If you have received this email in
error please notify the sender immediately and remove
it from your system. Do not disclose the contents to
another person or take copies.<br>
<br>
Email is not secure and may contain viruses. The
University of Lincoln makes every effort to ensure
email is sent without viruses, but cannot guarantee
this and recommends recipients take appropriate
precautions.<br>
<br>
The University may monitor email traffic data and
content in accordance with its policies and English
law. Further information can be found at:
<a class="moz-txt-link-freetext" href="http://www.lincoln.ac.uk/legal">http://www.lincoln.ac.uk/legal</a>.</font></div>
</div>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">*** Options: <a class="moz-txt-link-freetext" href="http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech">http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech</a>
*** Archive: <a class="moz-txt-link-freetext" href="http://www.eprints.org/tech.php/">http://www.eprints.org/tech.php/</a>
*** EPrints community wiki: <a class="moz-txt-link-freetext" href="http://wiki.eprints.org/">http://wiki.eprints.org/</a>
*** EPrints developers Forum: <a class="moz-txt-link-freetext" href="http://forum.eprints.org/">http://forum.eprints.org/</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Christopher Gutteridge -- <a class="moz-txt-link-freetext" href="http://users.ecs.soton.ac.uk/cjg">http://users.ecs.soton.ac.uk/cjg</a>
University of Southampton Open Data Service: <a class="moz-txt-link-freetext" href="http://data.southampton.ac.uk/">http://data.southampton.ac.uk/</a>
You should read our Web & Data Innovation blog: <a class="moz-txt-link-freetext" href="http://blogs.ecs.soton.ac.uk/webteam/">http://blogs.ecs.soton.ac.uk/webteam/</a>
</pre>
</body>
</html>