Neuer Menüpunkt -> iframe

Hilfe zu Znuny Problemen aller Art
Locked
steste123
Znuny wizard
Posts: 554
Joined: 25 Sep 2012, 19:04
Znuny Version: OTRS Help Desk
Real Name: Stefan

Neuer Menüpunkt -> iframe

Post by steste123 »

Hallo zusammen,
hat jemand bereits soetwas umgesetzt oder eine Idee, wie man dies umsetzen kann?

Image

(Link: http://v64i.img-up.net/otrs158c.png)


Nachtrag: Wie man den Menüpunkt einpflegt ist mir bewusst. Es geht mir darum, Inhalt per Iframe darzustellen
Last edited by steste123 on 30 Jan 2014, 16:46, edited 2 times in total.
OTRS 5.x - Debian 8 - apache 2.4 - MySQL 5.x
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: Neuer Menüpunkt -> iframe

Post by reneeb »

Mach ein neues Frontend-Modul, dessen Template einfach nur das iFrame hat...

Config

Code: Select all

    <ConfigItem Name="Frontend::Module###AgentMyIframe" Required="0" Valid="1">
        <Description Translatable="1">Frontend module registration for the agent interface.</Description>
        <Group>Custom</Group>
        <SubGroup>Frontend::Agent::ModuleRegistration</SubGroup>
        <Setting>
            <FrontendModuleReg>
                <Description>Overview of all open Tickets</Description>
                <Title>QueueView</Title>
                <NavBarName>Ticket</NavBarName>
                <NavBar>
                    <Description Translatable="1">your description</Description>
                    <Name Translatable="1">My Iframe</Name>
                    <Link>Action=AgentMyIframe</Link>
                    <LinkOption></LinkOption>
                    <NavBar>Ticket</NavBar>
                    <Type></Type>
                    <Block></Block>
                    <AccessKey>n</AccessKey>
                    <Prio>711</Prio>
                </NavBar>
            </FrontendModuleReg>
        </Setting>
    </ConfigItem>
Kernel/Modules/AgentMyIframe.pm

Code: Select all

package Kernel::Modules::AgentMyIframe;

use strict;
use warnings;

use Kernel::System::Email;

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

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

    # check needed objects
    for my $Needed (qw(ParamObject DBObject LayoutObject LogObject ConfigObject)) {
        if ( !$Self->{$Needed} ) {
            $Self->{LayoutObject}->FatalError( Message => "Got no $Needed!" );
        }
    }

    return $Self;
}

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

    my $Output = $Self->{LayoutObject}->Header();
    $Output .= $Self->{LayoutObject}->NavigationBar();
    $Output .= $Note;
    $Output .= $Self->{LayoutObject}->Output(
        TemplateFile => 'AgentMyIframe',
    );
    $Output .= $Self->{LayoutObject}->Footer();

    return $Output;
}

1;
Kernel/Output/HTML/Standard/AgentMyIframe.dtl

Code: Select all

<iframe src="...."></iframe>
(ungetestet)
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
steste123
Znuny wizard
Posts: 554
Joined: 25 Sep 2012, 19:04
Znuny Version: OTRS Help Desk
Real Name: Stefan

Re: Neuer Menüpunkt -> iframe

Post by steste123 »

Hey,
danke die für die Hilfe.
Hat funktioniert.

Hast du noch einen Tipp, wie ich "einfach" weitere Frames einbinden kann?
Übrigens, der Menüpunkt wird durch die XML nicht eingefügt.
OTRS 5.x - Debian 8 - apache 2.4 - MySQL 5.x
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: Neuer Menüpunkt -> iframe

Post by reneeb »

steste123 wrote:Hast du noch einen Tipp, wie ich "einfach" weitere Frames einbinden kann?
Wie meinst Du das?
steste123 wrote:Übrigens, der Menüpunkt wird durch die XML nicht eingefügt.
Du hast die Beispielconfig einfach als Datei abgespeichert und bekommst jetzt Fehlermeldungen? Dann siehe viewtopic.php?f=35&t=23329&p=91964#p91964
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
steste123
Znuny wizard
Posts: 554
Joined: 25 Sep 2012, 19:04
Znuny Version: OTRS Help Desk
Real Name: Stefan

Re: [Gelöst] Neuer Menüpunkt -> iframe

Post by steste123 »

