Author: hfnukal
Date: 2012-06-24 06:03:29 -0400 (Sun, 24 Jun 2012)
New Revision: 8742
Modified:
epp/portal/branches/EPP_5_2_Branch/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/GadgetRegistryServiceImpl.java
epp/portal/branches/EPP_5_2_Branch/portlet/dashboard/src/main/java/org/exoplatform/gadget/webui/component/UIGadgetPortlet.java
epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/javascript/eXo/gadget/Gadgets.js
epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/javascript/eXo/gadget/UIGadget.js
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIGadget.java
Log:
Bug 824852 - UIGadgetPortlet doesn't set up correctly browser caching for gadget
resources
Modified:
epp/portal/branches/EPP_5_2_Branch/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/GadgetRegistryServiceImpl.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/GadgetRegistryServiceImpl.java 2012-06-24
09:36:01 UTC (rev 8741)
+++
epp/portal/branches/EPP_5_2_Branch/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/GadgetRegistryServiceImpl.java 2012-06-24
10:03:29 UTC (rev 8742)
@@ -304,9 +304,7 @@
public boolean isGadgetDeveloper(String username)
{
- if(PropertyManager.isDevelopping())
- return true;
- return false;
+ return PropertyManager.isDevelopping();
}
public String getCountry()
Modified:
epp/portal/branches/EPP_5_2_Branch/portlet/dashboard/src/main/java/org/exoplatform/gadget/webui/component/UIGadgetPortlet.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/portlet/dashboard/src/main/java/org/exoplatform/gadget/webui/component/UIGadgetPortlet.java 2012-06-24
09:36:01 UTC (rev 8741)
+++
epp/portal/branches/EPP_5_2_Branch/portlet/dashboard/src/main/java/org/exoplatform/gadget/webui/component/UIGadgetPortlet.java 2012-06-24
10:03:29 UTC (rev 8742)
@@ -20,8 +20,9 @@
package org.exoplatform.gadget.webui.component;
import org.exoplatform.application.gadget.Gadget;
+import org.exoplatform.application.gadget.GadgetRegistryService;
import org.exoplatform.application.gadget.GadgetImporter;
-import org.exoplatform.application.gadget.GadgetRegistryService;
+import org.exoplatform.commons.utils.PropertyManager;
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.portal.webui.application.GadgetUtil;
@@ -198,6 +199,16 @@
return metadata_;
}
+ public boolean isNoCache()
+ {
+ return PropertyManager.isDevelopping();
+ }
+
+ public boolean isDebug()
+ {
+ return PropertyManager.isDevelopping();
+ }
+
static public class SaveUserPrefActionListener extends
EventListener<UIGadgetPortlet>
{
public void execute(Event<UIGadgetPortlet> event) throws Exception
Modified:
epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/javascript/eXo/gadget/Gadgets.js
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/javascript/eXo/gadget/Gadgets.js 2012-06-24
09:36:01 UTC (rev 8741)
+++
epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/javascript/eXo/gadget/Gadgets.js 2012-06-24
10:03:29 UTC (rev 8742)
@@ -712,26 +712,6 @@
this.id +').handleSaveUserPrefs()"> <input type="button"
value="'+eXo.gadget.UIGadget.CancelTitle+'"
onclick="gadgets.container.getGadget(' +
this.id +').handleCancelUserPrefs()">';
parentEl.appendChild(saveEl);
-
- /** Minh Hoang TO: Instantly remove the noCache and Debug boxes
- if(gadget.isdev) {
- //Are we in a portlet ? if not, we don't had this code because we can't
save the value
- var gadgetEl = document.getElementById("gadget_" + gadget.id) ;
- var portletFragment = eXo.core.DOMUtil.findAncestorByClass(gadgetEl,
"PORTLET-FRAGMENT");
-
- if (portletFragment) {
- var devEl = document.createElement("div");
- devEl.className = "devToolbar";
- devEl.innerHTML = '<table>' +
-
'<tr><td>'+eXo.gadget.UIGadget.Cache+'</td><td><input
type="checkbox"' + (gadget.nocache ? ' checked=""' :
"") + ' onclick="gadgets.container.getGadget(' + this.id +
').setNoCache(checked)"/></td></tr>' +
-
'<tr><td>'+eXo.gadget.UIGadget.Debug+'</td><td><input
type="checkbox"' + (gadget.debug ? ' checked=""' :
"") + ' onclick="gadgets.container.getGadget(' + this.id +
').setDebug(checked)"/></td></tr>' +
- '</table>';
- parentEl.appendChild(devEl);
- }
- }
- */
-
-
};
gadgets.IfrGadget.prototype.buildUserPrefsDialog = function(content) {
Modified:
epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/javascript/eXo/gadget/UIGadget.js
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/javascript/eXo/gadget/UIGadget.js 2012-06-24
09:36:01 UTC (rev 8741)
+++
epp/portal/branches/EPP_5_2_Branch/web/eXoResources/src/main/webapp/javascript/eXo/gadget/UIGadget.js 2012-06-24
10:03:29 UTC (rev 8742)
@@ -25,11 +25,10 @@
* @param {String} metadata contain information of gadget
* @param {Object} userPref
* @param {String} view type of view (home, canvas, ...)
- * @param {boolean} isdev normal or development mode (0, 1)
* @param {boolean} debug normal or debug mode (0, 1)
* @param {String} nocache value indicate cache or nocache at shindig level (0, 1)
*/
- createGadget : function(url, id, metadata, userPref, view, hostName, isdev, debug,
nocache) {
+ createGadget : function(url, id, metadata, userPref, view, hostName, debug, nocache) {
//eXo = eXo || {};
window.gadgets = window.gadgets || {};
eXo.gadgets = window.gadgets;
@@ -43,7 +42,7 @@
eXo.gadget.UIGadget.createCallback, null, arguments);
},
- createCallback : function(url, id, metadata, userPref, view, hostName, isdev, debug,
nocache) {
+ createCallback : function(url, id, metadata, userPref, view, hostName, debug,
nocache) {
//TODO: dang.tung - set language for gadget
//-----------------------------------------
var language = eXo.core.I18n.getLanguage();
@@ -63,7 +62,6 @@
gadget.parentId = id;
gadget.debug = debug;
gadget.nocache = nocache;
- gadget.isdev = isdev;
gadget.serverBase_ = hostName;
gadgets.container.addGadget(gadget);
Modified:
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIGadget.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIGadget.java 2012-06-24
09:36:01 UTC (rev 8741)
+++
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIGadget.java 2012-06-24
10:03:29 UTC (rev 8742)
@@ -22,7 +22,6 @@
import org.exoplatform.application.gadget.Gadget;
import org.exoplatform.application.gadget.GadgetRegistryService;
import org.exoplatform.commons.utils.PropertyManager;
-import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.model.ApplicationState;
import org.exoplatform.portal.config.model.ApplicationType;
@@ -76,8 +75,6 @@
private String url_;
- private GadgetRegistryService gadgetRegistryService = null;
-
public static final String PREF_KEY = "_pref_gadget_";
public static final String PREF_NO_CACHE = "_pref_no_cache_";
@@ -389,42 +386,16 @@
return url_;
}
- private GadgetRegistryService getGadgetRegistryService()
- {
- if (gadgetRegistryService == null)
- gadgetRegistryService =
-
(GadgetRegistryService)ExoContainerContext.getCurrentContainer().getComponentInstanceOfType(
- GadgetRegistryService.class);
- return gadgetRegistryService;
- }
-
public boolean isNoCache()
{
- if(PropertyManager.isDevelopping())
- return true;
- return false;
+ return PropertyManager.isDevelopping();
}
- public void setNoCache(boolean value)
- {
- }
-
public boolean isDebug()
{
- if(PropertyManager.isDevelopping())
- return true;
- return false;
+ return PropertyManager.isDevelopping();
}
- public void setDebug(boolean value)
- {
- }
-
- public boolean isGadgetDeveloper()
- {
- return
getGadgetRegistryService().isGadgetDeveloper(Util.getPortalRequestContext().getRemoteUser());
- }
-
public String getView()
{
if (view != null)