From 4311ae355f0a94637c94d1d02a6edcbe65bebaa7 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 23 Aug 2009 13:49:55 +0100 Subject: [PATCH] Tickbox for each line --- yarrg/web/lookup | 7 ++++++- yarrg/web/query_route | 4 ++-- yarrg/web/routetrade | 18 ++++++++++++++++++ 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/yarrg/web/lookup b/yarrg/web/lookup index 683fd12..8475f68 100755 --- a/yarrg/web/lookup +++ b/yarrg/web/lookup @@ -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; diff --git a/yarrg/web/query_route b/yarrg/web/query_route index b2c52b1..18c3ecb 100644 --- a/yarrg/web/query_route +++ b/yarrg/web/query_route @@ -166,9 +166,8 @@ function ms_Setarch(dd) { % } #---------- end of dropdowns, now common middle of page code ---------- -% my $ours= sub { $_[0] =~ m/^island|^archipelago|^routestring/; }; +% my $ours= sub { $_[0] =~ m/^island|^archipelago|^routestring|^rtsel[ag]_/; }; <& "lookup:formhidden", ours => $ours &> - <%perl> #========== results ========== @@ -213,4 +212,5 @@ for my $dd (0..$qa->{Dropdowns}-1) { archipelagoes => \@archipelagoes, qa => $qa &> + % } diff --git a/yarrg/web/routetrade b/yarrg/web/routetrade index 597f9ee..dcf3671 100644 --- a/yarrg/web/routetrade +++ b/yarrg/web/routetrade @@ -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; @@ -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} ? 'Stall' : ''; + + +
>Collect >Deliver @@ -325,6 +337,7 @@ push @columns, qw(OptQty OptCapital OptProfit); % }
Island <% $cdstall %> Island <% $cdstall %> Commodity @@ -346,12 +359,17 @@ push @columns, qw(OptQty OptCapital OptProfit); % foreach my $flow (@flows) {
{Uid} %> value=1> + {Uid} %> value=1 + <% $flow->{Suppress} ? '' : 'checked' %> > % foreach my $col (@columns) { <% $flow->{$col} |h %> % } % }
+ + <%init> use CommodsWeb; use Commods; -- 2.30.2