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 #######################################################################
38 my $menufile = "menu.ini";
40 use CGI::Carp qw(fatalsToBrowser);
52 my $form = $main::form;
54 $form->{callback} = $form->unescape($form->{callback});
55 $form->{callback} ||= "login.pl?action=company_logo";
64 <iframe id="win1" src="$form->{callback}" width="100%" height="93%" name="main_window" style="position: absolute; border:0px;">
65 <p>Ihr Browser kann leider keine eingebetteten Frames anzeigen.
77 my $form = $main::form;
79 my $fensterlink="menujs.pl?action=display";
80 my $fenster = "["."<a href=\"$fensterlink\" target=\"_blank\">neues Fenster</a>]";
82 my $login = "[Nutzer "
84 . " - <a href=\"login.pl?action=logout\" target=\"_top\">"
85 . $locale->text('Logout')
87 my ($Sekunden, $Minuten, $Stunden, $Monatstag, $Monat,
88 $Jahr, $Wochentag, $Jahrestag, $Sommerzeit)
90 my $CTIME_String = localtime(time);
93 $Monat = $Monat < 10 ? $Monat = "0" . $Monat : $Monat;
94 $Monatstag = $Monatstag < 10 ? $Monatstag = "0" . $Monatstag : $Monatstag;
96 my @Wochentage = ("Sonntag", "Montag", "Dienstag", "Mittwoch",
97 "Donnerstag", "Freitag", "Samstag");
98 my @Monatsnamen = ("", "Januar", "Februar", "März",
99 "April", "Mai", "Juni", "Juli",
100 "August", "September", "Oktober", "November",
103 $Wochentage[$Wochentag] . ", der "
108 #$zeit="<div id='Uhr'>".$Stunden.":".$Minuten.":".$Sekunden."</div>";
109 my $zeit = "<div id='Uhr'>" . $Stunden . ":" . $Minuten . "</div>";
111 <script type="text/javascript">
114 var now = new Date();
115 var h = now.getHours();
116 var m = now.getMinutes();
117 document.getElementById('clock_id').innerHTML = (h<10?'0'+h:h)+":"+(m<10?'0'+m:m);
118 var timer=setTimeout("clockon()", 10000);
120 window.onload=clockon
123 <table border="0" width="100%" background="image/bg_titel.gif" cellpadding="0" cellspacing="0">
125 <td style="color:white; font-family:verdana,arial,sans-serif; font-size: 12px;"> $fenster [<a href="JavaScript:top.main_window.print()">drucken</a>]</td>
126 <td align="right" style="vertical-align:middle; color:white; font-family:verdana,arial,sans-serif; font-size: 12px;" nowrap>
127 $login $datum <span id='clock_id' style='position:relative'></span>
136 my $form = $main::form;
137 my %myconfig = %main::myconfig;
139 $locale = Locale->new($myconfig{countrycode}, "menu");
140 my $mainlevel = $form->{level};
141 $mainlevel =~ s/$mainlevel--//g;
142 my $menu = new Menu "$menufile";
151 border: 1px solid black
155 text-decoration: none;
157 font: 12px Arial, Helvetica
161 text-decoration: none;
163 font: 12px Arial, Helvetica
168 background:url(image/bg_css_menu.png) repeat bottom;
170 border-color:#ccc #888 #555 #bbb;
176 <script type="text/javascript">
178 var isDOM = (document.getElementById ? true : false);
179 var isIE4 = ((document.all && !isDOM) ? true : false);
180 var isNS4 = (document.layers ? true : false);
181 //var KO = (navigator.appName=="Konqueror" \|\| navigator.appName=="Opera") ;
182 var KO = ((navigator.userAgent.indexOf('Opera',0) != -1) \|\| (navigator.userAgent.indexOf('Konqueror',0) != -1));
183 function getRef(id) {
184 if (isDOM) return document.getElementById(id);
185 if (isIE4) return document.all[id];
186 if (isNS4) return document.layers[id];
188 function getSty(id) {
189 return (isNS4 ? getRef(id) : getRef(id).style);
192 var litNow = new Array();
193 function popOver(menuNum, itemNum) {
194 if (KO) document.getElementById("win1").style.visibility = "hidden";
195 clearTimeout(popTimer);
197 litNow = getTree(menuNum, itemNum);
198 changeCol(litNow, true);
199 targetNum = menu[menuNum][itemNum].target;
201 thisX = parseInt(menu[menuNum][0].ref.left) + parseInt(menu[menuNum][itemNum].ref.left);
202 thisY = parseInt(menu[menuNum][0].ref.top) + parseInt(menu[menuNum][itemNum].ref.top);
203 with (menu[targetNum][0].ref) {
204 left = parseInt(thisX + menu[targetNum][0].x);
205 top = parseInt(thisY + menu[targetNum][0].y);
206 visibility = 'visible';
210 function popOut(menuNum, itemNum) {
211 if ((menuNum == 0) && !menu[menuNum][itemNum].target)
213 if (KO) document.getElementById("win1").style.visibility = "visible";
215 popTimer = setTimeout('hideAllBut(0)', 500);
217 function getTree(menuNum, itemNum) {
218 itemArray = new Array(menu.length);
220 itemArray[menuNum] = itemNum;
221 if (menuNum == 0) return itemArray;
222 itemNum = menu[menuNum][0].parentItem;
223 menuNum = menu[menuNum][0].parentMenu;
226 function changeCol(changeArray, isOver) {
227 for (menuCount = 0; menuCount < changeArray.length; menuCount++) {
228 if (changeArray[menuCount]) {
229 newCol = isOver ? menu[menuCount][0].overCol : menu[menuCount][0].backCol;
230 with (menu[menuCount][changeArray[menuCount]].ref) {
231 if (isNS4) bgColor = newCol;
232 else backgroundColor = newCol;
237 function hideAllBut(menuNum) {
238 var keepMenus = getTree(menuNum, 1);
239 for (count = 0; count < menu.length; count++)
240 if (!keepMenus[count])
241 menu[count][0].ref.visibility = 'hidden';
242 changeCol(litNow, false);
245 function Menu(isVert, popInd, x, y, width, overCol, backCol, borderClass, textClass) {
246 this.isVert = isVert;
251 this.overCol = overCol;
252 this.backCol = backCol;
253 this.borderClass = borderClass;
254 this.textClass = textClass;
255 this.parentMenu = null;
256 this.parentItem = null;
259 function Item(text, href, frame, length, spacing, target) {
263 this.length = length;
264 this.spacing = spacing;
265 this.target = target;
268 function go(link,frame) {
269 tmp=eval("top."+frame);
271 //top.main_window.location=link;
273 function writeMenus() {
274 if (!isDOM && !isIE4 && !isNS4) return;
275 for (currMenu = 0; currMenu < menu.length; currMenu++) with (menu[currMenu][0]) {
276 var str = '', itemX = 0, itemY = 0;
277 for (currItem = 1; currItem < menu[currMenu].length; currItem++) with (menu[currMenu][currItem]) {
278 var itemID = 'menu' + currMenu + 'item' + currItem;
279 var w = (isVert ? width : length);
280 var h = (isVert ? length : width);
281 if (isDOM \|\| isIE4) {
282 str += '<div id="' + itemID + '" style="position: absolute; left: ' + itemX + '; top: ' + itemY + '; width: ' + w + '; height: ' + h + '; visibility: inherit; ';
283 if (backCol) str += 'background: ' + backCol + '; ';
287 str += '<layer id="' + itemID + '" left="' + itemX + '" top="' + itemY + '" width="' + w + '" height="' + h + '" visibility="inherit" ';
288 if (backCol) str += 'bgcolor="' + backCol + '" ';
290 if (borderClass) str += 'class="' + borderClass + '" "';
291 str += 'onMouseOver="popOver(' + currMenu + ',' + currItem + ')" onMouseOut="popOut(' + currMenu + ',' + currItem + ')">';
292 str += '<table width="' + (w - 8) + '" border="0" cellspacing="0" cellpadding="' + (!isNS4 && borderClass ? 3 : 0) + '">';
293 str +='<tr><td class="' + textClass + '" style="cursor:pointer;" align="left" height="' + (h - 7) + '" onClick=\\'go("' + href + '","' + frame + '")\\'>' + text + '</a></td>';
295 menu[target][0].parentMenu = currMenu;
296 menu[target][0].parentItem = currItem;
297 if (popInd) str += '<td class="' + textClass + '" align="right">' + popInd + '</td>';
299 str += '</tr></table>' + (isNS4 ? '</layer>' : '</div>');
300 if (isVert) itemY += length + spacing;
301 else itemX += length + spacing;
304 var newDiv = document.createElement('div');
305 document.getElementsByTagName('body').item(0).appendChild(newDiv);
306 newDiv.innerHTML = str;
308 ref.position = 'absolute';
309 ref.visibility = 'hidden';
312 document.body.insertAdjacentHTML('beforeEnd', '<div id="menu' + currMenu + 'div" ' + 'style="position: absolute; visibility: hidden">' + str + '</div>');
313 ref = getSty('menu' + currMenu + 'div');
317 ref.document.write(str);
318 ref.document.close();
320 for (currItem = 1; currItem < menu[currMenu].length; currItem++) {
321 itemName = 'menu' + currMenu + 'item' + currItem;
322 if (isDOM \|\| isIE4) menu[currMenu][currItem].ref = getSty(itemName);
323 if (isNS4) menu[currMenu][currItem].ref = ref.document[itemName];
329 ref.visibility = 'visible';
332 var menu = new Array();
333 var defOver = '#cccccc';
334 var defBack = '#dddddd';
336 menu[0] = new Array();
337 menu[0][0] = new Menu(false, '', 5, 18, 19, '#cccccc', '', '', 'rootItemText');
341 §ion_menu($menu);
344 var popOldWidth = window.innerWidth;
345 nsResizeHandler = new Function('if (popOldWidth != window.innerWidth) location.reload()');
346 if (isNS4) document.captureEvents(Event.CLICK);
347 document.onclick = clickHandle;
348 function clickHandle(evt) {
349 if (isNS4) document.routeEvent(evt);
351 if (KO) document.getElementById("win1").style.visibility = "visible";
353 function moveRoot() {
354 with(menu[0][0].ref) left = ((parseInt(left) < 100) ? 100 : 5);
359 <BODY scrolling="no" topmargin="0" leftmargin="0" marginwidth="0" marginheight="0" style="margin: 0" onLoad="writeMenus(); clockon();" onResize="if (isNS4) nsResizeHandler()">
362 <table class="menu" width="100%" border="0" cellpadding="0" cellspacing="0">
363 <tr><td height="21"><font size="1"> </font></td></tr></table>
375 my ($menu, $level) = @_;
377 my $form = $main::form;
378 my %myconfig = %main::myconfig;
381 my @menuorder = $menu->access_control(\%myconfig, $level);
386 my (%mlz, $sm, $z, $pm, $mm);
388 my $item = shift @menuorder;
391 $label =~ s/$level--//g;
393 $label = $locale->text($label);
394 $label =~ s/ / /g;
395 $menu->{$item}{target} = "main_window" unless $menu->{$item}{target};
397 if ($menu->{$item}{submenu}) {
398 $menu->{$item}{$item} = !$form->{$item};
401 if ($mlz{"s$ml"} > 1) {
409 qq|menu[$mlz{$ml}][$z] = new Item('$label', '#', '', defLength, 0, |
413 print qq|menu[$pm] = new Array();\n|;
415 qq|menu[$pm][0] = new Menu(true, '', 85, 0, 180, defOver, defBack, 'itemBorder', 'itemText');\n|;
416 map { shift @menuorder } grep /^$item/, @menuorder;
417 §ion_menu($menu, $item);
418 map { shift @menuorder } grep /^$item/, @menuorder;
420 if ($menu->{$item}{module}) {
423 my $target = $menu->{$item}{target};
424 my $uri = $menu->menuitem_js(\%myconfig, \%$form, $item, $level);
427 qq|menu[$pm][$sm] = new Item('$label', '$uri', '$target', defLength, 0, 0);\n|;
430 my $ml_ = $form->escape($ml);
433 %mlz = ($ml, $pm, "s$ml", 1);
436 my $breit = 15 + length($label) * 6;
438 qq|menu[0][$mm] = new Item(' $label', '#', '', $breit, 10, $pm); \n|;
439 print qq|menu[$pm] = new Array();\n|;
441 qq|menu[$pm][0] = new Menu(true, '>', 0, 20, 180, defOver, defBack, 'itemBorder', 'itemText');\n|;
443 §ion_menu($menu, $item);