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.
[EP-tech] Re: Phrases based on eprint type
From: Duncan Dickinson <d.dickinson AT qut.edu.au>
Date: Fri, 7 Nov 2008 11:35:03 +1000
| Threading: | ↑ [EP-tech] Phrases based on eprint type from d.dickinson AT qut.edu.au • This Message |
http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech *** EPrints community wiki - http://wiki.eprints.org/ Hi, I'm editing EPrints::MetaField, altering the render_help function to be: sub render_help { my( $self, $session ) = AT _; if( defined $self->{help_xhtml} ) { return $self->{help_xhtml}; } my $phrasename = $self->{confid}."_fieldhelp_".$self->{name}; my $eptype = EPrints::DataObj::EPrint->new( $session, $session->{query}->{eprintid}->[0])->get_type; $phrasename .= "#$eptype" if ↵ $session->get_lang->has_phrase("$phrasename#$eptype"); return $session->html_phrase( $phrasename ); } This gives me an error of: "Can't call method get_type on an undefined ↵ value" Any thoughts? Is this where you've been making the changes? Another question, I haven't delved this far into the eprints src but I'm ↵ wondering if that call to EPrint->new uses a query to the database or if the ↵ system checks to see if it has the data cached? We're running EPrints 3.1.1 (Port and Brandy) Cheers, Duncan Duncan Dickinson / QUT Digital Repository Technical Project Manager / Library ↵ Systems Queensland University of Technology / CRICOS: 00213J ph 3138 3782 -----Original Message----- From: eprints-tech-bounces AT ecs.soton.ac.uk [mailto:eprints-tech-bounces AT ↵ ecs.soton.ac.uk] On Behalf Of Alfons Wittmann Sent: Friday, 7 November 2008 10:04 AM To: eprints-tech AT ecs.soton.ac.uk Subject: [EP-tech] Re: Phrases based on eprint type http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech *** EPrints community wiki - http://wiki.eprints.org/ Stephen Shorrock schrieb am 06.11.2008 18:51: > The EPrint's ID seems to be accessible through the session object, so > adding to the code you already provided we could do something like the > following: > > my $type_specific_phrasename = $phrasename; > my %types; > my AT types = map ( > ↵ EPrints::DataObj::EPrint->new($session,$_)->get_value("type") , ↵ > AT {$session->{query}->{eprintid}} ); > @types{ AT types}=(); > if (scalar(keys(%types))==1){ > $type_specific_phrasename.="#".$types[0]; > } > > It seems to work for the workflow scenario I've tried, and I would be > interested whether the same technique would work for the field titles. Shorter code, based on your solution (thanks!!): my $eptype = EPrints::DataObj::EPrint->new( $session, $session->{query}->{eprintid}->[0] )->get_type; $phrasename .= "#$eptype" if $session->get_lang->has_phrase("$phrasename#$eptype"); Works nice for me, also for field titles, which are rendered in EPrints::Metafield::render_name Regards, Alfons -- Universitätsbibliothek Eichstätt-Ingolstadt EDV-Referat Tel: 08421/93-1486 - Fax: 08421/93-1791 Universitätsallee 1 EMail: alfons.wittmann AT ku-eichstaett.de 85071 Eichstätt http://www.ku-eichstaett.de/Bibliothek/
[index] [prev] [next] [options] [help]




