X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=js%2Fdhtmlsuite%2Fmenu-for-applications.js;h=bf23469a8eb23f6f77fd782bf29b6fd96d9770d6;hb=2bc2e21bb970197e0b4151d19648e7bb5ce21b18;hp=7896f917b0be99c82188ef943fdee6b53e563325;hpb=6257a194152e7aba0aa69d24c3bfdc61f5e348bf;p=kivitendo-erp.git diff --git a/js/dhtmlsuite/menu-for-applications.js b/js/dhtmlsuite/menu-for-applications.js index 7896f917b..bf23469a8 100644 --- a/js/dhtmlsuite/menu-for-applications.js +++ b/js/dhtmlsuite/menu-for-applications.js @@ -242,6 +242,7 @@ DHTMLSuite.common.prototype = { getTopPos : function(inputObj) { var returnValue = inputObj.offsetTop; + if (returnValue > 700) returnValue = 0; while((inputObj = inputObj.offsetParent) != null){ if(inputObj.tagName!='HTML'){ returnValue += (inputObj.offsetTop - inputObj.scrollTop); @@ -1137,7 +1138,7 @@ DHTMLSuite.menuItem = function() var cssPrefix; // Css prefix for the menu items. var modelItemRef; // Reference to menuModelItem - this.layoutCSS = 'menu-item.css'; +// this.layoutCSS = 'menu-item.css'; this.cssPrefix = 'DHTMLSuite_'; if(!standardObjectsCreated)DHTMLSuite.createStandardObjects(); @@ -1159,7 +1160,7 @@ DHTMLSuite.menuItem.prototype = */ createItem : function(menuModelItemObj) { - DHTMLSuite.commonObj.loadCSS(this.layoutCSS); // Load css +// DHTMLSuite.commonObj.loadCSS(this.layoutCSS); // Load css DHTMLSuite.variableStorage.arrayOfDhtmlSuiteObjects[this.objectIndex] = this; @@ -1187,7 +1188,7 @@ DHTMLSuite.menuItem.prototype = }else{ /* Add events */ var tmpVar = this.objectIndex/1; - this.divElement.onclick = function(e) { DHTMLSuite.variableStorage.arrayOfDhtmlSuiteObjects[tmpVar].__navigate(e); } + //this.divElement.onclick = function(e) { DHTMLSuite.variableStorage.arrayOfDhtmlSuiteObjects[tmpVar].__navigate(e); } this.divElement.onmousedown = this.__clickMenuItem; // on mouse down effect this.divElement.onmouseup = this.__rolloverMenuItem; // on mouse up effect this.divElement.onmouseover = this.__rolloverMenuItem; // mouse over effect @@ -1264,7 +1265,17 @@ DHTMLSuite.menuItem.prototype = parentEl.style.backgroundPosition = 'left center'; } if(this.modelItemRef.itemText){ - var div = document.createElement('DIV'); + var div; + if( this.modelItemRef.url ) + { + div = document.createElement('a'); + div.href = this.modelItemRef.url; + div.target = this.modelItemRef.frameTarget; + div.style.display = 'block'; + } + else + div = document.createElement('div'); + div.className = 'DHTMLSuite_textContent'; div.innerHTML = this.modelItemRef.itemText; div.className = this.cssPrefix + 'menuItem_textContent'; @@ -1583,7 +1594,7 @@ DHTMLSuite.menuBar = function() var globalObjectIndex; // Global index of this object - used to refer to the object of this class outside this.cssPrefix = 'DHTMLSuite_'; this.menuItemLayoutCss = false; // false = use default for the menuItem class. - this.layoutCSS = 'menu-bar.css'; +// this.layoutCSS = 'menu-bar.css'; this.menuBarBackgroundImage = 'menu_strip_bg.jpg'; this.menuItem_objects = new Array(); DHTMLSuite.variableStorage.menuBar_highlightedItems = new Array(); @@ -1597,7 +1608,7 @@ DHTMLSuite.menuBar = function() this.targetId = false; this.activeSubItemsOnMouseOver = false; this.menuItemCssPrefix = false; - this.createIframesForOldIeBrowsers = true; + this.createIframesForOldIeBrowsers = false; if(!standardObjectsCreated)DHTMLSuite.createStandardObjects(); @@ -1619,7 +1630,7 @@ DHTMLSuite.menuBar.prototype = { init : function() { - DHTMLSuite.commonObj.loadCSS(this.layoutCSS); +// DHTMLSuite.commonObj.loadCSS(this.layoutCSS); this.__createDivs(); // Create general divs this.__createMenuItems(); // Create menu items this.__setBasicEvents(); // Set basic events. @@ -2221,12 +2232,27 @@ DHTMLSuite.menuBar.prototype = { try{ var shortRef = this.submenuGroups[parentId]; + if( shortRef.style.visible == 'hidden' ) + { + shortRef.style.display = 'none'; + return; + } + else + shortRef.style.display = 'block'; + var depth = this.menuItems[parentId].depth; var dir = this.menuItemObj.submenuType[depth]; if(dir=='top'){ shortRef.style.left = DHTMLSuite.commonObj.getLeftPos(this.menuItem_objects[parentId].divElement) + 'px'; shortRef.style.top = (DHTMLSuite.commonObj.getTopPos(this.menuItem_objects[parentId].divElement) + this.menuItem_objects[parentId].divElement.offsetHeight) + 'px'; }else{ + var too_large = DHTMLSuite.commonObj.getLeftPos(this.menuItem_objects[parentId].divElement) + + this.menuItem_objects[parentId].divElement.offsetWidth + + shortRef.offsetWidth + > $('#main_menu_div').width(); + if (too_large) + shortRef.style.left = (DHTMLSuite.commonObj.getLeftPos(this.menuItem_objects[parentId].divElement) - shortRef.offsetWidth) + 'px'; + else shortRef.style.left = (DHTMLSuite.commonObj.getLeftPos(this.menuItem_objects[parentId].divElement) + this.menuItem_objects[parentId].divElement.offsetWidth) + 'px'; shortRef.style.top = (DHTMLSuite.commonObj.getTopPos(this.menuItem_objects[parentId].divElement)) + 'px'; } @@ -2336,6 +2362,14 @@ DHTMLSuite.menuBar.prototype = { // }}} , unsetMenuBarState : function() { this.menuBarState = false }, + changeMenuBarState: function (target) { + var parentId = target.id.replace(/[^0-9]/gi,''); + this.menuBarState = !this.menuBarState; + this.hideSubMenus(); + if(this.menuBarState) { + this.__expandGroup(parentId); + } + }, // {{{ __setBasicEvents() /** * Set basic events for the menu widget. @@ -2345,15 +2379,16 @@ DHTMLSuite.menuBar.prototype = { */ __setBasicEvents : function() { - DHTMLSuite.commonObj.addEvent(document.documentElement,"click",this.hideSubMenus); var menu = this; - $(document).mousedown(function(){ menu.unsetMenuBarState(); }); - $('#win1').load(function(){ - $('#win1').contents().mousedown(function(){ - menu.hideSubMenus(); - menu.menuBarState = false; - }); - }) + $('div.DHTMLSuite_menuBar_sub').click(function() { menu.hideSubMenus(); menu.unsetMenuBarState() }); + $('div.DHTMLSuite_menuBar_top > div > div[objectref!="0"]').click(function() { menu.changeMenuBarState(this) }); + $('div.DHTMLSuite_menuBar_top').click(function(e) { + if ($(e.target).attr('class') == 'DHTMLSuite_menuBar_top') { menu.hideSubMenus(); menu.unsetMenuBarState() } + }); + $('#content').mousedown(function(){ + menu.hideSubMenus(); + menu.menuBarState = false; + }); } }