Author: phuong_vu
Date: 2010-10-11 06:19:48 -0400 (Mon, 11 Oct 2010)
New Revision: 4618
Modified:
portal/branches/branch-GTNPORTAL-1537/web/eXoResources/src/main/webapp/javascript/eXo/gadget/Gadgets.js
portal/branches/branch-GTNPORTAL-1537/web/eXoResources/src/main/webapp/javascript/eXo/gadget/UIGadget.js
portal/branches/branch-GTNPORTAL-1537/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalHttpRequest.js
portal/branches/branch-GTNPORTAL-1537/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIDashboard.js
portal/branches/branch-GTNPORTAL-1537/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties
portal/branches/branch-GTNPORTAL-1537/webui/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboard.java
portal/branches/branch-GTNPORTAL-1537/webui/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardContainer.java
portal/branches/branch-GTNPORTAL-1537/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIGadget.java
Log:
GTNPORTAL-1534 Can't display any Gadgets in IE, and fix Unknown error when delete and
move, maximize, minimize gadget in 2 browsers concurrently
Modified:
portal/branches/branch-GTNPORTAL-1537/web/eXoResources/src/main/webapp/javascript/eXo/gadget/Gadgets.js
===================================================================
---
portal/branches/branch-GTNPORTAL-1537/web/eXoResources/src/main/webapp/javascript/eXo/gadget/Gadgets.js 2010-10-10
22:33:10 UTC (rev 4617)
+++
portal/branches/branch-GTNPORTAL-1537/web/eXoResources/src/main/webapp/javascript/eXo/gadget/Gadgets.js 2010-10-11
10:19:48 UTC (rev 4618)
@@ -674,11 +674,9 @@
el.type = "checkbox";
el.name = prefix + att;
el.id = elID;
- if (userPrefs[att] && userPrefs[att] == "true") {
- el.checked = userPrefs[att];
- } else {
- if(prefs[att].default == "true")
- el.checked = true;
+ if ((userPrefs[att] && userPrefs[att] == "true") ||
+ prefs[att]["default"] == "true") {
+ el.checked = true;
}
attEl.appendChild(el);
}
Modified:
portal/branches/branch-GTNPORTAL-1537/web/eXoResources/src/main/webapp/javascript/eXo/gadget/UIGadget.js
===================================================================
---
portal/branches/branch-GTNPORTAL-1537/web/eXoResources/src/main/webapp/javascript/eXo/gadget/UIGadget.js 2010-10-10
22:33:10 UTC (rev 4617)
+++
portal/branches/branch-GTNPORTAL-1537/web/eXoResources/src/main/webapp/javascript/eXo/gadget/UIGadget.js 2010-10-11
10:19:48 UTC (rev 4618)
@@ -244,7 +244,7 @@
href += "&op=MinimizeGadget";
href += "&minimized=" + minimized;
href += "&objectId=" + uiGadget.id +
"&ajaxRequest=true";
- ajaxAsyncGetRequest(href);
+ ajaxGet(href);
if (uiGadget.minimizeCallback)
uiGadget.minimizeCallback(portletFrag.parentNode.id);
},
/**
@@ -294,7 +294,7 @@
var uiDashboardCont = DOMUtil.findAncestorByClass(uiGadget,
"UIDashboardContainer");
if(uiDashboardCont) {
- ajaxAsyncGetRequest(href);
+ ajaxGet(href);
DOMUtil.removeElement(uiGadget);
if(!DOMUtil.findFirstDescendantByClass(uiDashboardCont, "div",
"UIGadget")) {
DOMUtil.findFirstDescendantByClass(uiDashboardCont, "div",
"NoGadget").style.display = "block";
Modified:
portal/branches/branch-GTNPORTAL-1537/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalHttpRequest.js
===================================================================
---
portal/branches/branch-GTNPORTAL-1537/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalHttpRequest.js 2010-10-10
22:33:10 UTC (rev 4617)
+++
portal/branches/branch-GTNPORTAL-1537/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalHttpRequest.js 2010-10-11
10:19:48 UTC (rev 4618)
@@ -515,7 +515,7 @@
}
}
}
- if(response.blocksToUpdate == undefined) {
+ if(response.blocksToUpdate == undefined && temp.innerHTML !== "") {
if(confirm(eXo.i18n.I18NMessage.getMessage("SessionTimeout")))
instance.ajaxTimeout(request) ;
}
//Handle the portal responses
Modified:
portal/branches/branch-GTNPORTAL-1537/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIDashboard.js
===================================================================
---
portal/branches/branch-GTNPORTAL-1537/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIDashboard.js 2010-10-10
22:33:10 UTC (rev 4617)
+++
portal/branches/branch-GTNPORTAL-1537/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIDashboard.js 2010-10-11
10:19:48 UTC (rev 4618)
@@ -233,7 +233,7 @@
{name: "objectId", value: dragObj.id}
];
var url = uiDashboardUtil.createRequest(compId, 'MoveGadget', params);
- ajaxAsyncGetRequest(url);
+ ajaxGet(url);
}
}
}
Modified:
portal/branches/branch-GTNPORTAL-1537/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties
===================================================================
---
portal/branches/branch-GTNPORTAL-1537/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties 2010-10-10
22:33:10 UTC (rev 4617)
+++
portal/branches/branch-GTNPORTAL-1537/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties 2010-10-11
10:19:48 UTC (rev 4618)
@@ -1249,6 +1249,7 @@
UIDashboard.msg.addGadget=Drag your gadgets here.
UIDashboard.msg.notUrl=The url is invalid. Please enter a correct url of a gadget xml or
of an RSS feed.
UIDashboard.msg.ApplicationNotExisted=This application is not exist or may be deleted.
+UIDashboard.msg.StaleData=Some stale data are on your dashboard, it will be refreshed
now
################################################################################
# org.exoplatform.webui.organization.account.UIUserSelector
Modified:
portal/branches/branch-GTNPORTAL-1537/webui/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboard.java
===================================================================
---
portal/branches/branch-GTNPORTAL-1537/webui/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboard.java 2010-10-10
22:33:10 UTC (rev 4617)
+++
portal/branches/branch-GTNPORTAL-1537/webui/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboard.java 2010-10-11
10:19:48 UTC (rev 4618)
@@ -31,7 +31,9 @@
import org.exoplatform.webui.config.annotation.ComponentConfigs;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.UIContainer;
+import org.exoplatform.webui.core.UIPopupMessages;
import org.exoplatform.webui.core.UIPopupWindow;
+import org.exoplatform.webui.core.UIPortletApplication;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
@@ -62,6 +64,26 @@
addChild(UIDashboardContainer.class, null, null);
}
+ @Override
+ public void processRender(WebuiRequestContext context) throws Exception
+ {
+ UIGadget uiGadget = this.getMaximizedGadget();
+ if (uiGadget != null)
+ {
+ UIPopupMessages uiPopupMessages =
getAncestorOfType(UIPortletApplication.class).getUIPopupMessages();
+ for (ApplicationMessage msg : uiPopupMessages.getErrors())
+ {
+ if
(msg.getMessageKey().equals("UIDashboard.msg.ApplicationNotExisted"))
+ {
+ this.setMaximizedGadget(null);
+ break;
+ }
+ }
+ }
+
+ super.processRender(context);
+ }
+
public void setColumns(int num) throws Exception
{
getChild(UIDashboardContainer.class).setColumns(num);
@@ -152,9 +174,13 @@
else
{
uiGadget.getProperties().setProperty("minimized", minimized);
+ uiDashboardCont.save();
+ if
(uiDashboard.getAncestorOfType(UIPortletApplication.class).getUIPopupMessages().hasMessage())
+ {
+ return;
+ }
+ Util.getPortalRequestContext().setResponseComplete(true);
}
- uiDashboardCont.save();
- context.addUIComponentToUpdateByAjax(uiGadget);
}
}
@@ -178,13 +204,16 @@
context.addUIComponentToUpdateByAjax(uiDashboard);
return;
}
-
- //TODO nguyenanhkien2a(a)gmail.com
- //We need to expand unminimized state of uiGadget to view all body of gadget,
not just a title with no content
+
+ // TODO nguyenanhkien2a(a)gmail.xn--com-gla
+ // We need to expand unminimized state of uiGadget to view all body of
+ // gadget, not just a title with no content
uiGadget.getProperties().setProperty("minimized", "false");
uiDashboardCont.save();
-
- if (maximize.equals("maximize"))
+
+ UIPortletApplication uiDashboarPortlet =
uiDashboard.getAncestorOfType(UIPortletApplication.class);
+ if (maximize.equals("maximize")
+ && !uiDashboarPortlet.getUIPopupMessages().hasMessage())
{
uiGadget.setView(UIGadget.CANVAS_VIEW);
uiDashboard.setMaximizedGadget(uiGadget);
Modified:
portal/branches/branch-GTNPORTAL-1537/webui/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardContainer.java
===================================================================
---
portal/branches/branch-GTNPORTAL-1537/webui/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardContainer.java 2010-10-10
22:33:10 UTC (rev 4617)
+++
portal/branches/branch-GTNPORTAL-1537/webui/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardContainer.java 2010-10-11
10:19:48 UTC (rev 4618)
@@ -22,6 +22,7 @@
import org.exoplatform.application.registry.Application;
import org.exoplatform.application.registry.ApplicationRegistryService;
import org.exoplatform.portal.config.DataStorage;
+import org.exoplatform.portal.config.StaleModelException;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.Dashboard;
import org.exoplatform.portal.config.model.TransientApplicationState;
@@ -30,6 +31,7 @@
import org.exoplatform.portal.webui.application.UIPortlet;
import org.exoplatform.portal.webui.container.UIContainer;
import org.exoplatform.portal.webui.util.PortalDataMapper;
+import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.web.application.RequestContext;
import org.exoplatform.webui.application.WebuiRequestContext;
@@ -40,6 +42,8 @@
import org.exoplatform.webui.config.annotation.ParamConfig;
import org.exoplatform.webui.core.UIApplication;
import org.exoplatform.webui.core.UIComponent;
+import org.exoplatform.webui.core.UIPopupMessages;
+import org.exoplatform.webui.core.UIPortletApplication;
import org.exoplatform.webui.core.model.SelectItemOption;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
@@ -47,6 +51,8 @@
import org.jibx.runtime.IBindingFactory;
import org.jibx.runtime.IUnmarshallingContext;
+import com.sun.mail.imap.protocol.UIDSet;
+
import java.io.ByteArrayInputStream;
import java.util.ArrayList;
import java.util.List;
@@ -148,7 +154,7 @@
uiRoot.getChildren().clear();
// Assemble the dashboard
- PortalDataMapper.toUIContainer(uiRoot, dashboard);
+ PortalDataMapper.toUIContainer(uiRoot, dashboard);
}
//
@@ -478,7 +484,15 @@
DataStorage service = getApplicationComponent(DataStorage.class);
// Save
- service.saveDashboard(dashboard);
+ try
+ {
+ service.saveDashboard(dashboard);
+ }
+ catch (StaleModelException e)
+ {
+ getAncestorOfType(UIPortletApplication.class).addMessage(
+ new ApplicationMessage("UIDashboard.msg.StaleData", null,
ApplicationMessage.ERROR));
+ }
}
}
@@ -532,7 +546,11 @@
uiDashboardContainer.moveUIGadget(objectId, col, row);
uiDashboardContainer.save();
- event.getRequestContext().setResponseComplete(true);
+ if
(uiDashboard.getAncestorOfType(UIPortletApplication.class).getUIPopupMessages().hasMessage())
+ {
+ return;
+ }
+ Util.getPortalRequestContext().setResponseComplete(true);
}
}
@@ -552,15 +570,18 @@
UIDashboardContainer uiDashboardContainer =
uiDashboard.getChild(UIDashboardContainer.class);
uiDashboardContainer.removeUIGadget(objectId);
boolean isMaximized = false;
- if (uiDashboard.getMaximizedGadget() != null &&
uiDashboard.getMaximizedGadget().getId().equals(objectId))
+ if (uiDashboard.getMaximizedGadget() != null &&
+ uiDashboard.getMaximizedGadget().getId().equals(objectId))
{
uiDashboard.setMaximizedGadget(null);
isMaximized = true;
}
uiDashboardContainer.save();
- if (!isMaximized)
+ UIPopupMessages uiPopupMessages =
+
uiDashboard.getAncestorOfType(UIPortletApplication.class).getUIPopupMessages();
+ if (!isMaximized && !uiPopupMessages.hasMessage())
{
- context.setResponseComplete(true);
+ Util.getPortalRequestContext().setResponseComplete(true);
}
}
}
Modified:
portal/branches/branch-GTNPORTAL-1537/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIGadget.java
===================================================================
---
portal/branches/branch-GTNPORTAL-1537/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIGadget.java 2010-10-10
22:33:10 UTC (rev 4617)
+++
portal/branches/branch-GTNPORTAL-1537/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIGadget.java 2010-10-11
10:19:48 UTC (rev 4618)
@@ -379,10 +379,13 @@
WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
//
- try{
+ try
+ {
uiGadget.addUserPref(event.getRequestContext().getRequestParameter("userPref"));
- Util.getPortalRequestContext().setFullRender(true);
- } catch(Exception e){
+ Util.getPortalRequestContext().setResponseComplete(true);
+ }
+ catch(Exception e)
+ {
UIPortletApplication uiPortlet =
uiGadget.getAncestorOfType(UIPortletApplication.class);
context.addUIComponentToUpdateByAjax(uiPortlet);
throw new MessageException(new
ApplicationMessage("UIDashboard.msg.ApplicationNotExisted", null,
ApplicationMessage.ERROR));