aboutsummaryrefslogtreecommitdiff
path: root/lib/MasterWebInterface
diff options
context:
space:
mode:
authorDarkelarious <darkelarious@333networks.com>2021-10-02 23:36:23 +0200
committerDarkelarious <darkelarious@333networks.com>2021-10-02 23:36:23 +0200
commitae716da5bb24039df3073c04905a5e1444a19771 (patch)
treeba2a04e6d32604500d832dc4d5a56b5efb5eb105 /lib/MasterWebInterface
parent177aa717db0e1879433d9a964f70b71b83da4aec (diff)
downloadWebInterface-Perl-ae716da5bb24039df3073c04905a5e1444a19771.tar.gz
WebInterface-Perl-ae716da5bb24039df3073c04905a5e1444a19771.zip
serverflag symbols and style rotation
Diffstat (limited to 'lib/MasterWebInterface')
-rwxr-xr-xlib/MasterWebInterface/Handler/ServInfo.pm18
-rwxr-xr-xlib/MasterWebInterface/Util/Layout.pm14
2 files changed, 22 insertions, 10 deletions
diff --git a/lib/MasterWebInterface/Handler/ServInfo.pm b/lib/MasterWebInterface/Handler/ServInfo.pm
index 032f929..ef9d2cf 100755
--- a/lib/MasterWebInterface/Handler/ServInfo.pm
+++ b/lib/MasterWebInterface/Handler/ServInfo.pm
@@ -102,26 +102,26 @@ sub show_server
# uplink or manually added/through applet
if ( $info->{f_direct} )
- { div class => "direct", title => "This server uplinks directly to $self->{site_name}.", ""; }
+ { div class => "g"; div class => "direct", title => "This server uplinks directly to $self->{site_name}.", ""; end;}
else
- { div class => "manual", title => "This server was added through master synchronisation and does not uplink to $self->{site_name}.", ""; }
+ { div class => "r"; div class => "manual", title => "This server was added through master synchronisation and does not uplink to $self->{site_name}.", ""; end;}
# authenticated through secure/validate
if ( $info->{f_auth} )
- { div class => "authed", title => "This server authenticated through the secure/validate challenge.", ""; }
+ { div class => "g"; div class => "authed", title => "This server authenticated through the secure/validate challenge.", ""; end;}
else
- { div class => "noauthed", title => "This server failed the secure/validate challenge or did not reply.", ""; }
+ { div class => "r"; div class => "noauthed", title => "This server failed the secure/validate challenge or did not reply.", ""; end;}
# server blacklisted?
if ( $info->{f_blacklist} )
- { div class => "blacklist", title => "This server is blacklisted for violating the $self->{site_name} Terms of Use or by request from the administrator.", ""; }
+ { div class => "r"; div class => "blacklist", title => "This server is blacklisted for violating the $self->{site_name} Terms of Use or by request from the administrator.", ""; end;}
else
- { div class => "noblacklist", title => "This server is not blacklisted by $self->{site_name}.", ""; }
+ { div class => "g"; div class => "noblacklist", title => "This server is not blacklisted by $self->{site_name}.", ""; end;}
if ( $info->{passworded} and $info->{passworded} =~ /(true|1)/i )
- { div class => "passwd", title => "This server requires a password to join.", ""; }
+ { div class => "r"; div class => "passwd", title => "This server requires a password to join.", ""; end;}
else
- { div class => "nopasswd", title => "This server is accessible for everybody.", "";}
+ { div class => "g"; div class => "nopasswd", title => "This server is accessible for everybody.", ""; end;}
end;
h1 title => $info->{hostname} // "[unnamed $gamename server]",
$info->{hostname} // "[unnamed $gamename server]";
@@ -173,7 +173,7 @@ sub show_server
span title => ("Server was added on ". strftime "%e %b %Y", gmtime ($info->{dt_added} // 0) );
txt "information updated ";
- my @t = gmtime( time - ( $info->{dt_updated} // 0 ) );
+ my @t = gmtime( time - ( $info->{dt_serverinfo} // 0 ) );
my $diff;
$diff .= ($t[5]-70)*365 + $t[7] > 0 ? ( ($t[5]-70)*365 + $t[7])." days" : "" ; # years+days
diff --git a/lib/MasterWebInterface/Util/Layout.pm b/lib/MasterWebInterface/Util/Layout.pm
index 536aad7..20647fa 100755
--- a/lib/MasterWebInterface/Util/Layout.pm
+++ b/lib/MasterWebInterface/Util/Layout.pm
@@ -15,12 +15,24 @@ sub htmlHeader
# CSS override: allow passing of style from GET --> ?style=classic
my $style = $self->{style};
+
+ # rotate styles for different occasions.
+ my @dt = localtime(time);
+ # specify dates [m/d] = styles
+ if ($dt[4] == 2 && $dt[3] == 31) {$style = "april";} # 31 mar and 1 apr
+ if ($dt[4] == 3 && $dt[3] == 1) {$style = "april";}
+ if ($dt[4] == 9 && $dt[3] >= 1) {$style = "halloween";}
+ if ($dt[4] == 11 && $dt[3] >= 7) {$style = "xmas";}
+
if (my $overrideStyle = $self->reqParam("style") )
{
# default to custom style if specified option doesn't exist
- $style = ( -e "$self->{root}/s/style/$overrideStyle" ) ? $overrideStyle : $self->{style};
+ $style = $overrideStyle;
}
+ # default to default style if specified option does not exist
+ $style = ( -e "$self->{root}/s/style/$style" ) ? $style : $self->{style};
+
html lang => "en";
head;
title "$o{title} :: $self->{site_name} masterserver";