<tmpl_var header_template escape="none">

<table cellpadding="0" cellspacing="0" border="0" align="center" width="90%">
<tr>
  <td class="titlebar" colspan="4">Edit Mail Filters</td>
  <td class="titlebar" colspan="6" align="right" nowrap><tmpl_var freespace escape="html"> KB Available</td>
</tr>
<tr>
  <td class="menubar" colspan="9">
    <tmpl_if caller_main><a href="<tmpl_var url_cgi escape="none">/openwebmail-main.pl?action=listmessages&amp;sessionid=<tmpl_var sessionid escape="url">&amp;folder=<tmpl_var folder escape="url">&amp;message_id=<tmpl_var message_id escape="url">&amp;sort=<tmpl_var sort escape="url">&amp;page=<tmpl_var page escape="url">&amp;longpage=<tmpl_var longpage escape="url">&amp;userfirsttime=<tmpl_var userfirsttime escape="url">&amp;prefs_caller=<tmpl_var prefs_caller escape="url">" accesskey="B" class="icon"><tmpl_if use_texticon>back to <tmpl_var callerfoldername escape="html"><tmpl_else><img src="<tmpl_var url_html escape="none">/images/iconsets/<tmpl_var iconset escape="html">/backtofolder.gif" title="back to <tmpl_var callerfoldername escape="html">" alt="back to <tmpl_var callerfoldername escape="html">" border="0" align="absmiddle"></tmpl_if></a></tmpl_if>

    <tmpl_if caller_calendar><a href="<tmpl_var url_cgi escape="none">/openwebmail-cal.pl?action=<tmpl_var calendardefaultview escape="url">&amp;sessionid=<tmpl_var sessionid escape="url">&amp;folder=<tmpl_var folder escape="url">&amp;message_id=<tmpl_var message_id escape="url">&amp;sort=<tmpl_var sort escape="url">&amp;page=<tmpl_var page escape="url">&amp;longpage=<tmpl_var longpage escape="url">&amp;userfirsttime=<tmpl_var userfirsttime escape="url">&amp;prefs_caller=<tmpl_var prefs_caller escape="url">" accesskey="B" class="icon"><tmpl_if use_texticon>back to calendar<tmpl_else><img src="<tmpl_var url_html escape="none">/images/iconsets/<tmpl_var iconset escape="html">/backtofolder.gif" title="back to calendar" alt="back to calendar" border="0" align="absmiddle"></tmpl_if></a></tmpl_if>

    <tmpl_if caller_webdisk><a href="<tmpl_var url_cgi escape="none">/openwebmail-webdisk.pl?action=showdir&amp;sessionid=<tmpl_var sessionid escape="url">&amp;folder=<tmpl_var folder escape="url">&amp;message_id=<tmpl_var message_id escape="url">&amp;sort=<tmpl_var sort escape="url">&amp;page=<tmpl_var page escape="url">&amp;longpage=<tmpl_var longpage escape="url">&amp;userfirsttime=<tmpl_var userfirsttime escape="url">&amp;prefs_caller=<tmpl_var prefs_caller escape="url">" accesskey="B" class="icon"><tmpl_if use_texticon>back to webdisk<tmpl_else><img src="<tmpl_var url_html escape="none">/images/iconsets/<tmpl_var iconset escape="html">/backtofolder.gif" title="back to webdisk" alt="back to webdisk" border="0" align="absmiddle"></tmpl_if></a></tmpl_if>

    <tmpl_if caller_read><a href="<tmpl_var url_cgi escape="none">/openwebmail-read.pl?action=readmessage&amp;sessionid=<tmpl_var sessionid escape="url">&amp;folder=<tmpl_var folder escape="url">&amp;message_id=<tmpl_var message_id escape="url">&amp;sort=<tmpl_var sort escape="url">&amp;page=<tmpl_var page escape="url">&amp;longpage=<tmpl_var longpage escape="url">&amp;userfirsttime=<tmpl_var userfirsttime escape="url">&amp;prefs_caller=<tmpl_var prefs_caller escape="url">" accesskey="B" class="icon"><tmpl_if use_texticon>back to <tmpl_var callerfoldername escape="html"><tmpl_else><img src="<tmpl_var url_html escape="none">/images/iconsets/<tmpl_var iconset escape="html">/backtofolder.gif" title="back to <tmpl_var callerfoldername escape="html">" alt="back to <tmpl_var callerfoldername escape="html">" border="0" align="absmiddle"></tmpl_if></a></tmpl_if>
  </td>
</tr>
<tr>
  <td colspan="9">&nbsp;</td>
</tr>
<tr>
  <td class="columnheader" align="center" nowrap>Count&nbsp;&nbsp;</td>
  <td class="columnheader" align="center" nowrap>Priority</td>
  <td class="columnheader" align="center" nowrap>Rules</td>
  <td class="columnheader" align="center" nowrap>Inc/Exc</td>
  <td class="columnheader" align="center" nowrap>Filter String</td>
  <td class="columnheader" align="center" nowrap>Action</td>
  <td class="columnheader" align="center" nowrap>Destination</td>
  <td class="columnheader" align="center" nowrap>Enable</td>
  <td class="columnheader" align="center" nowrap>Action</td>
