2012-03-03 23:49:10 +01:00
|
|
|
##@file
|
|
|
|
# Menu
|
|
|
|
|
|
|
|
##@class
|
|
|
|
# Menu
|
|
|
|
#
|
|
|
|
# Display a menu on protected applications
|
2017-02-11 08:47:22 +01:00
|
|
|
package Lemonldap::NG::Handler::ApacheMP2::Menu;
|
2012-03-03 23:49:10 +01:00
|
|
|
|
|
|
|
use strict;
|
2017-02-08 23:18:52 +01:00
|
|
|
use base qw(Lemonldap::NG::Handler::ApacheMP2::Main);
|
2012-03-03 23:49:10 +01:00
|
|
|
use Apache2::Filter ();
|
2016-02-15 18:31:26 +01:00
|
|
|
use constant BUFF_LEN => 8192;
|
2012-03-03 23:49:10 +01:00
|
|
|
|
2016-02-17 07:18:23 +01:00
|
|
|
sub handler {
|
|
|
|
my $r = pop;
|
|
|
|
__PACKAGE__->run($r);
|
|
|
|
}
|
|
|
|
|
2012-03-03 23:49:10 +01:00
|
|
|
## @rmethod Apache2::Const run(Apache2::Filter f)
|
|
|
|
# Overload main run method
|
|
|
|
# @param f Apache2 Filter
|
|
|
|
# @return Apache2::Const::OK
|
|
|
|
sub run {
|
|
|
|
my $class = shift;
|
|
|
|
my $f = $_[0];
|
|
|
|
|
|
|
|
unless ( $f->ctx ) {
|
|
|
|
$f->r->headers_out->unset('Content-Length');
|
|
|
|
$f->ctx(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
# CSS parameters
|
|
|
|
my $background = "#ccc";
|
|
|
|
my $border = "#aaa";
|
|
|
|
my $width = "30%";
|
|
|
|
my $marginleft = "35%";
|
|
|
|
my $marginright = "35%";
|
|
|
|
|
2016-02-14 09:13:56 +01:00
|
|
|
my $menudiv = qq(
|
2012-03-03 23:49:10 +01:00
|
|
|
<style>
|
|
|
|
#lemonldap-ng-menu {
|
|
|
|
background-color: $background;
|
|
|
|
border-color: $border;
|
|
|
|
border-width: 2px 2px 0 2px;
|
|
|
|
border-style: solid;
|
|
|
|
border-top-left-radius: 10px;
|
|
|
|
border-top-right-radius: 10px;
|
|
|
|
width: $width;
|
|
|
|
margin-right: $marginright;
|
|
|
|
margin-left: $marginleft;
|
|
|
|
position: absolute;
|
|
|
|
bottom: 0px;
|
|
|
|
text-align: center;
|
|
|
|
padding: 3px;
|
|
|
|
z-index: 2;
|
|
|
|
}
|
|
|
|
html>body #lemonldap-ng-menu {
|
|
|
|
position: fixed;
|
|
|
|
}
|
|
|
|
</style>
|
2016-02-14 09:13:56 +01:00
|
|
|
<div id="lemonldap-ng-menu">
|
2016-03-17 23:19:44 +01:00
|
|
|
<a href=") . $class->tsv->{portal}->() . qq(">☖ Home</a>
|
2012-03-03 23:49:10 +01:00
|
|
|
<span> </span>
|
2016-03-17 23:19:44 +01:00
|
|
|
<a href=") . $class->tsv->{portal}->() . qq(?logout=1">☒ Logout</a>
|
2016-02-14 09:13:56 +01:00
|
|
|
</div>);
|
2012-03-03 23:49:10 +01:00
|
|
|
|
|
|
|
while ( $f->read( my $buffer, BUFF_LEN ) ) {
|
|
|
|
$buffer =~ s/<\/body>/$menudiv<\/body>/g;
|
|
|
|
$f->print($buffer);
|
|
|
|
}
|
|
|
|
|
2016-03-17 23:19:44 +01:00
|
|
|
return $class->OK;
|
2012-03-03 23:49:10 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
1;
|