1 #=====================================================================
 
   4 # Based on SQL-Ledger Version 2.1.9
 
   5 # Web http://www.lx-office.org
 
   7 ######################################################################
 
   8 # SQL-Ledger Accounting
 
   9 # Copyright (c) 1998-2002
 
  11 #  Author: Dieter Simader
 
  12 #   Email: dsimader@sql-ledger.org
 
  13 #     Web: http://www.sql-ledger.org
 
  15 #  Contributors: Christopher Browne
 
  17 # This program is free software; you can redistribute it and/or modify
 
  18 # it under the terms of the GNU General Public License as published by
 
  19 # the Free Software Foundation; either version 2 of the License, or
 
  20 # (at your option) any later version.
 
  22 # This program is distributed in the hope that it will be useful,
 
  23 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 
  24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
  25 # GNU General Public License for more details.
 
  26 # You should have received a copy of the GNU General Public License
 
  27 # along with this program; if not, write to the Free Software
 
  28 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
  29 #######################################################################
 
  31 # thre frame layout with refractured menu
 
  34 #   DS. 2002-03-25  Created
 
  35 #  2004-12-14 - Holger Lindemann
 
  36 #######################################################################
 
  42 use CGI::Carp qw(fatalsToBrowser);
 
  50   my $form     = $main::form;
 
  52   $form->{callback}   = $form->unescape($form->{callback});
 
  53   $form->{callback} ||= "login.pl?action=company_logo";
 
  62 <iframe id="win1" src="$form->{callback}" width="100%" height="93%" name="main_window" style="position: absolute; border:0px;">
 
  63 <p>Ihr Browser kann leider keine eingebetteten Frames anzeigen.
 
  75   my $form     = $main::form;
 
  77   my $fensterlink="menujs.pl?action=display";
 
  78   my $fenster = "["."<a href=\"$fensterlink\" target=\"_blank\">neues Fenster</a>]";
 
  80   my $login = "[Nutzer "
 
  82     . " - <a href=\"login.pl?action=logout\" target=\"_top\">"
 
  83     . $::locale->text('Logout')
 
  85   my ($Sekunden, $Minuten,   $Stunden,   $Monatstag, $Monat,
 
  86       $Jahr,     $Wochentag, $Jahrestag, $Sommerzeit)
 
  88   my $CTIME_String = localtime(time);
 
  91   $Monat     = $Monat < 10     ? $Monat     = "0" . $Monat     : $Monat;
 
  92   $Monatstag = $Monatstag < 10 ? $Monatstag = "0" . $Monatstag : $Monatstag;
 
  94   my @Wochentage = ("Sonntag",    "Montag",  "Dienstag", "Mittwoch",
 
  95                     "Donnerstag", "Freitag", "Samstag");
 
  96   my @Monatsnamen = ("",       "Januar",    "Februar", "März",
 
  97                      "April",  "Mai",       "Juni",    "Juli",
 
  98                      "August", "September", "Oktober", "November",
 
 101       $Wochentage[$Wochentag] . ", der "
 
 106   #$zeit="<div id='Uhr'>".$Stunden.":".$Minuten.":".$Sekunden."</div>";
 
 107   my $zeit = "<div id='Uhr'>" . $Stunden . ":" . $Minuten . "</div>";
 
 109 <script type="text/javascript">
 
 112   var now = new Date();
 
 113   var h = now.getHours();
 
 114   var m = now.getMinutes();
 
 115   document.getElementById('clock_id').innerHTML = (h<10?'0'+h:h)+":"+(m<10?'0'+m:m);
 
 116   var timer=setTimeout("clockon()", 10000);
 
 118 window.onload=clockon
 
 121 <table border="0" width="100%" background="image/bg_titel.gif" cellpadding="0" cellspacing="0">
 
 123     <td style="color:white; font-family:verdana,arial,sans-serif; font-size: 12px;">   $fenster   [<a href="JavaScript:top.main_window.print()">drucken</a>]</td>
 
 124     <td align="right" style="vertical-align:middle; color:white; font-family:verdana,arial,sans-serif; font-size: 12px;" nowrap>
 
 125       $login $datum <span id='clock_id' style='position:relative'></span> 
 
 134   my $form     = $main::form;
 
 135   my %myconfig = %main::myconfig;
 
 137   my $mainlevel = $form->{level};
 
 138   $mainlevel =~ s/$mainlevel--//g;
 
 139   my $menu = Menu->new("menu.ini");
 
 148   border: 1px solid black
 
 152   text-decoration: none;
 
 154   font: 12px Arial, Helvetica
 
 158   text-decoration: none;
 
 160   font: 12px Arial, Helvetica
 
 165   background:url(image/bg_css_menu.png) repeat bottom;
 
 167   border-color:#ccc #888 #555 #bbb;
 
 173 <script type="text/javascript">
 
 175 var isDOM = (document.getElementById ? true : false);
 
 176 var isIE4 = ((document.all && !isDOM) ? true : false);
 
 177 var isNS4 = (document.layers ? true : false);
 
 178 //var KO = (navigator.appName=="Konqueror" \|\| navigator.appName=="Opera") ;
 
 179 var KO = ((navigator.userAgent.indexOf('Opera',0) != -1) \|\| (navigator.userAgent.indexOf('Konqueror',0) != -1));
 
 180 function getRef(id) {
 
 181   if (isDOM) return document.getElementById(id);
 
 182   if (isIE4) return document.all[id];
 
 183   if (isNS4) return document.layers[id];
 
 185 function getSty(id) {
 
 186   return (isNS4 ? getRef(id) : getRef(id).style);
 
 189 var litNow = new Array();
 
 190 function popOver(menuNum, itemNum) {
 
 191   if (KO) document.getElementById("win1").style.visibility = "hidden";
 
 192   clearTimeout(popTimer);
 
 194   litNow = getTree(menuNum, itemNum);
 
 195   changeCol(litNow, true);
 
 196   targetNum = menu[menuNum][itemNum].target;
 
 198     thisX = parseInt(menu[menuNum][0].ref.left) + parseInt(menu[menuNum][itemNum].ref.left);
 
 199     thisY = parseInt(menu[menuNum][0].ref.top) + parseInt(menu[menuNum][itemNum].ref.top);
 
 200     with (menu[targetNum][0].ref) {
 
 201       left = parseInt(thisX + menu[targetNum][0].x);
 
 202       top = parseInt(thisY + menu[targetNum][0].y);
 
 203       visibility = 'visible';
 
 207 function popOut(menuNum, itemNum) {
 
 208   if ((menuNum == 0) && !menu[menuNum][itemNum].target)
 
 210     if (KO) document.getElementById("win1").style.visibility = "visible";
 
 212     popTimer = setTimeout('hideAllBut(0)', 500);
 
 214 function getTree(menuNum, itemNum) {
 
 215   itemArray = new Array(menu.length);
 
 217     itemArray[menuNum] = itemNum;
 
 218     if (menuNum == 0) return itemArray;
 
 219     itemNum = menu[menuNum][0].parentItem;
 
 220     menuNum = menu[menuNum][0].parentMenu;
 
 223 function changeCol(changeArray, isOver) {
 
 224   for (menuCount = 0; menuCount < changeArray.length; menuCount++) {
 
 225     if (changeArray[menuCount]) {
 
 226       newCol = isOver ? menu[menuCount][0].overCol : menu[menuCount][0].backCol;
 
 227       with (menu[menuCount][changeArray[menuCount]].ref) {
 
 228         if (isNS4) bgColor = newCol;
 
 229         else backgroundColor = newCol;
 
 234 function hideAllBut(menuNum) {
 
 235   var keepMenus = getTree(menuNum, 1);
 
 236   for (count = 0; count < menu.length; count++)
 
 237     if (!keepMenus[count])
 
 238       menu[count][0].ref.visibility = 'hidden';
 
 239   changeCol(litNow, false);
 
 242 function Menu(isVert, popInd, x, y, width, overCol, backCol, borderClass, textClass) {
 
 243   this.isVert = isVert;
 
 248   this.overCol = overCol;
 
 249   this.backCol = backCol;
 
 250   this.borderClass = borderClass;
 
 251   this.textClass = textClass;
 
 252   this.parentMenu = null;
 
 253   this.parentItem = null;
 
 256 function Item(text, href, frame, length, spacing, target) {
 
 260   this.length = length;
 
 261   this.spacing = spacing;
 
 262   this.target = target;
 
 265 function go(link,frame) {
 
 266   tmp=eval("top."+frame);
 
 268         //top.main_window.location=link;
 
 270 function writeMenus() {
 
 271   if (!isDOM && !isIE4 && !isNS4) return;
 
 272   for (currMenu = 0; currMenu < menu.length; currMenu++) with (menu[currMenu][0]) {
 
 273     var str = '', itemX = 0, itemY = 0;
 
 274     for (currItem = 1; currItem < menu[currMenu].length; currItem++) with (menu[currMenu][currItem]) {
 
 275       var itemID = 'menu' + currMenu + 'item' + currItem;
 
 276       var w = (isVert ? width : length);
 
 277       var h = (isVert ? length : width);
 
 278       if (isDOM \|\| isIE4) {
 
 279         str += '<div id="' + itemID + '" style="position: absolute; left: ' + itemX + '; top: ' + itemY + '; width: ' + w + '; height: ' + h + '; visibility: inherit; ';
 
 280         if (backCol) str += 'background: ' + backCol + '; ';
 
 284         str += '<layer id="' + itemID + '" left="' + itemX + '" top="' + itemY + '" width="' +  w + '" height="' + h + '" visibility="inherit" ';
 
 285         if (backCol) str += 'bgcolor="' + backCol + '" ';
 
 287       if (borderClass) str += 'class="' + borderClass + '" "';
 
 288       str += 'onMouseOver="popOver(' + currMenu + ',' + currItem + ')" onMouseOut="popOut(' + currMenu + ',' + currItem + ')">';
 
 289       str += '<table width="' + (w - 8) + '" border="0" cellspacing="0" cellpadding="' + (!isNS4 && borderClass ? 3 : 0) + '">';
 
 290       str +='<tr><td class="' + textClass + '" style="cursor:pointer;" align="left" height="' + (h - 7) + '" onClick=\\'go("' + href + '","' + frame + '")\\'>' + text + '</a></td>';
 
 292         menu[target][0].parentMenu = currMenu;
 
 293         menu[target][0].parentItem = currItem;
 
 294         if (popInd) str += '<td class="' + textClass + '" align="right">' + popInd + '</td>';
 
 296       str += '</tr></table>' + (isNS4 ? '</layer>' : '</div>');
 
 297       if (isVert) itemY += length + spacing;
 
 298       else itemX += length + spacing;
 
 301       var newDiv = document.createElement('div');
 
 302       document.getElementsByTagName('body').item(0).appendChild(newDiv);
 
 303       newDiv.innerHTML = str;
 
 305       ref.position = 'absolute';
 
 306       ref.visibility = 'hidden';
 
 309       document.body.insertAdjacentHTML('beforeEnd', '<div id="menu' + currMenu + 'div" ' + 'style="position: absolute; visibility: hidden">' + str + '</div>');
 
 310       ref = getSty('menu' + currMenu + 'div');
 
 314       ref.document.write(str);
 
 315       ref.document.close();
 
 317     for (currItem = 1; currItem < menu[currMenu].length; currItem++) {
 
 318       itemName = 'menu' + currMenu + 'item' + currItem;
 
 319       if (isDOM \|\| isIE4) menu[currMenu][currItem].ref = getSty(itemName);
 
 320       if (isNS4) menu[currMenu][currItem].ref = ref.document[itemName];
 
 326     ref.visibility = 'visible';
 
 329 var menu = new Array();
 
 330 var defOver = '#cccccc';
 
 331 var defBack = '#dddddd';
 
 333 menu[0] = new Array();
 
 334 menu[0][0] = new Menu(false, '', 5, 18, 19, '#cccccc', '', '', 'rootItemText');
 
 338   §ion_menu($menu);
 
 341 var popOldWidth = window.innerWidth;
 
 342 nsResizeHandler = new Function('if (popOldWidth != window.innerWidth) location.reload()');
 
 343 if (isNS4) document.captureEvents(Event.CLICK);
 
 344 document.onclick = clickHandle;
 
 345 function clickHandle(evt) {
 
 346   if (isNS4) document.routeEvent(evt);
 
 348   if (KO) document.getElementById("win1").style.visibility = "visible";
 
 350 function moveRoot() {
 
 351   with(menu[0][0].ref) left = ((parseInt(left) < 100) ? 100 : 5);
 
 356 <BODY scrolling="no" topmargin="0" leftmargin="0"  marginwidth="0" marginheight="0" style="margin: 0" onLoad="writeMenus(); clockon();" onResize="if (isNS4) nsResizeHandler()">
 
 359 <table class="menu" width="100%" border="0" cellpadding="0" cellspacing="0">
 
 360 <tr><td height="21"><font size="1"> </font></td></tr></table>
 
 372   my ($menu, $level) = @_;
 
 374   my $form     = $main::form;
 
 375   my %myconfig = %main::myconfig;
 
 378   my @menuorder = $menu->access_control(\%myconfig, $level);
 
 383   my (%mlz, $sm, $z, $pm, $mm);
 
 385     my $item  = shift @menuorder;
 
 388     $label =~ s/$level--//g;
 
 390     $label = $::locale->text($label);
 
 391     $label =~ s/ / /g;
 
 392     $menu->{$item}{target} = "main_window" unless $menu->{$item}{target};
 
 394     if ($menu->{$item}{submenu}) {
 
 395       $menu->{$item}{$item} = !$form->{$item};
 
 398       if ($mlz{"s$ml"} > 1) {
 
 406         qq|menu[$mlz{$ml}][$z] = new Item('$label', '#', '', defLength, 0, |
 
 410       print qq|menu[$pm] = new Array();\n|;
 
 412         qq|menu[$pm][0] = new Menu(true, '', 85, 0, 180, defOver, defBack, 'itemBorder', 'itemText');\n|;
 
 413       map { shift @menuorder } grep /^$item/, @menuorder;
 
 414       §ion_menu($menu, $item);
 
 415       map { shift @menuorder } grep /^$item/, @menuorder;
 
 417       if ($menu->{$item}{module}) {
 
 420         my $target = $menu->{$item}{target};
 
 421         my $uri    = $menu->menuitem_js(\%myconfig, \%$form, $item, $level);
 
 424           qq|menu[$pm][$sm] = new Item('$label', '$uri', '$target', defLength, 0, 0);\n|;
 
 427         my $ml_ = $form->escape($ml);
 
 430         %mlz   = ($ml, $pm, "s$ml", 1);
 
 433         my $breit = 15 + length($label) * 6;
 
 435           qq|menu[0][$mm] = new Item('  $label', '#', '', $breit, 10, $pm); \n|;
 
 436         print qq|menu[$pm] = new Array();\n|;
 
 438           qq|menu[$pm][0] = new Menu(true, '>', 0, 20, 180, defOver, defBack, 'itemBorder', 'itemText');\n|;
 
 440         §ion_menu($menu, $item);