EPrints Technical Mailing List Archive

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

Message: #01447


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

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


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/