From 3c4456c1de9701d93b64fcbadcfaca598a0347d8 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 21 Jul 2008 19:09:36 +0000 Subject: [PATCH] signup w/globalpops DID selection via mason components pass-through --- FS/FS/ClientAPI/MasonComponent.pm | 46 +++++++++++++++++++++ FS/FS/ClientAPI/Signup.pm | 1 + FS/FS/Conf.pm | 42 +++++++++++++++---- fs_selfservice/FS-SelfService/SelfService.pm | 14 ++++++- fs_selfservice/FS-SelfService/cgi/images/cross.png | Bin 0 -> 655 bytes .../FS-SelfService/cgi/images/wait-orange.gif | Bin 0 -> 1849 bytes .../FS-SelfService/cgi/misc/areacodes.cgi | 18 ++++++++ .../FS-SelfService/cgi/misc/exchanges.cgi | 18 ++++++++ .../FS-SelfService/cgi/misc/phonenums.cgi | 18 ++++++++ fs_selfservice/FS-SelfService/cgi/signup.html | 4 +- httemplate/elements/select-did.html | 5 ++- 11 files changed, 155 insertions(+), 11 deletions(-) create mode 100644 FS/FS/ClientAPI/MasonComponent.pm create mode 100644 fs_selfservice/FS-SelfService/cgi/images/cross.png create mode 100644 fs_selfservice/FS-SelfService/cgi/images/wait-orange.gif create mode 100755 fs_selfservice/FS-SelfService/cgi/misc/areacodes.cgi create mode 100755 fs_selfservice/FS-SelfService/cgi/misc/exchanges.cgi create mode 100755 fs_selfservice/FS-SelfService/cgi/misc/phonenums.cgi diff --git a/FS/FS/ClientAPI/MasonComponent.pm b/FS/FS/ClientAPI/MasonComponent.pm new file mode 100644 index 000000000..78ea9bd4f --- /dev/null +++ b/FS/FS/ClientAPI/MasonComponent.pm @@ -0,0 +1,46 @@ +package FS::ClientAPI::MasonComponent; + +use strict; +use vars qw($DEBUG $me); +use FS::Mason qw( mason_interps ); +use FS::Conf; + +$DEBUG = 0; +$me = '[FS::ClientAPI::MasonComponent]'; + +my %allowed_comps = map { $_=>1 } qw( + /elements/select-did.html + /misc/areacodes.cgi + /misc/exchanges.cgi + /misc/phonenums.cgi +); + +my $outbuf; +my( $fs_interp, $rt_interp ) = mason_interps('standalone', 'outbuf'=>\$outbuf); + +sub mason_comp { + my $packet = shift; + + warn "$me mason_comp called on $packet\n" if $DEBUG; + + my $comp = $packet->{'comp'}; + unless ( $allowed_comps{$comp} ) { + return { 'error' => 'Illegal component' }; + } + + my @args = $packet->{'args'} ? @{ $packet->{'args'} } : (); + + my $conf = new FS::Conf; + $FS::Mason::Request::FSURL = $conf->config('selfservice_server-base_url'); + $FS::Mason::Request::QUERY_STRING = $packet->{'query_string'} || ''; + + $outbuf = ''; + $fs_interp->exec($comp, @args); #only FS for now alas... + + #errors? (turn off in-line error reporting?) + + return { 'output' => $outbuf }; + +} + +1; diff --git a/FS/FS/ClientAPI/Signup.pm b/FS/FS/ClientAPI/Signup.pm index f5efc2dea..aeb0aaac9 100644 --- a/FS/FS/ClientAPI/Signup.pm +++ b/FS/FS/ClientAPI/Signup.pm @@ -121,6 +121,7 @@ sub signup_info { 'default_pkgpart' => scalar($conf->config('signup_server-default_pkgpart')), 'signup_service' => $svc_x, + 'default_svcpart' => scalar($conf->config('signup_server-default_svcpart')), }; diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 0fea39d89..8684a5aa4 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -441,7 +441,7 @@ sub _orbase_items { map { new FS::ConfItem { 'key' => $_, 'section' => $proto->section, - 'description' => 'Alternate ' . $proto->description . ' See the billing documentation for details.', + 'description' => 'Alternate ' . $proto->description . ' See the billing documentation for details.', 'type' => $proto->type, }; } &$listmaker($base); @@ -554,7 +554,7 @@ worry that config_items is freeside-specific and icky. { 'key' => 'alerter_template', 'section' => 'billing', - 'description' => 'Template file for billing method expiration alerts. See the billing documentation for details.', + 'description' => 'Template file for billing method expiration alerts. See the billing documentation for details.', 'type' => 'textarea', }, @@ -761,14 +761,14 @@ worry that config_items is freeside-specific and icky. { 'key' => 'invoice_template', 'section' => 'billing', - 'description' => 'Text template file for invoices. Used if no invoice_html template is defined, and also seen by users using non-HTML capable mail clients. See the billing documentation for details.', + 'description' => 'Text template file for invoices. Used if no invoice_html template is defined, and also seen by users using non-HTML capable mail clients. See the billing documentation for details.', 'type' => 'textarea', }, { 'key' => 'invoice_html', 'section' => 'billing', - 'description' => 'Optional HTML template for invoices. See the billing documentation for details.', + 'description' => 'Optional HTML template for invoices. See the billing documentation for details.', 'type' => 'textarea', }, @@ -797,7 +797,7 @@ worry that config_items is freeside-specific and icky. { 'key' => 'invoice_latex', 'section' => 'billing', - 'description' => 'Optional LaTeX template for typeset PostScript invoices. See the billing documentation for details.', + 'description' => 'Optional LaTeX template for typeset PostScript invoices. See the billing documentation for details.', 'type' => 'textarea', }, @@ -992,7 +992,7 @@ worry that config_items is freeside-specific and icky. { 'key' => 'signupurl', 'section' => 'UI', - 'description' => 'if you are using customer-to-customer referrals, and you enter the URL of your signup server CGI, the customer view screen will display a customized link to the signup server with the appropriate customer as referral', + 'description' => 'if you are using customer-to-customer referrals, and you enter the URL of your signup server CGI, the customer view screen will display a customized link to the signup server with the appropriate customer as referral', 'type' => 'text', }, @@ -1278,6 +1278,27 @@ worry that config_items is freeside-specific and icky. }, { + 'key' => 'signup_server-default_svcpart', + 'section' => '', + 'description' => 'Default svcpart for the signup server - only necessary for services that trigger special provisioning widgets (such as DID provisioning).', + 'type' => 'select-sub', + 'options_sub' => sub { require FS::Record; + require FS::part_svc; + map { $_->svcpart => $_->svc } + FS::Record::qsearch( 'part_svc', + { 'disabled' => ''} + ); + }, + 'option_sub' => sub { require FS::Record; + require FS::part_svc; + my $part_svc = FS::Record::qsearchs( + 'part_svc', { 'svcpart'=>shift } + ); + $part_svc ? $part_svc->svc : ''; + }, + }, + + { 'key' => 'signup_server-service', 'section' => '', 'description' => 'Service for the signup server - "Account (svc_acct)" is the default setting, or "Phone number (svc_phone)" for ITSP signup', @@ -1289,6 +1310,13 @@ worry that config_items is freeside-specific and icky. }, { + 'key' => 'selfservice_server-base_url', + 'section' => '', + 'description' => 'Base URL for the self-service web interface - necessary for special provisioning widgets to find their way.', + 'type' => 'text', + }, + + { 'key' => 'show-msgcat-codes', 'section' => 'UI', 'description' => 'Show msgcat codes in error messages. Turn this option on before reporting errors to the mailing list.', @@ -1669,7 +1697,7 @@ worry that config_items is freeside-specific and icky. { 'key' => 'ticket_system', 'section' => '', - 'description' => 'Ticketing system integration. RT_Internal uses the built-in RT ticketing system (see the integrated ticketing installation instructions). RT_External accesses an external RT installation in a separate database (local or remote).', + 'description' => 'Ticketing system integration. RT_Internal uses the built-in RT ticketing system (see the integrated ticketing installation instructions). RT_External accesses an external RT installation in a separate database (local or remote).', 'type' => 'select', #'select_enum' => [ '', qw(RT_Internal RT_Libs RT_External) ], 'select_enum' => [ '', qw(RT_Internal RT_External) ], diff --git a/fs_selfservice/FS-SelfService/SelfService.pm b/fs_selfservice/FS-SelfService/SelfService.pm index cbe7b72f6..6867fd87d 100644 --- a/fs_selfservice/FS-SelfService/SelfService.pm +++ b/fs_selfservice/FS-SelfService/SelfService.pm @@ -57,6 +57,7 @@ $socket .= '.'.$tag if defined $tag && length($tag); 'agent_logout' => 'Agent/agent_logout', 'agent_info' => 'Agent/agent_info', 'agent_list_customers' => 'Agent/agent_list_customers', + 'mason_comp' => 'MasonComponent/mason_comp', ); @EXPORT_OK = ( keys(%autoload), qw( regionselector expselect popselector domainselector didselector) ); @@ -1412,7 +1413,7 @@ sub domainselector { return '' unless scalar(keys %$domains); - + if (scalar(keys %$domains) == 1) { my $key; foreach(keys %$domains) { @@ -1443,6 +1444,10 @@ Takes as input a hashref or list of key/value pairs with the following keys: =over 4 +=item field + +=item svcpart + =back Returns an HTML fragment for DID selection. @@ -1457,7 +1462,12 @@ sub didselector { $param = { @_ }; } - return "choose your DID XXX"; + my $rv = mason_comp( 'comp'=>'/elements/select-did.html', + 'args'=>[ %$param ], + ); + + #hmm. + $rv->{'error'} || $rv->{'output'}; } diff --git a/fs_selfservice/FS-SelfService/cgi/images/cross.png b/fs_selfservice/FS-SelfService/cgi/images/cross.png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EJXQrW2?NF>`@ zwVO}S)wW#-AlPbaaZFIsQvuR?=qLGPE`r&Yc|SyI}S18xVGu25tzzh zvNe*Ie()}qkV&>&4_dJTMZFjTs?OFT1dFJ_t@C`Vcsi?XJ-_A z5pij9^nNLzNnSLy79&^^rx_|v1qdP9j`D;y70uV;_-fc6Bge3v!8LV(SF@n0Dn2Q{ zL5*j^n&OvyHB5ZJIj{JxAaSwd?&@$s`?GUk{UedOsaj*ILCmD=9PW8H6#qOUx55_U zowXr(eW2TA%;oG$VG56pPDR*U9t6U?1U-ZMF|4iJhC(u@QdiHqmBB~q?=G!mYP^G# zIvu57&4fs;;y0rK&-yA7DFK~nPLt3IcwB3)&keWZWO{&9!fn|4tfu+U~8U`Q(Qok9QcS9 F>MwO18Eyao literal 0 HcmV?d00001 diff --git a/fs_selfservice/FS-SelfService/cgi/misc/areacodes.cgi b/fs_selfservice/FS-SelfService/cgi/misc/areacodes.cgi new file mode 100755 index 000000000..b33e58c5a --- /dev/null +++ b/fs_selfservice/FS-SelfService/cgi/misc/areacodes.cgi @@ -0,0 +1,18 @@ +#!/usr/bin/perl -w + +use strict; +use CGI; +use FS::SelfService qw( mason_comp ); + +my $cgi = new CGI; + +my $rv = mason_comp( 'comp' => '/misc/areacodes.cgi', + 'query_string' => $cgi->query_string, #pass CGI params... + ); + +#hmm. +my $output = $rv->{'error'} || $rv->{'output'}; + +print $cgi->header( '-expires' => 'now' ). + $output; + diff --git a/fs_selfservice/FS-SelfService/cgi/misc/exchanges.cgi b/fs_selfservice/FS-SelfService/cgi/misc/exchanges.cgi new file mode 100755 index 000000000..d8df970d9 --- /dev/null +++ b/fs_selfservice/FS-SelfService/cgi/misc/exchanges.cgi @@ -0,0 +1,18 @@ +#!/usr/bin/perl -w + +use strict; +use CGI; +use FS::SelfService qw( mason_comp ); + +my $cgi = new CGI; + +my $rv = mason_comp( 'comp' => '/misc/exchanges.cgi', + 'query_string' => $cgi->query_string, #pass CGI params... + ); + +#hmm. +my $output = $rv->{'error'} || $rv->{'output'}; + +print $cgi->header( '-expires' => 'now' ). + $output; + diff --git a/fs_selfservice/FS-SelfService/cgi/misc/phonenums.cgi b/fs_selfservice/FS-SelfService/cgi/misc/phonenums.cgi new file mode 100755 index 000000000..e7d695d07 --- /dev/null +++ b/fs_selfservice/FS-SelfService/cgi/misc/phonenums.cgi @@ -0,0 +1,18 @@ +#!/usr/bin/perl -w + +use strict; +use CGI; +use FS::SelfService qw( mason_comp ); + +my $cgi = new CGI; + +my $rv = mason_comp( 'comp' => '/misc/phonenums.cgi', + 'query_string' => $cgi->query_string, #pass CGI params... + ); + +#hmm. +my $output = $rv->{'error'} || $rv->{'output'}; + +print $cgi->header( '-expires' => 'now' ). + $output; + diff --git a/fs_selfservice/FS-SelfService/cgi/signup.html b/fs_selfservice/FS-SelfService/cgi/signup.html index 46387fc4a..9dcf01f79 100755 --- a/fs_selfservice/FS-SelfService/cgi/signup.html +++ b/fs_selfservice/FS-SelfService/cgi/signup.html @@ -260,7 +260,9 @@ HTML::Widgets::SelectLayers->new( if ( $signup_service eq 'svc_phone' ) { $OUT .= 'Phone number'. - didselector(). + didselector( 'field' => 'phonenum', + 'svcpart' => $default_svcpart, + ). ''; $OUT .= < 'phonenum', + 'svcpart' => 5, + #OR + 'object' => $svc_phone, ); @@ -65,7 +68,7 @@ my $conf = new FS::Conf; my $country = $conf->config('countrydefault') || 'US'; #XXX make sure this comes through on errors too -my $svcpart = $opt{'object'}->svcpart; +my $svcpart = $opt{'svcpart'} || $opt{'object'}->svcpart; my $part_svc = qsearchs('part_svc', { 'svcpart'=>$svcpart } ); die "unknown svcpart $svcpart" unless $part_svc; -- 2.11.0