X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Fselect-cgp_rule_action.html;h=7cefdc4b53fe0da9471594381875d6539487edfc;hb=613464e6e7b634586bca9fabac145d2850b0f0f7;hp=24301b59b9e17d8cda01de9db772c5dc70f2d998;hpb=51d08ea7a5f0d07185c683db7a65722f4ebea781;p=freeside.git
diff --git a/httemplate/elements/select-cgp_rule_action.html b/httemplate/elements/select-cgp_rule_action.html
index 24301b59b..7cefdc4b5 100644
--- a/httemplate/elements/select-cgp_rule_action.html
+++ b/httemplate/elements/select-cgp_rule_action.html
@@ -1,25 +1,71 @@
-%# 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' },
- )
-%>
-
- >
-%# XXX curr value
-
-<%init>
+% unless ( $opt{'js_only'} ) {
-my %opt = @_;
+
+
+ <% include( 'select.html',
+ 'field' => $name.'_action',
+ 'id' => $id.'_action',
+ 'options' => \@actions,
+ 'curr_value' => $action,
+ 'labels' => { '' => 'Select Action' },
+ 'onchange' => $name.'_changed',
+ 'style' => 'vertical-align:top',
+ )
+ %>
+
+
+
+% }
+% unless ( $opt{'html_only'} || $opt{'js_only'} ) {
+
+% }
+<%once>
my @actions = (
'',
+
+ #generic http://www.communigate.com/CommunigatePro/Rules.html#Actions
+ 'Reject',
+ 'SendURL',
+ 'Send IM',
+ 'FingerNotify',
+ 'Write To Log',
+ "Remember 'From' in",
+
+ #email http://www.communigate.com/CommunigatePro/QueueRules.html#Actions
'Stop Processing',
'Discard',
'Reject With',
@@ -40,6 +86,31 @@ my @actions = (
'Accept Request',
);
-#XXX hmm, hide textarea w/Stop Processing,Discard like _condition.html
+my %noparam = ( map { $_=>1 } '', 'Stop Processing', 'Discard' );
+
+%once>
+<%init>
+
+my %opt = @_;
+
+my $name = $opt{'element_name'} || $opt{'field'} || 'ruleactionnum';
+#my $id = $opt{'id'} || 'contactnum';
+my $id = $opt{'id'} || $opt{'field'} || 'ruleactionnum';
+
+my $curr_value = $opt{'curr_value'} || $opt{'value'};
+
+my $cgp_rule_action;
+if ( $curr_value ) {
+ $cgp_rule_action = qsearchs('cgp_rule_action',
+ { 'ruleactionnum' => $curr_value } );
+} else {
+ $cgp_rule_action = new FS::cgp_rule_action {};
+}
+
+my $action = scalar($cgi->param($name.'_action'))
+ || $cgp_rule_action->action;
+
+my $disabled = $noparam{$action} ? 'DISABLED' : '';
+my $style = $disabled ? 'STYLE="visibility:hidden"' : '';
-%Init>
+%init>