Iframe in Agentticketzoom

Hilfe zu Znuny Problemen aller Art
Locked
innasa
Znuny newbie
Posts: 3
Joined: 23 Oct 2016, 08:04
Znuny Version: 5.0.13

Iframe in Agentticketzoom

Post by innasa »

Hallo zusammen,

ich möchte gerne in der Agentticketzoom einen Iframe in der rechten Spalte einblenden, ideal wäre es wenn er wie die Bereiche Ticket-Informationen, Kundeninformationen und Verknüpfe Objekte funktionieren würde. In dem Iframe würde ich eine externe Seite einer Reklamationsverwaltung anzeigen lassen. Aus einem Ticket wird per Link in diesem System eine Reklamation erzeugt. Diese würde ich dann in dem iframe anzeigen lassen, dazu müsste ich die Ticket-ID und die Ticket-Nummer übergeben.

Habt ihr einen Tipp wie ich das machen kann?

Vielen Dank für die Unterstützung.

Dominik
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: Iframe in Agentticketzoom

Post by reneeb »

Schreibe einen Outputfilter der Dir das Widget erzeugt. Also Vorlage kannst Du https://github.com/reneeb/otrs-TicketCh ... ecklist.pm nehmen.

Zeilen 20, 21 rausnehmen

Zeilen 39 - 108 ersetzen durch

Code: Select all

    # define if rich text should be used
    my ($TicketID) = $Kernel::OM->Get('Kernel::System::Web::Request')->GetParam( Param => 'TicketID' );

    return 1 if !$TicketID;

    my $Snippet = qq~<div class="WidgetSimple">
    <div class="Header">
        <div class="WidgetAction Toggle">
            <a href="#" title="[% Translate("Show or hide the content") | html %]"><i class="fa fa-caret-right"></i><i class="fa fa-caret-down"></i></a>
        </div>
        <h2>[% Translate("Your IFrame") | html %]</h2>
    </div>
<div class="Content">
        <iframe src="http://hostname/path?ticket=$TicketID"></iframe>
</div>
</div>
    ~;
und 119-125 ersetzen durch

Code: Select all

return 1;
Noch in der SysConfig aktivieren https://github.com/reneeb/otrs-TicketCh ... xml#L3-L18

TicketChecklist natürlich durch einen eigenen Namen ersetzen...
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
innasa
Znuny newbie
Posts: 3
Joined: 23 Oct 2016, 08:04
Znuny Version: 5.0.13

Re: Iframe in Agentticketzoom

Post by innasa »

Hallo,

leider klappt das irgendwie nicht, das das Widet erscheint einfach nicht, in der Weboberläche der Sysconf wird der Eintrag der XML aber korrekt angezeigt.

iframe.xml:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<otrs_config version="1.0" init="Application"><ConfigItem Name="Frontend::Output::FilterContent###iframe" Required="0" Valid="1">
        <Description Translatable="1">Iframe fuer Reklamationanzeige.</Description>
        <Group>Reklaiframe</Group>
        <SubGroup>OutputFilter</SubGroup>
        <Setting>
            <Hash>
                <Item Key="Module">Kernel::Output::HTML::FilterContent::iframe</Item>
                <Item Key="Debug">0</Item>
                <Item Key="Templates">
                    <Hash>
                        <Item Key="AgentTicketZoom">1</Item>
                    </Hash>
                </Item>
            </Hash>
        </Setting>
</ConfigItem></otrs_config>
iframe.pm

Code: Select all

# --
# Kernel/Output/HTML/FilterContent/iframe.pm
# Copyright (C) 2014-2016 Perl-Services.de, http://www.perl-services.de/
# --
# 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::FilterContent::iframe;

use strict;
use warnings;

use List::Util qw(first);

our @ObjectDependencies = qw(
    Kernel::System::Ticket
    Kernel::System::Web::Request

);

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

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

    $Self->{UserID} = $Param{UserID};

    return $Self;
}

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

    # define if rich text should be used
    my ($TicketID) = $Kernel::OM->Get('Kernel::System::Web::Request')->GetParam( Param => 'TicketID' );

    return 1 if !$TicketID;

    my $Snippet = qq~<div class="WidgetSimple">
    <div class="Header">
        <div class="WidgetAction Toggle">
            <a href="#" title="[% Translate("Show or hide the content") | html %]"><i class="fa fa-caret-right"></i><i class="fa fa-caret-down"></i></a>
        </div>
        <h2>[% Translate("Your IFrame") | html %]</h2>
    </div>
<div class="Content">
        <iframe src="http://www.google.de?ticket=$TicketID"></iframe>
</div>
</div>
    ~;

    my $Position = $ConfigObject->Get( 'iframe::Position' ) || 'top';

    if ( $Position eq 'bottom' ) {
        ${ $Param{Data} } =~ s{(</div> \s+ <div \s+ class="ContentColumn)}{ $Snippet $1 }xms;
    }
    else {
        ${ $Param{Data} } =~ s{(<div \s+ class="SidebarColumn">)}{$1 $Snippet}xsm;
    }

    return 1;
}

1;
Hast du noch einen Tipp für mich? Vielen Dank für die Hilfe!
innasa
Znuny newbie
Posts: 3
Joined: 23 Oct 2016, 08:04
Znuny Version: 5.0.13

Re: Iframe in Agentticketzoom

Post by innasa »

Hallo,

ich habe heute noch mal zwei Stunden gebastelt, leider komme ich irgendwie nicht weiter. Hat irgendwer noch einen Tipp dazu? Gibt es vielleicht noch irgendwo ein Tutorial wo ich mir etwas abschauen kann?

Danke für die Hilfe!
Locked