EPrints Technical Mailing List Archive

Message: #06702


< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

Re: [EP-tech] Tweaking the "creators" section on the workflow


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.

example for the citations/eprints/summary_page.xml file;

     <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 ];
};

On 12/07/2017 12:22, Christopher Gutteridge wrote:
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. 

On 12 Jul 2017 10:28 am, Andrew Beeken <anbeeken@lincoln.ac.uk> wrote:

Hello all,

 

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:

 

Family Name

Given Name

Unique ID (I think that this a field added by some previous system alterations)

Role (Dropdown)

Internal ID (New field)

 

 

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:

 

Family Name

Given Name

Internal ID

Role

 

 

Any thoughts?

 

Andrew


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.

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.

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.

The University may monitor email traffic data and content in accordance with its policies and English law. Further information can be found at: http://www.lincoln.ac.uk/legal.



*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/

-- 
Christopher Gutteridge -- http://users.ecs.soton.ac.uk/cjg

University of Southampton Open Data Service: http://data.southampton.ac.uk/
You should read our Web & Data Innovation blog: http://blogs.ecs.soton.ac.uk/webteam/