X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Fselect-cgp_rule_action.html;h=7cefdc4b53fe0da9471594381875d6539487edfc;hb=49ff577b9fbb4b017f0652cdfe567b023d7ea4de;hp=b53a96e9e46293be3fd0f1cb08a3910259096534;hpb=6874a21f3cb26a167e49cc1324df30119c6ed75d;p=freeside.git diff --git a/httemplate/elements/select-cgp_rule_action.html b/httemplate/elements/select-cgp_rule_action.html index b53a96e9e..7cefdc4b5 100644 --- a/httemplate/elements/select-cgp_rule_action.html +++ b/httemplate/elements/select-cgp_rule_action.html @@ -1,26 +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 = @_; -warn "SELECT-CGP_RULE-ACTION.HTML: ". join ' / ', %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', @@ -41,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' ); + + +<%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"' : ''; - +