package Mlogic;
#
# 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';
use Config::General;
use Mod::Buttons;
use Mod::Libenz;
use Mod::Libenzdb;
use Mod::DBtank;
use POSIX;
use Data::Dumper;
sub new {
my $class = shift;
my $self = {};
bless($self,$class);
return $self;
}
#Template
sub tpl(){
my $self = shift;
my $node_meta = shift;
my $users_dms = shift;
my $mode = shift || "";
my $varenv = shift;
my $users_sharee = shift || "";
my $return = shift || "";
my $q = new CGI;
my $lb = new Libenz;
my $db = new Libenzdb;
my $dbt = new DBtank;
my $but = new Buttons;
my %ib = $but->ibuttons();
my $script = $q->script_name();
my $path_info = $q->path_info();
my $path = $path_info;
if("$varenv->{metahost}"){
$path = "$script" . "$path_info";
$script="";
}
my $coo = $q->cookie(-name=>'domcookie');
my $debug = "";
my $lang = "de";
my @viewsel = split /\//,$1 if($path =~ /^\/(.*)/);
my $view_root = $viewsel[0] || "";
my $mandant = $db->get_node("$view_root","$lang");
my $parent_id = $node_meta->{parent_id};
my $main_id = $node_meta->{main_id};
my $title = "";
$title .= $dbt->{primary}->{$varenv->{dbname}}->{title} if($dbt->{primary}->{$varenv->{dbname}}->{title});
$title .= $dbt->{operator}->{$varenv->{dbname}}->{title} if($dbt->{operator}->{$varenv->{dbname}}->{title});
$title .= " " . $dbt->{operator}->{$varenv->{dbname}}->{oprefix} if($dbt->{operator}->{$varenv->{dbname}}->{oprefix});
$title .= $dbt->{website}->{$varenv->{syshost}}->{title} if($dbt->{website}->{$varenv->{syshost}}->{title});
$title .= " (DEVEL $varenv->{dbname})" if($dbt->{copri_conf}->{stage} eq "test");
###User Panel
if($users_dms->{u_id}){
###header start
print "