16 Mar 2012 11:21
Re: [Ledger-smb-commits] SF.net SVN: ledger-smb:[4485] branches/1.3/bin
Hi Chris,
How about abstracting these tests into a generic method in the LedgerSMB::Template module: format_available($) which takes the format string as its argument and returns true or not?
The implementation can be as easy as:
sub format_available {
my ($format) = <at> _;
return ! eval { require "LedgerSMB::Template::$format"; };
}
?
Bye,
Erik.
On Fri, Mar 16, 2012 at 11:16 AM, <ehuelsmann-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org> wrote:
Revision: 4485
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4485&view=rev
Author: ehuelsmann
Date: 2012-03-16 10:16:52 +0000 (Fri, 16 Mar 2012)
Log Message:
-----------
Disable export buttons when the required Perl modules are missing (fixes 3473861).
Modified Paths:
--------------
branches/1.3/bin/am.pl
branches/1.3/bin/rp.pl
Modified: branches/1.3/bin/am.pl
===================================================================
--- branches/1.3/bin/am.pl 2012-03-16 07:16:58 UTC (rev 4484)
+++ branches/1.3/bin/am.pl 2012-03-16 10:16:52 UTC (rev 4485)
<at> <at> -252,6 +252,11 <at> <at>
push <at> rows, \%column_data;
}
+ my %can_load;
+ $can_load{CSV} = 1;
+ $can_load{XLS} = ! eval { require Excel::Template::Plus };
+ $can_load{ODS} = ! eval { require OpenOffice::OODoc };
+
my <at> buttons;
for my $type (qw(CSV XLS ODS)) {
push <at> buttons, {
<at> <at> -260,6 +265,7 <at> <at>
text => $locale->text("[_1] Report", $type),
type => 'submit',
class => 'submit',
+ disabled => $can_load{$type} ? "" : "disabled",
};
}
my %hiddens = (
Modified: branches/1.3/bin/rp.pl
===================================================================
--- branches/1.3/bin/rp.pl 2012-03-16 07:16:58 UTC (rev 4484)
+++ branches/1.3/bin/rp.pl 2012-03-16 10:16:52 UTC (rev 4485)
<at> <at> -854,6 +854,12 <at> <at>
$column_data{debit} = $totaldebit;
$column_data{credit} = $totalcredit;
+
+ my %can_load;
+ $can_load{CSV} = 1;
+ $can_load{XLS} = ! eval { require Excel::Template::Plus };
+ $can_load{ODS} = ! eval { require OpenOffice::OODoc };
+
my <at> buttons;
for my $type (qw(CSV XLS ODS)) {
push <at> buttons, {
<at> <at> -862,6 +868,7 <at> <at>
text => $locale->text("[_1] Report", $type),
type => 'submit',
class => 'submit',
+ disabled => $can_load{$type} ? "" : "disabled",
};
}
my $format;
<at> <at> -1265,6 +1272,11 <at> <at>
## &menubar;
## }
+ my %can_load;
+ $can_load{CSV} = 1;
+ $can_load{XLS} = ! eval { require Excel::Template::Plus };
+ $can_load{ODS} = ! eval { require OpenOffice::OODoc };
+
for my $type (qw(CSV XLS ODS)) {
push <at> buttons, {
name => 'action',
<at> <at> -1272,6 +1284,7 <at> <at>
text => $locale->text("[_1] Report", $type),
type => 'submit',
class => 'submit',
+ disabled => $can_load{$type} ? "" : "disabled",
};
}
my $format;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Ledger-smb-commits mailing list
Ledger-smb-commits-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits
------------------------------------------------------------------------------ This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________ Ledger-smb-devel mailing list Ledger-smb-devel@... https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel
RSS Feed