From: SVN a. m. <m.b...@li...> - 2007-09-12 13:59:41
|
Author: mbunkus Date: 2007-09-12 15:59:27 +0200 (Wed, 12 Sep 2007) New Revision: 2842 Modified: trunk/unstable/bin/mozilla/dn.pl trunk/unstable/bin/mozilla/io.pl Log: Die Argumente f?\195?\188r print_options() als Hash und nicht als Hash-Referenz ?\195?\188bergeben. Weitere Optionen zum Verstecken bestimmter Drop-Down-Boxen eingebaut. Modified: trunk/unstable/bin/mozilla/dn.pl =================================================================== --- trunk/unstable/bin/mozilla/dn.pl 2007-09-12 08:28:48 UTC (rev 2841) +++ trunk/unstable/bin/mozilla/dn.pl 2007-09-12 13:59:27 UTC (rev 2842) @@ -124,11 +124,11 @@ $form->{jsscript} = 1; $form->{callback} ||= build_std_url("action=show_invoices", qw(login password customer invnumber ordnumber groupinvoices minamount dunning_level notes)); - $form->{PRINT_OPTIONS} = print_options({ 'inline' => 1, - 'no_queue' => 1, - 'no_postscript' => 1, - 'no_html' => 1, - 'no_opendocument' => 1, }); + $form->{PRINT_OPTIONS} = print_options('inline' => 1, + 'no_queue' => 1, + 'no_postscript' => 1, + 'no_html' => 1, + 'no_opendocument' => 1,); $form->header(); print $form->parse_html_template("dunning/show_invoices"); @@ -282,11 +282,11 @@ 'languages' => 'languages'); $form->{type} = 'dunning'; - $form->{PRINT_OPTIONS} = print_options({ 'inline' => 1, - 'no_queue' => 1, - 'no_postscript' => 1, - 'no_html' => 1, - 'no_opendocument' => 1, }); + $form->{PRINT_OPTIONS} = print_options('inline' => 1, + 'no_queue' => 1, + 'no_postscript' => 1, + 'no_html' => 1, + 'no_opendocument' => 1,); $form->{title} = $locale->text('Dunning overview'); my $report = SL::ReportGenerator->new(\%myconfig, $form); Modified: trunk/unstable/bin/mozilla/io.pl =================================================================== --- trunk/unstable/bin/mozilla/io.pl 2007-09-12 08:28:48 UTC (rev 2841) +++ trunk/unstable/bin/mozilla/io.pl 2007-09-12 13:59:27 UTC (rev 2842) @@ -1404,10 +1404,8 @@ sub print_options { $lxdebug->enter_sub(); - my ($options) = @_; + my %options = @_; - $options ||= { }; - # names 3 parameters and returns a hashref, for use in templates sub opthash { +{ value => shift, selected => shift, oname => shift } } (@FORMNAME, @FORMNAME, @LANGUAGE_ID, @FORMAT, @SENDMODE, @MEDIA, @PRINTER_ID, @SELECTS) = (); @@ -1461,21 +1459,21 @@ opthash("screen", $form->{OP}{screen}, $locale->text('Screen')), (scalar @{ $form->{printers} } && $latex_templates) ? opthash("printer", $form->{OP}{printer}, $locale->text('Printer')) : undef, - ($latex_templates && !$options->{no_queue}) ? + ($latex_templates && !$options{no_queue}) ? opthash("queue", $form->{OP}{queue}, $locale->text('Queue')) : undef if ($form->{media} ne 'email'); push @FORMAT, grep $_, ($opendocument_templates && $openofficeorg_writer_bin && $xvfb_bin && (-x $openofficeorg_writer_bin) && (-x $xvfb_bin) - && !$options->{no_opendocument_pdf}) ? + && !$options{no_opendocument_pdf}) ? opthash("opendocument_pdf", $form->{DF}{"opendocument_pdf"}, $locale->text("PDF (OpenDocument/OASIS)")) : undef, ($latex_templates) ? opthash("pdf", $form->{DF}{pdf}, $locale->text('PDF')) : undef, - ($latex_templates && !$options->{no_postscript}) ? + ($latex_templates && !$options{no_postscript}) ? opthash("postscript", $form->{DF}{postscript}, $locale->text('Postscript')) : undef, - (!$options->{no_html}) ? + (!$options{no_html}) ? opthash("html", $form->{DF}{html}, "HTML") : undef, - ($opendocument_templates && !$options->{no_opendocument}) ? + ($opendocument_templates && !$options{no_opendocument}) ? opthash("opendocument", $form->{DF}{opendocument}, $locale->text("OpenDocument/OASIS")) : undef; push @LANGUAGE_ID, @@ -1486,7 +1484,7 @@ map { opthash($_->{id}, ($_->{id} eq $form->{printer_id} ? 'selected' : ''), $_->{printer_description}) } +{}, @{ $form->{printers} } if ((ref $form->{printers} eq 'ARRAY') && scalar @{ $form->{printers } }); - @SELECTS = map { sname => lc $_, DATA => \@$_, show => scalar @$_ }, qw(FORMNAME LANGUAGE_ID FORMAT SENDMODE MEDIA PRINTER_ID); + @SELECTS = map { sname => lc $_, DATA => \@$_, show => !$options{"hide_" . lc($_)} && scalar @$_ }, qw(FORMNAME LANGUAGE_ID FORMAT SENDMODE MEDIA PRINTER_ID); my %dont_display_groupitems = ( 'dunning' => 1, @@ -1502,7 +1500,7 @@ my $print_options = $form->parse_html_template("generic/print_options", { SELECTS => \@SELECTS, %template_vars } ); - if ($options->{inline}) { + if ($options{inline}) { $lxdebug->leave_sub() and return $print_options; } else { print $print_options; $lxdebug->leave_sub(); |