}
sub HTML::Element::fid { shift->look_down(id => shift) }
-sub HTML::Element::fclass { shift->look_down(class => shift) }
+sub HTML::Element::fclass { shift->look_down(class => qr/\b$_[0]\b/) }
sub HTML::Element::namedlink {
my ($self, $id, $name) = @_;
stop => ftime $args{stop},
status => $status,
description => literal $args{description});
+ $tree->fid('ctcountdown')->detach if $args{time} >= $args{stop};
}
sub process_ct {
$tree->fid('solution_modal')->fclass('modal-body')->replace_content(literal $args{solution});
}
if ($args{cansubmit}) {
+ $tree->fid('nosubmit')->detach;
$tree->look_down(name => 'problem')->attr(value => $args{id});
my $contest = $tree->look_down(name => 'contest');
$contest->attr(value => $args{contest}) if $args{contest};
$contest->detach unless $args{contest}
} else {
+ $tree->fid('nosubmit')->find('a')->edit_href(sub{s/id/$args{id}/});
$tree->fid('submit')->detach
}
}
$tr->fclass('name')->namedlink($data->{id}, $data->{name});
$tr->fclass('name')->find('a')->edit_href(sub {$_ .= "?contest=$args{contest}"}) if $args{contest};
$tr->fclass('owner')->namedlink($data->{owner}, $data->{owner_name});
- $tr->find('td')->attr(class => $tr->find('td')->attr('class').' warning') if $data->{private};
+ $tr->find('td')->attr(class => $tr->find('td')->attr('class').' warning') if $data->{private} && !$args{contest};
};
my $iter = sub {
my ($data, $div) = @_;
$div->find('tbody')->find('tr')->iter3($args{$data}, $titer);
};
$tree->fid('beginner')->iter3([grep {$args{$_}} qw/beginner easy medium hard/], $iter);
+ $tree->fid('open-alert')->detach unless $args{contest};
}
sub process_log_entry {
$tr->fclass('contest')->namedlink($data->{contest}, $data->{contest_name}) if $data->{contest};
$tr->fclass('contest')->replace_content('None') unless $data->{contest};
$tr->fclass('date')->replace_content(ftime $data->{date});
- $tr->fclass('format')->replace_content($data->{format});
- $tr->fclass('size')->namedlink("$data->{id}.$data->{extension}", sprintf "%.2fKB", $data->{size}/1024);
- $tr->fclass('size')->attr('data-private', '') if $data->{private};
+ $tr->fclass('source')->namedlink("$data->{id}.$data->{extension}", sprintf "%.2fKB %s", $data->{size}/1024, $data->{format});
$tr->fclass('owner')->namedlink($data->{owner}, $data->{owner_name});
$tr->fclass('result_text')->replace_content($data->{result_text});
$tr->fclass('result_text')->attr(class => "r$data->{result}");
next unless $elem;
delete $args{args}{page};
my $str = join '&', map { $_ . '=' . $args{args}{$_} } keys %{$args{args}};
- $elem->find('a')->edit_href(sub{s/$/&$str/});
+ $elem->find('a')->edit_href(sub{s/$/&$str/}) if $str;
}
$tree->fclass('current')->replace_content("Page $args{current_page} of $args{last_page}");
}
sub process_ed {
my ($tree, %args) = @_;
+ $tree->content_handler(editorial => literal $args{editorial});
my $iter = sub {
my ($data, $div) = @_;
$div->set_child_content(class => 'value', $data->{value});
$div->set_child_content(class => 'solution', literal $data->{solution});
$div->fclass('problem')->namedlink($data->{id}, $data->{name});
};
- my @pb = map { @{$args{$_}} } qw/beginner easy medium hard/;
+ my @pb = map { @{$args{$_} // []} } qw/beginner easy medium hard/;
$tree->fclass('well')->iter3(\@pb, $iter);
}