X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FMason.pm;h=e26a4b74766575af21649c2e22d9bc3e47a72f9f;hb=226ebde26712fb03cb768235038a2d7c4f0a4fbf;hp=49980924f214e0bf528bfc9221f3b66a07886dc6;hpb=e3a2ca0a7ef6e0931283136321ba8c1494b37c19;p=freeside.git diff --git a/FS/FS/Mason.pm b/FS/FS/Mason.pm index 49980924f..e26a4b747 100644 --- a/FS/FS/Mason.pm +++ b/FS/FS/Mason.pm @@ -55,7 +55,7 @@ if ( -e $addl_handler_use_file ) { #use CGI::Carp qw(fatalsToBrowser); use CGI::Cookie; - use List::Util qw( max min ); + use List::Util qw( max min sum ); use Data::Dumper; use Date::Format; use Time::Local; @@ -64,11 +64,12 @@ if ( -e $addl_handler_use_file ) { use DateTime; use DateTime::Format::Strptime; use FS::Misc::DateTime qw( parse_datetime ); + use FS::Misc::Geo qw( get_censustract get_district ); use Lingua::EN::Inflect qw(PL); Lingua::EN::Inflect::classical names=>0; #Categorys use Tie::IxHash; use URI; - use URI::Escape; + use URI::Escape 3.31; use HTML::Entities; use HTML::TreeBuilder; use HTML::TableExtract qw(tree); @@ -114,12 +115,14 @@ if ( -e $addl_handler_use_file ) { #selectlayers.html use Locale::Country; use Business::US::USPS::WebTools::AddressStandardization; + use Geo::GoogleEarth::Pluggable; use LWP::UserAgent; use Storable qw( nfreeze thaw ); use FS; use FS::UID qw( getotaker dbh datasrc driver_name ); use FS::Record qw( qsearch qsearchs fields dbdef str2time_sql str2time_sql_closing + midnight_sql ); use FS::Conf; use FS::CGI qw(header menubar table itable ntable idiot @@ -133,10 +136,14 @@ if ( -e $addl_handler_use_file ) { ); use FS::Misc::eps2png qw( eps2png ); use FS::Report::FCC_477; + use FS::Report::Table; use FS::Report::Table::Monthly; + use FS::Report::Table::Daily; use FS::TicketSystem; use FS::NetworkMonitoringSystem; use FS::Tron qw( tron_lint ); + use FS::Locales; + use FS::Maketext qw( mt emt js_mt ); use FS::agent; use FS::agent_type; @@ -242,6 +249,7 @@ if ( -e $addl_handler_use_file ) { use FS::cust_category; use FS::prospect_main; use FS::contact; + use FS::phone_type; use FS::svc_pbx; use FS::discount; use FS::cust_pkg_discount; @@ -272,6 +280,38 @@ if ( -e $addl_handler_use_file ) { use FS::torrus_srvderive; use FS::torrus_srvderive_component; use FS::areacode; + use FS::svc_dish; + use FS::h_svc_dish; + use FS::svc_hardware; + use FS::h_svc_hardware; + use FS::hardware_class; + use FS::hardware_type; + use FS::hardware_status; + use FS::did_order_item; + use FS::msa; + use FS::rate_center; + use FS::cust_msg; + use FS::radius_group; + use FS::template_content; + use FS::dsl_device; + use FS::nas; + use FS::nas; + use FS::export_nas; + use FS::legacy_cust_bill; + use FS::rate_tier; + use FS::rate_tier_detail; + use FS::radius_attr; + use FS::discount_plan; + use FS::tower; + use FS::tower_sector; + use FS::sales; + use FS::access_groupsales; + use FS::contact_class; + use FS::part_svc_class; + use FS::ftp_target; + use FS::quotation; + use FS::quotation_pkg; + use FS::quotation_pkg_discount; # Sammath Naur if ( $FS::Mason::addl_handler_use ) { @@ -474,28 +514,7 @@ sub mason_interps { RT::LoadConfig(); } - # A hook supporting strange legacy ways people (well, SG) have added stuff on - - my @addl_comp_root = (); - my $addl_comp_root_file = '%%%FREESIDE_CONF%%%/addl_comp_root.pl'; - if ( -e $addl_comp_root_file ) { - warn "reading $addl_comp_root_file\n"; - my $text = slurp( $addl_comp_root_file ); - my @addl = eval $text; - if ( @addl && ! $@ ) { - @addl_comp_root = @addl; - } elsif ($@) { - warn "error parsing $addl_comp_root_file: $@\n"; - } - } - - my $fs_comp_root = - scalar(@addl_comp_root) - ? [ - [ 'freeside'=>'%%%FREESIDE_DOCUMENT_ROOT%%%' ], - @addl_comp_root, - ] - : '%%%FREESIDE_DOCUMENT_ROOT%%%'; + my $fs_comp_root = '%%%FREESIDE_DOCUMENT_ROOT%%%'; my %interp = ( request_class => $request_class, @@ -509,21 +528,26 @@ sub mason_interps { 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; ${$_[0]} =~ s/\r/\\r/g; ${$_[0]} =~ s/\n/\\n/g; + # prevent premature termination of the script + ${$_[0]} =~ s[][<\\/script>]ig; ${$_[0]} = "'". ${$_[0]}. "'"; }; + my $defang_sub = sub { + ${$_[0]} = $html_defang->defang(${$_[0]}); + }; + my $fs_interp = new HTML::Mason::Interp ( %interp, comp_root => $fs_comp_root, - escape_flags => { 'js_string' => $js_string_sub, - 'defang' => sub { - ${$_[0]} = $html_defang->defang(${$_[0]}); - }, + escape_flags => { 'js_string' => $js_string_sub, + 'defang' => $defang_sub, }, compiler => HTML::Mason::Compiler::ToObject->new( allow_globals => [qw(%session)], @@ -537,11 +561,13 @@ sub mason_interps { [ 'freeside' => '%%%FREESIDE_DOCUMENT_ROOT%%%' ], ], escape_flags => { 'h' => \&RT::Interface::Web::EscapeUTF8, + 'u' => \&RT::Interface::Web::EscapeURI, + 'j' => \&RT::Interface::Web::EscapeJS, 'js_string' => $js_string_sub, }, compiler => HTML::Mason::Compiler::ToObject->new( default_escape_flags => 'h', - allow_globals => [qw(%session)], + allow_globals => [qw(%session $DECODED_ARGS)], ), );