aboutsummaryrefslogtreecommitdiff
path: root/lib/MasterWebInterface/Util/FilterBox.pm
blob: 40218acf5240acb2fdc8f1cafb3f34a7ef435364 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package MasterWebInterface::Util::FilterBox;
use strict;
use warnings;
use utf8;
use TUWF ':html', 'xml_escape';
use Exporter 'import';
our @EXPORT = qw| htmlFilterBox |;

# generates a filter box, arguments:
# title  => games/ (game) servers
# action => form action
# sel    => g or s selected
# fq     => form query string
sub htmlFilterBox
{
    my($self, %opt) = @_;
    
    div class => 'mainbox';
        div class => "header";
            h1 "Browse Servers";
            p class => "alttitle", "An overview of games titles and servers that are currently online.";
        end;
        
        # filter box
        form action => $opt{action}, 'accept-charset' => 'UTF-8', method => 'get';
            fieldset class => 'simple';
                a href => '/g',    $opt{sel} eq 'g' ? (class => 'sel') : (), 'Games';
                a href => '/s',    $opt{sel} eq 's' ? (class => 'sel') : (), 'Servers';
                input type => 'text', name => 'q', id => 'q', class => 'text', value => $opt{fq} || 'filter...';
                input type => 'submit', class => 'submit', value => 'submit';
            end 'fieldset';
        end; # form

        div class => "simpleadvanced";
            a href => $opt{gamename} ? "/adv/$opt{gamename}" : "/adv";
                txt "advanced server filter ";
                lit "\x{25BE}";
            end;
        end;
    end 'div'; # mainbox
}

1;