* static common helpers
*/
Tine.Tinebase.common = {
-
- /**
- * Open browsers native popup
- *
- * @param {string} windowName
- * @param {string} url
- * @param width
- * @param height
- */
- openWindow: function (windowName, url, width, height) {
- var dualScreenLeft,
- dualScreenTop,
- w,
- h,
- left,
- top;
-
-
- // M$ IE has its internal location bar in the viewport
- if (Ext.isIE) {
- height += 20;
- }
-
- // chrome counts window decoration and location bar to window height
- if (Ext.isChrome) {
- height += 40;
- }
-
- windowName = Ext.isString(windowName) ? windowName.replace(/[^a-zA-Z0-9_]/g, '') : windowName;
-
- // thanks to http://www.nigraphic.com/blog/java-script/how-open-new-window-popup-center-screen
-
- // Determine offsets in case of dualscreen
- dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left;
- dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top;
-
- // Window should be opened on mid of tine window
- w = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
- h = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
-
- // Determine correct left and top values including dual screen setup
- left = ((w / 2) - (width / 2)) + dualScreenLeft;
- top = ((h / 2) - (height / 2)) + dualScreenTop;
-
- try {
- popup = window.open(url, windowName, 'width=' + width + ',height=' + height + ',top=' + top + ',left=' + left +
- ',directories=no,toolbar=no,location=no,menubar=no,scrollbars=no,status=no,resizable=yes,dependent=no');
-
- return popup;
- }
- catch(e) {
- Tine.log.info('window.open Exception: ');
- Tine.log.info(e);
-
- popup = false;
-
- }
-
- if (! popup) {
- var openCode = "window.open('http://127.0.0.1/tine20/tine20/" + url + "','" + windowName + "','width=" + width + ",height=" + height + ",top=" + top + ",left=" + left +
- ",directories=no,toolbar=no,location=no,menubar=no,scrollbars=no,status=no,resizable=yes,dependent=no')";
-
- var exception = {
- openCode: openCode,
- popup: null
- };
-
- Tine.log.debug('openCode: ' + openCode);
- popup = openCode;
- }
-
- return popup;
-
- },
--
/**
*
* @param {String} part