summaryrefslogtreecommitdiff
path: root/httemplate/browse
diff options
context:
space:
mode:
authorivan <ivan>2006-05-14 16:47:31 +0000
committerivan <ivan>2006-05-14 16:47:31 +0000
commit2c757d7db4cb6a7b9655de13206fcc84fb7ce61f (patch)
treef01088bb60d49ee0dd3dd796d57abe219c321f7b /httemplate/browse
parentc46235292c6bf929615ac28fc48c1d5609ce4590 (diff)
first part of ACL and re-skinning work and some other small stuff
Diffstat (limited to 'httemplate/browse')
-rw-r--r--httemplate/browse/access_group.html33
-rw-r--r--httemplate/browse/access_user.html63
-rwxr-xr-xhttemplate/browse/agent_type.cgi108
-rwxr-xr-xhttemplate/browse/cust_main_county.cgi185
-rwxr-xr-xhttemplate/browse/msgcat.cgi20
-rwxr-xr-xhttemplate/browse/part_pkg.cgi14
6 files changed, 259 insertions, 164 deletions
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.<BR><BR>".
+ qq!<A HREF="${p}edit/access_group.html"><I>Add an internal access group</I></A><BR><BR>!;
+
+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 <B>highly recommended</B> to add a <B>separate account for each person</B> rather than using role accounts.<BR><BR>".
+ qq!<A HREF="${p}edit/access_user.html"><I>Add an internal user</I></A><BR><BR>!;
+
+#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 @@
-<!-- mason kludge -->
-<%= 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.<BR><BR>
-<A HREF="<%= $p %>edit/agent_type.cgi"><I>Add a new agent type</I></A><BR><BR>
+<%
-<%= table() %>
-<TR>
- <TH COLSPAN=2>Agent Type</TH>
- <TH COLSPAN=2>Packages</TH>
-</TR>
+my $html_init =
+ 'Agent types define groups of packages that you can then assign to'.
+ ' particular agents.<BR><BR>'.
+ qq!<A HREF="${p}edit/agent_type.cgi"><I>Add a new agent type</I></A><BR><BR>!;
-<%
-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 <<END;
- <TR>
- <TD ROWSPAN=$rowspan><A HREF="${p}edit/agent_type.cgi?$hashref->{typenum}">
- $hashref->{typenum}
- </A></TD>
- <TD ROWSPAN=$rowspan><A HREF="${p}edit/agent_type.cgi?$hashref->{typenum}">$hashref->{atype}</A></TD>
-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!<TR>! if ($tdcount == 0) ;
- $tdcount = 0 if ($tdcount == -1) ;
- print qq!<TD><A HREF="${p}edit/part_pkg.cgi?$pkgpart">!,
- $part_pkg->getfield('pkg'),"</A></TD>";
- $tdcount ++ ;
- if ($tdcount == 2)
- {
- print qq!</TR>\n! ;
- $tdcount = 0 ;
- }
- }
+#false laziness w/access_user.html
+my $packages_sub = sub {
+ my $agent_type = shift;
- print "</TR>";
-}
+ [ 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;
- </TABLE>
- </BODY>
-</HTML>
-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 @@
-<!-- mason kludge -->
-<%
+<%= include('/elements/header.html', "Tax Rate Listing", menubar(
+ 'Edit tax rates' => $p. "edit/cust_main_county.cgi",
+)) %>
+
+ Click on <u>expand country</u> to specify a country's tax rates by state.
+ <BR>Click on <u>expand state</u> 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",
-)),<<END;
- Click on <u>expand country</u> to specify a country's tax rates by state.
- <BR>Click on <u>expand state</u> to specify a state's tax rates by county.
-END
+if ( $enable_taxclasses ) { %>
-if ( $enable_taxclasses ) {
- print '<BR>Click on <u>expand taxclasses</u> to specify tax classes';
-}
+ <BR>Click on <u>expand taxclasses</u> to specify tax classes
-print '<BR><BR>'. &table(). <<END;
- <TR>
- <TH><FONT SIZE=-1>Country</FONT></TH>
- <TH><FONT SIZE=-1>State</FONT></TH>
- <TH>County</TH>
- <TH>Taxclass<BR><FONT SIZE=-1>(per-package classification)</FONT></TH>
- <TH>Tax name<BR><FONT SIZE=-1>(printed on invoices)</FONT></TH>
- <TH><FONT SIZE=-1>Tax</FONT></TH>
- <TH><FONT SIZE=-1>Exemption</TH>
- </TR>
-END
+<% } %>
+
+<BR><BR>
+<%= table() %>
+
+ <TR>
+ <TH><FONT SIZE=-1>Country</FONT></TH>
+ <TH><FONT SIZE=-1>State</FONT></TH>
+ <TH>County</TH>
+ <TH>Taxclass<BR><FONT SIZE=-1>(per-package classification)</FONT></TH>
+ <TH>Tax name<BR><FONT SIZE=-1>(printed on invoices)</FONT></TH>
+ <TH><FONT SIZE=-1>Tax</FONT></TH>
+ <TH><FONT SIZE=-1>Exemption</TH>
+ </TR>
+<%
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 <<END;
+
+ %>
<TR>
- <TD BGCOLOR="#ffffff">$hashref->{country}</TD>
-END
+ <TD BGCOLOR="#ffffff"><%= $hashref->{country} %></TD>
+
+ <%
my $j;
if ( $sup ) {
@@ -74,69 +77,73 @@ END
$j = 1;
}
- print "<TD ROWSPAN=$j", $hashref->{state}
+ %>
+
+ <TD ROWSPAN=<%= $j %><%=
+ $hashref->{state}
? ' BGCOLOR="#ffffff">'. $hashref->{state}
: qq! BGCOLOR="#cccccc">(ALL) <FONT SIZE=-1>!.
qq!<A HREF="${p}edit/cust_main_county-expand.cgi?!. $hashref->{taxnum}.
- qq!">expand country</A></FONT>!;
-
- print qq! <FONT SIZE=-1><A HREF="${p}edit/process/cust_main_county-collapse.cgi?!. $hashref->{taxnum}. qq!">collapse state</A></FONT>! if $j>1;
-
- print "</TD>";
- }
-
-# $sup=$newsup;
-
- print "<TD";
- if ( $hashref->{county} ) {
- print ' BGCOLOR="#ffffff">'. $hashref->{county};
- } else {
- print ' BGCOLOR="#cccccc">(ALL)';
- if ( $hashref->{state} ) {
- print qq!<FONT SIZE=-1>!.
- qq!<A HREF="${p}edit/cust_main_county-expand.cgi?!. $hashref->{taxnum}.
- qq!">expand state</A></FONT>!;
- }
- }
- print "</TD>";
-
- print "<TD";
- if ( $hashref->{taxclass} ) {
- print ' BGCOLOR="#ffffff">'. $hashref->{taxclass};
- } else {
- print ' BGCOLOR="#cccccc">(ALL)';
- if ( $enable_taxclasses ) {
- print qq!<FONT SIZE=-1>!.
- qq!<A HREF="${p}edit/cust_main_county-expand.cgi?taxclass!.
- $hashref->{taxnum}. qq!">expand taxclasses</A></FONT>!;
- }
-
- }
- print "</TD>";
-
- print "<TD";
- if ( $hashref->{taxname} ) {
- print ' BGCOLOR="#ffffff">'. $hashref->{taxname};
- } else {
- print ' BGCOLOR="#cccccc">Tax';
- }
- print "</TD>";
-
- print "<TD BGCOLOR=\"#ffffff\">$hashref->{tax}%</TD>".
- '<TD BGCOLOR="#ffffff">';
- print '$'. sprintf("%.2f", $hashref->{exempt_amount} ).
- '&nbsp;per&nbsp;month<BR>'
- if $hashref->{exempt_amount} > 0;
- print 'Setup&nbsp;fee<BR>' if $hashref->{setuptax} =~ /^Y$/i;
- print 'Recurring&nbsp;fee<BR>' if $hashref->{recurtax} =~ /^Y$/i;
- print '</TD></TR>';
-
-}
-
-print <<END;
- </TABLE>
- </BODY>
-</HTML>
-END
-
-%>
+ qq!">expand country</A></FONT>!
+ %>
+ <% if ( $j>1 ) { %>
+ <FONT SIZE=-1><A HREF="<%= $p %>edit/process/cust_main_county-collapse.cgi?<%= $hashref->{taxnum} %>">collapse state</A></FONT>
+ <% } %>
+
+ </TD>
+ <% } %>
+
+<% # $sup=$newsup; %>
+
+ <TD<% if ( $hashref->{county} ) {
+ %> BGCOLOR="#ffffff"><%= $hashref->{county} %>
+ <% } else {
+ %> BGCOLOR="#cccccc">(ALL)
+ <% if ( $hashref->{state} ) { %>
+ <FONT SIZE=-1><A HREF="<%= $p %>edit/cust_main_county-expand.cgi?<%= $hashref->{taxnum} %>">expand state</A></FONT>
+ <% } %>
+ <% } %>
+ </TD>
+
+ <TD<% if ( $hashref->{taxclass} ) {
+ %> BGCOLOR="#ffffff"><%= $hashref->{taxclass} %>
+ <% } else {
+ %> BGCOLOR="#cccccc">(ALL)
+ <% if ( $enable_taxclasses ) { %>
+ <FONT SIZE=-1><A HREF="<%= $p %>edit/cust_main_county-expand.cgi?taxclass<%= $hashref->{taxnum} %>">expand taxclasses</A></FONT>
+ <% } %>
+ <% } %>
+ </TD>
+
+ <TD<% if ( $hashref->{taxname} ) {
+ %> BGCOLOR="#ffffff"><%= $hashref->{taxname} %>
+ <% } else {
+ %> BGCOLOR="#cccccc">Tax
+ <% } %>
+ </TD>
+
+ <TD BGCOLOR="#ffffff"><%= $hashref->{tax} %>%</TD>
+
+ <TD BGCOLOR="#ffffff">
+
+ <% if ( $hashref->{exempt_amount} > 0 ) { %>
+ $<%= sprintf("%.2f", $hashref->{exempt_amount} ) %>&nbsp;per&nbsp;month<BR>
+ <% } %>
+
+ <% if ( $hashref->{setuptax} =~ /^Y$/i ) { %>
+ Setup&nbsp;fee<BR>
+ <% } %>
+
+ <% if ( $hashref->{recurtax} =~ /^Y$/i ) { %>
+ Recurring&nbsp;fee<BR>
+ <% } %>
+
+ </TD>
+
+ </TR>
+
+<% } %>
+
+</TABLE>
+
+<%= 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 @@
-<!-- mason kludge -->
-<%
-
-print header("View Message catalog", menubar(
- 'Main Menu' => $p,
+<%= include('/elements/header.html', "View Message catalog", menubar(
'Edit message catalog' => $p. "edit/msgcat.cgi",
-)), '<BR>';
+)) %><%
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;
- </TABLE>
- </BODY>
-</HTML>
-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') ) {
<A HREF="${p}edit/part_pkg.cgi"><I>Add a new package definition</I></A>
<BR><BR>
!;
-}
+#}
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<BR>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; };