+ <INPUT TYPE="hidden" NAME="<%$name%>" ID="<%$id%>" VALUE="<% $curr_value %>">
+
+ <% include( 'select.html',
+ 'field' => $name.'_conditionname',
+ 'id' => $id.'_conditionname',
+ 'options' => \@conditions,
+ 'curr_value' => $conditionname,
+ 'labels' => { '' => 'Select Condition' },
+ 'onchange' => $name.'_changed',
+ )
+ %>
+
+ <% include( 'select.html',
+ 'field' => $name.'_op',
+ 'id' => $id.'_op',
+ 'options' => \@op,
+ 'curr_value' => scalar($cgi->param($name.'_op'))
+ || $cgp_rule_condition->op,
+ 'disabled' => $disabled,
+ 'style' => $style,
+ )
+ %>
+
+ <% include( 'input-text.html',
+ 'field' => $name.'_params',
+ 'id' => $id.'_params',
+ 'curr_value' => scalar($cgi->param($name.'_params'))
+ || $cgp_rule_condition->params,
+ 'disabled' => $disabled,
+ 'style' => $style,
+ 'nodarken_disabled' => 1,
+ )
+ %>
+
+% # could add more UI sugar for date/time ranges, string #lists, etc.
+
+% }
+% unless ( $opt{'html_only'} || $opt{'js_only'} ) {
+ <SCRIPT TYPE="text/javascript">
+% }
+% unless ( $opt{'html_only'} ) {
+
+ function opt(what,value,text) {
+ var optionName = new Option(text, value, false, false);
+ var length = what.length;
+ what.options[length] = optionName;
+ }
+
+ function <% $name %>_changed(what) {
+
+ <% $onchange %>
+
+ var <% $name %>_value = what.options[what.selectedIndex].value;
+
+ var op_Element = what.form.<% $name %>_op;
+ var params_Element = what.form.<% $name %>_params;
+
+ //cond2op in javascript... not as elegant cause my js << my perl
+
+ // if bool, hide/disable _op and _params entirely
+ if ( <%$name%>_value == '' || <%$name%>_value == 'Human Generated' ) {
+ op_Element.disabled = true;
+ op_Element.style.visibility = "hidden";
+ params_Element.disabled = true;
+ params_Element.style.visibility = "hidden";
+ return true;
+ }
+
+ var OpArray = [ 'is', 'is not' ];
+
+ // if lt_ge, add em
+ if ( <%$name%>_value == 'Message Size' || <%$name%>_value == 'Time of Day' || <%$name%>_value == 'Current Date' ) {
+ OpArray.push('less than');
+ OpArray.push('greater than');
+ }
+
+ // unless no_in, add em
+ if ( <%$name%>_value != 'Message Size' && <%$name%>_value != 'Current Date' && <%$name%>_value != 'Existing Mailbox' ) {
+ OpArray.push('in');
+ OpArray.push('not in');
+ }
+
+ // blank the current op list
+ for ( var i = op_Element.length; i >= 0; i-- )
+ op_Element.options[i] = null;
+
+ // update the _op select with this new array
+ for ( var s = 0; s < OpArray.length; s++ )
+ opt(what.form.<% $name %>_op, OpArray[s], OpArray[s]);
+
+ // show _op and _params (in case we were a bool before)
+ op_Element.disabled = false;
+ op_Element.style.visibility = "visible";
+ params_Element.disabled = false;
+ params_Element.style.visibility = "visible";
+
+ }
+% }
+% unless ( $opt{'html_only'} || $opt{'js_only'} ) {
+ </SCRIPT>
+% }
+<%once>