2021-12-30 12:05:56 +01:00
|
|
|
package Failure;
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
# Copyright (c) Rainer Gümpelein, TeilRad GmbH
|
|
|
|
#
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use CGI::Carp qw(fatalsToBrowser);
|
|
|
|
use CGI ':standard';
|
2023-01-17 20:43:36 +01:00
|
|
|
use POSIX;
|
|
|
|
use Data::Dumper;
|
2021-12-30 12:05:56 +01:00
|
|
|
|
|
|
|
sub new {
|
|
|
|
my $class = shift;
|
|
|
|
my $self = {};
|
|
|
|
bless($self,$class);
|
|
|
|
return $self;
|
|
|
|
}
|
|
|
|
|
2023-01-17 20:43:36 +01:00
|
|
|
#just some frontend feedback
|
2021-12-30 12:05:56 +01:00
|
|
|
sub tpl(){
|
2023-01-17 20:43:36 +01:00
|
|
|
my $varenv = shift;
|
|
|
|
my $u_id = shift || "";
|
|
|
|
my $feedb = shift || {};
|
2021-12-30 12:05:56 +01:00
|
|
|
my $q = new CGI;
|
2023-01-17 20:43:36 +01:00
|
|
|
my $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime;
|
|
|
|
|
|
|
|
open(FILE,">>$varenv->{logdir}/feedbFailure.log");
|
|
|
|
print FILE "\n*-->syshost $varenv->{syshost} $now_dt| u_id: $u_id\n";
|
|
|
|
print FILE Dumper($feedb) . "\n";
|
|
|
|
|
|
|
|
my $failure = $feedb->{message} || "";
|
2021-12-30 12:05:56 +01:00
|
|
|
$failure =~ s/failure:://g;
|
2023-01-17 20:43:36 +01:00
|
|
|
my $link = "";
|
|
|
|
my $lname = "";
|
|
|
|
($failure,$link,$lname) = split(/::/,$failure);
|
2021-12-30 12:05:56 +01:00
|
|
|
my $width="600";
|
|
|
|
my $height="300";
|
2023-01-17 20:43:36 +01:00
|
|
|
my $bg_color1 = "white";
|
|
|
|
my $bg_color2 = "";
|
2021-12-30 12:05:56 +01:00
|
|
|
|
2023-01-17 20:43:36 +01:00
|
|
|
print FILE "$failure | $link | $lname\n";
|
2021-12-30 12:05:56 +01:00
|
|
|
|
2023-01-17 20:43:36 +01:00
|
|
|
if($varenv->{syshost} =~ /shareedms-/){
|
2021-12-30 12:05:56 +01:00
|
|
|
print<<EOF
|
|
|
|
<style>
|
|
|
|
.ui-dialog .ui-dialog-content {
|
|
|
|
background: $bg_color1;
|
|
|
|
}
|
|
|
|
.ui-dialog > .ui-widget-header {
|
|
|
|
color:red;
|
|
|
|
font-weight:normal;
|
|
|
|
border:1px solid $bg_color2;
|
|
|
|
background: $bg_color2;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
\$(function() {
|
|
|
|
\$( "#dialog-failure" )
|
|
|
|
.css("background-color","$bg_color1")
|
|
|
|
.dialog({
|
|
|
|
height: $height,
|
|
|
|
width: $width,
|
|
|
|
closeOnEscape: true,
|
|
|
|
modal: true
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
EOF
|
|
|
|
;
|
2023-01-17 20:43:36 +01:00
|
|
|
}
|
2021-12-30 12:05:56 +01:00
|
|
|
|
|
|
|
my $title = "Achtung";
|
|
|
|
my $back = "zurück";
|
2023-01-17 20:43:36 +01:00
|
|
|
print "<div id='dialog-failure' style='text-align:left;margin:auto;max-width:600px;' title='$title'>";
|
2021-12-30 12:05:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
print "<div style='padding:1em;background-color:white;'>\n";
|
|
|
|
print $q->div("$failure");
|
|
|
|
|
|
|
|
print "<style>.linknav2 { margin:3px; padding:1px 20px; border: 1px solid $bg_color2; background-color: $bg_color2; font-size:13px; text-decoration: none; } .linknav2:hover { color:#464433;}</style>\n";
|
|
|
|
|
|
|
|
print $q->div({-style=>'float:left;padding:1em;'}, $q->a({-class=>"linknav2",-href=>"$link",-title=>''}, " $lname ")) if($lname);
|
|
|
|
print $q->div({-style=>'float:left;padding:1em;'},$q->a({-class=>"linknav2",-href=>'javascript:history.back()'}, " $back "));
|
|
|
|
print "</div>\n";
|
|
|
|
|
|
|
|
print "</div>";
|
2023-01-17 20:43:36 +01:00
|
|
|
|
|
|
|
close(FILE);
|
2021-12-30 12:05:56 +01:00
|
|
|
}
|
|
|
|
1;
|