aboutsummaryrefslogtreecommitdiff
path: root/lib/MasterWebInterface/Util/FilterBox.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/MasterWebInterface/Util/FilterBox.pm')
-rwxr-xr-xlib/MasterWebInterface/Util/FilterBox.pm43
1 files changed, 43 insertions, 0 deletions
diff --git a/lib/MasterWebInterface/Util/FilterBox.pm b/lib/MasterWebInterface/Util/FilterBox.pm
new file mode 100755
index 0000000..8db7a60
--- /dev/null
+++ b/lib/MasterWebInterface/Util/FilterBox.pm
@@ -0,0 +1,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{gamename} ? "/s/$opt{gamename}" : "/s", '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;