Customer Logo je Kunde

Hilfe zu OTRS Problemen aller Art
Post Reply
jokakilla
Znuny newbie
Posts: 23
Joined: 18 Feb 2011, 16:25
Znuny Version: 3.1.3

Customer Logo je Kunde

Post by jokakilla »

Hi,
ich versuche gerade im Kundeninterface ein Kundenabhängiges Logo einzubauen.

Ich habe dazu bei Framework -> Frontend::Customer die CustomerLogo URL (skins/Customer/default/img/logo.png) durch logo.pl ersetzt.

Die logo.pl habe ich unter /opt/otrs/bin/cgi-bin abgelegt. Testhalber steht im Skript folgendes:

Code: Select all

#!/usr/bin/perl
print "Content-type:text/html\r\n\r\n";
print '<html>';
print '<body>';
#print $ENV{'REMOTE_USER'};
print '<img src="https://x.x.x.x:8443/logo.png">';
print '</body>';
print '</html>';
exit (0);
Je nach REMOTE_USER soll dann später ein anderes Bild zurück gegeben werden.
Wenn ich das Perl Skript von Hand aufrufe zeigt er das Bild. Wenn ich die Login Maske aufrufe sehe ich:

Code: Select all

    <style type="text/css">
        #Header #Logo {
            background-image: url(/otrs-web/logo.pl);
            top: 2px;
            right: 25px;
            width: 149px;
            height: 44px;
        }
    </style>
Ich bin da wohl irgendwie auf dem Holzweg. Kann mir jemand einen Tipp geben wie man sowas am Besten löst?

Jan
jokakilla
Znuny newbie
Posts: 23
Joined: 18 Feb 2011, 16:25
Znuny Version: 3.1.3

Re: Customer Logo je Kunde

Post by jokakilla »

Oder anders gefragt:
Gibt es eine Möglichkeit Skins auf Benutzerbasis anzulegen? Soweit ich das bisher gelesen habe, ist es nur möglich den Customer Skin global zu definieren.
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: Customer Logo je Kunde

Post by reneeb »

Code: Select all

url(/otrs-web/logo.pl);
erwartet, dass Grafikdaten zurückkommen. Dein Perl-Skript liefert aber HTML zurück.

Dein Perl-Skript müsste ungefähr so aussehen:

Code: Select all

#!/usr/bin/perl

use strict;
use warnings;

use CGI;

print CGI->header( 'image/png' ); # Header ausgeben

my $logo = '/path/to/logo.png'; # Pfad auf Dateisystem, *nicht* URL

if ( open my $fh, '<', $logo ) {
    binmode $fh; # Daten wie sie auf Platte liegen auch auslesen
    local $/;   # nicht mehr zeilenweises einlesen, sondern alles auf einmal
    print <$fh>;
}
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
jokakilla
Znuny newbie
Posts: 23
Joined: 18 Feb 2011, 16:25
Znuny Version: 3.1.3

Re: Customer Logo je Kunde

Post by jokakilla »

Danke funktioniert soweit :-)
jokakilla
Znuny newbie
Posts: 23
Joined: 18 Feb 2011, 16:25
Znuny Version: 3.1.3

Re: Customer Logo je Kunde

Post by jokakilla »

Könnte man das Logo auch mit Hilfe eines Skins verändern?

Das Logo das ich in einer CSS im Skin festlege wird ignoriert. Er nimmt immer das aus der CustomerLogo URL Einstellung die ja nicht je Skin funktioniert...glaube ich.
mh254
Znuny newbie
Posts: 37
Joined: 03 Mar 2010, 12:00
Znuny Version: 3.1.1
Real Name: Markus Hoffmann
Location: Helmbrechts

Re: Customer Logo je Kunde

Post by mh254 »

ich habe das Ganze mal für meine Bedürfnisse angepasst. Mein Skript sieht jetzt so aus:

Code: Select all

#!/usr/bin/perl

# This script could be used to print a seperate customer logo
# per website.

# Usage:
# If the the url of your website is www.example.com then
# the name of the logo must be www.example.com.png
# The path to the logo could be changed to whatever
# you need, by default it is /opt/otrs/var/httpd/htdocs/
#
# You need to use ../otrs/logo.pl as URL of the customer logo.

use strict;
use warnings;

use CGI;

my $q = new CGI;
print $q->header( 'image/png' ); # print file header
my $logo = "/opt/otrs/var/httpd/htdocs/".$ENV{'HTTP_HOST'}.".png"; # logo-path $

if ( open my $fh, '<', "$logo" ) {
    binmode $fh;
    local $/;
    print <$fh>;
}
Danke für euren hilfreichen Beitrag, ohne den ich das nicht hinbekommen hätte. Was ich nicht verstehe ist, warum ich ../otrs/logo.pl und nicht logo.pl als URL angeben muss, aber mit ../otrs/logo.pl funktioniert es auf jeden Fall bei mir.
Produktiv:
OTRS: 3.1.11
OS: Ubuntu Server 12.04
Apache2/MySQL 5
Test:
OTRS: 3.1.1
OS: Ubuntu Server 12.04
Apache2/MySQL 5
Post Reply