chiark / gitweb /
New way of showing position in list info
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 12 Nov 2009 18:20:16 +0000 (18:20 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 12 Nov 2009 18:20:16 +0000 (18:20 +0000)
yarrg/web/routetrade
yarrg/web/style.css

index 27cf295..4134020 100644 (file)
@@ -695,12 +695,26 @@ SELECT commodclass, maxposinclass FROM commodclasses WHERE commodclassid = ?
 END
                        $findclass->execute($f->{'commodclassid'});
                        my $classinfo= $findclass->fetchrow_hashref();
-                       $$todo->{'posinclass'}=
-                               sprintf "(%s %d/%d)",
-                               $classinfo->{'commodclass'},
-                               $f->{'posinclass'},
-                               $classinfo->{'maxposinclass'}
-                                       if $classinfo->{'maxposinclass'} > 9;
+                       if ($classinfo->{'maxposinclass'} >= 8) {
+                               my $maxpic= $classinfo->{'maxposinclass'};
+                               my $inpic= $f->{'posinclass'};
+                               my @tmbs= qw(TT T M B BB);
+                               my @tmbds= (    'in Top fifth of list',
+                                               'in 2nd fifth of the list',
+                                               'in Middle fifth of the list',
+                                               'in 2nd-bottom fifth of list',
+                                               'in Bottom fifth of the list');
+                               my $tmbi= ($inpic+0.5)*$#tmbs/$maxpic;
+                               my $desc= (sprintf "%s is under %s,".
+                                       " commodity %d of %d;".
+                                       " i.e. %s or %s",
+                                       $f->{'commodname'},
+                                       $classinfo->{'commodclass'},
+                                       $inpic, $maxpic,
+                                       $tmbs[$tmbi], $tmbds[$tmbi]);
+                               $$todo->{'posinclass'}=
+ "<div class=mouseover title=\"$desc\">$tmbs[$tmbi]</div>";
+                       }
                }
                $$todo->{'stallname'}= $stallname;
                $$todo->{Price}= $price;
@@ -764,7 +778,7 @@ END
 % tr_datarow($m,$dline);
 <<% $td %>><% $collectdeliver %>
 <<% $td %>><% $t->{'commodname'} |h %>
-<<% $td %>><% $t->{'posinclass'} |h %>
+<<% $td %>><% $t->{'posinclass'} %>
 %
 %              my @stalls= sort keys %{ $t->{Stalls} };
 %              my $pstall= sub {
index 858dcb9..1d52168 100755 (executable)
@@ -47,4 +47,5 @@ $r->content_type('text/css')
      padding-left: 1em; padding-top: 0.15em;
      padding-right: 1em; padding-bottom: 0.15em;
   }
+  div.mouseover { color: blue; }
   hr { display: none; }