/** * eGroupWare - API * http://www.egroupware.org * * This file was originally created Tyamad, but their content is now completly removed! * It still contains some commonly used javascript functions, always included by EGroupware. * * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @package api * @subpackage jsapi * @version $Id: jsapi.js 27380 2009-07-07 12:55:11Z ralfbecker $ */ /***********************************************\ * INITIALIZATION * \***********************************************/ if (document.all) { navigator.userAgent.toLowerCase().indexOf('msie 5') != -1 ? is_ie5 = true : is_ie5 = false; is_ie = true; is_moz1_6 = false; is_mozilla = false; is_ns4 = false; } else if (document.getElementById) { navigator.userAgent.toLowerCase().match('mozilla.*rv[:]1\.6.*gecko') ? is_moz1_6 = true : is_moz1_6 = false; is_ie = false; is_ie5 = false; is_mozilla = true; is_ns4 = false; } else if (document.layers) { is_ie = false; is_ie5 = false is_moz1_6 = false; is_mozilla = false; is_ns4 = true; } // works only correctly in Mozilla/FF and Konqueror function phpgw_openWindowCentered2(_url, _windowName, _width, _height, _status) { windowWidth = phpgw_getWindowOuterWidth(); windowHeight = phpgw_getWindowOuterHeight(); positionLeft = (windowWidth/2)-(_width/2)+phpgw_getWindowLeft(); positionTop = (windowHeight/2)-(_height/2)+phpgw_getWindowTop(); windowID = window.open(_url, _windowName, "width=" + _width + ",height=" + _height + ",screenX=" + positionLeft + ",left=" + positionLeft + ",screenY=" + positionTop + ",top=" + positionTop + ",location=no,menubar=no,directories=no,toolbar=no,scrollbars=yes,resizable=yes,status="+_status); return windowID; } function phpgw_openWindowCentered(_url, _windowName, _width, _height) { return phpgw_openWindowCentered2(_url, _windowName, _width, _height, 'no'); } // return the left position of the window function phpgw_getWindowLeft() { if(is_mozilla) { return window.screenX; } else { return window.screenLeft; } } // return the left position of the window function phpgw_getWindowTop() { if(is_mozilla) { return window.screenY; } else { //alert(window.screenTop); return window.screenTop-90; } } // get the outerWidth of the browser window. For IE we simply return the innerWidth function phpgw_getWindowInnerWidth() { if (is_mozilla) { return window.innerWidth; } else { // works only after the body has parsed //return document.body.offsetWidth; return document.body.clientWidth; //return document.documentElement.clientWidth; } } // get the outerHeight of the browser window. For IE we simply return the innerHeight function phpgw_getWindowInnerHeight() { if (is_mozilla) { return window.innerHeight; } else { // works only after the body has parsed //return document.body.offsetHeight; //return document.body.clientHeight; return document.documentElement.clientHeight; } } // get the outerWidth of the browser window. For IE we simply return the innerWidth function phpgw_getWindowOuterWidth() { if (is_mozilla) { return window.outerWidth; } else { return phpgw_getWindowInnerWidth(); } } // get the outerHeight of the browser window. For IE we simply return the innerHeight function phpgw_getWindowOuterHeight() { if (is_mozilla) { return window.outerHeight; } else { return phpgw_getWindowInnerHeight(); } } function changeSorting(_sort) { resetMessageSelect(); document.getElementById('messageCounter').innerHTML = 'Change sorting ...'; document.getElementById('divMessageList').innerHTML = ''; xajax_doXMLHTTP("felamimail.ajaxfelamimail.changeSorting",_sort); } function onNodeSelect(_nodeID) { window.location.href = nodeSelectURL+'&folderid='+_nodeID; } function onNodeSelectRight(_nodeID) { var nodeObject = false; var domObject; var top=0; var left=0; if(nodeObject = tree._globalIdStorageFind(_nodeID)) { domObject = nodeObject.htmlNode.childNodes[0].childNodes[0].childNodes[3].childNodes[0]; top = getPosTop(domObject) + domObject.offsetHeight; left = getPosLeft(domObject) + 10; resultBox = document.getElementById('rightClickMenu'); resultBox.style.top=top + 'px'; resultBox.style.left=left + 'px'; resultBox.style.display='block'; } } function selectFolder(_folderID, _formName) { openDlg = phpgw_openWindowCentered(folderChooserURL+"&form="+_formName+"&mode=3&exlcude=-1&folderid="+_folderID,'openDlg',300,450); } function getPosLeft(_node) { var left=0; if(_node.offsetParent) { while (_node.offsetParent) { left += _node.offsetLeft; _node = _node.offsetParent; } } else if (_node.x) { left += _node.x; } return left; } function getPosTop(_node) { var top=0; if(_node.offsetParent) { while (_node.offsetParent) { top += _node.offsetTop; if(_node.parentNode.scrollTop) { top -= _node.parentNode.scrollTop } _node = _node.offsetParent; } } else if (_node.y) { left += _node.y; } return top; }