<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.apple-tab-span
        {mso-style-name:apple-tab-span;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hi Adam,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Thanks for the pointers.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I think I can achieve what I need through this – but I don’t think I can order a review column based on a virtual field – so I’ll have to make the default rendering
be the list-style, and use the virtual field for the abstract page – but that might also fall foul of your comment about epxml :o\<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Cheers,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">John<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk]
<b>On Behalf Of </b>Adam Field<br>
<b>Sent:</b> 17 June 2015 19:42<br>
<b>To:</b> eprints-tech@ecs.soton.ac.uk<br>
<b>Subject:</b> [EP-tech] Re: Rendering a metafield - use different format in Listing and Abstract page<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I've solved this problem by using a virtual field with a custom renderer. The virtual field's render method reads the value from the actual field you're interested in and renders it differently. The problem with virtual fields is that
I think they're hard to test for in epxml (and possibly also with is_set).<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">You can see an example from the tweepository package here:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><span class="apple-tab-span"> </span><a href="https://github.com/gobfrey/tweepository/blob/master/cfg/cfg.d/z_tweepository_libs.pl#L314">https://github.com/gobfrey/tweepository/blob/master/cfg/cfg.d/z_tweepository_libs.pl#L314</a> (field
definition)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span class="apple-tab-span"> </span><a href="https://github.com/gobfrey/tweepository/blob/master/cfg/cfg.d/z_tweepository_libs.pl#L1710">https://github.com/gobfrey/tweepository/blob/master/cfg/cfg.d/z_tweepository_libs.pl#L1710</a> (render
method)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="color:black">--<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black">Adam Field<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black">Business Relationship Manager and Community Lead<br>
EPrints Services<o:p></o:p></span></p>
</div>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">On 17 Jun 2015, at 17:47, John Salter <<a href="mailto:J.Salter@leeds.ac.uk">J.Salter@leeds.ac.uk</a>> wrote:<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Hi,<br>
I'd like to be able to apply a different rendering to a field if it's being displayed in a listing (e.g. the Review screen) to how it gets rendered 'normally'.<br>
<br>
In this specific case, a compound field is normally rendered as a table:<br>
+----------+----------+<br>
| Sub A | Sub B |<br>
+----------+----------+<br>
| Val 1A | Val 1B |<br>
| Val 2A | Val 2B |<br>
| Val 3A | Val 3B |<br>
+----------+----------+<br>
<br>
This rendering is OK on an abstract page, but when using the compound field as a review column, I want to render is as a list:<br>
* Val 1B (Val 1A)<br>
* Val 2B (Val 2A)<br>
* Val 3B (Val 3A)<br>
<br>
Is there a way (in the render_value of a field) to determine if the field is being rendered as part of a listing?<br>
I've got access to the $session - so was thinking along the lines of (CAUTION: nonsense code!)<br>
if( $session->{screen}->isa( "EPrints::Screen::Listing" ) ){<br>
<span class="apple-tab-span"> </span>#do list rendering<br>
} else {<br>
<span class="apple-tab-span"> </span>#revert to normal table rendering<br>
}<br>
<br>
but I can't quite get my head around going from session to screen. Any pointers welcome!<br>
<br>
I may be missing something obvious too - e.g. if there's a citation style that I should use to do this!<br>
<br>
Cheers,<br>
John<br>
<br>
<br>
<br>
*** Options: <a href="http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech">
http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech</a><br>
*** Archive: <a href="http://www.eprints.org/tech.php/">http://www.eprints.org/tech.php/</a><br>
*** EPrints community wiki: <a href="http://wiki.eprints.org/">http://wiki.eprints.org/</a><br>
*** EPrints developers Forum: <a href="http://forum.eprints.org/">http://forum.eprints.org/</a><o:p></o:p></p>
</div>
</blockquote>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
</div>
</body>
</html>