chiark / gitweb /
More clearly explain [?] for location codes
[ypp-sc-tools.db-live.git] / yarrg / web / routetrade
index 27cf295d19376abb8451f7dbba43f972a7aab100..59a856631b5a1cfdc042664a3d7c67815453c61f 100644 (file)
@@ -638,14 +638,18 @@ Generated by YARRG at <strong><%
 %
 % foreach my $i (0..$#islandids) {
 <% $tbody->(1) %>
-<tr><td colspan=5>
+<tr>
 %      $iquery->execute($islandids[$i]);
 %      my ($islandname) = $iquery->fetchrow_array();
 %      if (!$i) {
+<td colspan=2>
 <strong>Start at <% $islandname |h %></strong>
+<td colspan=2><a href="docs#posinclass">[what are these codes?]</a>
+<td>
 %      } else {
 %              my $this_dist= $distance->($islandids[$i-1],$islandids[$i]);
 %              $total_dist += $this_dist;
+<td colspan=5>
 <%perl>
                my $total_value= 0;
                foreach my $sf (@subflows) {
@@ -689,18 +693,31 @@ Generated by YARRG at <strong><%
                } unless $$todo;
                $$todo->{'commodname'}= $f->{'commodname'};
                $$todo->{'posinclass'}= '';
-               if ($f->{'posinclass'}) {
-                       my $findclass= $dbh->prepare(<<END);
+               my $incl= $f->{'posinclass'};
+
+               my $findclass= $dbh->prepare(<<END);
 SELECT commodclass, maxposinclass FROM commodclasses WHERE commodclassid = ?
 END
-                       $findclass->execute($f->{'commodclassid'});
-                       my $classinfo= $findclass->fetchrow_hashref();
+               $findclass->execute($f->{'commodclassid'});
+               my $classinfo= $findclass->fetchrow_hashref();
+               if ($classinfo) {
+                       my $clname= $classinfo->{'commodclass'};
+                       my $desc= encode_entities(sprintf "%s is under %s",
+                                       $f->{'commodname'}, $clname);
+                       my $abbrev= substr($clname,0,1);
+                       if ($incl) {
+                               my $maxpic= $classinfo->{'maxposinclass'};
+                               $desc.= (sprintf ", commodity %d of %d",
+                                       $incl, $maxpic);
+                               if ($classinfo->{'maxposinclass'} >= 8) {
+                                       my @tmbs= qw(0 1 2 3 4 5 6 7 8 9);
+                                       my $tmbi= ($incl+0.5)*$#tmbs/$maxpic;
+                                       $abbrev.= " ".$tmbs[$tmbi]."&nbsp;";
+                               }
+                       }
                        $$todo->{'posinclass'}=
-                               sprintf "(%s %d/%d)",
-                               $classinfo->{'commodclass'},
-                               $f->{'posinclass'},
-                               $classinfo->{'maxposinclass'}
-                                       if $classinfo->{'maxposinclass'} > 9;
+                               "<div class=mouseover title=\"$desc\">"
+                               .$abbrev."</div>";
                }
                $$todo->{'stallname'}= $stallname;
                $$todo->{Price}= $price;
@@ -764,7 +781,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 {