<html xmlns:tal="http://xml.zope.org/namespaces/tal"
      xmlns:metal="http://xml.zope.org/namespaces/metal"
      metal:use-macro="here/main_template/macros/master">
<body>
<div metal:fill-slot="main">

<div class="Desktop">

<h1>Search <span tal:replace="here/Title" /></h1>

<form action="search"
      tal:attributes="action string:${here/portal_url}/search"
>

<table class="FormLayout">


 <tr tal:condition="python: here.portal_membership.checkPermission('Review portal content', here)">
  <th> Review Status
  </th>
  <td>
   <select name="review_state" size="3" multiple>
    <option value="" selected>-- any --</option>
    <option>private</option>
    <option>pending</option>
    <option>published</option>
   </select>
   <dl class="FieldHelp">
    <dd> As a reviewer, you may search for items based on their
         review state.  If you wish to constrain results to items
         in certain states, select them from this list.
    </dd>
   </dl>
  </td>
 </tr>
 
 <tr valign="top">
  <th> Full Text
  </th>
  <td>
    <input name="SearchableText" size="40">
   <dl class="FieldHelp">
    <dd> For a simple text search, enter your search term
         here.  Multiple words may be found by combining
         them with <b>AND</b> and <b>OR</b>.  This will
         find text in items' contents, title and
         description.
    </dd>
   </dl>
  </td>
 </tr>

 <tr>
  <th>Title
  </th>
  <td>
   <input name="Title" size="20">
  </td>
 </tr>

 <tr valign="top">
  <th>Subject</th>
  <td tal:define="items python: here.portal_catalog.uniqueValuesFor('Subject')">
   <select name="Subject:list" multiple size="5">
    <option value="" selected>-- any --</option>
    <option value=""
		    tal:repeat="item items"
		    tal:attributes="value item"
		    tal:content="item">
      </option>
    </select>
  </td>
 </tr>

 <tr>
  <th> Description
  </th>
  <td>
   <input name="Description" size="20">
   <dl class="FieldHelp">
    <dd> You may also search the items' descriptions and
         titles specifically.  Multiple words may be found
         by combining them with <b>AND</b> and <b>OR</b>.
    </dd>
   </dl>
  </td>
 </tr>

 <tr>
  <th> Find new items since...
  </th>
  <td tal:define="today python: here.ZopeTime().earliestTime();
			      mtool here/portal_membership;
                  member python:mtool.getAuthenticatedMember();
                  lastLogin member/last_login_time|nothing;
	              yesterday python:(today-1).Date();
	              lastWeek python:(today-7).Date();
	              lastMth python:(today-31).Date();
                 ">
   <select name="created:date">
    <option value="1970/01/01 00:00:00 GMT">Ever</option>
	<option value=""
	        tal:condition="python:not(here.portal_membership.isAnonymousUser())"
			tal:attributes="value lastLogin">Last login</option>
    <option value=""
			tal:attributes="value yesterday">Yesterday</option>
    <option value=""
			tal:attributes="value lastWeek">Last week</option>
    <option value=""
			tal:attributes="value lastMth">Last month</option>
   </select>
   <input type="hidden" name="created_usage" value="range:min">
   <dl class="FieldHelp">
    <dd> You may find only recent items by selecting a time-frame.
    </dd>
   </dl>
  </td>
 </tr>

 <tr>
  <th> Item type
  </th>
  <td tal:define="typeinfos here/portal_types/listTypeInfo" >
   <select name="portal_type:list" multiple size="5">
    <option value="" selected>-- any --</option>
    <option value=""
		    tal:repeat="typeinfo typeinfos"
		    tal:attributes="value typeinfo/getId"
		    tal:content="typeinfo/Title"></option>
    </select> 
   <dl class="FieldHelp">
    <dd> You may limit your results to particular kinds of
         items by selecting them above.  To find all kinds
         of items, do not select anything.
    </dd>
   </dl>
  </td>
 </tr>

 <tr>
  <th> Creator
  </th>
  <td>
   <input name="Creator" size="20">

   <dl class="FieldHelp">
    <dd> To find items by a particular user only, enter
         their username above.  Note that you must enter
         their username <i>exactly</i>.
    </dd>
   </dl>
  </td>
 </tr>

 <tr>
  <td><br></td>
  <td>
    <input type="submit" value="Search">
  </td>
 </tr>
</table>
</form>

</div>
</div>
</body>
</html>