[freeside-commits] freeside/httemplate/browse access_group.html, NONE, 1.1 access_user.html, NONE, 1.1 agent_type.cgi, 1.14, 1.15 cust_main_county.cgi, 1.13, 1.14 msgcat.cgi, 1.3, 1.4 part_pkg.cgi, 1.31, 1.32

Ivan,,, ivan at wavetail.420.am
Sun May 14 09:47:32 PDT 2006


Update of /home/cvs/cvsroot/freeside/httemplate/browse
In directory wavetail:/tmp/cvs-serv14201/httemplate/browse

Modified Files:
	agent_type.cgi cust_main_county.cgi msgcat.cgi part_pkg.cgi 
Added Files:
	access_group.html access_user.html 
Log Message:
first part of ACL and re-skinning work and some other small stuff

--- NEW FILE: access_user.html ---
<%

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,
                                    ''
                                  ],
             )
%>

--- NEW FILE: access_group.html ---
<%

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,
                                  ],
             )
%>

Index: agent_type.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/browse/agent_type.cgi,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- agent_type.cgi	31 Jan 2006 04:26:54 -0000	1.14
+++ agent_type.cgi	14 May 2006 16:47:30 -0000	1.15
@@ -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,
+                                    '',
+                                  ],
+             )
 %>

Index: part_pkg.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/browse/part_pkg.cgi,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- part_pkg.cgi	22 Apr 2006 00:58:38 -0000	1.31
+++ part_pkg.cgi	14 May 2006 16:47:30 -0000	1.32
@@ -11,8 +11,8 @@
 my $orderby = 'pkgpart';
 if ( $cgi->param('active') ) {
 
-  $orderby = 'num_active';
-
+  $orderby = 'num_active DESC';
+}
   $select = "
 
     *,
@@ -33,13 +33,13 @@
 
   ";
 
-}
+#}
 
 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 @@
     <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 @@
   $align .= 'l';
 }
 
-if ( $cgi->param('active') ) {
+#if ( $cgi->param('active') ) {
   push @header, 'Customer<BR>packages';
   my %col = (
     'active'      => '00CC00',
@@ -117,7 +117,7 @@
                             } (qw( active suspended cancelled ))
                       ]; };
   $align .= 'r';
-}
+#}
 
 push @header, 'Frequency';
 push @fields, sub { shift->freq_pretty; };

Index: cust_main_county.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/browse/cust_main_county.cgi,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- cust_main_county.cgi	26 Sep 2003 08:11:12 -0000	1.13
+++ cust_main_county.cgi	14 May 2006 16:47:30 -0000	1.14
@@ -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 @@
 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 @@
       $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>!;
+          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>
+      <% } %>
 
-    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;
+    </TD>
+  <% } %>
 
-    print "</TD>";
-  }
+<% #  $sup=$newsup; %>
 
-#  $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>
 
-  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>";
+    <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>
 
-  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>!;
-    }
+    <TD<% if ( $hashref->{taxname} ) {
+            %> BGCOLOR="#ffffff"><%= $hashref->{taxname} %>
+       <% } else {
+            %> BGCOLOR="#cccccc">Tax
+       <% } %>
+    </TD>
 
-  }
-  print "</TD>";
+    <TD BGCOLOR="#ffffff"><%= $hashref->{tax} %>%</TD>
 
-  print "<TD";
-  if ( $hashref->{taxname} ) {
-    print ' BGCOLOR="#ffffff">'. $hashref->{taxname};
-  } else {
-    print ' BGCOLOR="#cccccc">Tax';
-  }
-  print "</TD>";
+    <TD BGCOLOR="#ffffff">
 
-  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>';
+      <% 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>
+      <% } %>
 
-print <<END;
-    </TABLE>
-  </BODY>
-</HTML>
-END
+    </TD>
 
-%>
+  </TR>
+
+<% } %>
+
+</TABLE>
+
+<%= include('/elements/footer.html') %>

Index: msgcat.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/browse/msgcat.cgi,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- msgcat.cgi	10 Apr 2002 13:42:49 -0000	1.3
+++ msgcat.cgi	14 May 2006 16:47:30 -0000	1.4
@@ -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 @@
   },
 
 );
-
-print $widget->html;
-
-print <<END;
-    </TABLE>
-  </BODY>
-</HTML>
-END
-
 %>
+
+<%=  $widget->html %>
+<%= include('/elements/footer.html') %>



More information about the freeside-commits mailing list