%#--- Arguments ---#

<%args>
$widget
$object
$disp_field
$use_form_tag
$wf
</%args>

%#--- Initialization ---#
<%init>
my $agent = detect_agent();
my $spacerRow = $agent->ie ? '<img src="/media/images/spacer.gif" width=550 height=3>' : "";

my $advanced_search = get_state_data($widget, 'advanced_search')
  || get_pref('Default Search');
my $asset_opts = $advanced_search ? {
        '' => $lang->maketext('All Types'),
        map { $_->get_id, $_->get_name }
          Bric::Biz::AssetType->list({
              top_level => 1,
              media     => 1,
              active    => 1,
              site_id   => $wf->get_site_id,
          })
    } : undef;
</%init>

% if ($use_form_tag) {
<form action="<% $r->uri %>" method="post">
% }

<table border=0 cellpadding=0 cellspacing=0 width=580>
<tr>
  <td class=darkHeader valign=top width=13><img src="/media/images/666633_curve_left.gif" width=13 height=18></td>
% unless ($advanced_search) {
  <td class=darkHeader width=556><% $lang->maketext('SEARCH') %> [ <a href="<% $r->uri %>?<% $widget %>|set_advanced_cb=1" class="whiteUnderlinedLink"><% $lang->maketext('Advanced Search') %></a> ]</td>
% } else {
  <td class=darkHeader width=556><% $lang->maketext('ADVANCED SEARCH') %> [ <a href="<% $r->uri %>?<% $widget %>|unset_advanced_cb=1" class="whiteUnderlinedLink"><% $lang->maketext('Simple Search') %></a> ]</td>
% }
  <td class=darkHeader valign=top width=13 align=right><img src="/media/images/666633_curve_right.gif" width=13 height=18></td>
</tr>
</table>
<table border=0 cellpadding=0 cellspacing=0 width=580>
<tr>
  <td class=darkHeader><img src="/media/images/spacer.gif" width=1 height=1></td>
  <td class=lightHeader>
<% $spacerRow %>
            <table>
% unless ($advanced_search) {
              <tr>
                <td>
                  <& /widgets/profile/text.mc, 
                     name     => $widget.'|simple',
                     value    => get_state_data($widget, 'simple') || '',
                     useTable => 0 &>
                </td>
                <td>
%# This hidden field is required to make the form submit when the user hits
%# the "enter" key.
                  <input type="hidden" name="<% $widget %>|media_cb" value="Search" />
                  <input type="image" src="/media/images/<% $lang_key %>/search_red.gif" border=0 name="<% $widget %>|media_cb" value="Search">
                </td>
% } else {
              <tr>
                <td align="right"><span class=label><% $lang->maketext('Title') %>:</span></td>
                <td>
                  <& /widgets/profile/text.mc, 
                     name     => $widget.'|name',
                     value    => get_state_data($widget, 'name') || '',
                     useTable => 0 &>
                </td>
              </tr>             
              <tr>
                <td align="right"><span class=label><% $lang->maketext('URI') %>:</span></td>
                <td>
                  <& /widgets/profile/text.mc, 
                     name     => $widget.'|uri',
                     value    => get_state_data($widget, 'uri') || '',
                     useTable => 0 &>
                </td>
              </tr>
                <td align="right"><span class=label><% $lang->maketext('Text to search') %>:</span></td>
                <td>
                  <& /widgets/profile/text.mc,
                     name     => $widget.'|data_text',
                     value    => get_state_data($widget, 'data_text') || '',
                     useTable => 0 &>
                </td>
              </tr>
              <tr>

              <tr>
                <td align="right"><span class=label><% $lang->maketext('Type') %>:</span></td>
                <td>
                  <& /widgets/profile/select.mc, 
                     name     => $widget.'|element__id',
                     value    => get_state_data($widget, 'element__id') || '',
                     options  => $asset_opts,
                     localize => 0,
                     useTable => 0 &>
                </td>
              </tr>
              <tr>
                <td colspan=2><span class=label><% $lang->maketext('Cover Date') %></span><br />
                  <% $lang->maketext('From') %>:
                  <& '/widgets/select_time/select_time.mc',
                     base_name  => "$widget|cover_date_start",
                     indent     => 1,
                     no_hour    => 1,
                     no_min     => 1,
                     repopulate => 0,
                     def_date   => get_state_data($widget, 'cover_date_start')||'',
                     compact    => 1,
                     style      => 'inline',
                  &>
                  <% $lang->maketext('To') %>:
                  <& '/widgets/select_time/select_time.mc', 
                     base_name  => "$widget|cover_date_end",
                     indent     => 1,
                     no_hour    => 1,
                     no_min     => 1,
                     repopulate => 0,
                     def_date   => get_state_data($widget, 'cover_date_end')||'',
                     compact    => 1,
                     style      => 'inline',
                  &>
                </td>
              </tr>
              <tr>
                <td colspan=2><span class=label><% $lang->maketext('Publish Date') %></span><br />
                  <% $lang->maketext('From') %>:
                  <& '/widgets/select_time/select_time.mc', 
                     base_name  => "$widget|publish_date_start",
                     indent     => 1,
                     no_hour    => 1,
                     no_min     => 1,
                     repopulate => 0,
                     def_date   => get_state_data($widget, 'publish_date_start')||'',
                     compact    => 1,
                     style      => 'inline',
                  &>
                  <% $lang->maketext('To') %>:
                  <& '/widgets/select_time/select_time.mc', 
                     base_name  => "$widget|publish_date_end",
                     indent     => 1,
                     no_hour    => 1,
                     no_min     => 1,
                     repopulate => 0,
                     def_date   => get_state_data($widget, 'publish_date_end')||'',
                     compact    => 1,
                     style      => 'inline',
                  &>
                </td>
              </tr>
              <tr>
                <td colspan=2><span class=label><% $lang->maketext('Expire Date') %></span><br />
                  <% $lang->maketext('From') %>:
                  <& '/widgets/select_time/select_time.mc', 
                     base_name  => "$widget|expire_date_start",
                     indent     => 1,
                     no_hour    => 1,
                     no_min     => 1,
                     repopulate => 0,
                     def_date   => get_state_data($widget, 'expire_date_start')||'',
                     compact    => 1,
                     style      => 'inline',
                  &>
                  <% $lang->maketext('To') %>:
                  <& '/widgets/select_time/select_time.mc', 
                     base_name  => "$widget|expire_date_end",
                     indent     => 1,
                     no_hour    => 1,
                     no_min     => 1,
                     repopulate => 0,
                     def_date   => get_state_data($widget, 'expire_date_end')||'',
                     compact    => 1,
                     style      => 'inline',
                  &>
                </td>
              </tr>
% }
            </table>
  </td>
  <td class=darkHeader><img src="/media/images/spacer.gif" width=1 height=1></td>
</tr>
<tr>
  <td class=darkHeader width=580 colspan=2><img src="/media/images/spacer.gif" width=580 height=1></td>
</tr>
</table>
% if ($advanced_search) {
<p></p>
<input type="image" src="/media/images/<% $lang_key %>/search_lgreen.gif" border=0 name="<% $widget %>|media_cb" value="Search">
<input type="image" src="/media/images/<% $lang_key %>/clear_values_lgreen.gif" border=0 name="<% $widget %>|clear_cb" value="Clear Values">
% }
%#--- Log History ---#
% if ($use_form_tag) {
</form>
% }

