Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision eaf4d483

Von Moritz Bunkus vor fast 18 Jahren hinzugefügt

  • ID eaf4d4830c5b449170dbef0d0ad5f88863f1e8bd
  • Vorgänger 94fe7579
  • Nachfolger 4b1c7617

Einheiten sortierbar gemacht.

Unterschiede anzeigen:

bin/mozilla/am.pl
3665 3665

  
3666 3666
  @languages = AM->language(\%myconfig, $form, 1);
3667 3667

  
3668
  @unit_list = ();
3669
  foreach $name (sort({ lc($a) cmp lc($b) } grep({ !$units->{$_}->{"base_unit"} } keys(%{$units})))) {
3670
    map({ push(@unit_list, $units->{$_}); }
3671
        sort({ ($units->{$a}->{"resolved_factor"} * 1) <=> ($units->{$b}->{"resolved_factor"} * 1) }
3672
             grep({ $units->{$_}->{"resolved_base_unit"} eq $name } keys(%{$units}))));
3673
  }
3668
  @unit_list = sort({ $a->{"sortkey"} <=> $b->{"sortkey"} } values(%{$units}));
3669

  
3674 3670
  my $i = 1;
3675 3671
  foreach (@unit_list) {
3676 3672
    $_->{"factor"} = $form->format_amount(\%myconfig, $_->{"factor"} * 1) if ($_->{"factor"});
......
3690 3686
  $units = AM->retrieve_units(\%myconfig, $form, $form->{"unit_type"});
3691 3687
  $ddbox = AM->unit_select_data($units, undef, 1);
3692 3688

  
3689
  my $updownlink = build_std_url("action=swap_units", "unit_type");
3690

  
3693 3691
  $form->{"title"} = sprintf($locale->text("Add and edit %s"), $form->{"unit_type"} eq "dimension" ? $locale->text("dimension units") : $locale->text("service units"));
3694 3692
  $form->header();
3695 3693
  print($form->parse_html_template("am/edit_units",
3696 3694
                                   { "UNITS" => \@unit_list,
3697 3695
                                     "NEW_BASE_UNIT_DDBOX" => $ddbox,
3698
                                     "LANGUAGES" => \@languages }));
3696
                                     "LANGUAGES" => \@languages,
3697
                                     "updownlink" => $updownlink }));
3699 3698

  
3700 3699
  $lxdebug->leave_sub();
3701 3700
}
......
3831 3830

  
3832 3831
  $lxdebug->leave_sub();
3833 3832
}
3833

  
3834
sub swap_units {
3835
  $lxdebug->enter_sub();
3836

  
3837
  my $dir = $form->{"dir"} eq "down" ? "down" : "up";
3838
  my $unit_type = $form->{"unit_type"} eq "dimension" ?
3839
    "dimension" : "service";
3840
  AM->swap_units(\%myconfig, $form, $dir, $form->{"name"}, $unit_type);
3841

  
3842
  edit_units();
3843

  
3844
  $lxdebug->leave_sub();
3845
}

Auch abrufbar als: Unified diff