Moin,
ich erhalte keine Fehlermeldungen und das ich die Kopfdaten in die XML einfügen muss, ist mir klar ;-)

Ich möchte weitere IFrames einbinden, also auch weitere Menüpunkte
OTRS 5.x - Debian 8 - apache 2.4 - MySQL 5.x
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: Neuer Menüpunkt -> iframe

Post by reneeb »

steste123 wrote:Übrigens, der Menüpunkt wird durch die XML nicht eingefügt.
Jepp, mein Fehler. Mit dieser Konfig sollte es funktionieren:

Code: Select all

    <ConfigItem Name="Frontend::Module###AgentMyIframe" Required="0" Valid="1">
        <Description Translatable="1">Frontend module registration for the agent interface.</Description>
        <Group>Custom</Group>
        <SubGroup>Frontend::Agent::ModuleRegistration</SubGroup>
        <Setting>
            <FrontendModuleReg>
                <Description>Overview of all open Tickets</Description>
                <Title>QueueView</Title>
                <NavBarName>MyIFrames</NavBarName>
                <NavBar>
                    <Description Translatable="1">your description</Description>
                    <Name Translatable="1">My Iframe</Name>
                    <Link>Action=AgentMyIframe</Link>
                    <LinkOption></LinkOption>
                    <NavBar>MyIFrame</NavBar>
                    <Type>Menu</Type>
                    <Block>ItemArea</Block>
                    <AccessKey>n</AccessKey>
                    <Prio>711</Prio>
                </NavBar>
            </FrontendModuleReg>
        </Setting>
    </ConfigItem>
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
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: [Gelöst] Neuer Menüpunkt -> iframe

Post by reneeb »

steste123 wrote:Ich möchte weitere IFrames einbinden, also auch weitere Menüpunkte
Dafür würde ich eine zusätzliche ConfigOption machen :

Code: Select all

    <ConfigItem Name="Iframes::Sources" Required="0" Valid="1">
        <Description Translatable="1">Sources for the iframes.</Description>
        <Group>Custom</Group>
        <SubGroup>Iframes</SubGroup>
        <Setting>
            <Hash>
                <Item Key="Source1">http://opar.perl-services.de</Item>
                <Item Key="Source2">http://otrs.perl-services.de</Item>
            </Hash>
        </Setting>
    </ConfigItem>
Dann im Frontendmodul:

Code: Select all

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

    my $SourceKey = $Self->{ParamObject}->GetParam( Param => 'Source' );
    my $Sources    = $Self->{ConfigObject}->Get( 'Iframe::Sources' ) || {};

    my $Output = $Self->{LayoutObject}->Header();
    $Output .= $Self->{LayoutObject}->NavigationBar();
    $Output .= $Note;
    $Output .= $Self->{LayoutObject}->Output(
        TemplateFile => 'AgentMyIframe',
        Data    => { Source => $Sources{$SourceKey} || '' },
    );
    $Output .= $Self->{LayoutObject}->Footer();

    return $Output;
}
Im Template:

Code: Select all

<iframe src="$Data{"Source"}"></iframe>
Um dann mehrere eigenständige Menüpunkte zu haben, musst Du die Config zum Frontendmodul duplizieren (oder wie oft Du das haben möchtest) und das

Code: Select all

<Link>Action=AgentMyIframe</Link>
muss zu

Code: Select all

<Link>Action=AgentMyIframe;Source=Source1</Link>
bzw.

Code: Select all

<Link>Action=AgentMyIframe;Source=Source2</Link>
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
steste123
Znuny wizard
Posts: 554
Joined: 25 Sep 2012, 19:04
Znuny Version: OTRS Help Desk
Real Name: Stefan

Re: [Gelöst] Neuer Menüpunkt -> iframe

Post by steste123 »

Danke für deine Antwort - nun habe ich es ausprobiert und erhalte aber keinen Menüpunkt.

Hier meine Dateien:

Modules/AgentMyIframe.pm

Code: Select all

package Kernel::Modules::AgentMyIframe;

use strict;
use warnings;

