%#============================================================================ %# ePortal - WEB Based daily organizer %# Author - S.Rusakov %# %# Copyright (c) 2000-2003 Sergey Rusakov. All rights reserved. %# This program is free software; you can redistribute it %# and/or modify it under the same terms as Perl itself. %# %# %#---------------------------------------------------------------------------- %# Parameters: %# text - text to search in Catalog %#----------------------------------------------------------------------------
<% pick_lang( rus => "Результат поиска ", eng => "Search result of ") %><% $ARGS{sd_text} |h%> <& SELF:search, %ARGS &> <& /catalog/search_dialog.mc &>
%#=== @metags search ==================================================== <%method search><%perl> $links_count = 0; my $text = $ARGS{sd_text}; my (@sql_where, @sql_bind); foreach my $t (split('\s+', $text)) { my $like = '%'.$t.'%'; push @sql_where, "(title like ? OR memo like ? OR url like ? OR (recordtype like 'text%' AND text like ?))"; push @sql_bind, $like, $like, $like, $like; } my $catalog = new ePortal::Catalog; <&| /list.mc, obj => $catalog, restore_where => { where => join(' AND ', @sql_where), bind => [ @sql_bind ], order_by => "Title", skip_attributes => [qw/text/]} &> <& /list.mc:column_image &> <&| /list.mc:column, id => 'title', url => '/catalog/'.$_->id. '/' &> <% $_->title |h %> <&| /list.mc:column, id => 'RecordType', -align => 'center' &> <% $_->RecordType eq 'group' ? pick_lang(rus => "Группа ресурсов", eng => "Group") : pick_lang(rus => "Ресурс", eng => "Resource") %> <&| /list.mc:nodata &> <& /message.mc, ErrorMessage => pick_lang( rus => "Поиск не принес результатов", eng => 'Nothing found' ) &> %#=== @METAGS attr ========================================================= <%attr> Title => {rus => "Результат поиска в Каталоге ресурсов", eng => "Search results"} %#=== @METAGS once ========================================================= <%once> my $links_count = 0; %#=== @METAGS HTMLhead ==================================================== <%method HTMLhead> %#=== @METAGS onStartRequest ==================================================== <%method onStartRequest><%perl> if ( ! $ARGS{sd_text} ) { # nothing to search return "index.htm"; }