# HG changeset patch # User Nikola Nikov # Date 1274904884 -10800 # Node ID 1c27514d61a19e1a11ccdbea6cea0173ab0d9aea # Parent fdb07e066bc0dee95777256118066d7a55db2849 The submenus are ready diff -r fdb07e066bc0 -r 1c27514d61a1 interface/img/ico-arrow-right.png Binary file interface/img/ico-arrow-right.png has changed diff -r fdb07e066bc0 -r 1c27514d61a1 interface/menu.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/interface/menu.html Wed May 26 23:14:44 2010 +0300 @@ -0,0 +1,35 @@ + + + + +XCP web interface submenu test + + + + + + +teeeest menu +
+ + + \ No newline at end of file diff -r fdb07e066bc0 -r 1c27514d61a1 interface/rightmenu.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/interface/rightmenu.css Wed May 26 23:14:44 2010 +0300 @@ -0,0 +1,117 @@ +.rightmenu { + margin: 0px; + padding: 0px; + background-color: #f2f2f2; + font-size: 11px; + width: 160px; + font-family: Arial, Helvetica, sans-serif; + border-top-width: 1px; + border-right-width: 2px; + border-bottom-width: 2px; + border-left-width: 1px; + border-top-style: solid; + border-right-style: solid; + border-bottom-style: solid; + border-left-style: solid; + border-top-color: #CCCCCC; + border-right-color: #666666; + border-bottom-color: #666666; + border-left-color: #CCCCCC; + position: fixed; + _position:absolute; + z-index: 30!important; + z-index:30; + left: 0px; + top: 0px; + display: none; +} +.rightmenu li.sub { + background-color: #f2f2f2; + background-image: url(ico-arrow-right.png); + background-repeat: no-repeat; + background-position: 145px center; +} + +.rightmenu ul { + width:160px; + height:auto; + overflow:visible; + padding:0; + margin:0; +} +.rightmenu ul li { + list-style-image:none; + list-style:none; + list-style-type:none; + width:160px; + height:21px; + text-align:left; + margin:0; + padding:0; + margin-top:-1px; + clear:both; + overflow:visible; + position:relative; + padding-top:5px; + border-top-width: 1px; + border-top-style: solid; + border-top-color: #CCCCCC; + cursor:pointer; +} +.rightmenu ul li a { + text-decoration:none; + color:#000000; +} +.rightmenu ul li:hover { + color:#000000; + background-color: #9dd4fc; +} +.rightmenu ul li ul { + position:absolute; + top:-30px; + left:145px; + padding:30px 50px 40px 0px; + display:none; + z-index:30; +} +.rightmenu ul li ul li { + border-top-width: 1px; + border-right-width: 2px; + border-bottom-width: 2px; + border-left-width: 1px; + border-top-style: solid; + border-right-style: solid; + border-bottom-style: solid; + border-left-style: solid; + border-top-color: #CCCCCC; + border-right-color: #666666; + border-bottom-color: #666666; + border-left-color: #CCCCCC; + background-color: #f2f2f2; + margin-top:-2px; +} +.rightmenu ul li:hover > ul { + display:block; +} +.menu-ico { + padding:0; + float: left; + width: 16px; + margin-right: 6px; + padding-right:0; + padding-left:6px; + margin-top:-2px; +} +.menu-ico input { + float:left; + margin:0; + margin-top:2px; +} +.menu-ico-sub { + padding:0; + float: left; + width: 16px; + margin-right: 3px; + padding-right:3px; + padding-left:6px; +} diff -r fdb07e066bc0 -r 1c27514d61a1 interface/rightmenu.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/interface/rightmenu.js Wed May 26 23:14:44 2010 +0300 @@ -0,0 +1,458 @@ +function xcp_Menu() { + var bw=document.getElementById&&!document.all; + var winm; + var prgm; + var param; + var attr; + var oname; + var fobj; + var self = this; + this.openedForFiles = new Array(); + this.openedForObjects = false; + this.menuopen = new Array(); + this.menubeforeopen = new Array(); + this.winm = false; + this.mousedown = function(e) { + fobj = bw ? e.target : event.srcElement; + self.checkforopenmenu(e,fobj); + } + this.checkforopenmenu = function(e,fobj) { + if (self.winm && typeof(self.winm) == 'object') { + if (!fobj.getAttribute('submenu')) { + var menuid; + if (menuid = self.getMainMenuId(fobj)) { + self.dropMenu(menuid.substr(5)); + } + else if (menuid = self.getMainMenuId(self.winm)) { + self.dropMenu(menuid.substr(5)); + } + + } + else { + var menuid = self.getMainMenuId(fobj); + if (document.getElementById(menuid)) { + var menuObj = document.getElementById(menuid); + var menuObjLeft = tplf.findPosX(menuObj); + if (menuObjLeft > menuObj.offsetWidth) { + var mx = bw ? e.clientX : event.clientX; + menuObj.style.left = (menuObjLeft-(menuObj.offsetWidth - 15))+'px'; + } + } + } + } + if (fobj.getAttribute('menuclick') && self.isEnabled(fobj)) { + if (fobj.tagName == 'INPUT' && fobj.type == 'checkbox') { + fobj.checked = !fobj.checked; + } + else { + var obj = self.getMenuId(fobj); + if (typeof(obj) == 'string' && document.getElementById(obj)) { + self.changeCheckBox(obj); + } + } + eval(fobj.getAttribute('menuclick')); + } + } + this.openRightMenu = function(winm,e,param) { + if (!document.getElementById(winm)) { return false; } + var mx = bw ? e.clientX : event.clientX; + var my = bw ? e.clientY : event.clientY; + self.winm = document.getElementById(winm); + if (!param) { + self.winm.style.left=mx+"px"; + self.winm.style.top=my+"px"; + } + self.winm.style.display="block"; + if (!param) { + if (parseInt(navigator.appVersion)>3) { + if (navigator.appName=="Netscape") { + var winW = window.innerWidth; + var winH = window.innerHeight; + } + if (navigator.appName.indexOf("Microsoft")!=-1) { + var winW = document.body.scrollWidth; + var winH = document.body.scrollHeight; + } + } + if ((Number(self.winm.offsetLeft) + Number(self.winm.offsetWidth)) >= winW) { + self.winm.style.left = Number(self.winm.offsetLeft) - Number(self.winm.offsetWidth)+'px'; + } + if ((Number(self.winm.offsetTop) + Number(self.winm.offsetHeight)) >= winH) { + self.winm.style.top = Number(winH) - Number(self.winm.offsetHeight)+'px'; + } + } + } + + + var menuobj; + var menupos; + var menuname; + var menuclick; + var menuicon; + this.isMenu = function(param) { + if (document.getElementById('menu_'+param)) { return true; } + else { return false; } + } + this.getMenu = function(param) { + if (self.isMenu(param)) { return document.getElementById('menu_'+param); } + else { return false; } + } + this.isInMenu = function(menuobj,param) { + if (!menuobj) { return false; } + if (typeof(menuobj) == 'object') { + var mname = self.getMainMenuId(menuobj); + if (!mname) { return false; } + if (document.getElementById(mname+'_'+param)) { return true; } + else { return false; } + } + return false; + } + this.getInMenu = function(menuobj,param) { + if (!menuobj) { return false; } + if (typeof(menuobj) == 'object') { + var mname = self.getMainMenuId(menuobj); + if (!mname) { return false; } + if ((menuobj.className && menuobj.className == 'sub') || menuobj.tagName == 'DIV') { + menuobj = menuobj.getElementsByTagName('UL'); + if (menuobj.length) { menuobj = menuobj[0]; } + else { return false; } + } + for (i=0;i -1) { + return fobj.offsetLeft; + } + var curleft = 0; + if(fobj.offsetParent) + while(1) { + curleft += fobj.offsetLeft; + if(!fobj.offsetParent) + break; + fobj = fobj.offsetParent; + } + else if(fobj.x) + curleft += fobj.x; + return curleft; + } + this.findPosY = function(fobj) { + if (typeof(fobj) != 'object') { return 0; } + if (navigator.appName == 'Microsoft Internet Explorer' || navigator.appName == 'Opera' || navigator.appName == 'Netscape') { + return fobj.offsetTop; + } + if (navigator.userAgent.indexOf('Chrome') > -1) { + return fobj.offsetTop; + } + var curtop = 0; + if(fobj.offsetParent) + while(1) { + curtop += fobj.offsetTop; + if(!fobj.offsetParent) + break; + fobj = fobj.offsetParent; + } + else if(fobj.y) + curtop += fobj.y; + return curtop; + } +} +var tplf = new xcp_Functions(); +document.onmousedown = xcp_menu.mousedown; \ No newline at end of file