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: Stephen Shorrock <sms67 AT cam.ac.uk>
Date: Thu, 06 Nov 2008 17:51:22 +0000
| Threading: | ↑ [EP-tech] Re: 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 Duncan, Thanks for the direction. I've found one way to get the EPrint type. > http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech > *** EPrints community wiki - http://wiki.eprints.org/ > Hi All, > > I'm afraid to say that no answers have appeared (yet) > > Looking into the code, I think for contextual help text we'd need to ↵ change Metafield.pm > > sub render_help > { > my( $self, $session ) = AT _; > > if( defined $self->{help_xhtml} ) > { > return $self->{help_xhtml}; > } > > my $phrasename = ↵ $self->{confid}."_fieldhelp_".$self->{name}; > > return $session->html_phrase( $phrasename ); > } > > > If you can get the eprint type in this section of code, you could change ↵ it to be something like: > > > sub render_help > { > my( $self, $session ) = AT _; > > if( defined $self->{help_xhtml} ) > { > return $self->{help_xhtml}; > } > > my $phrasename = ↵ $self->{confid}."_fieldhelp_".$self->{name}; > > my $type_specific_phrasename = ($phrasename . "#" . ↵ ?getEprintType?; > > if (EPrints::Language->has_phrase($type_specific_phrasename) { > return $session->html_phrase($type_specific_phrasename); > } else { > return $session->html_phrase( $phrasename ); > } > } > > This could allow you to set the following in the phrases file: > <epp:phrase id="eprint_fieldhelp_title">This is the title ↵ of the item</epp:phrase> > <epp:phrase id="eprint_fieldhelp_title#book">This is the ↵ title of the book</epp:phrase> > <epp:phrase id="eprint_fieldhelp_title#booksection">This ↵ is the title of the chapter and not the book itself</epp:phrase> > > There's always a default to use but you can give specific help for ↵ specific resource types. > > My main problem is that I can't work out how to get the current eprint ↵ record's data - this is the eprint we're editing in the workflow. Calling ↵ $self{type} will give you the field type (ala Longtext) and not the eprint type ↵ (ala Article). I'm also unsure about getting to the Language object. > > Any ideas on getting that eprint type? > 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. Maybe if I get some more time. Regards Stephen > Cheers, > > Duncan > > > Ps The same would be great for field titles. For example > <epp:phrase ↵ id="eprint_fieldname_volume">Volume</epp:phrase> > <epp:phrase id="eprint_fieldname_volume#book">Series ↵ Volume</epp:phrase> > ...but I just don't have the time to keep digging in the code > > 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 Stephen Shorrock > Sent: Wednesday, 5 November 2008 12:28 AM > To: EPrints.org Technical List > 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/ > Hi Duncan, > > I was wondering whether you found a solution for this? > > If so I wondered whether you wouldn't mind sharing it. I think that we > would like to do the exact same thing. > > TIA > Stephen > > Dickinson wrote: > >> *** ↵ http://www.eprints.org/tech.php/id/%3CCDD4943B0C84AD4B87B7B2EB6BF47ED2B6303E0B%40QUTEXMBX01.qut.edu.au%3E >> *** EPrints community wiki - http://wiki.eprints.org/ >> >> Hi Matthaeus, >> >> Thanks for responding to my query. I was trying to avoid creating ↵ another field as the information is basically the same (ie it is the creator of ↵ the item) and just try to change the wording on the screen depending on the ↵ resource type being described. This is along the lines of the citations where ↵ you can use epc conditionals to format the output based on resource type. >> >> Another example would be to display one help string for Journal titles ↵ and another for Books. You don't want to create separate fields for each title ↵ but you need different display text. >> >> Cheers, >> >> Duncan >> >> Duncan Dickinson / QUT Digital Repository Technical Project Manager / ↵ Library Systems >> Queensland University of Technology / CRICOS: 00213J >> ph 3138 3782 >> >> >> -----Original Message----- >> From: owner-eprints-tech AT ecs.soton.ac.uk [mailto:owner-eprints-tech ↵ AT ecs.soton.ac.uk] On Behalf Of Matthäus Zylka >> Sent: Monday, 20 October 2008 9:21 PM >> To: EPrints.org Technical List >> Subject: Re: [EP-tech] Phrases based on eprint type >> >> *** ↵ http://www.eprints.org/tech.php/id/%3C1224501689.48fc69b9c61fc%40webmail.uni-koeln.de%3E >> *** EPrints community wiki - http://wiki.eprints.org/ >> >> Zitat von Duncan Dickinson <d.dickinson AT qut.edu.au>: >> >> Hi Duncan, >> >> If you want to add a new Eprint type you have to add some lines into ↵ following >> files: >> >> -> /phrases/eprint_types.xml: >> >> <epp:phrase ↵ id="eprint_typename_artwork">Artwork</epp:phrase> >> <epp:phrase id="eprint_optdetails_type_artwork">An ↵ Artwork ;)</epp:phrase> >> >> ->/namedsets/eprint: >> >> artwork >> >> Then you have to edit the /cfg.d/eprint_fields.pl and add: >> >> { >> 'name' => 'artist', >> 'type' => 'compound', >> 'multiple' => 1, >> 'fields' => [ >> { >> 'sub_name' => 'name', >> 'type' => 'name', >> 'hide_honourific' => 1, >> 'hide_lineage' => 1, >> 'family_first' => 1, >> }, >> { >> 'sub_name' => 'id', >> 'type' => 'text', >> 'input_cols' => 20, >> 'allow_null' => 1, >> } >> ], >> 'input_boxes' => 4, >> }, >> >> -> /phrases/eprint_fields.xml: >> >> <epp:phrase ↵ id="eprint_fieldname_artist">Artist</epp:phrase> >> <epp:phrase ↵ id="eprint_fieldname_artist_name">Artists</epp:phrase> >> <epp:phrase ↵ id="eprint_fieldname_artist_id">E-Mail</epp:phrase> >> <epp:phrase id="eprint_fieldhelp_artist">HELPHELP ↵ or something</epp:phrase> >> >> and the last one >> >> /workflows/eprint/default.xml: >> >> <stage name="core"> >> <epc:choose> >> . >> . >> . >> <epc:when test="type='artwork'"> >> <component><field ref="artist" >> input_lookup_url="{$config{rel_cgipath}}/users/lookup/name" ↵ /></component> >> </epc:when> >> >> I don't know what kind of fields you really need. So here is only an ↵ example: >> <epc:if test="type = 'artwork'"> >> <field ref="date"/> >> <field ref="date_type"/> >> <field ref="place_of_pub"/> >> <field ref="series"/> >> <field ref="official_url"/> >> </epc:if> >> >> After that, run "generate_static XXX", "_views", ↵ "_abstracts", "epadmin >> upgrade_database_structure XXX" (I don't know if its a feature of ↵ eprints >> version < 3.1.0) and "epadmin reload XXX". >> If "epadmin upgrade_database_structure XXX" doesn't work, ↵ you'll have to add >> "artist" in your SQL Database by hand. >> >> Don't forget to restart Apache >> >> regards, >> -- >> Matthaeus Zylka >> University of Cologne >> Libary for Computer Science >> and Business Computing >> Pohligstr. 1 >> 50969 Cologne >> >> >> >> > > >
[index] [prev] [next] [options] [help]




