From 2c757d7db4cb6a7b9655de13206fcc84fb7ce61f Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 14 May 2006 16:47:31 +0000 Subject: first part of ACL and re-skinning work and some other small stuff --- httemplate/browse/access_group.html | 33 ++++++ httemplate/browse/access_user.html | 63 +++++++++++ httemplate/browse/agent_type.cgi | 108 +++++++++---------- httemplate/browse/cust_main_county.cgi | 185 +++++++++++++++++---------------- httemplate/browse/msgcat.cgi | 20 +--- httemplate/browse/part_pkg.cgi | 14 +-- 6 files changed, 259 insertions(+), 164 deletions(-) create mode 100644 httemplate/browse/access_group.html create mode 100644 httemplate/browse/access_user.html (limited to 'httemplate/browse') diff --git a/httemplate/browse/access_group.html b/httemplate/browse/access_group.html new file mode 100644 index 000000000..6ba89ea81 --- /dev/null +++ b/httemplate/browse/access_group.html @@ -0,0 +1,33 @@ +<% + +my $html_init = + "Internal access groups control access to the back-office interface.

". + qq!Add an internal access group

!; + +my $count_query = 'SELECT COUNT(*) FROM access_group'; + +my $link = [ $p.'edit/access_group.html?', 'groupnum' ]; + +%><%= include( 'elements/browse.html', + 'title' => 'Internal Access Groups', + 'menubar' => [ # 'Main menu' => $p, + 'Internal users' => $p.'browse/access_user.html', + ], + 'html_init' => $html_init, + 'name' => 'internal access groups', + 'query' => { 'table' => 'access_group', + 'hashref' => {}, + 'extra_sql' => 'ORDER BY groupname', #?? + }, + 'count_query' => $count_query, + 'header' => [ '#', + 'Group name', + ], + 'fields' => [ 'groupnum', + 'groupname', + ], + 'links' => [ $link, + $link, + ], + ) +%> diff --git a/httemplate/browse/access_user.html b/httemplate/browse/access_user.html new file mode 100644 index 000000000..38d5430b1 --- /dev/null +++ b/httemplate/browse/access_user.html @@ -0,0 +1,63 @@ +<% + +my $html_init = + "Internal users have access to the back-office interface. Typically, this is your employees and contractors, but in a VISP setup, you can also add accounts for your reseller's employees. It is highly recommended to add a separate account for each person rather than using role accounts.

". + qq!Add an internal user

!; + +#false laziness w/agent_type.cgi +my $groups_sub = sub { + my $access_user = shift; + + [ map { + my $access_usergroup = $_; + my $access_group = $access_usergroup->access_group; + [ + { + 'data' => $access_group->groupname, + 'align' => 'left', + 'link' => + $p. 'edit/access_group.html?'. $access_usergroup->groupnum, + }, + ]; + } + grep { $_->access_group # and ! $_->access_group->disabled + } + $access_user->access_usergroup, + + ]; + +}; + +my $count_query = 'SELECT COUNT(*) FROM access_user'; + +my $link = [ $p.'edit/access_user.html?', 'usernum' ]; + +%><%= include( 'elements/browse.html', + 'title' => 'Internal Users', + 'menubar' => [ #'Main menu' => $p, + 'Internal access groups' => $p.'browse/access_group.html', + ], + 'html_init' => $html_init, + 'name' => 'internal users', + 'query' => { 'table' => 'access_user', + 'hashref' => {}, + 'extra_sql' => 'ORDER BY last, first', + }, + 'count_query' => $count_query, + 'header' => [ '#', + 'Username', + 'Full name', + 'Groups' + ], + 'fields' => [ 'usernum', + 'username', + 'name', # sub { shift->name }, + $groups_sub, + ], + 'links' => [ $link, + $link, + $link, + '' + ], + ) +%> diff --git a/httemplate/browse/agent_type.cgi b/httemplate/browse/agent_type.cgi index 2e1bdad42..a5ffb1048 100755 --- a/httemplate/browse/agent_type.cgi +++ b/httemplate/browse/agent_type.cgi @@ -1,60 +1,62 @@ - -<%= include("/elements/header.html","Agent Type Listing", menubar( - 'Main Menu' => $p, - 'Agents' => $p. 'browse/agent.cgi', -)) %> -Agent types define groups of packages that you can then assign to particular -agents.

-Add a new agent type

+<% -<%= table() %> - - Agent Type - Packages - +my $html_init = + 'Agent types define groups of packages that you can then assign to'. + ' particular agents.

'. + qq!Add a new agent type

!; -<% -foreach my $agent_type ( sort { - $a->getfield('typenum') <=> $b->getfield('typenum') -} qsearch('agent_type',{}) ) { - my $hashref = $agent_type->hashref; - #more efficient to do this with SQL... - my @type_pkgs = grep { $_->part_pkg and ! $_->part_pkg->disabled } - qsearch('type_pkgs',{'typenum'=> $hashref->{typenum} }); - my $rowspan = scalar(@type_pkgs); - $rowspan = int($rowspan/2+0.5) ; - print < - - $hashref->{typenum} - - $hashref->{atype} -END +my $count_query = 'SELECT COUNT(*) FROM agent_type'; - my($type_pkgs); - my($tdcount) = -1 ; - foreach $type_pkgs ( @type_pkgs ) { - my($pkgpart)=$type_pkgs->getfield('pkgpart'); - my($part_pkg) = qsearchs('part_pkg',{'pkgpart'=> $pkgpart }); - print qq!! if ($tdcount == 0) ; - $tdcount = 0 if ($tdcount == -1) ; - print qq!!, - $part_pkg->getfield('pkg'),""; - $tdcount ++ ; - if ($tdcount == 2) - { - print qq!\n! ; - $tdcount = 0 ; - } - } +#false laziness w/access_user.html +my $packages_sub = sub { + my $agent_type = shift; - print ""; -} + [ map { + my $type_pkgs = $_; + my $part_pkg = $type_pkgs->part_pkg; + [ + { + 'data' => $part_pkg->pkg. ' - '. $part_pkg->comment, + 'align' => 'left', + 'link' => $p. 'edit/part_pkg.cgi?'. $type_pkgs->pkgpart, + }, + ]; + } + #sort { + # } + grep { + $_->part_pkg and ! $_->part_pkg->disabled + } + $agent_type->type_pkgs #XXX the method should order itself by something + ]; -print < - - -END +}; +my $link = [ $p.'edit/agent_type.cgi?', 'typenum' ]; + +%><%= include( 'elements/browse.html', + 'title' => 'Agent Types', + 'menubar' => [ #'Main menu' => $p, + 'Agents' =>"${p}browse/agent.cgi", + ], + 'html_init' => $html_init, + 'name' => 'agent types', + 'query' => { 'table' => 'agent_type', + 'hashref' => {}, + 'extra_sql' => 'ORDER BY typenum', # 'ORDER BY atype', + }, + 'count_query' => $count_query, + 'header' => [ '#', + 'Agent Type', + 'Packages', + ], + 'fields' => [ 'typenum', + 'atype', + $packages_sub, + ], + 'links' => [ $link, + $link, + '', + ], + ) %> diff --git a/httemplate/browse/cust_main_county.cgi b/httemplate/browse/cust_main_county.cgi index 1e0e0880c..9e3feb8f3 100755 --- a/httemplate/browse/cust_main_county.cgi +++ b/httemplate/browse/cust_main_county.cgi @@ -1,33 +1,34 @@ - -<% +<%= include('/elements/header.html', "Tax Rate Listing", menubar( + 'Edit tax rates' => $p. "edit/cust_main_county.cgi", +)) %> + + Click on expand country to specify a country's tax rates by state. +
Click on expand state to specify a state's tax rates by county. +<% my $conf = new FS::Conf; my $enable_taxclasses = $conf->exists('enable_taxclasses'); -print header("Tax Rate Listing", menubar( - 'Main Menu' => $p, - 'Edit tax rates' => $p. "edit/cust_main_county.cgi", -)),<expand country to specify a country's tax rates by state. -
Click on expand state to specify a state's tax rates by county. -END +if ( $enable_taxclasses ) { %> -if ( $enable_taxclasses ) { - print '
Click on expand taxclasses to specify tax classes'; -} +
Click on expand taxclasses to specify tax classes -print '

'. &table(). < - Country - State - County - Taxclass
(per-package classification) - Tax name
(printed on invoices) - Tax - Exemption - -END +<% } %> + +

+<%= table() %> + + + Country + State + County + Taxclass
(per-package classification) + Tax name
(printed on invoices) + Tax + Exemption + +<% my @regions = sort { $a->country cmp $b->country or $a->state cmp $b->state or $a->county cmp $b->county @@ -39,10 +40,12 @@ my $sup=0; for ( my $i=0; $i<@regions; $i++ ) { my $cust_main_county = $regions[$i]; my $hashref = $cust_main_county->hashref; - print < - $hashref->{country} -END + <%= $hashref->{country} %> + + <% my $j; if ( $sup ) { @@ -74,69 +77,73 @@ END $j = 1; } - print "{state} + %> + + <%= + $hashref->{state} ? ' BGCOLOR="#ffffff">'. $hashref->{state} : qq! BGCOLOR="#cccccc">(ALL) !. qq!expand country!; - - print qq! collapse state! if $j>1; - - print ""; - } - -# $sup=$newsup; - - print "{county} ) { - print ' BGCOLOR="#ffffff">'. $hashref->{county}; - } else { - print ' BGCOLOR="#cccccc">(ALL)'; - if ( $hashref->{state} ) { - print qq!!. - qq!expand state!; - } - } - print ""; - - print "{taxclass} ) { - print ' BGCOLOR="#ffffff">'. $hashref->{taxclass}; - } else { - print ' BGCOLOR="#cccccc">(ALL)'; - if ( $enable_taxclasses ) { - print qq!!. - qq!expand taxclasses!; - } - - } - print ""; - - print "{taxname} ) { - print ' BGCOLOR="#ffffff">'. $hashref->{taxname}; - } else { - print ' BGCOLOR="#cccccc">Tax'; - } - print ""; - - print "$hashref->{tax}%". - ''; - print '$'. sprintf("%.2f", $hashref->{exempt_amount} ). - ' per month
' - if $hashref->{exempt_amount} > 0; - print 'Setup fee
' if $hashref->{setuptax} =~ /^Y$/i; - print 'Recurring fee
' if $hashref->{recurtax} =~ /^Y$/i; - print ''; - -} - -print < - - -END - -%> + qq!">expand country
! + %> + <% if ( $j>1 ) { %> + collapse state + <% } %> + + + <% } %> + +<% # $sup=$newsup; %> + + {county} ) { + %> BGCOLOR="#ffffff"><%= $hashref->{county} %> + <% } else { + %> BGCOLOR="#cccccc">(ALL) + <% if ( $hashref->{state} ) { %> + expand state + <% } %> + <% } %> + + + {taxclass} ) { + %> BGCOLOR="#ffffff"><%= $hashref->{taxclass} %> + <% } else { + %> BGCOLOR="#cccccc">(ALL) + <% if ( $enable_taxclasses ) { %> + expand taxclasses + <% } %> + <% } %> + + + {taxname} ) { + %> BGCOLOR="#ffffff"><%= $hashref->{taxname} %> + <% } else { + %> BGCOLOR="#cccccc">Tax + <% } %> + + + <%= $hashref->{tax} %>% + + + + <% if ( $hashref->{exempt_amount} > 0 ) { %> + $<%= sprintf("%.2f", $hashref->{exempt_amount} ) %> per month
+ <% } %> + + <% if ( $hashref->{setuptax} =~ /^Y$/i ) { %> + Setup fee
+ <% } %> + + <% if ( $hashref->{recurtax} =~ /^Y$/i ) { %> + Recurring fee
+ <% } %> + + + + + +<% } %> + + + +<%= include('/elements/footer.html') %> diff --git a/httemplate/browse/msgcat.cgi b/httemplate/browse/msgcat.cgi index d4adf9f1a..318ebfdff 100755 --- a/httemplate/browse/msgcat.cgi +++ b/httemplate/browse/msgcat.cgi @@ -1,10 +1,6 @@ - -<% - -print header("View Message catalog", menubar( - 'Main Menu' => $p, +<%= include('/elements/header.html', "View Message catalog", menubar( 'Edit message catalog' => $p. "edit/msgcat.cgi", -)), '
'; +)) %><% my $widget = new HTML::Widgets::SelectLayers( 'selected_layer' => 'en_US', @@ -38,13 +34,7 @@ my $widget = new HTML::Widgets::SelectLayers( }, ); - -print $widget->html; - -print < - - -END - %> + +<%= $widget->html %> +<%= include('/elements/footer.html') %> diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi index 0afa54750..41d86358c 100755 --- a/httemplate/browse/part_pkg.cgi +++ b/httemplate/browse/part_pkg.cgi @@ -11,8 +11,8 @@ my $select = '*'; my $orderby = 'pkgpart'; if ( $cgi->param('active') ) { - $orderby = 'num_active'; - + $orderby = 'num_active DESC'; +} $select = " *, @@ -33,13 +33,13 @@ if ( $cgi->param('active') ) { "; -} +#} my $conf = new FS::Conf; my $taxclasses = $conf->exists('enable_taxclasses'); my $html_init; -unless ( $cgi->param('active') ) { +#unless ( $cgi->param('active') ) { $html_init = qq! One or more service definitions are grouped together into a package definition and given pricing information. Customers purchase packages @@ -47,7 +47,7 @@ unless ( $cgi->param('active') ) { Add a new package definition

!; -} +#} my $posttotal; if ( $cgi->param('showdisabled') ) { @@ -85,7 +85,7 @@ unless ( 0 ) { #already showing only one class or something? $align .= 'l'; } -if ( $cgi->param('active') ) { +#if ( $cgi->param('active') ) { push @header, 'Customer
packages'; my %col = ( 'active' => '00CC00', @@ -117,7 +117,7 @@ if ( $cgi->param('active') ) { } (qw( active suspended cancelled )) ]; }; $align .= 'r'; -} +#} push @header, 'Frequency'; push @fields, sub { shift->freq_pretty; }; -- cgit v1.2.1