2021-12-30 12:05:56 +01:00
|
|
|
package Contact;
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
# Copyright (c) Rainer Gümpelein, TeilRad GmbH
|
|
|
|
#
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use CGI ':standard';
|
|
|
|
use Lib::Config;
|
|
|
|
use Mod::Buttons;
|
|
|
|
use Mod::Libenz;
|
|
|
|
use Mod::DBtank;
|
|
|
|
use Encode;
|
|
|
|
use Data::Dumper;
|
|
|
|
|
|
|
|
sub new {
|
|
|
|
my $class = shift;
|
|
|
|
my $self = {};
|
|
|
|
bless($self,$class);
|
|
|
|
return $self;
|
|
|
|
}
|
|
|
|
|
|
|
|
#Template
|
|
|
|
sub tpl(){
|
|
|
|
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 $cf = new Config;
|
|
|
|
my $but = new Buttons;
|
|
|
|
my $lb = new Libenz;
|
|
|
|
my $dbt = new DBtank;
|
|
|
|
|
|
|
|
my $lang = "de";
|
|
|
|
my $script = $q->script_name();
|
|
|
|
my $path_info = $q->path_info();
|
|
|
|
my $path = $path_info;
|
|
|
|
#with meta_host,
|
|
|
|
if($varenv->{metahost}){
|
|
|
|
$path = "$script" . "$path_info";
|
|
|
|
$script="";
|
|
|
|
}
|
|
|
|
my $user_agent = $q->user_agent();
|
|
|
|
my @tpl_order = split /,/,$node_meta->{tpl_order};
|
|
|
|
my $main_ids = $node_meta->{main_id};
|
|
|
|
my @viewsel = split /\//,$1 if($path =~ /^\/(.*)/);
|
|
|
|
|
|
|
|
my $session="";
|
|
|
|
my $session_and="";
|
|
|
|
if(length($R::sessionid) > 20){
|
|
|
|
$session = "?sessionid=$R::sessionid";
|
|
|
|
$session_and = "&sessionid=$R::sessionid";
|
|
|
|
}
|
|
|
|
|
2022-04-04 14:57:43 +02:00
|
|
|
my $project = "";#project dependent operator contact match
|
|
|
|
my $oprefix = "";#single operator contact match
|
2022-03-14 17:37:49 +01:00
|
|
|
$project = "Freiburg" if($varenv->{syshost} eq "shareeweb-sharee");
|
2021-12-30 12:05:56 +01:00
|
|
|
$project = "Bayern" if($varenv->{syshost} eq "shareeweb-bayern");
|
|
|
|
$project = "Konstanz" if($varenv->{syshost} eq "shareeweb-konstanz");
|
2022-04-04 14:57:43 +02:00
|
|
|
$oprefix = "REN" if($varenv->{syshost} eq "shareeweb-ren");
|
|
|
|
|
2021-12-30 12:05:56 +01:00
|
|
|
|
|
|
|
my $sort_updown = "up";
|
|
|
|
my $content2 = "content2_contact";
|
|
|
|
my $content_img = "pic-contact";
|
|
|
|
my $record_cc = { c_id => 0 };
|
|
|
|
my $pref_cc = {
|
|
|
|
table => "contentuser",
|
|
|
|
fetch => "one",
|
|
|
|
template_id => "197",
|
|
|
|
c_id => 1,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
print "<div id='Contentapp'>\n";
|
|
|
|
print $q->div({-class=>"$content2"},"Bei Fragen und Problemen bitte den örtlichen Betreiber kontaktieren"),"\n";
|
|
|
|
|
|
|
|
#BIG LOOP content table
|
|
|
|
#while (my ($mandant_conf, $value) = each %{ $dbt->{operator} }) {
|
|
|
|
foreach my $m_id (sort { $dbt->{operator}->{$b}->{oprefix} cmp $dbt->{operator}->{$a}->{oprefix} } keys(%{ $dbt->{operator} })) {
|
2022-04-04 14:57:43 +02:00
|
|
|
#if($dbt->{operator}->{$m_id}->{project} eq $project || $project eq "all"){
|
|
|
|
if($dbt->{operator}->{$m_id}->{oprefix} eq $oprefix || $dbt->{operator}->{$m_id}->{project} eq $project){
|
2021-12-30 12:05:56 +01:00
|
|
|
print $q->div({-class=>"$content2"}," "),"\n";
|
|
|
|
|
2022-09-15 17:06:08 +02:00
|
|
|
my $sharee_operator = $dbt->{operator}->{$m_id}->{database}->{dbname} || "";
|
2021-12-30 12:05:56 +01:00
|
|
|
my $dbh_operator = $dbt->dbconnect_extern($sharee_operator);
|
|
|
|
$record_cc = $dbt->fetch_record($dbh_operator,$pref_cc);
|
|
|
|
#print Dumper($node_meta->{tpl_order}) . "<br />\n";
|
2022-05-19 06:35:50 +02:00
|
|
|
|
2022-09-15 17:06:08 +02:00
|
|
|
#handmade activation to show only realy live operators on web contact
|
|
|
|
if($sharee_operator && $sharee_operator =~ /sharee_mak|sharee_sx|sharee_lec/){
|
2022-05-19 06:35:50 +02:00
|
|
|
|
2021-12-30 12:05:56 +01:00
|
|
|
foreach (@tpl_order){
|
|
|
|
my ($key,$des,$size) = split /=/,$_;
|
|
|
|
$record_cc->{$key} = $q->unescapeHTML("$record_cc->{$key}");
|
|
|
|
$record_cc->{$key} = $lb->newline($record_cc->{$key},"","");
|
|
|
|
|
|
|
|
if($key =~ /ct_name/){
|
2022-04-04 14:57:43 +02:00
|
|
|
#print $q->div({-id=>"$record_cc->{c_id}",-class=>'content_title2'},"• $record_cc->{$key}"),"\n";
|
|
|
|
my $title = "$record_cc->{$key}";
|
|
|
|
$title = "$dbt->{operator}->{$m_id}->{title}";# if($dbt->{operator}->{$m_id}->{oprefix} eq $oprefix);
|
|
|
|
print $q->div({-id=>"$record_cc->{c_id}",-class=>'content_title2'},"• $title"),"\n";
|
2021-12-30 12:05:56 +01:00
|
|
|
}elsif($key =~ /txt|int/ && $record_cc->{$key} && $key !~ /txt85/){
|
|
|
|
#phone tag
|
|
|
|
if($record_cc->{$key} =~ /\d+$/ && $des =~ /hotline|Telefon|phone/i){
|
|
|
|
$record_cc->{$key} =~ s/([\s0-9-\/]+)/\<a href=\'tel:00$1\'\>$1\<\/a\>/;
|
|
|
|
}
|
|
|
|
#email tag with little coding against grabber
|
|
|
|
if($record_cc->{$key} =~ /(\w+\@[\w-]+\.\w+)/){
|
2022-01-11 10:53:21 +01:00
|
|
|
$record_cc->{$key} =~ s/([\w\.\-_]+\@[\w-]+\.\w+)/\<a href=\'mailto:$1\'\>$1\<\/a\>/;
|
2021-12-30 12:05:56 +01:00
|
|
|
$record_cc->{$key} =~ s/\@/\&\#64\;/g;
|
|
|
|
}
|
|
|
|
$record_cc->{$key} =~ s/\\//g;
|
|
|
|
if($des =~ /hotline|e-Mail|zeiten/i){
|
|
|
|
print $q->div({-class=>"$content2"}, "$des: $record_cc->{$key}"),"\n";
|
|
|
|
}else{
|
2022-09-15 17:06:08 +02:00
|
|
|
print $q->div({-class=>"$content2"}," "),"\n" if($key eq "txt01");
|
2021-12-30 12:05:56 +01:00
|
|
|
print $q->div({-class=>"$content2"}, "$record_cc->{$key}"),"\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2022-05-19 06:35:50 +02:00
|
|
|
}
|
2021-12-30 12:05:56 +01:00
|
|
|
}
|
|
|
|
}#end if
|
|
|
|
}
|
|
|
|
print "</div>\n";
|
|
|
|
}
|
|
|
|
1;
|