<dtml-if expr="REQUEST.get('close_filter_form', 0)">
 <dtml-call expr="RESPONSE.expireCookie('show_filter_form', path='/')">
 <dtml-call expr="REQUEST.set('show_filter_form', '')">
<dtml-elif expr="REQUEST.get('open_filter_form', 0)">
 <dtml-call "RESPONSE.setCookie('show_filter_form', '1', path='/',
             expires='Wed, 19 Feb 2020 14:28:00 GMT')">
 <dtml-call expr="REQUEST.set('show_filter_form', '1')">
</dtml-if>

<form action="&dtml-absolute_url;/folder_contents" method="POST">
 <dtml-if expr="REQUEST.get('show_filter_form', 0)">
  <dtml-let Subject="''"
            filter="decodeFolderFilter(REQUEST.get('folderfilter', ''))"
            portalType="filter.get('portal_type', ())">
  <dtml-with filter mapping>
  <table border="0" cellspacing="0" cellpadding="2">
   <tr>
    <th colspan="2" align="left">Contents View Filter</th>
   </tr>
   <tr>
    <td align="left" valign="TOP" width="*">Subject:</td>
    <td align="left" valign="TOP">
     <input type="text" name="filter_by_Subject:tokens"
      value="<dtml-if Subject><dtml-var
              expr="_.string.join(Subject, ' ')"></dtml-if>" />
    </td>
   </tr>
   <tr>
    <td align="left" valign="TOP" width="*">Content Type:</td>
    <td align="left" valign="TOP">
     <select name="filter_by_portal_type:list" multiple size="3">
      <dtml-in expr="portal_types.listTypeInfo( container=this() )" sort>
      <dtml-let typeinfo=sequence-item typeid=getId>
       <dtml-unless "typeid == 'Portal Folder'">
        <option value="&dtml-typeid;"
         <dtml-if expr="not portalType or (typeid in portalType)">selected
         </dtml-if>
        >  &dtml-Title;</option>
       </dtml-unless>
      </dtml-let>
      </dtml-in>
     </select>
    </td>
   </tr>
   <tr>
    <td colspan="1" align="left">
     <input type="submit" name="set_view_filter" value="Set Filter" />
    </td>
    <td colspan="1" align="left">
     <input type="submit" name="close_filter_form" value="Close View Filter" />
    </td>
    <td colspan="1" align="left">
     <input type="submit" name="clear_view_filter" value="Clear View Filter" />
    </td>
   </tr>
  </table>
  </dtml-with>
  </dtml-let>
 <dtml-else>
  <dtml-if expr="REQUEST.get('folderfilter', _.None)">
   <em>This is a filtered list.</em>
  </dtml-if>
  <input type="submit" name="open_filter_form" value="Set View Filter" />
 </dtml-if>
</form>
