Author: kien_nguyen
Date: 2011-10-24 06:59:41 -0400 (Mon, 24 Oct 2011)
New Revision: 7848
Modified:
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIDashboard.js
Log:
GTNPORTAL-2210 Cleanup javascript code in Dashboard.js
Modified:
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIDashboard.js
===================================================================
---
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIDashboard.js 2011-10-24
10:54:58 UTC (rev 7847)
+++
portal/trunk/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIDashboard.js 2011-10-24
10:59:41 UTC (rev 7848)
@@ -267,12 +267,6 @@
var uiContainer = DOMUtil.findFirstDescendantByClass(uiDashboard, "div",
"UIDashboardContainer");
if(!uiContainer) return;
- var uiWindow = DOMUtil.findAncestorByClass(portletWindow, "UIWindow") ;
- if(uiWindow) {
- if(!uiWindow.resizeCallback) uiWindow.resizeCallback = new eXo.core.HashMap() ;
- uiWindow.resizeCallback.put(DOMUtil.generateId(windowId),
eXo.webui.UIDashboard.initHeight) ;
- }
-
var gadgetContainer = DOMUtil.findFirstChildByClass(uiContainer, "div",
"GadgetContainer");
uiDashboard.style.overflow = "hidden";
portletFragment.style.overflow = "hidden" ;
@@ -292,8 +286,6 @@
//else colsContainer.style.width = "100%" ;
colsContainer.style.width = "100%" ;
- eXo.webui.UIDashboard.initHeight(windowId) ;
-
//Todo: nguyenanhkien2a(a)gmail.com
//We set and increase waiting time for initDragDrop function to make sure all UI (tag,
div, iframe, etc)
//was loaded and to avoid some potential bugs (ex: GTNPORTAL-1068)
@@ -311,7 +303,6 @@
eXo.webui.UIDashboard.init(gadgetControls[j], uiGadget);
if(minimizeButton) minimizeButton.style.display = "block" ;
- uiGadget.minimizeCallback = eXo.webui.UIDashboard.initHeight ;
} else{
if(minimizeButton) {
minimizeButton.style.display = "none" ;
@@ -325,68 +316,6 @@
}
};
- UIDashboard.prototype.initHeight = function(windowId) {
- var DOMUtil = eXo.core.DOMUtil;
- var portletWindow, uiWindow ;
- if(typeof(windowId) != "string") {
- uiWindow = eXo.desktop.UIWindow.portletWindow ;
- portletWindow = document.getElementById(uiWindow.id.replace(/^UIWindow-/,
"")) ;
- } else {
- portletWindow = document.getElementById(windowId) ;
- uiWindow = DOMUtil.findAncestorByClass("UIWindow") ;
- }
- var uiDashboard = DOMUtil.findFirstDescendantByClass(portletWindow, "div",
"UIDashboard") ;
- var uiSelect = DOMUtil.findFirstDescendantByClass(uiDashboard, "div",
"UIDashboardSelectContainer");
-
- if(uiSelect && document.getElementById("UIPageDesktop")) {
- var itemCont = DOMUtil.findFirstChildByClass(uiSelect, "div",
"DashboardItemContainer");
- var middleItemCont = DOMUtil.findFirstDescendantByClass(uiSelect, "div",
"MiddleItemContainer");
- var topItemCont = DOMUtil.findNextElementByTagName(middleItemCont, "div");
- var bottomItemCont = DOMUtil.findPreviousElementByTagName(middleItemCont,
"div");
-
- var uiContainer = DOMUtil.findFirstDescendantByClass(uiDashboard, "div",
"UIDashboardContainer");
-
- var minusHeight = 0 ;
- var minusHeightEle = DOMUtil.findPreviousElementByTagName(middleItemCont.parentNode,
"div") ;
- while(minusHeightEle) {
- minusHeight += minusHeightEle.offsetHeight ;
- minusHeightEle = DOMUtil.findPreviousElementByTagName(minusHeightEle,
"div") ;
- }
- minusHeightEle = DOMUtil.findPreviousElementByTagName(itemCont, "div") ;
- while(minusHeightEle) {
- minusHeight += minusHeightEle.offsetHeight ;
- minusHeightEle = DOMUtil.findPreviousElementByTagName(minusHeightEle,
"div") ;
- }
- minusHeightEle = null;
- var windowHeight = portletWindow.offsetHeight ;
- if(uiWindow && uiWindow.style.display == "none") {
- windowHeight = parseInt(DOMUtil.getStyle(portletFragment, "height")) ;
- }
- var middleItemContHeight = windowHeight - minusHeight
- - parseInt(DOMUtil.getStyle(itemCont,"paddingTop"))
- - parseInt(DOMUtil.getStyle(itemCont,"paddingBottom"))
- - 5 ;
- // fix bug IE 6
- if (middleItemContHeight < 0) {
- middleItemContHeight = 0;
- }
- middleItemCont.style.height = middleItemContHeight + "px";
-
- //TODO: tan.pham: fix bug WEBOS-272: Ie7 can get positive scrollHeight value
althrought portlet doesn't display
- if(middleItemCont.offsetHeight > 0) {
- if(middleItemCont.scrollHeight > middleItemCont.offsetHeight) {
- topItemCont.style.display = "block";
- bottomItemCont.style.display = "block";
- middleItemCont.style.height = middleItemCont.offsetHeight - topItemCont.offsetHeight
- bottomItemCont.offsetHeight + "px";
- } else {
- topItemCont.style.display = "none";
- bottomItemCont.style.display = "none";
- middleItemCont.scrollTop = 0 ;
- }
- }
- }
- };
-
UIDashboard.prototype.initPopup = function(popup) {
if(typeof(popup) == "string") popup = document.getElementById(popup);
if(!popup || popup.style.display == "none") return;