2021-12-30 12:05:56 +01:00
|
|
|
package NodeEdit;
|
|
|
|
#
|
|
|
|
# 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 Lib::Config;
|
|
|
|
use Mod::Buttons;
|
|
|
|
use Mod::Libenz;
|
|
|
|
use Mod::Basework;
|
|
|
|
use Mod::DBtank;
|
|
|
|
use Mod::Relation;
|
|
|
|
use Data::Dumper;
|
|
|
|
|
|
|
|
sub new {
|
|
|
|
my $class = shift;
|
|
|
|
my $self = {};
|
|
|
|
bless($self,$class);
|
|
|
|
return $self;
|
|
|
|
}
|
|
|
|
|
|
|
|
#Template
|
|
|
|
sub admin_tpl(){
|
|
|
|
my $node_meta = shift;
|
|
|
|
my $users_dms = shift;
|
|
|
|
my $u_group = shift;
|
|
|
|
my $return = shift;
|
|
|
|
my $superu_id = shift || "";
|
|
|
|
|
|
|
|
my $q = new CGI;
|
|
|
|
my @keywords = $q->param;
|
|
|
|
my $cf = new Config;
|
|
|
|
my $lb = new Libenz;
|
|
|
|
my $bw = new Basework;
|
|
|
|
my $dbt = new DBtank;
|
|
|
|
my $but = new Buttons;
|
|
|
|
my $relform = new Relation;
|
|
|
|
my %varenv = $cf->envonline();
|
|
|
|
my $script = $q->script_name();
|
|
|
|
my $path = $q->path_info();
|
|
|
|
$path = "$script" . "$path";
|
|
|
|
my $lang = "de";
|
|
|
|
|
|
|
|
my $coo = $q->cookie(-name=>'domcookie');
|
|
|
|
my %ib = $but->ibuttons();
|
|
|
|
my $dbh = "";
|
|
|
|
|
2023-03-05 20:01:47 +01:00
|
|
|
my $u_name = $node_meta->{nowner};
|
|
|
|
$u_name = $dbt->sys_username($dbh,$node_meta->{nowner});
|
2021-12-30 12:05:56 +01:00
|
|
|
|
2023-03-05 20:01:47 +01:00
|
|
|
my $change = $lb->time4de($node_meta->{nchange},"1") if($node_meta->{nchange});
|
2021-12-30 12:05:56 +01:00
|
|
|
my $subid = $1 if($node_meta->{main_id} =~ /^(\d)/);
|
|
|
|
|
|
|
|
#Node templates
|
2023-03-05 20:01:47 +01:00
|
|
|
my $tpl_id = 97;
|
|
|
|
my $tpl_lists4selection = "";
|
2021-12-30 12:05:56 +01:00
|
|
|
|
|
|
|
if($node_meta->{ct_table} eq "content"){
|
|
|
|
$tpl_id = 100;
|
|
|
|
if($node_meta->{template_id} eq "205"){
|
|
|
|
$tpl_lists4selection = 205;
|
|
|
|
}elsif($node_meta->{template_id} eq "225"){
|
|
|
|
$tpl_lists4selection = 225;
|
|
|
|
}elsif($node_meta->{template_id} eq "210"){
|
|
|
|
$tpl_lists4selection = 210;
|
|
|
|
}else{
|
|
|
|
$tpl_lists4selection = "224,226,227,228,229";
|
|
|
|
}
|
|
|
|
}elsif($node_meta->{ct_table} eq "contenttrans"){
|
|
|
|
$tpl_id = "101";
|
|
|
|
$tpl_lists4selection = "218";
|
|
|
|
}elsif($node_meta->{ct_table} eq "contenttranspos"){
|
|
|
|
$tpl_id = "101";
|
|
|
|
$tpl_lists4selection = "221,222";
|
|
|
|
}elsif($node_meta->{ct_table} eq "contentadr" || $node_meta->{ct_table} eq "contentadrpos"){
|
|
|
|
$tpl_id = "101";
|
2022-03-30 07:29:24 +02:00
|
|
|
$tpl_lists4selection = "401,402,403";
|
2021-12-30 12:05:56 +01:00
|
|
|
}
|
|
|
|
|
2023-03-05 20:01:47 +01:00
|
|
|
my $tpl = $dbt->get_tpl($dbh,$tpl_id);
|
2021-12-30 12:05:56 +01:00
|
|
|
my @tpl_order = ("");
|
|
|
|
@tpl_order = split /,/,$tpl->{tpl_order};
|
|
|
|
|
|
|
|
|
|
|
|
my @_templates;
|
2023-03-05 20:01:47 +01:00
|
|
|
my $tpl_all = $dbt->collect_tpl($tpl_lists4selection);
|
2021-12-30 12:05:56 +01:00
|
|
|
foreach my $id (sort {$tpl_all->{$a}->{tpl_name} cmp $tpl_all->{$b}->{tpl_name}} keys (%$tpl_all)){
|
|
|
|
push (@_templates, "$id:$tpl_all->{$id}->{tpl_name}") if($tpl_all->{$id}->{tpl_name} !~ /dummy/);
|
|
|
|
}
|
|
|
|
|
|
|
|
#content container
|
|
|
|
print "<div id='Container_cms'>$superu_id";
|
2022-01-27 20:30:35 +01:00
|
|
|
|
|
|
|
print $q->hidden(-name=>'last_node_name', -value=>"$node_meta->{node_name}");
|
|
|
|
print $q->hidden(-name=>'owner', -value=>"$users_dms->{u_id}");
|
|
|
|
print $q->hidden(-name=>'parent_id', -value=>"$node_meta->{parent_id}");
|
|
|
|
print $q->hidden(-name=>'main_id', -value=>"$node_meta->{main_id}");
|
2022-10-18 20:15:11 +02:00
|
|
|
#print $q->hidden(-name=>'template_id', -value=>"$node_meta->{template_id}");
|
2022-01-27 20:30:35 +01:00
|
|
|
|
2021-12-30 12:05:56 +01:00
|
|
|
print $q->start_table({-style=>'margin-top:6px;', -border=>'0', -width=>'100%', -align=>'left', -cellpadding=>'3', -cellspacing=>'3'});
|
|
|
|
print $q->Tr();
|
2023-03-05 20:01:47 +01:00
|
|
|
if($users_dms->{u_id}){
|
2023-01-05 18:11:24 +01:00
|
|
|
print "<td style='background:#a7a18f;margin:1px 0;padding:2px;' colspan='2' nowrap>\n";
|
2023-03-05 20:01:47 +01:00
|
|
|
print $but->singlesubmit7("rel_edit","save_relation","$ib{save_relation}","","");
|
|
|
|
print $q->span({-style=>'margin:0 0.2em;'}," ");
|
|
|
|
print $but->singlesubmit7("rel_edit","delete_relation","$ib{delete_relation}","","");
|
|
|
|
print $q->span({-style=>'margin:0 0.2em;'}," ");
|
|
|
|
print $but->singlesubmit7("rel_edit","new_relation","$ib{new_relation}","","");
|
|
|
|
print $q->span({ -style=>'margin:4px 0 0 4px;'},$but->checkbox("1","new_submenu","$R::new_submenu"),"Submenu") if($subid < 3 && $node_meta->{template_id} !~ /205/);#no submenue if bikes);
|
|
|
|
print $q->span({-style=>'margin-left:10em; font-size:0.91em;'}, "$u_name / $change") if($u_name);
|
2021-12-30 12:05:56 +01:00
|
|
|
print "</td>\n";
|
|
|
|
|
|
|
|
print $q->Tr();
|
|
|
|
print $q->td({-colspan=>'2',-style=>'padding:5px;font-style:italic;'},"Path: $path");
|
|
|
|
foreach (@tpl_order){
|
|
|
|
my ($key,$des,$isize) = split /=/,$_;
|
|
|
|
$des .= " ($key)" if($users_dms->{u_id} eq $varenv{superu_id});
|
|
|
|
#print "$key, $des, $isize|";
|
|
|
|
$isize = "20" if(!$isize);
|
|
|
|
|
|
|
|
if($key =~ /node_public|footer/){
|
|
|
|
print $q->Tr();
|
|
|
|
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
|
|
|
|
print $q->td({-class=>'content1_cms'},$but->checkbox("1","$key","$node_meta->{$key}")),"\n";
|
|
|
|
}elsif($key =~ /tpl_name/){
|
|
|
|
print $q->Tr();
|
|
|
|
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
|
|
|
|
print $q->td({-class=>'content1_cms'},$but->selector("template_id","200px",$node_meta->{template_id},@_templates)),"\n";
|
|
|
|
}elsif($key =~ /node_name/){
|
|
|
|
print $q->Tr();
|
|
|
|
print $q->td({-class=>'left_italic_cms'},"$des");
|
|
|
|
print $q->td({-class=>'content1_cms'},$q->textfield(-class=>'etxt',-name=>"$key",-default=>"$node_meta->{$key}",-override=>'1',-size=>"$isize",-maxlength=>120)),"\n";
|
|
|
|
}elsif($key =~ /n_sort/){
|
|
|
|
print $q->Tr();
|
|
|
|
print $q->td({-class=>'left_italic_cms'},"$des");
|
|
|
|
print $q->td({-class=>'content1_cms'},$q->textfield(-class=>'etxt',-name=>"$key",-default=>"$node_meta->{$key}",-override=>'1',-size=>"$isize",-maxlength=>120)),"\n";
|
2023-03-05 20:01:47 +01:00
|
|
|
}elsif($key eq "type_id" && $isize eq "select" && $node_meta->{template_id} eq "205"){
|
|
|
|
my @s_valxx = ();
|
|
|
|
my $s_hash = {};
|
|
|
|
$s_hash = $dbt->{copri_conf}->{type_id};
|
|
|
|
print $q->Tr();
|
|
|
|
print $q->td({-class=>'left_italic_cms',-colspan=>'1'},"$des");
|
|
|
|
foreach my $s_key (sort keys (%{ $s_hash })) {
|
|
|
|
push @s_valxx, "$s_key:$s_hash->{$s_key}";
|
|
|
|
}
|
|
|
|
print $q->td({-class=>'content1_cms'},$but->selector_class("$key","","",$node_meta->{$key},@s_valxx)),"\n";
|
|
|
|
}elsif($key eq "energy_id" && $isize eq "checkbox"){
|
|
|
|
print $q->Tr();
|
|
|
|
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
|
|
|
|
print $q->td({-class=>'content1_cms', -colspan=>'1'}, $but->checkbox("1","$key","$node_meta->{$key}")),"\n";
|
|
|
|
print $q->hidden(-name=>"$key",-override=>1,-value=>"null");
|
2021-12-30 12:05:56 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}else{
|
2023-03-05 20:01:47 +01:00
|
|
|
print $q->div({-style=>'text-align:left;margin:0.5em;padding:1em;background-color:white;'},"Keine Zugriffsrechte");
|
2021-12-30 12:05:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
print $q->end_table;
|
|
|
|
|
2023-03-05 20:01:47 +01:00
|
|
|
my $debug = "";
|
2022-07-20 06:54:17 +02:00
|
|
|
$debug = "(ct_table: $node_meta->{ct_table} | main_id: $node_meta->{main_id} | tpl_id: $node_meta->{template_id} | type_id: $node_meta->{type_id} | energy_id: $node_meta->{energy_id}" if($users_dms->{u_id} == $dbt->{copri_conf}->{superu_id});
|
2021-12-30 12:05:56 +01:00
|
|
|
print $q->div({-style=>'position:absolute;bottom:2%;right:2%;z-index:10;font-size:13px;'},"$debug"),"\n";
|
|
|
|
print "</div>";
|
|
|
|
}
|
|
|
|
1;
|