/[Grep]/share/web/templates/fragments/results
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /share/web/templates/fragments/results

Parent Directory Parent Directory | Revision Log Revision Log


Revision 44 - (hide annotations)
Tue Feb 20 21:55:24 2007 UTC (17 years, 3 months ago) by dpavlin
File size: 1022 byte(s)
refactoring: after testing IPC::PubSub with vairous back-ends, it seems that COMET isn't a
good choice if you want predictible delivery. It also has problems with delay, because it's
a, uh, bus....

However, this refactoring has a good side: code size is reduced and is now easier to handle.
1 dpavlin 24 <%args>
2 dpavlin 44 $q
3     $max => 10
4 dpavlin 28 $item_fragment => 'long'
5 dpavlin 24 $coll => undef
6 dpavlin 44 $result_moniker => 'search'
7     $result => undef
8 dpavlin 24 </%args>
9     <%init>
10    
11     use Data::Dump qw/dump/;
12    
13 dpavlin 44 $result ||= Jifty->web->response->result( $result_moniker );
14     if ( $result and $result->content('search') ) {
15     $coll = $result->content('search');
16 dpavlin 43 } elsif (! defined($coll)) {
17 dpavlin 44 warn "called without result for $result_moniker";
18 dpavlin 24 }
19 dpavlin 40
20 dpavlin 44 warn "notes: ",dump($result->message, $result->error) if ($result);
21    
22 dpavlin 40 my $i = 1;
23    
24 dpavlin 24 </%init>
25 dpavlin 44 % if ($result and $result->message) {
26     <div class="grep-note">
27     <div class="message"><% $result->message %></div>
28     </div>
29     % }
30     % if ($result and $result->error) {
31     <div class="grep-note">
32     <div class="error"><% $result->error %></div>
33     </div>
34     % }
35 dpavlin 24 % if ($coll) {
36     <div class="results">
37 dpavlin 40 % while ( my $i = $coll->next and $i++ <= $max ) {
38 dpavlin 28 <& "/fragments/item/$item_fragment", item => $i &>
39 dpavlin 24 % }
40     </div>
41 dpavlin 40 % if ($i > $max) {
42     <div class="grep-note">
43     <div class="message">
44     Found more than <% $max %> results for '<% $q %>', refine search query....
45     </div>
46     </div>
47     % }
48 dpavlin 24 % }

  ViewVC Help
Powered by ViewVC 1.1.26