Tech List

[index] [prev] [next] [options] [help]
See the Mailing Lists Page for how to subscribe and unsubscribe.

eprints_tech messages

Please note: this page shows emails that have been sent to the eprints_tech mailing list. Some of these may be spam emails we have failed to filter.

Re: [EP-tech] chane the rendering of a compund field

From: roman <roman.chyla AT gmail.com>
Date: Fri, 10 Oct 2008 11:06:22 +0200


Threading: [EP-tech] chane the rendering of a compund field from yurj AT alfa.it
      • This Message

*** 
http://www.eprints.org/tech.php/id/%3CEMEW-k99A83104791fc75dcf7dc98fdf1ec70f8e158-48EF1B0E.5060000%40googlemail.com%3E
*** EPrints community wiki - http://wiki.eprints.org/

i was lazy (and the dom tree is no fun)
so this is a possible solution:

   #creators
   my $creators;
   if( $eprint->is_set( "creators" ) )
	{
     my  AT values;
     foreach ($eprint->render_value( "creators" 
)->getElementsByTagName('tr')){
       my  AT line;
       foreach($_->childNodes()) {
         push( AT line, $_->textContent());
       }
       push( AT values, [ AT line]);
     }
     $creators = $session->make_element('div', id => 
"creators");
     for (my $i=1; $i <  AT values; $i++) { #preskocime prvni radek 
(zahlavi)
       my $d = $session->make_element('div');
       $values[$i][1] =~ s/\./ dot /g; #emaily
       $values[$i][1] =~ s/\ AT / at /g;
       $values[$i][0] .= '; ' if $values[$i][1];
       $values[$i][1] .= '; ' if $values[$i][2];
       $a = $session->make_element("strong");
       $a->appendChild($session->make_text(shift( AT {$values[$i]})));
       $d->appendChild($a);
       $d->appendChild($session->make_text(join(" ",  AT 
{$values[$i]})));
       $creators->appendChild($d)

     }
     #print STDERR $creators->serialize();


or this for your inspiration, authors again - no html rendering:

my $field = $dataset->get_field( $fieldname );
my $value = $eprint->get_value( $fieldname );
foreach my $item (  AT {$value} )
{;
if ($display_name eq 'Publication order reference') {
my $x = '';
if ($item->{affiliation}) {
$x .= $item->{name}->{given} ? $item->{name}->{given} . " 
" : "";
$x .= $item->{name}->{family} ? " " . 
$item->{name}->{family} . "" : "";
$x .= $item->{affiliation} ? ", " . $item->{affiliation} : 
"";
$x .= $item->{id} ? ', e-mail: <a href="mailto:' . $item->{id} . 
'">' . 
$item->{id} . '</a>' : "";
}
}
}



Yuri wrote:
> *** 
> 
http://www.eprints.org/tech.php/id/%3CEMEW-k98H2Ic02b7674656eeaa79fd5060559317770-48EE2B18.6030307%40alfa.it%3E 
> 
> *** EPrints community wiki - http://wiki.eprints.org/
> 
> the rendering of a compund field is hardcoded in 
> perl_lib/EPrints/MetaField/Compound.pm
> 
> so I would like to do a get_value and render it by myself in 
> eprint_render.pl. Can someone share the code if it has been already 
> done? :)
> 
> Thanks!
> 
> 


[index] [prev] [next] [options] [help]