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 27cf295d19376abb8451f7dbba43f972a7aab100..41340201bfc8f4d7ab99d2e87a65046d6178b784 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 858dcb9f9d3b056ad59ec05e6df14e6cfb84fc21..1d52168653a072bc07bd5d36cad37f431d0a176e 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; }