summaryrefslogtreecommitdiff
path: root/httemplate/elements
diff options
context:
space:
mode:
authorivan <ivan>2010-04-27 10:57:01 +0000
committerivan <ivan>2010-04-27 10:57:01 +0000
commitc8edb1e681cadff9a84572c4a6e3b16662f566cd (patch)
tree9c26d9cdc87e465251faecb5cbc322a65d02044d /httemplate/elements
parent2e7196e70c3fc040a51aa5ce1549f6885ac9d01d (diff)
communigate (phase 2): rules: start of adding conditions and actions to rule edit. RT#7514
Diffstat (limited to 'httemplate/elements')
-rw-r--r--httemplate/elements/select-cgp_rule_action.html46
-rw-r--r--httemplate/elements/select.html64
-rw-r--r--httemplate/elements/tr-select.html61
3 files changed, 121 insertions, 50 deletions
diff --git a/httemplate/elements/select-cgp_rule_action.html b/httemplate/elements/select-cgp_rule_action.html
new file mode 100644
index 000000000..b53a96e9e
--- /dev/null
+++ b/httemplate/elements/select-cgp_rule_action.html
@@ -0,0 +1,46 @@
+%# 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>
diff --git a/httemplate/elements/select.html b/httemplate/elements/select.html
new file mode 100644
index 000000000..7aa4180b6
--- /dev/null
+++ b/httemplate/elements/select.html
@@ -0,0 +1,64 @@
+% 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>
diff --git a/httemplate/elements/tr-select.html b/httemplate/elements/tr-select.html
index 07b0a01d5..f9c768c60 100644
--- a/httemplate/elements/tr-select.html
+++ b/httemplate/elements/tr-select.html
@@ -1,61 +1,22 @@
-<% include('tr-td-label.html', @_ ) %>
+% unless ( $opt{'js_only'} ) {
- <TD <% $style %>>
+ <% include('tr-td-label.html', %opt ) %>
- <SELECT NAME = "<% $opt{field} %>"
- ID = "<% $opt{id} %>"
- previousValue = "<% $curr_value %>"
- previousText = "<% $labels->{$curr_value} || $curr_value %>"
- <% $onchange %>
- >
+ <TD <% $colspan %> <% $style %>>
+% }
-% 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>
-
- </TD>
-
-</TR>
+ <% 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>