[EP-tech] Re: Order of subjects in view

Florian Heß hess at ub.uni-heidelberg.de
Mon Jan 14 09:36:35 GMT 2013


Am 21.12.2012 15:38, schrieb Florian Heß:
> Hi,
>

Foremost, may you all have a nice and successfull 2013 :-) ...

Could someone give me a tip on how to inspect this one further, please? 
How come the custom order key is determined but ignored, do I miss 
something?


Regards,
F Heß

> I want to have the entries in a view menue sorted properly. My
> make_single_value_orderkey routine, however, does not seem to influence
> the response to the client (the problem is not the browser cache), even
> if that routine is actually executed. This has been tested successfully
> by running `perl -d ~/bin/generate_views --view=myview` with a
> $DB::single=1 in that routine: The routine has been executed and got
> passed every pair of subject $field => $value, and the returned order
> keys were perfect.
>
> Did I miss something?
>
> In cfg.d/views.pl:
>
>           {
>                   id => "schriftenreihen",
>                   menus => [
>                           {
>                                   fields => [ "schriftenreihe_cluster_id" ],
>                                   hideempty => 1,
>                           },
>                   ],
>                   citation => "schriftenreihe_tr",
>                   order => "schriftenreihe_order",
>          }
>
>
> In cfg.d/eprint_fields.pl:
>
>             {
>               'name' => 'schriftenreihe',
>               'type' => 'compound',
>               'fields' => [
>                             {
>                               'sub_name' => 'cluster_id',
>                               'top' => 'sr',
>                               'type' => 'subject',
>                               'multiple' => 0,
>                               'browse_link' => 'schriftenreihen',
>                               'make_single_value_orderkey' =>
>                                   \&schriftenreihe_sort_value
>                             },
>                             {
>                               'sub_name' => 'order',
>                               'type' => 'text',
>                               'input_cols' => 10,
>                               'allow_null' => 1,
>                             },
>                           ],
>               'input_boxes' => 1,
>             },
>
> sub schriftenreihe_sort_value {
>       my ($field, $value) = @_;
>       $DB::single=1;
>
>       $value = $field->{repository}
>                      ->dataset("subject")
>                      ->dataobj($value)
>                      ->{data}
>                      ->{name_name}[0]
>                   ;
>
>       # $value e.g. "Works by or about Ix Why"
>
>       return join ", ", reverse $value =~ m{
>               (\S+\w)                # given name
>               (?:\s\w\.|\s[a-z]\S*)* # 2nd-name initials, "von" and alike
>               \s*\b (\S+) \s* \z     # family name
>           }xms;
>
> }
>
> After making these changes I did a `./epadmin reload $repo && epadmin
> reorder $repo subject &&  ./generate_views $repo --view=schriftenreihen`
> , but the browser still displays the old naively sorted values.
>
> Not expecting anyone answers this in 2012 - Wish you all a merry
> christmas, a good time and a happy new year! EPrints is a great superb
> system after all (my complains *g*)!
>
> Regards,
> Florian
>


-- 
UB Heidelberg (Altstadt)
Plöck 107-109, 69117 HD
- Informationstechnik
- WWW-Redaktion
Tel. 06221 / 54 3550
http://www.ub.uni-heidelberg.de/



More information about the Eprints-tech mailing list