use FS::L10N;
use HTML::Entities qw( encode_entities );
-our @EXPORT_OK = qw( mt emt );
+our @EXPORT_OK = qw( mt emt js_mt );
our $lh;
encode_entities(mt(@_));
}
+# Javascript-escaped version of mt()
+sub js_mt {
+ my $s = mt(@_);
+ #false laziness w/Mason.pm
+ $s =~ s/(['\\])/\\$1/g;
+ $s =~ s/\r/\\r/g;
+ $s =~ s/\n/\\n/g;
+ $s = "'$s'";
+}
+
sub lh {
my $locale = $FS::CurrentUser::CurrentUser->option('locale')
|| FS::Conf->new->config('locale')
use FS::NetworkMonitoringSystem;
use FS::Tron qw( tron_lint );
use FS::Locales;
- use FS::Maketext qw( mt emt );
+ use FS::Maketext qw( mt emt js_mt );
use FS::agent;
use FS::agent_type;
my $html_defang = new HTML::Defang (%defang_opts);
+ #false laziness w/ FS::Maketext js_mt
my $js_string_sub = sub {
#${$_[0]} =~ s/(['\\\n])/'\\'.($1 eq "\n" ? 'n' : $1)/ge;
${$_[0]} =~ s/(['\\])/\\$1/g;
'<SCRIPT TYPE="text/javascript">
function confirm_print_process() {
- if ( ! confirm('.emt("Are you sure you want to reprint these invoices?").') ) {
+ if ( ! confirm('.js_mt("Are you sure you want to reprint these invoices?").') ) {
return;
}
print_process();
}
function confirm_email_process() {
- if ( ! confirm('.emt("Are you sure you want to re-email these invoices?").') ) {
+ if ( ! confirm('.js_mt("Are you sure you want to re-email these invoices?").') ) {
return;
}
email_process();
}
function confirm_fax_process() {
- if ( ! confirm('.emt("Are you sure you want to re-fax these invoices?").') ) {
+ if ( ! confirm('.js_mt("Are you sure you want to re-fax these invoices?").') ) {
return;
}
fax_process();
}
function confirm_ftp_process() {
- if ( ! confirm('.emt("Are you sure you want to re-FTP these invoices?").') ) {
+ if ( ! confirm('.js_mt("Are you sure you want to re-FTP these invoices?").') ) {
return;
}
ftp_process();
}
function confirm_spool_process() {
- if ( ! confirm('.emt("Are you sure you want to re-spool these invoices?").') ) {
+ if ( ! confirm('.js_mt("Are you sure you want to re-spool these invoices?").') ) {
return;
}
spool_process();