</tr>

<form action="<tmpl_var url_cgi escape="none">/openwebmail-prefs.pl" method="post" name="newfilter">
<input type="hidden" name="action" value="addfilter">
<input type="hidden" name="sessionid" value="<tmpl_var sessionid escape="html">">
<input type="hidden" name="folder" value="<tmpl_var folder escape="html">">
<input type="hidden" name="message_id" value="<tmpl_var message_id escape="html">">
<input type="hidden" name="sort" value="<tmpl_var sort escape="html">">
<input type="hidden" name="page" value="<tmpl_var page escape="html">">
<input type="hidden" name="longpage" value="<tmpl_var longpage escape="html">">
<input type="hidden" name="userfirsttime" value="<tmpl_var userfirsttime escape="html">">
<input type="hidden" name="prefs_caller" value="<tmpl_var prefs_caller escape="html">">

<tr>
  <td class="rowlight" align="center" nowrap>&nbsp;</td>
  <td class="rowlight" align="center" nowrap>
    <select name="priority">
    <tmpl_loop priorityselectloop>
      <option value="<tmpl_var option escape="html">" <tmpl_if selected>selected</tmpl_if>><tmpl_var label escape="html"></option>
    </tmpl_loop>
    </select>
  </td>
  <td class="rowlight" align="center" nowrap>
    <select name="ruletype">
    <tmpl_loop ruletypeselectloop>
      <option value="<tmpl_var option escape="html">" <tmpl_if selected>selected</tmpl_if>><tmpl_var label escape="html"></option>
    </tmpl_loop>
    </select>
  </td>
  <td class="rowlight" align="center" nowrap>
    <select name="include">
    <tmpl_loop includeselectloop>
      <option value="<tmpl_var option escape="html">" <tmpl_if selected>selected</tmpl_if>><tmpl_var label escape="html"></option>
    </tmpl_loop>
    </select>
  </td>
  <td class="rowlight" align="center" nowrap><input type="text" size="26" name="text" value="" accesskey="I"></td>
  <td class="rowlight" align="center" nowrap>
    <select name="op">
    <tmpl_loop operationselectloop>
      <option value="<tmpl_var option escape="html">" <tmpl_if selected>selected</tmpl_if>><tmpl_var label escape="html"></option>
    </tmpl_loop>
    </select>
  </td>
  <td class="rowlight" align="center" nowrap>
    <select name="destination">
    <tmpl_loop destinationselectloop>
      <option value="<tmpl_var option escape="html">" <tmpl_if selected>selected</tmpl_if>><tmpl_var label escape="html"></option>
    </tmpl_loop>
    </select>
  </td>
  <td class="rowlight" align="center" nowrap><input type="checkbox" name="enable" value="1" checked></td>
  <td class="rowlight" align="center" nowrap><input type="submit" name="newfilterselect" value="Add/Modify" accesskey="A"></td>
</tr>
</form>

<tmpl_loop filterrulesloop>
<tr>
  <td class="<tmpl_if __odd__>rowdark<tmpl_else>rowlight</tmpl_if>" align="center"><tmpl_if matchdate><a title="<tmpl_var matchdate escape="html">"><tmpl_var matchcount escape="html"></a><tmpl_else>0</tmpl_if></td>
  <td class="<tmpl_if __odd__>rowdark<tmpl_else>rowlight</tmpl_if>" align="center"><tmpl_var priority escape="html"></td>
  <td class="<tmpl_if __odd__>rowdark<tmpl_else>rowlight</tmpl_if>" align="center"><tmpl_var typetext escape="html"></td>
  <td class="<tmpl_if __odd__>rowdark<tmpl_else>rowlight</tmpl_if>" align="center"><tmpl_var includetext escape="html"></td>
  <td class="<tmpl_if __odd__>rowdark<tmpl_else>rowlight</tmpl_if>" align="center"><a href="javascript:update('<tmpl_var priority escape="js">','<tmpl_var type escape="js">','<tmpl_var include escape="js">','<tmpl_var text escape="js">','<tmpl_var operation escape="js">','<tmpl_var dest escape="js">','<tmpl_var enable escape="js">')" title="edit this filter rule" alt="edit this filter rule"><tmpl_var text escape="html"></a></td>
  <td class="<tmpl_if __odd__>rowdark<tmpl_else>rowlight</tmpl_if>" align="center"><tmpl_var operationtext escape="html"></td>
  <td class="<tmpl_if __odd__>rowdark<tmpl_else>rowlight</tmpl_if>" align="center"><tmpl_var desttext escape="html"></td>
  <td class="<tmpl_if __odd__>rowdark<tmpl_else>rowlight</tmpl_if>" align="center"><tmpl_if enable>Enabled<tmpl_else>Disabled</tmpl_if></td>
  <td class="<tmpl_if __odd__>rowdark<tmpl_else>rowlight</tmpl_if>" align="center">
    <form action="<tmpl_var url_cgi escape="none">/openwebmail-prefs.pl" method="post" name="deletefilterform">
    <input type="hidden" name="action" value="deletefilter">
    <input type="hidden" name="ruletype" value="<tmpl_var type escape="html">">
    <input type="hidden" name="include" value="<tmpl_var include escape="html">">
    <input type="hidden" name="text" value="<tmpl_var text escape="html">">
    <input type="hidden" name="destination" value="<tmpl_var dest escape="html">">
    <input type="hidden" name="sessionid" value="<tmpl_var sessionid escape="html">">
    <input type="hidden" name="folder" value="<tmpl_var folder escape="html">">
    <input type="hidden" name="message_id" value="<tmpl_var message_id escape="html">">
    <input type="hidden" name="sort" value="<tmpl_var sort escape="html">">
    <input type="hidden" name="page" value="<tmpl_var page escape="html">">
    <input type="hidden" name="longpage" value="<tmpl_var longpage escape="html">">
    <input type="hidden" name="userfirsttime" value="<tmpl_var userfirsttime escape="html">">
    <input type="hidden" name="prefs_caller" value="<tmpl_var prefs_caller escape="html">">
    <input type="submit" name="deletefilterformsubmit" value="Delete">
    </form>
  </td>