use Kernel::System::Email;

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

    my $SourceKey = $Self->{ParamObject}->GetParam( Param => 'Source' );
    my $Sources    = $Self->{ConfigObject}->Get( 'Iframe::Sources' ) || {};

    my $Output = $Self->{LayoutObject}->Header();
    $Output .= $Self->{LayoutObject}->NavigationBar();
    $Output .= $Note;
    $Output .= $Self->{LayoutObject}->Output(
        TemplateFile => 'AgentMyIframe',
        Data    => { Source => $Sources{$SourceKey} || '' },
    );
    $Output .= $Self->{LayoutObject}->Footer();

    return $Output;
}

1;
Kernel/Output/HTML/Standard/AgentMyIframe.dtl

Code: Select all

<iframe src="$Data{"Source"}"></iframe>
Kernel/Config/Files/IframeSource.xml

Code: Select all

   <?xml version="1.0" encoding="utf-8" ?>
<otrs_config version="1.0" init="Framework">
   

 <ConfigItem Name="Iframes::Sources" Required="0" Valid="1">
        <Description Translatable="1">Sources for the iframes.</Description>
        <Group>Custom</Group>
        <SubGroup>Iframes</SubGroup>
        <Setting>
            <Hash>
                <Item Key="Source1">http://opar.perl-services.de</Item>
                <Item Key="Source2">http://otrs.perl-services.de</Item>
            </Hash>
        </Setting>
    </ConfigItem>
</otrs_config>
OTRS 5.x - Debian 8 - apache 2.4 - MySQL 5.x
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: Neuer Menüpunkt -> iframe

Post by reneeb »

In der Konfig fehlt ja auch die Hälfte. Siehe auch viewtopic.php?f=35&t=23304#p92062
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
steste123
Znuny wizard
Posts: 554
Joined: 25 Sep 2012, 19:04
Znuny Version: OTRS Help Desk
Real Name: Stefan

Re: Neuer Menüpunkt -> iframe

Post by steste123 »

Ich steh auf'm Schlauch... An welcher Stelle muss das rein?
OTRS 5.x - Debian 8 - apache 2.4 - MySQL 5.x
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: Neuer Menüpunkt -> iframe

Post by reneeb »

Code: Select all

<?xml version="1.0" encoding="utf-8" ?>
    <otrs_config version="1.0" init="Framework">
        <ConfigItem Name="Frontend::Module###AgentMyIframe" Required="0" Valid="1">
            <Description Translatable="1">Frontend module registration for the agent interface.</Description>
            <Group>Custom</Group>
            <SubGroup>Frontend::Agent::ModuleRegistration</SubGroup>
            <Setting>
                <FrontendModuleReg>
                    <Description>Overview of all open Tickets</Description>
                    <Title>QueueView</Title>
                    <NavBarName>MyIFrames</NavBarName>
                    <NavBar>
                        <Description Translatable="1">your description</Description>
                        <Name Translatable="1">My Iframe</Name>
                        <Link>Action=AgentMyIframe</Link>
                        <LinkOption></LinkOption>
                        <NavBar>MyIFrame</NavBar>
                        <Type>Menu</Type>
                        <Block>ItemArea</Block>
                        <AccessKey>n</AccessKey>
                        <Prio>711</Prio>
                    </NavBar>
                </FrontendModuleReg>
            </Setting>
        </ConfigItem>
     <ConfigItem Name="Iframes::Sources" Required="0" Valid="1">
            <Description Translatable="1">Sources for the iframes.</Description>
            <Group>Custom</Group>
            <SubGroup>Iframes</SubGroup>
            <Setting>
                <Hash>
                    <Item Key="Source1">http://opar.perl-services.de</Item>
                    <Item Key="Source2">http://otrs.perl-services.de</Item>
                </Hash>
            </Setting>
        </ConfigItem>
    </otrs_config>
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
steste123
Znuny wizard
Posts: 554
Joined: 25 Sep 2012, 19:04
Znuny Version: OTRS Help Desk
Real Name: Stefan

Re: Neuer Menüpunkt -> iframe

Post by steste123 »

Habe ich aktualisiert.

Fehlermeldung:

Code: Select all

