]> wagnertech.de Git - kivitendo-erp.git/commitdiff
kopf.pl auf Controller umgestellt
authorMoritz Bunkus <m.bunkus@linet-services.de>
Fri, 13 May 2011 13:30:23 +0000 (15:30 +0200)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Fri, 13 May 2011 13:30:23 +0000 (15:30 +0200)
12 files changed:
SL/Controller/DebugMenu.pm
SL/Controller/FrameHeader.pm [new file with mode: 0644]
SL/Dispatcher.pm
SL/Form.pm
bin/mozilla/am.pl
bin/mozilla/kopf.pl [deleted file]
bin/mozilla/menu.pl
config/lx_office.conf.default
css/frame_header/header.css [new file with mode: 0644]
js/switchmenuframe.js
scripts/mklinks.sh
templates/webpages/menu/header.html

index d612d3701c4d601b5e20424811c02af945ed391e..0e536760aecb70deb699a554221379627a528314 100644 (file)
@@ -9,7 +9,7 @@ __PACKAGE__->run_before(sub { die 'not allowed in config' unless $::lx_office_co
 sub action_reload {
   my ($self, %params) = @_;
 
-  print $::cgi->redirect('kopf.pl');
+  print $::cgi->redirect('controller.pl?action=FrameHeader/header');
   exit;
 }
 
@@ -17,7 +17,7 @@ sub action_toggle {
   my ($self, %params) = @_;
 
   $::lxdebug->level_by_name($::form->{level}, !$::lxdebug->level_by_name($::form->{level}));
-  print $::cgi->redirect('kopf.pl');
+  print $::cgi->redirect('controller.pl?action=FrameHeader/header');
   return;
 }
 
diff --git a/SL/Controller/FrameHeader.pm b/SL/Controller/FrameHeader.pm
new file mode 100644 (file)
index 0000000..855350c
--- /dev/null
@@ -0,0 +1,17 @@
+package SL::Controller::FrameHeader;
+
+use strict;
+use parent qw(SL::Controller::Base);
+
+sub action_header {
+  my ($self) = @_;
+
+  delete $::form->{stylesheet};
+  $::form->use_stylesheet('frame_header/header.css');
+  $self->render('menu/header',
+                now        => DateTime->now_local,
+                is_fastcgi => scalar($::dispatcher->interface_type =~ /fastcgi/i),
+                is_links   => scalar($ENV{HTTP_USER_AGENT}         =~ /links/i));
+}
+
+1;
index e728976936a8d34936c37c32bbdcc2013ebdb737..47c2e2a35cb41d3f56edf222019303445441f236 100644 (file)
@@ -188,7 +188,7 @@ sub handle_request {
 
     $::form->error($::locale->text('System currently down for maintenance!')) if -e ($::lx_office_conf{paths}->{userspath} . "/nologin") && $script ne 'admin';
 
-    if ($script eq 'login' or $script eq 'admin' or $script eq 'kopf') {
+    if ($script eq 'login' or $script eq 'admin') {
       $::form->{titlebar} = "Lx-Office " . $::locale->text('Version') . " $::form->{version}";
       ::run($session_result);
 
index dfff9b4f7bd6444c6d24e0dc965704bad51309d4..cef5995ab8e4b8c7202d2defee98ae48648ea0d4 100644 (file)
@@ -640,6 +640,18 @@ sub create_http_response {
   return $output;
 }
 
+sub use_stylesheet {
+  my $self = shift;
+
+  $self->{stylesheet} = [ $self->{stylesheet} ] unless ref $self->{stylesheet} eq 'ARRAY';
+  $self->{stylesheet} = [ grep { -f                       }
+                          map  { m:^css/: ? $_ : "css/$_" }
+                          grep { $_                       }
+                               (@{ $self->{stylesheet} }, @_)
+                        ];
+
+  return @{ $self->{stylesheet} };
+}
 
 sub header {
   $::lxdebug->enter_sub;
@@ -662,8 +674,7 @@ sub header {
     push @header, "<meta http-equiv='refresh' content='$refresh_time;$refresh_url'>";
   }
 
-  push @header, "<link rel='stylesheet' href='css/$_' type='text/css' title='Lx-Office stylesheet'>"
-    for grep { -f "css/$_" } apply { s|.*/|| } $self->{stylesheet}, $self->{stylesheets};
+  push @header, map { qq|<link rel="stylesheet" href="$_" type="text/css" title="Lx-Office stylesheet">| } $self->use_stylesheet;
 
   push @header, "<style type='text/css'>\@page { size:landscape; }</style>" if $self->{landscape};
   push @header, "<link rel='shortcut icon' href='$self->{favicon}' type='image/x-icon'>" if -f $self->{favicon};
@@ -1638,7 +1649,7 @@ sub date_closed {
   #   Leere Datumseingabe i.O.
   #     SELECT 1 FROM defaults WHERE '' < closedto
   #   normale Zahlungsbuchung über Rechnungsmaske i.O.
-  #     SELECT 1 FROM defaults WHERE '10.05.2011' < closedto 
+  #     SELECT 1 FROM defaults WHERE '10.05.2011' < closedto
   # Testfälle mit definiertem closedto (30.04.2011):
   #  Leere Datumseingabe i.O.
   #   SELECT 1 FROM defaults WHERE '' < closedto
@@ -3812,7 +3823,7 @@ Examples:
 =head2 C<header>
 
 Generates a general purpose http/html header and includes most of the scripts
-ans stylesheets needed.
+and stylesheets needed. Stylesheets can be added with L<use_stylesheet>.
 
 Only one header will be generated. If the method was already called in this
 request it will not output anything and return undef. Also if no
@@ -3832,9 +3843,8 @@ default to 3 seconds and the refering url.
 
 =item stylesheet
 
-=item stylesheets
-
-If these are arrayrefs the contents will be inlined into the header.
+Either a scalar or an array ref. Will be inlined into the header. Add
+stylesheets with the L<use_stylesheet> function.
 
 =item landscape
 
index 5dfb72f00050e05016fb242d485de8afb1e6bb5f..c6bb8e47c1ea6a6ca0bf4cfe6b30c7c4594adc0d 100644 (file)
@@ -504,7 +504,7 @@ sub list_account {
 
   push(@ { $form->{AJAX} }, $pjx);
 
-  $form->{stylesheets} = "list_accounts.css";
+  $form->use_stylesheet("list_accounts.css");
   $form->{title}       = $locale->text('Chart of Accounts');
 
   $form->header;
diff --git a/bin/mozilla/kopf.pl b/bin/mozilla/kopf.pl
deleted file mode 100644 (file)
index 0228566..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use DateTime;
-
-sub run {
-  my $session_result = shift;
-
-  %::myconfig = $::auth->read_user($::form->{login})  if $::form->{login};
-  $::locale   = Locale->new($::myconfig{countrycode}) if $::myconfig{countrycode};
-
-  $::form->header;
-  print $::form->parse_html_template('menu/header', {
-    now        => DateTime->now,
-    show_debug => $::lx_office_conf{debug}{show_debug_menu},
-    lxdebug    => $::lxdebug,
-    is_links   => ($ENV{HTTP_USER_AGENT} =~ /links/i),
-  });
-}
-
-1;
-
-#
index cd0ca0d913a17bbadd32f1b1be8dc5d922792826..15c43efe53867ea290d704e12ef6e469d42f1c31 100644 (file)
@@ -63,7 +63,7 @@ sub display {
 
   print qq|
 <frameset rows="28px,*" cols="*" framespacing="0" frameborder="0">
-  <frame  src="kopf.pl" name="kopf"  scrolling="NO">
+  <frame  src="controller.pl?action=FrameHeader/header" scrolling="NO">
   <frameset cols="$framesize,*" framespacing="0" frameborder="0" border="0" id="menuframe" name="menuframe">
     <frame src="$::form->{script}?action=acc_menu" name="acc_menu"  scrolling="auto" noresize marginwidth="0">
     <frame src="$callback" name="main_window" scrolling="auto">
index 5f7f272a4dd4e0c4443166a58dffea35a051b6ca..bc350c7d1942c0c04d3847b16ace67d8b29b03fd 100644 (file)
@@ -222,7 +222,8 @@ global_level = NONE
 # default.
 watch_form = 0
 
-# Include menu options for debugging in the HTML menu
+# Include menu options for debugging in the HTML menu. Works only in
+# FastCGI mode.
 show_debug_menu = 0
 
 # If you want to debug the creation of LaTeX files then set this to 1.
diff --git a/css/frame_header/header.css b/css/frame_header/header.css
new file mode 100644 (file)
index 0000000..cfca081
--- /dev/null
@@ -0,0 +1,26 @@
+body {
+  margin: 0;
+  color: white;
+  background: url('../../image/fade.png') repeat-x;
+}
+
+a:link, a:visited, a:hover, a:active {
+  color: white;
+}
+
+body > * {
+  font-size: 12px;
+  font-family: verdana,arial,sans-serif;
+  vertical-align: middle;
+}
+
+table {
+  border: 0;
+  width: 100%;
+  background: url('../../image/bg_titel.gif');
+  border-spacing: 0;
+}
+
+td {
+  padding: 0;
+}
index d0bf2ac2d4ff6ac2428c085d2833b25c8c4c7f43..ec2242648eea2d6ef4c863701da00346e770a482 100644 (file)
@@ -1,6 +1,3 @@
-/* This is used in bin/mozilla/kopf.pl to switch the HTML side menu on/off
-   2010, Sven Donath, lxo@dexo.de  */
-
 var vSwitch_Menu = 1;
 var FrameSize = (parent.document.getElementById('menuframe').cols);
 
index 190433f2ce3fc889af9a9d0ebe15d404b4bf4799..52b8bb4d9e5903e45f763cf3205b4d68587cfe12 100755 (executable)
@@ -1,10 +1,10 @@
 #!/bin/sh
 
-for i in am dispatcher kopf login; do
+for i in am dispatcher login; do
        rm $i.pl 2> /dev/null
        ln -s admin.pl $i.pl
 done
-for i in acctranscorrections amcvar amtemplates ap ar bankaccounts bp ca common cp ct datev dn do fu gl ic ir is licenses menujs menunew menu menuv3 menuv4 menuXML oe pe projects rc rp sepa todo ustva wh vk; do 
+for i in acctranscorrections amcvar amtemplates ap ar bankaccounts bp ca common cp ct datev dn do fu gl ic ir is licenses menujs menunew menu menuv3 menuv4 menuXML oe pe projects rc rp sepa todo ustva wh vk; do
        rm $i.pl 2> /dev/null
        ln -s am.pl $i.pl
 done
index 359c9409407209d5905eaf3bd5930048995ce8bd..4c2cbddc221aa0c13506b4e56e2bd89ba21f7e52 100644 (file)
@@ -1,12 +1,5 @@
 [%- USE T8 %]
-<style type='text/css'>
-  body { margin: 0; color: white; background: url('image/fade.png') repeat-x; }
-  a:link, a:visited, a:hover, a:active { color:white }
-  body > * { font-size: 12px; font-family:verdana,arial,sans-serif; vertical-align:middle; }
-  table { border:0; width: 100%; background: url('image/bg_titel.gif'); border-spacing:0; }
-  td { padding: 0 }
-</style>
-<script language='javascript' src='js/switchmenuframe.js'></script>
+<script language="javascript" src="js/switchmenuframe.js"></script>
 <body>
  <table>
   <tr>
     [<a href="Javascript:top.main_window.history.forward();" title="[% 'Go one step forward' | $T8 %]">[% 'Fwd' | $T8 %]</a>]
    </td>
 [%- END %]
-[% IF show_debug %]
+[% IF is_fastcgi && LXCONFIG.debug.show_debug_menu %]
    <td align='center' nowrap>
     Debug:
     [<a href='controller.pl?action=DebugMenu/reload']>FCGI Reload</a>]
-    [<a href='controller.pl?action=DebugMenu/toggle&level=request_timer'>[% IF lxdebug.level_by_name('request_timer') %]<b>Timing</b>[% ELSE %]Timing[% END %]</a>]
-    [<a href='controller.pl?action=DebugMenu/toggle&level=trace'>[% IF lxdebug.level_by_name('trace') %]<b>Trace</b>[% ELSE %]Trace[% END %]</a>]
-    [<a href='controller.pl?action=DebugMenu/toggle&level=query'>[% IF lxdebug.level_by_name('query') %]<b>Query</b>[% ELSE %]Query[% END %]</a>]
+    [<a href='controller.pl?action=DebugMenu/toggle&level=request_timer'>[% IF LXDEBUG.level_by_name('request_timer') %]<b>Timing</b>[% ELSE %]Timing[% END %]</a>]
+    [<a href='controller.pl?action=DebugMenu/toggle&level=trace'>[% IF LXDEBUG.level_by_name('trace') %]<b>Trace</b>[% ELSE %]Trace[% END %]</a>]
+    [<a href='controller.pl?action=DebugMenu/toggle&level=query'>[% IF LXDEBUG.level_by_name('query') %]<b>Query</b>[% ELSE %]Query[% END %]</a>]
    </td>
 [%- END %]
    <td align="right" nowrap>