Revision bc433711
Von Moritz Bunkus vor fast 14 Jahren hinzugefügt
bin/mozilla/common.pl | ||
---|---|---|
386 | 386 |
} |
387 | 387 |
|
388 | 388 |
sub format_dates { |
389 |
$main::lxdebug->enter_sub(); |
|
390 |
|
|
391 |
my ($dateformat, $longformat, @indices) = @_; |
|
392 |
|
|
393 |
my $form = $main::form; |
|
394 |
my %myconfig = %main::myconfig; |
|
395 |
my $locale = $main::locale; |
|
396 |
|
|
397 |
$dateformat = $myconfig{"dateformat"} unless ($dateformat); |
|
398 |
|
|
399 |
foreach my $idx (@indices) { |
|
400 |
if ($form->{TEMPLATE_ARRAYS} && (ref($form->{TEMPLATE_ARRAYS}->{$idx}) eq "ARRAY")) { |
|
401 |
for (my $i = 0; $i < scalar(@{$form->{TEMPLATE_ARRAYS}->{$idx}}); $i++) { |
|
402 |
$form->{TEMPLATE_ARRAYS}->{$idx}->[$i] = |
|
403 |
$locale->reformat_date(\%myconfig, $form->{TEMPLATE_ARRAYS}->{$idx}->[$i], |
|
404 |
$dateformat, $longformat); |
|
405 |
} |
|
406 |
} |
|
407 |
|
|
408 |
next unless (defined($form->{$idx})); |
|
409 |
|
|
410 |
if (!ref($form->{$idx})) { |
|
411 |
$form->{$idx} = $locale->reformat_date(\%myconfig, $form->{$idx}, |
|
412 |
$dateformat, $longformat); |
|
413 |
|
|
414 |
} elsif (ref($form->{$idx}) eq "ARRAY") { |
|
415 |
for (my $i = 0; $i < scalar(@{$form->{$idx}}); $i++) { |
|
416 |
$form->{$idx}->[$i] = |
|
417 |
$locale->reformat_date(\%myconfig, $form->{$idx}->[$i], |
|
418 |
$dateformat, $longformat); |
|
419 |
} |
|
420 |
} |
|
421 |
} |
|
422 |
|
|
423 |
$main::lxdebug->leave_sub(); |
|
389 |
return $::form->format_dates(@_); |
|
424 | 390 |
} |
425 | 391 |
|
426 | 392 |
sub reformat_numbers { |
427 |
$main::lxdebug->enter_sub(); |
|
428 |
|
|
429 |
my ($numberformat, $places, @indices) = @_; |
|
430 |
|
|
431 |
my $form = $main::form; |
|
432 |
my %myconfig = %main::myconfig; |
|
433 |
|
|
434 |
return $main::lxdebug->leave_sub() |
|
435 |
if (!$numberformat || ($numberformat eq $myconfig{"numberformat"})); |
|
436 |
|
|
437 |
foreach my $idx (@indices) { |
|
438 |
if ($form->{TEMPLATE_ARRAYS} && (ref($form->{TEMPLATE_ARRAYS}->{$idx}) eq "ARRAY")) { |
|
439 |
for (my $i = 0; $i < scalar(@{$form->{TEMPLATE_ARRAYS}->{$idx}}); $i++) { |
|
440 |
$form->{TEMPLATE_ARRAYS}->{$idx}->[$i] = $form->parse_amount(\%myconfig, $form->{TEMPLATE_ARRAYS}->{$idx}->[$i]); |
|
441 |
} |
|
442 |
} |
|
443 |
|
|
444 |
next unless (defined($form->{$idx})); |
|
445 |
|
|
446 |
if (!ref($form->{$idx})) { |
|
447 |
$form->{$idx} = $form->parse_amount(\%myconfig, $form->{$idx}); |
|
448 |
|
|
449 |
} elsif (ref($form->{$idx}) eq "ARRAY") { |
|
450 |
for (my $i = 0; $i < scalar(@{$form->{$idx}}); $i++) { |
|
451 |
$form->{$idx}->[$i] = |
|
452 |
$form->parse_amount(\%myconfig, $form->{$idx}->[$i]); |
|
453 |
} |
|
454 |
} |
|
455 |
} |
|
456 |
|
|
457 |
my $saved_numberformat = $myconfig{"numberformat"}; |
|
458 |
$myconfig{"numberformat"} = $numberformat; |
|
459 |
|
|
460 |
foreach my $idx (@indices) { |
|
461 |
if ($form->{TEMPLATE_ARRAYS} && (ref($form->{TEMPLATE_ARRAYS}->{$idx}) eq "ARRAY")) { |
|
462 |
for (my $i = 0; $i < scalar(@{$form->{TEMPLATE_ARRAYS}->{$idx}}); $i++) { |
|
463 |
$form->{TEMPLATE_ARRAYS}->{$idx}->[$i] = $form->format_amount(\%myconfig, $form->{TEMPLATE_ARRAYS}->{$idx}->[$i], $places); |
|
464 |
} |
|
465 |
} |
|
466 |
|
|
467 |
next unless (defined($form->{$idx})); |
|
468 |
|
|
469 |
if (!ref($form->{$idx})) { |
|
470 |
$form->{$idx} = $form->format_amount(\%myconfig, $form->{$idx}, $places); |
|
471 |
|
|
472 |
} elsif (ref($form->{$idx}) eq "ARRAY") { |
|
473 |
for (my $i = 0; $i < scalar(@{$form->{$idx}}); $i++) { |
|
474 |
$form->{$idx}->[$i] = |
|
475 |
$form->format_amount(\%myconfig, $form->{$idx}->[$i], $places); |
|
476 |
} |
|
477 |
} |
|
478 |
} |
|
479 |
|
|
480 |
$myconfig{"numberformat"} = $saved_numberformat; |
|
481 |
|
|
482 |
$main::lxdebug->leave_sub(); |
|
483 |
} |
|
484 |
|
|
485 |
# ------------------------------------------------------------------------- |
|
486 |
|
|
487 |
sub show_history { |
|
488 |
$main::lxdebug->enter_sub(); |
|
489 |
|
|
490 |
my $form = $main::form; |
|
491 |
my %myconfig = %main::myconfig; |
|
492 |
my $locale = $main::locale; |
|
493 |
|
|
494 |
my $dbh = $form->dbconnect(\%myconfig); |
|
495 |
my ($sort, $sortby) = split(/\-\-/, $form->{order}); |
|
496 |
$sort =~ s/.*\.(.*)/$1/; |
|
497 |
|
|
498 |
$form->{title} = $locale->text("History"); |
|
499 |
$form->header(); |
|
500 |
print $form->parse_html_template( "common/show_history", { |
|
501 |
"DATEN" => $form->get_history($dbh,$form->{input_name},"",$form->{order}), |
|
502 |
"SUCCESS" => ($form->get_history($dbh,$form->{input_name}) ne "0"), |
|
503 |
uc($sort) => 1, |
|
504 |
uc($sort)."BY" => $sortby |
|
505 |
} ); |
|
506 |
|
|
507 |
$dbh->disconnect(); |
|
508 |
$main::lxdebug->leave_sub(); |
|
393 |
return $::form->format_numbers(@_); |
|
509 | 394 |
} |
510 | 395 |
|
511 | 396 |
# ------------------------------------------------------------------------- |
Auch abrufbar als: Unified diff
Funktionen format_dates und reformat_numbers von common.pl nach Form.pm verschoben