<?php
    $rule_url = Horde::applicationUrl('rule.php');
    if (!is_null($edit_number)) {
        $rule_url = Util::addParameter($rule_url, 'edit', $edit_number);
    }
?>
<script language="JavaScript" type="text/javascript">
<!--
function delete_condition(num)
{
    document.rule.actionID.value = 'rule_delete';
    document.rule.conditionnumber.value = num;
    document.rule.submit();
    return true;
}
//-->
</script>

<form method="post" name="rule" action="<?php echo $rule_url ?>">
<?php Util::pformInput() ?>
<input type="hidden" name="actionID" value="rule_update" />
<input type="hidden" name="conditionnumber" value="-1" />
<input type="hidden" name="new_folder_name" value="" />

<table cellspacing="0" cellpadding="0">
  <tr class="header">
    <td align="left" class="header">
      <?php echo _("Filter Rule") ?>
<?php if (!empty($rule['disable'])): ?>
      &nbsp;[<font color="red"><?php echo _("Disabled") ?></font>]
<?php endif; ?>
    </td>
    <td align="right">
      <?php echo Help::link('ingo', 'rule') ?>&nbsp;
    </td>
  </tr>
  <tr>
    <td class="control" align="left" style="padding:5px">
      <?php echo _("Rule Name") ?> : <input class="input" name="name" size="50" value="<?php echo (isset($rule['name'])) ? $rule['name'] : '' ?>" />
    </td>
    <td width="40px" align="right" class="control">
      <?php echo Help::link('ingo', 'rule-name') ?>&nbsp;
    </td>
  </tr>

  <tr class="item0">
    <td align="left" style="padding:5px">
      <i><?php echo _("For an incoming message that matches:") ?></i>
      <br />
      <table cellpadding="2" cellspacing="0">
        <tr>
          <td>
            <input id="all" onclick="document.rule.submit(); return true;" type="radio" name="combine" value="<?php echo INGO_STORAGE_COMBINE_ALL ?>"<?php echo ($rule['combine'] == INGO_STORAGE_COMBINE_ALL) ? ' checked="checked"' : '' ?> /><?php echo Horde::label('all', _("All of the following")) ?>
          </td>
          <td>
            <input id="any" onclick="document.rule.submit(); return true;" type="radio" name="combine" value="<?php echo INGO_STORAGE_COMBINE_ANY ?>"<?php echo ($rule['combine'] == INGO_STORAGE_COMBINE_ANY) ? ' checked="checked"' : '' ?> /><?php echo Horde::label('any', _("Any of the following")) ?>
          </td>
        </tr>
      </table>
    </td>
    <td width="40px" align="right">
      <?php echo Help::link('ingo', 'rule-combine') ?>&nbsp;
    </td>
  </tr>

  <tr class="item0">
    <td>
      <table width="100%" cellspacing="0" cellpadding="0">
