<%args> $widget $object $disp_field $use_form_tag $wf $state <%init> my $advanced_search = $state->{advanced_search}; $advanced_search = get_pref('Default Search') unless defined $advanced_search; my $asset_opts = $advanced_search ? { '' => $lang->maketext('All Types'), map { $_->get_id, $_->get_name } Bric::Biz::ElementType->list({ top_level => 1, media => 1, active => 1, }) } : undef; my $sites = $c->get('__SITES__'); unless ($sites) { $sites = Bric::Biz::Site->list({ active => 1 }); $c->set('__SITES__', $sites); } $sites = [grep { chk_authz($_, EDIT, 1) } @$sites]; % if ($use_form_tag) {
% } <%perl> my $caption; unless ($advanced_search) { $caption = sprintf(qq{%s ~[%s~]}, $lang->maketext('Search'), $r->uri, $widget, $lang->maketext('Advanced Search')); } else { $caption = sprintf(qq{%s ~[%s~]}, $lang->maketext('Advanced Search'), $r->uri, $widget, $lang->maketext('Simple Search')); } $m->comp("/widgets/wrappers/sharky/table_top.mc", caption => $caption, search => 1); % unless ($advanced_search) { <& '/widgets/profile/text.mc', name => $widget.'|simple', value => $state->{simple} || '', useTable => 0 &> % # This hidden field is required to make the form submit when the user hits % # the "enter" key. <& '/widgets/profile/hidden.mc', name => $widget.'|media_cb', value => 'Search' &> <& '/widgets/profile/button.mc', disp => $lang->maketext('Search'), widget => $widget, cb => 'media_cb', button => 'search_red', useTable => 0 &> % } else { <& /widgets/profile/text.mc, disp => $lang->maketext('Title'), name => $widget.'|name', value => $state->{name} || '' &> <& /widgets/profile/text.mc, disp => $lang->maketext('URI'), name => $widget.'|uri', value => $state->{uri} || '' &> <& /widgets/profile/text.mc, disp => $lang->maketext('Text to search'), name => $widget.'|data_text', value => $state->{data_text} || '' &> <& /widgets/profile/select.mc, disp => $lang->maketext('Type'), name => $widget.'|element_type_id', value => $state->{element_type_id} || '', options => $asset_opts, localize => 0 &> % my $active_checked = $state->{active} ? 1 : 0; <& /widgets/profile/checkbox.mc, disp => $lang->maketext('Include deleted'), name => $widget . '|active', value => 'tf', # XXX: 't' and 'f' (see Bric::App::Callback::Search) checked => $active_checked, localize => 0, useTable => 1, &> % if (get_pref("Filter by Site Context")) { <& /widgets/profile/hidden.mc, name => "$widget|site_id", value => $c->get_user_cx(get_user_id) &> % } elsif (@$sites > 1) { <& /widgets/profile/select.mc, disp => $lang->maketext('Site'), name => $widget.'|site_id', value => $state->{site_id} || '', options => [ [ '' => $lang->maketext('All Sites') ], map { [$_->get_id => $_->get_name] } @$sites ], localize => 0 &> % }
<% $lang->maketext('Cover Date') %>:
<& '/widgets/select_time/select_time.mc', base_name => "$widget|cover_date_start", indent => 1, no_hour => 1, no_min => 1, repopulate => 0, def_date => $state->{cover_date_start} ||'', compact => 1, style => 'inline', &> —<& '/widgets/select_time/select_time.mc', base_name => "$widget|cover_date_end", indent => 1, no_hour => 1, no_min => 1, repopulate => 0, def_date => $state->{cover_date_end} ||'', compact => 1, style => 'inline', &>
<% $lang->maketext('Publish Date') %>:
<& '/widgets/select_time/select_time.mc', base_name => "$widget|publish_date_start", indent => 1, no_hour => 1, no_min => 1, repopulate => 0, def_date => $state->{publish_date_start} ||'', compact => 1, style => 'inline', &> —<& '/widgets/select_time/select_time.mc', base_name => "$widget|publish_date_end", indent => 1, no_hour => 1, no_min => 1, repopulate => 0, def_date => $state->{publish_date_end} ||'', compact => 1, style => 'inline', &>
<% $lang->maketext('Expire Date') %>:
<& '/widgets/select_time/select_time.mc', base_name => "$widget|expire_date_start", indent => 1, no_hour => 1, no_min => 1, repopulate => 0, def_date => $state->{expire_date_start} ||'', compact => 1, style => 'inline', &> —<& '/widgets/select_time/select_time.mc', base_name => "$widget|expire_date_end", indent => 1, no_hour => 1, no_min => 1, repopulate => 0, def_date => $state->{expire_date_end} ||'', compact => 1, style => 'inline', &>
<& /widgets/profile/button.mc, disp => $lang->maketext('Search'), widget => $widget, cb => 'media_cb', button => 'search_red', useTable => 0 &> <& /widgets/profile/button.mc, disp => $lang->maketext('Clear Values'), widget => $widget, cb => 'clear_cb', button => 'clear_values_lgreen', useTable => 0 &>
% } <& '/widgets/wrappers/sharky/table_bottom.mc' &> %#--- Log History ---# % if ($use_form_tag) {
% }