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

138 lines
4 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-01-17 20:43:36 +01:00
my $node_meta = shift;
my $users_dms = shift;
my $feedb = shift || "";
my $return = shift || "";
my $mode = shift || "";
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 %varenv = $cf->envonline();
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 = "Artikel Editor" if($node_meta->{ct_table} eq "content");
$title = "Kunden Editor" if($node_meta->{ct_table} eq "contentadr");
$title = "DMS-Account Zugriffsberechtigung" if($node_meta->{ct_table} eq "users");
$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 = "300";
$width = "600";
}elsif($R::rel_edit =~ /dialog4menu|dialog4content/){
$title = "Relation Editor";
$height = "300";
$width = "550";
}
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 {
2022-12-16 08:37:05 +01: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,$mode,$return);
}elsif($users_dms->{u_id} == $dbt->{copri_conf}->{superu_id}){
require "Mod/NodeEdit.pm";
&NodeEdit::admin_tpl($node_meta,$users_dms,$mode,$return,"only superu_id");
}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);
#}
2023-03-05 20:01:47 +01:00
#elsif($R::relate_dialog || $R::rel_edit =~ /dialog4menu|dialog4content/){
# require "Mod/RelationEdit.pm";
# &RelationEdit::tpl($node_meta,$users_dms,$mode,$return);
#}
2021-12-30 12:05:56 +01:00
elsif(($R::node2edit && $R::node2edit =~ /editpart/) || ($R::base_edit && $R::base_edit !~ /delete/)){
require "Tpl/BaseEdit.pm";
2023-01-17 20:43:36 +01:00
&BaseEdit::tpl($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;