EPrints Technical Mailing List Archive

See the EPrints wiki for instructions on how to join this mailing list and related information.

Message: #04617


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

[EP-tech] Re: Advanced Search Page render of large number of choices (such as language).


Adam,

Just a confirmation that the following did indeed work although I changed the name of the file to z_overrides.pl just because I've already added a second one to the list which is the field 'formats' which suffered the same problem as language.  

Again, Thanks to both you and Gilles for your information.

Brian.

-----Original Message-----
From: eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk] On Behalf Of Field A.N.
Sent: Tuesday, September 01, 2015 10:20 AM
To: eprints-tech@ecs.soton.ac.uk
Subject: [EP-tech] Re: Advanced Search Page render of large number of choices (such as language).

Hi Brian

	You can override core fields with locally configured field if you set the replace_core function.  In z_document_language_render_override.pl

$c->add_dataset_field(
	'document',
	{
		#the following was copied from perl_lib/EPrints/DataObj/Document.pm
		name=>"language",
		type=>"namedset",
		required=>1,
		input_rows=>1,
		set_name=>"languages",

		#two new lines to change the way it renders in searches
		search_input_style => 'default',
		replace_core => 1,
	},
);

	This should do the trick, but in the future, if the core definition of the language field changes, you'll need to update this field definition	

--
Adam Field
Business Relationship Manager and Community Lead EPrints Services
+44 (0)23 8059 8814





On 1 Sep 2015, at 14:53, Brian D. Gregg wrote:

> All,
> 
> I've made the suggested changes.  However, I see in my advanced search languages field is defined as '{ meta_fields => [ "documents.language" ] },'  which is not defined in either of the eprint_fields.pl or document_fields.pl in the archive config directory.  But I did change our 'degree' field in the eprint_fields.pl to use 'search_input_style' => 'select' (Thanks for the tip Gilles.) and it is now showing as a select list box.  So I now see that using the 'search_input_style' change does indeed work.  Is there some indication anywhere of what the available options are for this as this is the first time I've run across this?
> 
> I've found what looks to be the original documents.language field definition in the perl_lib/EPrints/DataObj/Document.pm file as ' ' name=>"language", type=>"namedset", required=>1, input_rows=>1, set_name=>"languages"' Can I just re-enter it in the archive document_fields.pl file to override it or will that cause an issue with the archive (two definitions of the same field)?  I'm not sure if field definitions can be used as an override or they just additive in nature.
> 
> Thanks,
> Brian.
> 
> -----Original Message-----
> From: eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk] On Behalf Of Field A.N.
> Sent: Tuesday, September 01, 2015 8:32 AM
> To: eprints-tech@ecs.soton.ac.uk
> Subject: [EP-tech] Re: Advanced Search Page render of large number of choices (such as language).
> 
> Hmmm....  I've explored the codebase, and it looks like there's a 'search_input_style' property.  It looks like for a 'set' type, it defaults to 'checkbox'.  This is tested for here:
> 
> 	
> https://github.com/eprints/eprints/blob/3.3/perl_lib/EPrints/MetaField
> /Set.pm#L413
> 
> ...I don't think it's tested for anywhere else.  In your field definition, add:
> 
> 	'search_input_style' => 'default',
> 
> ...and see what happens.  You'll have to reload the configuration or restart the webserver.
> 
> --
> Adam Field
> Business Relationship Manager and Community Lead EPrints Services
> +44 (0)23 8059 8814
> 
> 
> 
> 
> 
> On 31 Aug 2015, at 17:48, Brian D. Gregg wrote:
> 
>> All,
>> 
>> I've been asked to find out if there is a "better way" to render a field that has a large number of choices such as the language field that may have upwards of 140 languages all listed on the advanced search page as each individually with a check box.   What I understand we are looking for is if there is a way to have this as a single select drop-down box or a multi-select drop-down box so that the languages field doesn't take up so much real estate on the page.
>> 
>> Any hints suggestions would be welcome.
>> 
>> Thanks.
>> 
>> Brian D. Gregg
>> Solutions Architect | Manager Systems Development University of 
>> Pittsburgh | University Library System
>> Address: 7500 Thomas Blvd.  Room 129 Pittsburgh, PA 15208
>> Tel: (412) 648-3264 | Email: bdgregg@pitt.edu | Fax: (412) 648-3585
>> 
>> *** 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/
> 
> 
> *** 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/
> 
> *** 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/


*** 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/