summaryrefslogtreecommitdiff
path: root/bin/mozilla
diff options
context:
space:
mode:
Diffstat (limited to 'bin/mozilla')
-rwxr-xr-xbin/mozilla/menu.pl310
1 files changed, 150 insertions, 160 deletions
diff --git a/bin/mozilla/menu.pl b/bin/mozilla/menu.pl
index f380dfb1..848cf14b 100755
--- a/bin/mozilla/menu.pl
+++ b/bin/mozilla/menu.pl
@@ -5,7 +5,7 @@
# See COPYRIGHT file for copyright information
#======================================================================
#
-# This file has NOT undergone whitespace cleanup.
+# This file has undergone whitespace cleanup.
#
#======================================================================
#
@@ -16,239 +16,229 @@
$menufile = "menu.ini";
use LedgerSMB::Menu;
-
1;
# end of main
sub display {
- $menuwidth = ($ENV{HTTP_USER_AGENT} =~ /links/i) ? "240" : "155";
- $menuwidth = $myconfig{menuwidth} if $myconfig{menuwidth};
+ $menuwidth = ($ENV{HTTP_USER_AGENT} =~ /links/i) ? "240" : "155";
+ $menuwidth = $myconfig{menuwidth} if $myconfig{menuwidth};
- $form->header(!$form->{duplicate});
+ $form->header(!$form->{duplicate});
- print qq|
+ 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}&js=$form->{js}" />
+ <frame name="main_window" src="am.pl?login=$form->{login}&sessionid=$form->{sessionid}&action=$form->{main}&path=$form->{path}" />
+ </frameset>
+ </body>
+ </html>
+ |;
-<frameset cols="$menuwidth,*" border="1">
+}
- <frame name="acc_menu" src="$form->{script}?login=$form->{login}&sessionid=$form->{sessionid}&action=acc_menu&path=$form->{path}&js=$form->{js}">
- <frame name="main_window" src="am.pl?login=$form->{login}&sessionid=$form->{sessionid}&action=$form->{main}&path=$form->{path}">
-</frameset>
-</body>
-</html>
-|;
+sub acc_menu {
-}
+ my $menu = new Menu "$menufile";
+ $menu->add_file("custom_$menufile") if -f "custom_$menufile";
+ $menu->add_file("$form->{login}_$menufile") if -f "$form->{login}_$menufile";
+ $form->{title} = $locale->text('Accounting Menu');
+ $form->header;
-sub acc_menu {
+ print q|
+ <script type="text/javascript">
- my $menu = new Menu "$menufile";
- $menu->add_file("custom_$menufile") if -f "custom_$menufile";
- $menu->add_file("$form->{login}_$menufile") if -f "$form->{login}_$menufile";
-
- $form->{title} = $locale->text('Accounting Menu');
-
- $form->header;
-
- print qq|
-<script type="text/javascript">
-function SwitchMenu(obj) {
- if (document.getElementById) {
- var el = document.getElementById(obj);
- var ar = document.getElementById("cont").getElementsByTagName("DIV");
-
- if (el.style.display == "none") {
- el.style.display = "block"; //display the block of info
- } else {
- el.style.display = "none";
- }
- }
-}
+ function SwitchMenu(obj) {
+ if (document.getElementById) {
+ var el = document.getElementById(obj);
+ var ar = document.getElementById("cont").getElementsByTagName("DIV");
-function ChangeClass(menu, newClass) {
- if (document.getElementById) {
- document.getElementById(menu).className = newClass;
- }
-}
-document.onselectstart = new Function("return false");
-</script>
+ if (el.style.display == "none") {
+ el.style.display = "block"; //display the block of info
+ } else {
+ el.style.display = "none";
+ }
+ }
+ }
-<body class=menu>
+ function ChangeClass(menu, newClass) {
+ if (document.getElementById) {
+ document.getElementById(menu).className = newClass;
+ }
+ }
-<img class="cornderlogo" src="ledger-smb_small.png" width="100" height="50" border="1" />
-|;
+ document.onselectstart = new Function("return false");
+ </script>
- if ($form->{js}) {
- &js_menu($menu);
- } else {
- &section_menu($menu);
- }
+ <body class="menu">
+ <img class="cornderlogo" src="ledger-smb_small.png" width="100" height="50" border="1" />
+ |;
- print qq|
-</body>
-</html>
-|;
+ if ($form->{js}) {
+ &js_menu($menu);
+ } else {
+ &section_menu($menu);
+ }
+
+ print q|
+ </body>
+ </html>
+ |;
}
sub section_menu {
- my ($menu, $level) = @_;
- # build tiered menus
- my @menuorder = $menu->access_control(\%myconfig, $level);
+ my ($menu, $level) = @_;
- while (@menuorder) {
- $item = shift @menuorder;
- $label = $item;
- $label =~ s/$level--//g;
+ # build tiered menus
+ my @menuorder = $menu->access_control(\%myconfig, $level);
- my $spacer = "&nbsp;" x (($item =~ s/--/--/g) * 2);
+ while (@menuorder) {
+ $item = shift @menuorder;
+ $label = $item;
+ $label =~ s/$level--//g;
- $label =~ s/.*--//g;
- $label = $locale->text($label);
- $label =~ s/ /&nbsp;/g if $label !~ /<img /i;
+ my $spacer = "&nbsp;" x (($item =~ s/--/--/g) * 2);
- $menu->{$item}{target} = "main_window" unless $menu->{$item}{target};
-
- if ($menu->{$item}{submenu}) {
+ $label =~ s/.*--//g;
+ $label = $locale->text($label);
+ $label =~ s/ /&nbsp;/g if $label !~ /<img /i;
- $menu->{$item}{$item} = !$form->{$item};
+ $menu->{$item}{target} = "main_window" unless $menu->{$item}{target};
- if ($form->{level} && $item =~ $form->{level}) {
+ if ($menu->{$item}{submenu}) {
- # expand menu
- print qq|<br>\n$spacer|.$menu->menuitem(\%myconfig, \%$form, $item, $level).qq|$label</a>|;
+ $menu->{$item}{$item} = !$form->{$item};
- # remove same level items
- map { shift @menuorder } grep /^$item/, @menuorder;
-
- &section_menu($menu, $item);
+ if ($form->{level} && $item =~ $form->{level}) {
- print qq|<br>\n|;
+ # expand menu
+ print qq|<br />\n$spacer|.$menu->menuitem(\%myconfig, \%$form, $item, $level).qq|$label</a>|;
- } else {
+ # remove same level items
+ map { shift @menuorder } grep /^$item/, @menuorder;
- print qq|<br>\n$spacer|.$menu->menuitem(\%myconfig, \%$form, $item, $level).qq|$label&nbsp;...</a>|;
+ &section_menu($menu, $item);
- # remove same level items
- map { shift @menuorder } grep /^$item/, @menuorder;
+ print qq|<br />\n|;
- }
-
- } else {
-
- if ($menu->{$item}{module}) {
+ } else {
- print qq|<br>\n$spacer|.$menu->menuitem(\%myconfig, \%$form, $item, $level).qq|$label</a>|;
-
- } else {
+ print qq|<br />\n$spacer|.$menu->menuitem(\%myconfig, \%$form, $item, $level).qq|$label&nbsp;...</a>|;
- $form->{tag}++;
- print qq|<a name="id$form->{tag}"></a>
- <p><b>$label</b>|;
-
- &section_menu($menu, $item);
+ # remove same level items
+ map { shift @menuorder } grep /^$item/, @menuorder;
- print qq|<br>\n|;
+ }
- }
- }
- }
-}
+ } 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></p>|;
+
+ &section_menu($menu, $item);
+
+ print qq|<br />\n|;
+
+ }
+ }
+ }
+}
sub js_menu {
- my ($menu, $level) = @_;
- print qq|
- <div id="cont">
- |;
+ my ($menu, $level) = @_;
- # build tiered menus
- my @menuorder = $menu->access_control(\%myconfig, $level);
+ print qq| <div id="cont"> |;
- while (@menuorder){
- $i++;
- $item = shift @menuorder;
- $label = $item;
- $label =~ s/.*--//g;
- $label = $locale->text($label);
+ # build tiered menus
+ my @menuorder = $menu->access_control(\%myconfig, $level);
- $menu->{$item}{target} = "main_window" unless $menu->{$item}{target};
+ while (@menuorder){
+ $i++;
+ $item = shift @menuorder;
+ $label = $item;
+ $label =~ s/.*--//g;
+ $label = $locale->text($label);
- if ($menu->{$item}{submenu}) {
-
- $display = "display: none;" unless $level eq ' ';
+ $menu->{$item}{target} = "main_window" unless $menu->{$item}{target};
- print qq|
-<div id="menu$i" class="menuOut" onclick="SwitchMenu('sub$i')" onmouseover="ChangeClass('menu$i','menuOver')" onmouseout="ChangeClass('menu$i','menuOut')">$label</div>
- <div class="submenu" id="sub$i" style="$display">|;
-
- # remove same level items
- map { shift @menuorder } grep /^$item/, @menuorder;
-
- &js_menu($menu, $item);
-
- print qq|
+ if ($menu->{$item}{submenu}) {
- </div>
- |;
+ $display = "display: none;" unless $level eq ' ';
- } else {
+ print qq|
+ <div id="menu$i" class="menuOut" onclick="SwitchMenu('sub$i')" onmouseover="ChangeClass('menu$i','menuOver')" onmouseout="ChangeClass('menu$i','menuOut')">$label</div>
+ <div class="submenu" id="sub$i" style="$display">|;
- if ($menu->{$item}{module}) {
- if ($level eq "") {
- print qq|<div id="menu$i" class="menuOut" onmouseover="ChangeClass('menu$i','menuOver')" onmouseout="ChangeClass('menu$i','menuOut')"> |.
- $menu->menuitem(\%myconfig, \%$form, $item, $level).qq|$label</a></div>|;
+ # remove same level items
+ map { shift @menuorder } grep /^$item/, @menuorder;
- # remove same level items
- map { shift @menuorder } grep /^$item/, @menuorder;
+ &js_menu($menu, $item);
- &js_menu($menu, $item);
+ print qq|
- } else {
-
- print qq|<div class="submenu"> |.
- $menu->menuitem(\%myconfig, \%$form, $item, $level).qq|$label</a></div>|;
- }
+ </div>
+ |;
- } else {
+ } else {
- $display = "display: none;" unless $item eq ' ';
+ if ($menu->{$item}{module}) {
- print qq|
-<div id="menu$i" class="menuOut" onclick="SwitchMenu('sub$i')" onmouseover="ChangeClass('menu$i','menuOver')" onmouseout="ChangeClass('menu$i','menuOut')">$label</div>
- <div class="submenu" id="sub$i" style="$display">|;
-
- &js_menu($menu, $item);
-
- print qq|
+ if ($level eq "") {
+ print qq|<div id="menu$i" class="menuOut" onmouseover="ChangeClass('menu$i','menuOver')" onmouseout="ChangeClass('menu$i','menuOut')"> |.
+ $menu->menuitem(\%myconfig, \%$form, $item, $level).qq|$label</a></div>|;
- </div>
- |;
+ # remove same level items
+ map { shift @menuorder } grep /^$item/, @menuorder;
- }
+ &js_menu($menu, $item);
- }
+ } else {
- }
+ print qq|<div class="submenu"> |.
+ $menu->menuitem(\%myconfig, \%$form, $item, $level).qq|$label</a></div>|;
+ }
- print qq|
- </div>
- |;
+ } else {
+
+ $display = "display: none;" unless $item eq ' ';
+
+ print qq|
+ <div id="menu$i" class="menuOut" onclick="SwitchMenu('sub$i')" onmouseover="ChangeClass('menu$i','menuOver')" onmouseout="ChangeClass('menu$i','menuOut')">$label</div>
+ <div class="submenu" id="sub$i" style="$display">|;
+
+ &js_menu($menu, $item);
+
+ print qq| </div> |;
+
+ }
+
+ }
+
+ }
+
+ print qq| </div> |;
}
sub menubar {
- 1;
+1;
}