</tr>
</tmpl_loop>

<tmpl_loop globalrulesloop>
<tmpl_if __first__>
<tr>
  <td colspan="9">&nbsp;</td>
</tr>
<tr>
  <td colspan="9" class="columnheader">Global Filter Rules (read only)</td>
</tr>
</tmpl_if>
<tr>
  <td class="<tmpl_if __odd__>rowlight<tmpl_else>rowdark</tmpl_if>" align="center"><tmpl_if matchdate><a title="<tmpl_var matchdate escape="html">"><tmpl_var matchcount escape="html"></a><tmpl_else>0</tmpl_if></td>
  <td class="<tmpl_if __odd__>rowlight<tmpl_else>rowdark</tmpl_if>" align="center"><tmpl_var priority escape="html"></td>
  <td class="<tmpl_if __odd__>rowlight<tmpl_else>rowdark</tmpl_if>" align="center"><tmpl_var typetext escape="html"></td>
  <td class="<tmpl_if __odd__>rowlight<tmpl_else>rowdark</tmpl_if>" align="center"><tmpl_var includetext escape="html"></td>
  <td class="<tmpl_if __odd__>rowlight<tmpl_else>rowdark</tmpl_if>" align="center"><a href="javascript:update('<tmpl_var priority escape="js">','<tmpl_var type escape="js">','<tmpl_var include escape="js">','<tmpl_var text escape="js">','<tmpl_var operation escape="js">','<tmpl_var dest escape="js">','<tmpl_var enable escape="js">')" title="create a new filter rule like this one" alt="create a new filter rule like this one"><tmpl_var text escape="html"></a></td>
  <td class="<tmpl_if __odd__>rowlight<tmpl_else>rowdark</tmpl_if>" align="center"><tmpl_var operationtext escape="html"></td>
  <td class="<tmpl_if __odd__>rowlight<tmpl_else>rowdark</tmpl_if>" align="center"><tmpl_var desttext escape="html"></td>
  <td class="<tmpl_if __odd__>rowlight<tmpl_else>rowdark</tmpl_if>" align="center"><tmpl_if enable>Enabled<tmpl_else>Disabled</tmpl_if></td>
  <td class="<tmpl_if __odd__>rowlight<tmpl_else>rowdark</tmpl_if>" align="center">-----</td>
</tr>
</tmpl_loop>

</table>

<script type="text/javascript">
<!--
   function update(priority,rules,include,text,op,destination,enable) {
      var quot = new RegExp("!QUOT!","g");
      text = text.replace(quot, '"');

      selectoption(document.newfilter.priority, priority);
      selectoption(document.newfilter.ruletype, rules);
      selectoption(document.newfilter.include, include);

      document.newfilter.text.value = text;

      selectoption(document.newfilter.op, op);
      selectoption(document.newfilter.destination, destination);

      document.newfilter.enable.checked = (enable == 1)?true:false;
      document.newfilter.priority.focus();
   }

   function selectoption (menu, value) {
      var i_default = 0;

      for (var i=0; i<menu.length; i++) {
         if (menu.options[i].value == value) {
            menu.options[i].selected = true;
            return i;
         }
         if (menu.options[i].defaultSelected) {
            i_default = i;
         }
      }

      menu.options[i_default].selected = true;
      return i_default;
   }
//-->
</script>

<tmpl_var footer_template escape="none">