Hoppla. Es ist ein Fehler aufgetreten.
Fehlermeldung: Global symbol "$Note" requires explicit package name at C:/otrs/OTRS/bin/cgi-bin[..]
Please contact your administrator.
Sie können  einen Fehlerbericht senden oder zurück zur vorhergehenden Seite.
Fehlerdetails
Backend ERROR: OTRS-CGI-30 Perl: 5.16.3 OS: MSWin32 Time: Thu Jan 30 20:01:34 2014 Message: Global symbol "$Note" requires explicit package name at C:/otrs/OTRS/bin/cgi-bin/../../Kernel/Modules/AgentMyIframe.pm line 16. Global symbol "%Sources" requires explicit package name at C:/otrs/OTRS/bin/cgi-bin/../../Kernel/Modules/AgentMyIframe.pm line 19. RemoteAddress: xxxxxxx RequestURI: /otrs/index.pl?Action=AgentMyIframe;Source=Source1 Traceback (3020): Module: Kernel::System::Web::InterfaceAgent::Run (OTRS 3.3.2) Line: 186 Module: PerlEx::Precompiler::c_::otrs::otrs::bin::cgi2dbin::index_pl::__ANON__ (unknown version) Line: 41 Module: (eval) (unknown version) Line: 458 Module: PerlEx::Precompiler::Execute (unknown version) Line: 458
Error log:

Code: Select all

[Error][Kernel::System::Web::InterfaceAgent::Run][186] Global symbol "$Note" requires explicit package name at C:/otrs/OTRS/bin/cgi-bin/../../Kernel/Modules/AgentMyIframe.pm line 16.
Global symbol "%Sources" requires explicit package name at C:/otrs/OTRS/bin/cgi-bin/../../Kernel/Modules/AgentMyIframe.pm line 19.
Was ich zudem auch probiert habe ist:
Ich habe in der Sysconfig>Frontend::Module###AgentMyIframe
Bei Verknüpfung noch den Verweis auf Source1 hinzugefügt.

Verknüpfen: Action=AgentMyIframe;Source=Source1
OTRS 5.x - Debian 8 - apache 2.4 - MySQL 5.x
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: Neuer Menüpunkt -> iframe

Post by reneeb »

Nimm das

Code: Select all

    $Output .= $Note;
raus...
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
steste123
Znuny wizard
Posts: 554
Joined: 25 Sep 2012, 19:04
Znuny Version: OTRS Help Desk
Real Name: Stefan

Re: Neuer Menüpunkt -> iframe

Post by steste123 »

Code: Select all

Backend ERROR: OTRS-CGI-30 Perl: 5.16.3 OS: MSWin32 Time: Fri Jan 31 07:51:01 2014 Message: Global symbol "%Sources" requires explicit package name at C:/otrs/OTRS/bin/cgi-bin/../../Kernel/Modules/AgentMyIframe.pm line 19. RemoteAddress: xxxxx RequestURI: /otrs/index.pl?Action=AgentMyIframe;Source=Source1 Traceback (2776): Module: Kernel::System::Web::InterfaceAgent::Run (OTRS 3.3.2) Line: 186 Module: PerlEx::Precompiler::c_::otrs::otrs::bin::cgi2dbin::index_pl::__ANON__ (unknown version) Line: 41 Module: (eval) (unknown version) Line: 458 Module: PerlEx::Precompiler::Execute (unknown version) Line: 458
OTRS 5.x - Debian 8 - apache 2.4 - MySQL 5.x
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: Neuer Menüpunkt -> iframe

Post by reneeb »

Code: Select all

$Sources{$SourceKey}
=>

Code: Select all

$Sources->{$SourceKey}
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
steste123
Znuny wizard
Posts: 554
Joined: 25 Sep 2012, 19:04
Znuny Version: OTRS Help Desk
Real Name: Stefan

Re: Neuer Menüpunkt -> iframe

Post by steste123 »

Moin Rene,
hast du eine Lösung für OTRS 4?
OTRS 5.x - Debian 8 - apache 2.4 - MySQL 5.x
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: Neuer Menüpunkt -> iframe

Post by reneeb »

Wie sieht das Frontend-Modul jetzt aus? Poste mal den Code...
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
steste123
Znuny wizard
Posts: 554
Joined: 25 Sep 2012, 19:04
Znuny Version: OTRS Help Desk
Real Name: Stefan

Re: Neuer Menüpunkt -> iframe

Post by steste123 »

OTRS 5.x - Debian 8 - apache 2.4 - MySQL 5.x
redjoker
Znuny newbie
Posts: 12
Joined: 20 Feb 2014, 21:26
Znuny Version: 4.0.3

Re: Neuer Menüpunkt -> iframe

Post by redjoker »

8)
Locked