summaryrefslogtreecommitdiff
path: root/sql-ledger/bin/mozilla/menu.pl
diff options
context:
space:
mode:
Diffstat (limited to 'sql-ledger/bin/mozilla/menu.pl')
-rw-r--r--sql-ledger/bin/mozilla/menu.pl158
1 files changed, 158 insertions, 0 deletions
diff --git a/sql-ledger/bin/mozilla/menu.pl b/sql-ledger/bin/mozilla/menu.pl
new file mode 100644
index 0000000..fab2905
--- /dev/null
+++ b/sql-ledger/bin/mozilla/menu.pl
@@ -0,0 +1,158 @@
+######################################################################
+# SQL-Ledger Accounting
+# Copyright (c) 2001
+#
+# Author: Dieter Simader
+# Email: dsimader@sql-ledger.org
+# Web: http://www.sql-ledger.org
+#
+# Contributors: Christopher Browne
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#######################################################################
+#
+# two frame layout with refractured menu
+#
+#######################################################################
+
+$menufile = "menu.ini";
+use SL::Menu;
+
+
+1;
+# end of main
+
+
+sub display {
+
+ $menuwidth = ($ENV{HTTP_USER_AGENT} =~ /links/i) ? "240" : "155";
+ $menuwidth = $myconfig{menuwidth} if $myconfig{menuwidth};
+
+ $form->header(1);
+
+ print qq|
+
+<FRAMESET COLS="$menuwidth,*" BORDER="1">
+
+ <FRAME NAME="acc_menu" SRC="$form->{script}?login=$form->{login}&sessionid=$form->{sessionid}&action=acc_menu&path=$form->{path}">
+ <FRAME NAME="main_window" SRC="am.pl?login=$form->{login}&sessionid=$form->{sessionid}&action=company_logo&path=$form->{path}">
+
+</FRAMESET>
+
+</BODY>
+</HTML>
+|;
+
+}
+
+
+
+sub acc_menu {
+
+ my $menu = new Menu "$menufile";
+ $menu = new Menu "custom_$menufile" if (-f "custom_$menufile");
+ $menu = new Menu "$form->{login}_$menufile" if (-f "$form->{login}_$menufile");
+
+ $form->{title} = $locale->text('Accounting Menu');
+
+ $form->header;
+
+ print qq|
+<body class=menu>
+
+|;
+
+ &section_menu($menu);
+
+ print qq|
+</body>
+</html>
+|;
+
+}
+
+
+sub section_menu {
+ my ($menu, $level) = @_;
+
+ # build tiered menus
+ my @menuorder = $menu->access_control(\%myconfig, $level);
+
+ while (@menuorder) {
+ $item = shift @menuorder;
+ $label = $item;
+ $label =~ s/$level--//g;
+
+ my $spacer = "&nbsp;" x (($item =~ s/--/--/g) * 2);
+
+ $label =~ s/.*--//g;
+ $label = $locale->text($label);
+ $label =~ s/ /&nbsp;/g if $label !~ /<img /i;
+
+ $menu->{$item}{target} = "main_window" unless $menu->{$item}{target};
+
+ if ($menu->{$item}{submenu}) {
+
+ $menu->{$item}{$item} = !$form->{$item};
+
+ if ($form->{level} && $item =~ $form->{level}) {
+
+ # expand menu
+ print qq|<br>\n$spacer|.$menu->menuitem(\%myconfig, \%$form, $item, $level).qq|$label</a>|;
+
+ # remove same level items
+ map { shift @menuorder } grep /^$item/, @menuorder;
+
+ &section_menu($menu, $item);
+
+ print qq|<br>\n|;
+
+ } else {
+
+ print qq|<br>\n$spacer|.$menu->menuitem(\%myconfig, \%$form, $item, $level).qq|$label&nbsp;...</a>|;
+
+ # remove same level items
+ map { shift @menuorder } grep /^$item/, @menuorder;
+
+ }
+
+ } else {
+
+ if ($menu->{$item}{module}) {
+
+ print qq|<br>\n$spacer|.$menu->menuitem(\%myconfig, \%$form, $item, $level).qq|$label</a>|;
+
+ } else {
+
+ $form->{tag}++;
+ print qq|<a name="id$form->{tag}"></a>
+ <p><b>$label</b>|;
+
+ &section_menu($menu, $item);
+
+ print qq|<br>\n|;
+
+ }
+ }
+ }
+}
+
+
+sub menubar {
+
+ 1;
+
+}
+
+