chiark / gitweb /
Tickbox for each line
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 23 Aug 2009 12:49:55 +0000 (13:49 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 23 Aug 2009 12:49:55 +0000 (13:49 +0100)
yarrg/web/lookup
yarrg/web/query_route
yarrg/web/routetrade

index 683fd12b8ddf4b60c35c71e4a0f06cd8d4c056ce..8475f689d4bb31b3bc452d5a99eccf163a7895f9 100755 (executable)
@@ -135,7 +135,12 @@ foreach my $var (@vars) {
 
 foreach my $var (keys %ARGS) {
        next unless $var =~
-               m/^(?:(?:route|commod)string|islandid\d|archipelago\d|debug)$/;
+               m/^(?: (?:route|commod)string |
+                       islandid \d |
+                       archipelago \d |
+                       debug |
+                       rtsel[ag]_\w+
+                   )$/x;
        my $val= $ARGS{$var};
        next if $val eq 'none';
        $queryqf{$var}= $val;
index b2c52b158f3b7c6531b48fbf9b0b34677ed56df8..18c3ecb1390af1f2d3a3fc4f2108d2a64f5c90ce 100644 (file)
@@ -166,9 +166,8 @@ function ms_Setarch(dd) {
 % } #---------- end of dropdowns, now common middle of page code ----------
 
 <input type=submit name=submit value="Go">
-% my $ours= sub { $_[0] =~ m/^island|^archipelago|^routestring/; };
+% my $ours= sub { $_[0] =~ m/^island|^archipelago|^routestring|^rtsel[ag]_/; };
 <& "lookup:formhidden", ours => $ours &>
-</form>
 
 <%perl>
 #========== results ==========
@@ -213,4 +212,5 @@ for my $dd (0..$qa->{Dropdowns}-1) {
    archipelagoes => \@archipelagoes,
    qa => $qa
  &>
+</form>
 % }
index 597f9eea3f7fc937a921e6056348064e1a041d66..dcf3671620f32b8680c7375b6d714e911442ed0d 100644 (file)
@@ -191,6 +191,11 @@ push @columns,                  qw(commodname
        }
        $f->{Uid}= join '_', @uid;
 
+       if ($qa->{"rtsela_$f->{Uid}"} &&
+           !$qa->{"rtselg_$f->{Uid}"}) {
+               $f->{Suppress}= 1;
+       }
+
        push @flows, $f;
 
 </%perl>
@@ -230,6 +235,12 @@ Subject To
 
 my %avail_csts;
 foreach my $flow (@flows) {
+       if ($flow->{Suppress}) {
+               $cplex .= "
+   $flow->{Var} = 0
+";
+               next;
+       }
        foreach my $od (qw(org dst)) {
                my $cstname= join '_', (
                        'avail',
@@ -313,6 +324,7 @@ push @columns, qw(OptQty OptCapital OptProfit);
 %      my $cdstall= $qa->{ShowStalls} ? '<th>Stall</th>' : '';
 <table>
 <tr>
+<th>
 <th<% $cdspan %>>Collect
 <th<% $cdspan %>>Deliver
 <th>
@@ -325,6 +337,7 @@ push @columns, qw(OptQty OptCapital OptProfit);
 %      }
 
 <tr>
+<th>
 <th>Island <% $cdstall %>
 <th>Island <% $cdstall %>
 <th>Commodity
@@ -346,12 +359,17 @@ push @columns, qw(OptQty OptCapital OptProfit);
 
 % foreach my $flow (@flows) {
 <tr>
+<td><input type=hidden   name=rtsela_<% $flow->{Uid} %> value=1>
+    <input type=checkbox name=rtselg_<% $flow->{Uid} %> value=1
+       <% $flow->{Suppress} ? '' : 'checked' %> >
 %      foreach my $col (@columns) {
 <td><% $flow->{$col} |h %>
 %      }
 % }
 </table>
 
+<input type=submit name=update value="Update">
+
 <%init>
 use CommodsWeb;
 use Commods;