[freeside-commits] freeside/httemplate/elements tr-select.html, 1.1, 1.1.6.1 select.html, NONE, 1.1.2.2 select-cgp_rule_action.html, NONE, 1.1.2.2 select-cgp_rule_condition.html, NONE, 1.1.2.2

Ivan,,, ivan at wavetail.420.am
Tue Apr 27 03:57:03 PDT 2010


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

Modified Files:
      Tag: FREESIDE_1_9_BRANCH
	tr-select.html 
Added Files:
      Tag: FREESIDE_1_9_BRANCH
	select.html select-cgp_rule_action.html 
	select-cgp_rule_condition.html 
Log Message:
communigate (phase 2): rules: start of adding conditions and actions to rule edit.  RT#7514

Index: tr-select.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/tr-select.html,v
retrieving revision 1.1
retrieving revision 1.1.6.1
diff -u -w -d -r1.1 -r1.1.6.1
--- tr-select.html	1 Aug 2007 22:25:10 -0000	1.1
+++ tr-select.html	27 Apr 2010 10:57:00 -0000	1.1.6.1
@@ -1,61 +1,22 @@
-<% include('tr-td-label.html', @_ ) %>
-
-  <TD <% $style %>>
-
-    <SELECT NAME          = "<% $opt{field} %>"
-            ID            = "<% $opt{id} %>"
-            previousValue = "<% $curr_value %>"
-            previousText  = "<% $labels->{$curr_value} || $curr_value %>"
-            <% $onchange %>
-    >
-
-%   if ( $opt{options} ) {
-%
-%     foreach my $option ( @{ $opt{options} } ) { #just arrayref for now
-
-        <OPTION VALUE="<% $option %>"
-                <% $opt{curr_value} eq $option ? 'SELECTED' : '' %>
-        >
-          <% $labels->{$option} || $option %>
-        </OPTION>
-
-%     }
-%
-%   } else { #deprecated weird value hashref used only by reason.html
-%
-%     my $aref = $opt{'value'}->{'values'};
-%     my $vkey = $opt{'value'}->{'vcolumn'};
-%     my $ckey = $opt{'value'}->{'ccolumn'};
-%     foreach my $v (@$aref) {
+% unless ( $opt{'js_only'} ) {
 
-        <OPTION VALUE="<% $v->$vkey %>"
-                <% ($opt{curr_value} eq $v->$vkey) ? 'SELECTED' : '' %>
-        >
-          <% $v->$ckey %>
-        </OPTION>
+    <% include('tr-td-label.html', %opt ) %>
 
-%     }
-%
+      <TD <% $colspan %> <% $style %>>
 %   }
 
-    </SELECT>
+    <% include('select.html', %opt ) %>
 
+% unless ( $opt{'js_only'} ) {
   </TD>
-
 </TR>
-
+% }
 <%init>
 
 my %opt = @_;
-
-my $onchange = $opt{'onchange'}
-                 ? 'onChange="'. $opt{'onchange'}. '(this)"'
-                 : '';
-
-my $labels = $opt{'option_labels'} || $opt{'labels'};
-
+warn join ' / ', %opt;
 my $style = $opt{'cell_style'} ? 'STYLE="'. $opt{'cell_style'}. '"' : '';
 
-my $curr_value = $opt{'curr_value'};
+my $colspan = $opt{'colspan'} ? 'COLSPAN="'.$opt{'colspan'}.'"' : '';
 
 </%init>

--- NEW FILE: select-cgp_rule_condition.html ---
<% include( 'select.html',
              %opt,
              'options' => \@conditions, #reverse order if we ever need to spec
              'labels'  => { '' => 'Select Condition' },
          )
%>
<% include( 'select.html',
              'name' => $opt{'field'}.'_op',
              'id'   => ($opt{'field'}||$opt{'id'}).'_op',
              'options' => \@myop,
          )
%>
<% include( 'input-text.html',
              'name' => $opt{'field'}.'_params',
              #XXX curr value... anything else?
          )
%>
<%init>

my %opt = @_;

my @conditions = (
  '',
  'From',
  'Sender',
  'To',
  'Cc',
  'Reply-To',
  'Any To or Cc',
  'Each To or Cc',
  'Return-Path',
  "'From' Name",
  'Subject',
  'Message-ID',
  'Message Size',
  'Human Generated',
  'Header Field',
  'Any Recipient',
  'Each Recipient',
  'Source',
  'Security',
  'Any Route',
  'Each Route'
);

my %bool = (
  'Human Generated' => 1,
);

my %number = (
  'Message Size' => 1,
);

#XXX curr value -> hidden op / param / param selects depending

my @op = ( 'is', 'is not', 'in', 'not in' );
my @op_number = ( 'is', 'is_not', 'less than', 'greater than' );

my @myop = @op; #XXX  $number{$curr_value} ? @op_number : @op;
#XXX and a fancy onchange handler... yes.
#XXX (and for total hiding of the %bool one)

</%init>

--- NEW FILE: select.html ---
% unless ( $opt{'js_only'} ) {

<SELECT NAME          = "<% $opt{field} %>"
        ID            = "<% $opt{id} %>"
        previousValue = "<% $curr_value %>"
        previousText  = "<% $labels->{$curr_value} || $curr_value %>"
        <% $onchange %>
>

% if ( $opt{options} ) {
%
%   foreach my $option ( @{ $opt{options} } ) { #just arrayref for now

      <OPTION VALUE="<% $option %>"
              <% $opt{curr_value} eq $option ? 'SELECTED' : '' %>
      >
        <% $labels->{$option} || $option %>
      </OPTION>

%   }
%
% } else { #deprecated weird value hashref used only by reason.html
%
%   my $aref = $opt{'value'}->{'values'};
%   my $vkey = $opt{'value'}->{'vcolumn'};
%   my $ckey = $opt{'value'}->{'ccolumn'};
%   foreach my $v (@$aref) {

      <OPTION VALUE="<% $v->$vkey %>"
              <% ($opt{curr_value} eq $v->$vkey) ? 'SELECTED' : '' %>
      >
        <% $v->$ckey %>
      </OPTION>

%   }
%
% }

</SELECT>

% }
<%init>

my %opt = @_;
warn "SELECT.HTML: ". join ' / ', %opt;

my $onchange = $opt{'onchange'}
                 ? 'onChange="'. $opt{'onchange'}. '(this)"'
                 : '';

my $labels = $opt{'option_labels'} || $opt{'labels'};

my $curr_value = $opt{'curr_value'};

my $onchange = '';
if ( $opt{'onchange'} ) {
  $onchange = $opt{'onchange'};
  $onchange .= '(this)' unless $onchange =~ /\(\w*\);?$/;
  $onchange =~ s/\(what\);/\(this\);/g; #ugh, terrible hack.  all onchange
                                        #callbacks should act the same
  $onchange = 'onChange="'. $onchange. '"' unless $onchange =~ /^onChange=/i;
}

</%init>

--- NEW FILE: select-cgp_rule_action.html ---
%# XXX CSS to verticially align the select vs. the textarea
<% include( 'select.html',
              %opt,
              'options' => \@actions, #reverse order if we ever need to specify
              'labels'  => { '' => 'Select Action' },
          )
%>
    <TEXTAREA NAME          = "<% $opt{field} %>_params"
%#              ID            = "<% $opt{id} %>"
%#              <% $rows %>
%#              <% $cols %>
%#              <% $onchange %>
%#    ><% $curr_value |h %></TEXTAREA>
    >
%# XXX curr value
    </TEXTAREA>
<%init>

my %opt = @_;
warn "SELECT-CGP_RULE-ACTION.HTML: ". join ' / ', %opt;

my @actions = (
  '',
  'Stop Processing',
  'Discard',
  'Reject With',
  'Mark',
  'Add Header',
  'Tag Subject',
  'Store in',
  'Redirect to',
  'Forward to',
  'Mirror to',
  'Reply with',
  'Reply to All with',
  'React with',
  'store Encrypted in',
  'Copy attachments into',
  'Execute',
  'ExternalFilter',
  'Accept Request',
);

#XXX hmm, hide textarea w/Stop Processing,Discard like _condition.html

</%Init>



More information about the freeside-commits mailing list