[otrs-cvs] Fred/Kernel/Output/HTML OutputFilterPostShowSystemNameInHeader.pm, 1.1, 1.2

"CVS commits notifications of OTRS.org" <[email protected]> Fri, 8 Mar 2013 08:54:04 +0000
Newsgroups gmane.comp.otrs.cvs
Message-ID <[email protected]>
Comments:
Update of /home/cvs/Fred/Kernel/Output/HTML
In directory lancelot:/tmp/cvs-serv2729/Kernel/Output/HTML

Modified Files:
	OutputFilterPostShowSystemNameInHeader.pm 
Log Message:
Added display of git branch name, if any.

Author: mg

Index: OutputFilterPostShowSystemNameInHeader.pm
===================================================================
RCS file: /home/cvs/Fred/Kernel/Output/HTML/OutputFilterPostShowSystemNameInHeader.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -2 -u -d -r1.1 -r1.2
--- OutputFilterPostShowSystemNameInHeader.pm	25 Oct 2012 16:50:54 -0000	1.1
+++ OutputFilterPostShowSystemNameInHeader.pm	8 Mar 2013 08:53:59 -0000	1.2
@@ -1,5 +1,5 @@
 # --
 # Kernel/Output/HTML/OutputFilterPostShowSystemNameInHeader.pm
-# Copyright (C) 2001-2012 OTRS AG, http://otrs.org/
+# Copyright (C) 2001-2013 OTRS AG, http://otrs.org/
 # --
 # $Id$
@@ -18,4 +18,6 @@
 $VERSION = qw($Revision$) [1];
 
+use Cwd;
+
 sub new {
     my ( $Type, %Param ) = @_;
@@ -56,8 +58,22 @@
         || 'red';
 
+    # Add current git branch to output
+    my $Home = $Self->{ConfigObject}->Get('Home');
+    if ( -d "$Home/.git" ) {
+        my $OldWorkingDir = getcwd();
+        chdir($Home);
+        my $GitResult = `git branch`;
+        chdir($OldWorkingDir);
+
+        if ($GitResult) {
+            my ($BranchName) = $GitResult =~ m/^[*] \s+ (\S+)/xms;
+            $SystemName .= " ($BranchName)";
+        }
+    }
+
     # inject system name right into the middle of the header to always have the attention
     my $Search  = '(<div \s* id="Logo"></div>)';
     my $Replace = <<"FILTERINPUT_HTML";
-<div style="font-size:18px; background-color: $BackgroundColor; padding: 10px 10px 15px 10px; width: 200px; text-align: center; position: absolute; left: 50%; margin-left: -110px; top: 0px; border-radius: 0px 0px 5px 5px;">$SystemName</div>
+<div style="font-size:18px; background-color: $BackgroundColor; padding: 10px 10px 15px 10px; width: 400px; text-align: center; position: absolute; left: 50%; margin-left: -110px; top: 0px; border-radius: 0px 0px 5px 5px;">$SystemName</div>
 FILTERINPUT_HTML
     ${ $Param{Data} } =~ s{$Search}{$Replace$1}xms;
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log