[freeside-commits] freeside/httemplate/elements tr-select-part_svc.html, 1.1, 1.2 select-part_svc.html, NONE, 1.1 select-table.html, 1.16, 1.17

Ivan,,, ivan at wavetail.420.am
Fri Sep 25 03:14:32 PDT 2009


Update of /home/cvs/cvsroot/freeside/httemplate/elements
In directory wavetail.420.am:/tmp/cvs-serv18545/httemplate/elements

Modified Files:
	tr-select-part_svc.html select-table.html 
Added Files:
	select-part_svc.html 
Log Message:
nomadix, RT#5876

Index: select-table.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/select-table.html,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- select-table.html	31 May 2009 06:59:37 -0000	1.16
+++ select-table.html	25 Sep 2009 10:14:30 -0000	1.17
@@ -34,6 +34,7 @@
     'empty_label'    => '', #better specify it though, the default might change
     'multiple'       => 0, # bool
     'disable_empty'  => 0, # bool (implied by multiple)
+    'label_showkey'  => 0, # bool
     'label_callback' => sub { my $record = shift; return "label"; },
 
     #more params controlling HTML stuff about the <SELECT>
@@ -77,13 +78,19 @@
     <OPTION VALUE=""><% $opt{'empty_label'} || 'all' %>
 % }
 
-% foreach my $record ( sort { $a->$name_col() cmp $b->$name_col() } @records ) {
+% foreach my $record ( sort {    $a->$name_col() cmp $b->$name_col()
+%                             || $a->$key()      <=> $b->$key()
+%                           }
+%                           @records
+%                    )
+% {
 %   my $recvalue = $record->$key();
     <OPTION VALUE="<% $recvalue %>"
             <% ref($value) && $value->{$recvalue} || $value == $recvalue
                ? ' SELECTED' : ''
             %>
-    ><% $opt{'label_callback'}
+    ><% $opt{'label_showkey'} ? "$recvalue: " : '' %>
+     <% $opt{'label_callback'}
           ? &{ $opt{'label_callback'} }( $record )
           : $record->$name_col()
      %>

Index: tr-select-part_svc.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/tr-select-part_svc.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- tr-select-part_svc.html	5 Oct 2007 14:26:37 -0000	1.1
+++ tr-select-part_svc.html	25 Sep 2009 10:14:30 -0000	1.2
@@ -7,11 +7,8 @@
   <TR>
     <TD ALIGN="right"><% $opt{'label'} || 'Package definition' %></TD>
     <TD>
-      <% include( '/elements/select-table.html',
-                    'table'     => 'part_svc',
-                    'name_col'  => 'svc',
-                    'multiple'  => 1,
-                    #N/A 'empty_label' => '(none)',
+      <% include( '/elements/select-part_svc.html',
+                    'multiple' => 1,
                     %opt,
                 )
       %>

--- NEW FILE: select-part_svc.html ---
<% include( '/elements/select-table.html',
              'table'         => 'part_svc',
              'name_col'      => 'svc',
              'label_showkey' => 1,
              #N/A 'empty_label' => '(none)',
              %opt,
          )
%>
<%init>

my( %opt ) = @_;

$opt{'records'} = delete $opt{'part_svc'}
  if $opt{'part_svc'};

$opt{'records'} ||= [ qsearch( 'part_svc', {} ) ]; # { disabled=>'' } )

</%init>



More information about the freeside-commits mailing list