sharee.bike/copri4/main/src/Mod/Modalbox3.pm

128 lines
3.6 KiB
Perl
Raw Normal View History

2021-12-30 12:05:56 +01:00
package Modalbox3;
# SPDX-License-Identifier: AGPL-3.0-or-later
# Copyright (c) Rainer Gümpelein, TeilRad GmbH
use strict;
use warnings;
use CGI::Cookie ();
use CGI ':standard';
use CGI::Carp qw(fatalsToBrowser);
use Lib::Config;
use Mod::Buttons;
use Mod::DBtank;
sub new {
my $class = shift;
my $self = {};
bless($self,$class);
return $self;
}
sub mobox3(){
2023-10-18 12:15:15 +02:00
my $varenv = shift;
2023-01-17 20:43:36 +01:00
my $node_meta = shift;
my $users_dms = shift;
my $feedb = shift || {};
2023-01-17 20:43:36 +01:00
2021-12-30 12:05:56 +01:00
my $q = new CGI;
my $cf = new Config;
my $dbt = new DBtank;
my $but = new Buttons;
$q->import_names('R');
my @keywords = $q->param;
my $script = $q->script_name();
my $path = $q->path_info();
my $coo = $q->cookie(-name=>'domcookie');
my $dbh = "";
if($node_meta->{main_id} > 100){
my $bg_color = "white";
my $bg_color2 = $node_meta->{bg_color} || "grey";
my $title = "Content Editor \"$node_meta->{tpl_name}\"";
$title = "Parts Editor" if($node_meta->{ct_table} eq "content");
2021-12-30 12:05:56 +01:00
$title = "Kunden Editor" if($node_meta->{ct_table} eq "contentadr");
2024-02-12 16:43:31 +01:00
$title = "DMS-Account Editor" if($node_meta->{ct_table} eq "users");
2021-12-30 12:05:56 +01:00
$title = "Service Editor" if($node_meta->{ct_table} eq "contentpos");
2022-06-02 10:34:03 +02:00
$title = "Rental Editor" if($node_meta->{ct_table} eq "contenttranspos");
2021-12-30 12:05:56 +01:00
my $height = $node_meta->{tpl_height} || "990";
my $width = $node_meta->{tpl_width} || "990";
2023-03-05 20:01:47 +01:00
if($R::node2edit eq "edit_relation" || $R::rel_edit =~ /_relation/){
2021-12-30 12:05:56 +01:00
$title = "Node Editor";
$height = "400";
2021-12-30 12:05:56 +01:00
$width = "600";
}
print<<EOF
<style>
.ui-dialog .ui-dialog-content {
background: $bg_color;
}
.ui-dialog > .ui-widget-header {
color:black;
font-weight:normal;
border:1px solid $bg_color2;
background: $bg_color2;
}
.ui-widget-overlay {
2023-10-18 12:15:15 +02:00
background: #666 url("$varenv->{metahost}/external/jquery-ui-1.12.1/images/ui-bg_diagonals-thick_20_666666_40x40.png") 50% 50% repeat;
2021-12-30 12:05:56 +01:00
opacity: .5;
filter: Alpha(Opacity=50);
}
</style>
<script>
\$(function() {
\$( "#dialog-form3" )
.css("background-color","$bg_color")
.dialog({
height: $height,
width: $width,
closeOnEscape: true,
modal: true
});
\$('.ui-widget-overlay').click(function() {
\$(".ui-dialog-titlebar-close").trigger('click');});
\$('.ui-dialog').css('z-index',9999);
});
</script>
EOF
;
print "<div id='dialog-form3' style='text-align:left;margin:auto;max-width:1400px;' title='$title'>\n";
print $q->start_multipart_form(-name=>"editform");
if($R::node2edit && $R::node2edit =~ /new_relation|edit_relation/){
if($node_meta->{ct_table} eq "content" && $node_meta->{template_id} eq "205"){
require "Mod/NodeEdit.pm";
&NodeEdit::admin_tpl($node_meta,$users_dms);
2021-12-30 12:05:56 +01:00
}elsif($users_dms->{u_id} == $dbt->{copri_conf}->{superu_id}){
require "Mod/NodeEdit.pm";
&NodeEdit::admin_tpl($node_meta,$users_dms,"only superu_id");
2021-12-30 12:05:56 +01:00
}else{
print $q->div("Dieses Menue ist zur Bearbeitung nicht freigegeben.");
}
}
#elsif($node_meta->{ct_table} eq "contentpos"){
# require "Tpl/APIdialog.pm";
# &APIdialog::tpl($node_meta,$users_dms,$mode,$return);
#}
elsif(($R::node2edit && $R::node2edit =~ /editpart/) || ($R::base_edit && $R::base_edit !~ /delete/)){
require "Tpl/BaseEdit.pm";
2023-10-18 12:15:15 +02:00
&BaseEdit::tpl($varenv,$node_meta,$users_dms,$feedb);
2021-12-30 12:05:56 +01:00
}
else{
print $q->div("Zugriff verweigert.");
}
print $q->end_form;
print "</div>\n";
}
}
1;