[Solved] Lightbox mit Version 4.0.4 funktioniert nicht

Hilfe zu Znuny Problemen aller Art
Locked
shining01
Znuny expert
Posts: 270
Joined: 07 Apr 2011, 08:02
Znuny Version: 6.0.4
Real Name: Tom

[Solved] Lightbox mit Version 4.0.4 funktioniert nicht

Post by shining01 »

Hallo,

Lightbox funktionierte in Version 3.8 wunderbar. Nun habe ich die Config in der 4.0.4 nachgezogen. Hier bekomme ich leider einen Fehler.

Im Browser:
The requested URL /otrs/$Env{ was not found on this server.

Im Apache Log:

Code: Select all

[Mon Jan 19 13:14:25 2015] [error] slurp_filename('/opt/otrs/bin/cgi-bin/$Config{') / opening: (2) No such file or directory at /usr/lib/perl5/ModPerl/RegistryCooker.pm line 541
[Mon Jan 19 13:14:25 2015] [error] slurp_filename('/opt/otrs/bin/cgi-bin/$Config{') / opening: (2) No such file or directory at /usr/lib/perl5/ModPerl/RegistryCooker.pm line 541
[Mon Jan 19 13:14:27 2015] [error] slurp_filename('/opt/otrs/bin/cgi-bin/$Env{') / opening: (2) No such file or directory at /usr/lib/perl5/ModPerl/RegistryCooker.pm line 541
In HTMLHead.tt habe ich wie in der alten Version folgendes eingefügt:

Code: Select all

<script src ="$Config{"Frontend::WebPath"}js/thirdparty/lightbox-2.7.1/js/jquery-1.11.0.min.js"></script>
<script src ="$Config{"Frontend::WebPath"}js/thirdparty/lightbox-2.7.1/js/lightbox.js"></script>
<link href="$Config{"Frontend::WebPath"}js/thirdparty/lightbox-2.7.1/css/lightbox.css" rel="stylesheet" />
In ArticleAttachmentDownload.pm habe ich die Run Methode wie folgt geändert.

Code: Select all

sub Run {
    my ( $Self, %Param ) = @_;

    # check needed stuff
    for (qw(File Article)) {
        if ( !$Param{$_} ) {
            $Self->{LogObject}->Log( Priority => 'error', Message => "Need $_!" );
            return;
        }
    }

    # download type	
    my $EncodedFilename = $Self->{LayoutObject}->LinkEncode( $Param{File}->{Filename} || '' );

    my $rel = '';
    if (lc $EncodedFilename =~ /\.(tif|jpg|png|gif|jpeg|tiff)$/i) {
       $rel = '" rel="lightbox';
    }
    return (
        %{ $Param{File} },
        Action => 'Download',
        Link =>
            "\$Env{\"CGIHandle\"}/$EncodedFilename?Action=AgentTicketAttachment;ArticleID=$Param{Article}->{ArticleID};FileID=$Param{File}->{FileID}" . $rel,
    );
}
Ich habe keine Idee woran das liegen könnte. Kann mir jemand helfen? Danke!
Last edited by shining01 on 21 Jan 2015, 12:17, edited 1 time in total.
Linux Debian Jessie
DB: postgres
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: Lightbox mit Version 4.0.4 funktioniert nicht

Post by reneeb »

Aus

Code: Select all

$Config{"Frontend::WebPath"}
muss

Code: Select all

[% Config("Frontend::WebPath") | html %]
werden
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
shining01
Znuny expert
Posts: 270
Joined: 07 Apr 2011, 08:02
Znuny Version: 6.0.4
Real Name: Tom

Re: Lightbox mit Version 4.0.4 funktioniert nicht

Post by shining01 »

Danke für deine Antwort. Leider bekomme ich nach wie vor die gleiche Fehlermeldung im Browser

Code: Select all

The requested URL /otrs/$Env{ was not found on this server.
Geändert habe ich nun die HTMLHead.tt wie folgt

Code: Select all

[% INCLUDE "HTMLHeadBlockEvents.tt" %]

<script src ="[% Config("Frontend::WebPath") | html %]js/thirdparty/lightbox-2.7.1/js/jquery-1.11.0.min.js"></script>
<script src ="[% Config("Frontend::WebPath") | html %]js/thirdparty/lightbox-2.7.1/js/lightbox.js"></script>
<link href="[% Config("Frontend::WebPath") | html %]js/thirdparty/lightbox-2.7.1/css/lightbox.css" rel="stylesheet" />
Vielleicht kannst Du mir nochmals einen Tipp geben. Danke!
Linux Debian Jessie
DB: postgres
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: Lightbox mit Version 4.0.4 funktioniert nicht

Post by reneeb »

Irgendwo hast Du noch was mit "$Env{""}" stehen. Diese ganzen Tags ($Env{""}, $Config{""}, $Text{""}, $JSText{""}, $Data{""}, $QData{""}, $LQData{""}) gibt's in OTRS4 nicht mehr. Gehe mal Deinen Code durch und poste die Vorkommen, dann kann ich Dir helfen die umzuschreiben...
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
shining01
Znuny expert
Posts: 270
Joined: 07 Apr 2011, 08:02
Znuny Version: 6.0.4
Real Name: Tom

Re: Lightbox mit Version 4.0.4 funktioniert nicht

Post by shining01 »

Das Problem ist in der Run Methode. Hier gibt es den $ENV.Ich denke das ist das Problem.

Link => "\$Env{\"CGIHandle\"}/

Code: Select all

# --
# Kernel/Output/HTML/ArticleAttachmentDownload.pm
# Copyright (C) 2001-2015 xxx, http://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

package Kernel::Output::HTML::ArticleAttachmentDownload;

use strict;
use warnings;

sub new {
    my ( $Type, %Param ) = @_;

    # allocate new hash for object
    my $Self = {};
    bless( $Self, $Type );

    # get needed objects
    for (qw(ConfigObject LogObject DBObject LayoutObject UserID TicketObject ArticleID)) {
        $Self->{$_} = $Param{$_} || die "Got no $_!";
    }
    return $Self;
}

sub Run {
    my ( $Self, %Param ) = @_;

    # check needed stuff
    for (qw(File Article)) {
        if ( !$Param{$_} ) {
            $Self->{LogObject}->Log( Priority => 'error', Message => "Need $_!" );
            return;
        }
    }

    # download type	
    my $EncodedFilename = $Self->{LayoutObject}->LinkEncode( $Param{File}->{Filename} || '' );

    my $rel = '';
    if (lc $EncodedFilename =~ /\.(tif|jpg|png|gif|jpeg|tiff)$/i) {
       $rel = '" rel="lightbox';
    }
    return (
        %{ $Param{File} },
        Action => 'Download',
        Link =>
            "\$Env{\"CGIHandle\"}/$EncodedFilename?Action=AgentTicketAttachment;ArticleID=$Param{Article}->{ArticleID};FileID=$Param{File}->{FileID}" . $rel,
    );
}

1;
Linux Debian Jessie
DB: postgres
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: Lightbox mit Version 4.0.4 funktioniert nicht

Post by reneeb »

Ist das noch aus einer Beta-Version? Momentan sieht das mit dem Link-Erzeugen so aus: https://github.com/OTRS/otrs/blob/rel-4 ... oad.pm#L55
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
shining01
Znuny expert
Posts: 270
Joined: 07 Apr 2011, 08:02
Znuny Version: 6.0.4
Real Name: Tom

Re: Lightbox mit Version 4.0.4 funktioniert nicht

Post by shining01 »

ja das stimmt. dies ist bereits meine geänderte Version aus der Version 3.8 da hat es nämlich funktioniert.
Wie müsste es dann unter der Version 4 aussehen?
Linux Debian Jessie
DB: postgres
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: Lightbox mit Version 4.0.4 funktioniert nicht

Post by reneeb »

Warum nimmst Du nicht einfach die von mir verlinkte Version des Moduls?
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
shining01
Znuny expert
Posts: 270
Joined: 07 Apr 2011, 08:02
Znuny Version: 6.0.4
Real Name: Tom

Re: Lightbox mit Version 4.0.4 funktioniert nicht

Post by shining01 »

Mit der Original-Version welche Du auch verlinkt hast, funktioniert aber die lightbox nicht. Diese ist ja standardmäßig enthalten. Das ist ja mein Problem ;)

Momentaner stand:

Original-Version von Dir von ArticleAttachmentDownload.pm und die Änderung in HTMLHead.tt

Code: Select all

[% INCLUDE "HTMLHeadBlockEvents.tt" %]

<script src ="[% Config("Frontend::WebPath") | html %]js/thirdparty/lightbox-2.7.1/js/jquery-1.11.0.min.js"></script>
<script src ="[% Config("Frontend::WebPath") | html %]js/thirdparty/lightbox-2.7.1/js/lightbox.js"></script>
<link href="[% Config("Frontend::WebPath") | html %]js/thirdparty/lightbox-2.7.1/css/lightbox.css" rel="stylesheet" />

</head>

Code: Select all

# --
# Kernel/Output/HTML/ArticleAttachmentDownload.pm
# Copyright (C) 2001-2015 xxx, http://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

package Kernel::Output::HTML::ArticleAttachmentDownload;

use strict;
use warnings;

sub new {
    my ( $Type, %Param ) = @_;

    # allocate new hash for object
    my $Self = {};
    bless( $Self, $Type );

    # get needed objects
    for (qw(ConfigObject LogObject DBObject LayoutObject UserID TicketObject ArticleID)) {
        $Self->{$_} = $Param{$_} || die "Got no $_!";
    }
    return $Self;
}

sub Run {
    my ( $Self, %Param ) = @_;

    # check needed stuff
    for (qw(File Article)) {
        if ( !$Param{$_} ) {
            $Self->{LogObject}->Log(
                Priority => 'error',
                Message  => "Need $_!"
            );
            return;
        }
    }

    # download type
    my $Type = $Self->{ConfigObject}->Get('AttachmentDownloadType') || 'attachment';

    # if attachment will be forced to download, don't open a new download window!
    my $Target = 'target="AttachmentWindow" ';
    if ( $Type =~ /inline/i ) {
        $Target = 'target="attachment" ';
    }

    return (
        %{ $Param{File} },
        Action => 'Download',
        Link   => $Self->{LayoutObject}->{Baselink} .
            "Action=AgentTicketAttachment;ArticleID=$Param{Article}->{ArticleID};FileID=$Param{File}->{FileID}",
        Image  => 'disk-s.png',
        Target => $Target,
    );
}

1;
Linux Debian Jessie
DB: postgres
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: Lightbox mit Version 4.0.4 funktioniert nicht

Post by reneeb »

Dann probier mal

Code: Select all

# --
# Kernel/Output/HTML/ArticleAttachmentDownload.pm
# Copyright (C) 2001-2015 xxx, http://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

package Kernel::Output::HTML::ArticleAttachmentDownload;

use strict;
use warnings;

sub new {
    my ( $Type, %Param ) = @_;

    # allocate new hash for object
    my $Self = {};
    bless( $Self, $Type );

    # get needed objects
    for (qw(ConfigObject LogObject DBObject LayoutObject UserID TicketObject ArticleID)) {
        $Self->{$_} = $Param{$_} || die "Got no $_!";
    }
    return $Self;
}

sub Run {
    my ( $Self, %Param ) = @_;

    # check needed stuff
    for (qw(File Article)) {
        if ( !$Param{$_} ) {
            $Self->{LogObject}->Log(
                Priority => 'error',
                Message  => "Need $_!"
            );
            return;
        }
    }

    # download type
    my $Type = $Self->{ConfigObject}->Get('AttachmentDownloadType') || 'attachment';

    # if attachment will be forced to download, don't open a new download window!
    my $Target = 'target="AttachmentWindow" ';
    if ( $Type =~ /inline/i ) {
        $Target = 'target="attachment" ';
    }

    my $rel = '';
    if (lc $Param{File}->{Filename} =~ /\.(tif|jpg|png|gif|jpeg|tiff)$/i) {
       $rel = '" rel="lightbox';
       $Target = '';
    }

    return (
        %{ $Param{File} },
        Action => 'Download',
        Link   => $Self->{LayoutObject}->{Baselink} .
            "Action=AgentTicketAttachment;ArticleID=$Param{Article}->{ArticleID};FileID=$Param{File}->{FileID}" . $rel,
        Image  => 'disk-s.png',
        Target => $Target,
    );
}

1;
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
shining01
Znuny expert
Posts: 270
Joined: 07 Apr 2011, 08:02
Znuny Version: 6.0.4
Real Name: Tom

Re: Lightbox mit Version 4.0.4 funktioniert nicht

Post by shining01 »

Danke super du hast mir sehr geholfen! Jetzt funktioniert es wider.
Linux Debian Jessie
DB: postgres
Locked