Author: trong.tran
Date: 2010-08-13 09:24:00 -0400 (Fri, 13 Aug 2010)
New Revision: 3826
Modified:
exo/portal/branches/3.1.x/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/GadgetRegistryServiceImpl.java
exo/portal/branches/3.1.x/component/resources/src/main/java/org/exoplatform/services/resources/ExoResourceBundle.java
exo/portal/branches/3.1.x/gadgets/eXoGadgets/src/main/webapp/gadgets/rssAggregator/script.js
exo/portal/branches/3.1.x/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIPortletManagement.java
exo/portal/branches/3.1.x/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalDragDrop.js
exo/portal/branches/3.1.x/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortal.js
exo/portal/branches/3.1.x/web/portal/src/main/webapp/groovy/portal/webui/application/UIPortlet.gtmpl
exo/portal/branches/3.1.x/webui/core/src/main/java/org/exoplatform/webui/form/validator/DateTimeValidator.java
exo/portal/branches/3.1.x/webui/portal/src/main/java/org/exoplatform/portal/webui/application/ExoPortletInvocationContext.java
exo/portal/branches/3.1.x/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIGadget.java
exo/portal/branches/3.1.x/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletLifecycle.java
Log:
Revert last committes that would be done in next version
Modified:
exo/portal/branches/3.1.x/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/GadgetRegistryServiceImpl.java
===================================================================
---
exo/portal/branches/3.1.x/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/GadgetRegistryServiceImpl.java 2010-08-13
12:43:07 UTC (rev 3825)
+++
exo/portal/branches/3.1.x/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/GadgetRegistryServiceImpl.java 2010-08-13
13:24:00 UTC (rev 3826)
@@ -26,7 +26,6 @@
import org.exoplatform.application.registry.impl.ApplicationRegistryChromatticLifeCycle;
import org.exoplatform.commons.chromattic.ChromatticLifeCycle;
import org.exoplatform.commons.chromattic.ChromatticManager;
-import org.exoplatform.commons.utils.PropertyManager;
import org.exoplatform.container.xml.InitParams;
import org.exoplatform.container.xml.PropertiesParam;
import org.exoplatform.container.xml.ValueParam;
@@ -261,9 +260,7 @@
public boolean isGadgetDeveloper(String username)
{
- if(PropertyManager.isDevelopping())
- return true;
- return false;
+ return true;
}
public String getCountry()
Modified:
exo/portal/branches/3.1.x/component/resources/src/main/java/org/exoplatform/services/resources/ExoResourceBundle.java
===================================================================
---
exo/portal/branches/3.1.x/component/resources/src/main/java/org/exoplatform/services/resources/ExoResourceBundle.java 2010-08-13
12:43:07 UTC (rev 3825)
+++
exo/portal/branches/3.1.x/component/resources/src/main/java/org/exoplatform/services/resources/ExoResourceBundle.java 2010-08-13
13:24:00 UTC (rev 3826)
@@ -20,10 +20,14 @@
package org.exoplatform.services.resources;
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.Enumeration;
+import java.util.List;
import java.util.ListResourceBundle;
import java.util.Map;
import java.util.ResourceBundle;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
/**
* May 7, 2004
@@ -74,7 +78,7 @@
String key = keys.nextElement();
if (key != null)
{
- map.put(key.trim(), getString(key));
+ map.put(key, getString(key));
}
}
}
Modified:
exo/portal/branches/3.1.x/gadgets/eXoGadgets/src/main/webapp/gadgets/rssAggregator/script.js
===================================================================
---
exo/portal/branches/3.1.x/gadgets/eXoGadgets/src/main/webapp/gadgets/rssAggregator/script.js 2010-08-13
12:43:07 UTC (rev 3825)
+++
exo/portal/branches/3.1.x/gadgets/eXoGadgets/src/main/webapp/gadgets/rssAggregator/script.js 2010-08-13
13:24:00 UTC (rev 3826)
@@ -83,20 +83,16 @@
}
}
-RssAggregator.prototype.renderFeed = function(feedObj) {
- if(feedObj.rc != 200 && feedObj.data == undefined) {
- document.write("the url: " + feedurl + " is down or invalid");
- return;
- }
- this.feed = feedObj.data;
- gadgets.window.setTitle("RSS: " + this.feed.Title);
+RssAggregator.prototype.renderFeed = function(feed) {
+ this.feed = feed;
+ gadgets.window.setTitle("RSS: " + feed.Title);
var feedEl = _gel("feedContainer");
var bullet = "<img src='" + this.getFavicon(feedurl) + "'
alt='' border=0 align='absmiddle' style='height:16;width:16;'
onerror='this.style.visibility=\"hidden\";'> ";
- if (this.feed != null) {
+ if (feed != null) {
// Access the data for a given entry
- if (this.feed.Entry) {
- for (var i = 0; i < this.feed.Entry.length; i++) {
+ if (feed.Entry) {
+ for (var i = 0; i < feed.Entry.length; i++) {
var itemEl = document.createElement('div');
var item_title = document.createElement('div');
var item_more = document.createElement('div');
@@ -120,10 +116,10 @@
item_date.className = 'date';
item_link.className = 'link';
- item_title.innerHTML = bullet + "<a
id='link_title_"+i+"' class='titlelink' href='" +
this.feed.Entry[i].Link + "'
onclick='rssAggregator.toggleDescription("+i+");return false;'>"
+ this.feed.Entry[i].Title + "</a>";
- item_date.innerHTML = this.timeToPrettyString(this.feed.Entry[i].Date);
+ item_title.innerHTML = bullet + "<a
id='link_title_"+i+"' class='titlelink' href='" +
feed.Entry[i].Link + "'
onclick='rssAggregator.toggleDescription("+i+");return false;'>"
+ feed.Entry[i].Title + "</a>";
+ item_date.innerHTML = this.timeToPrettyString(feed.Entry[i].Date);
- item_desc.innerHTML = this.feed.Entry[i].Summary;
+ item_desc.innerHTML = feed.Entry[i].Summary;
item_link.innerHTML = this.generateLinkContent(i);
@@ -150,10 +146,6 @@
}
RssAggregator.prototype.refreshFeed = function() {
- var params = {};
- params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.FEED;
- params[gadgets.io.RequestParameters.NUM_ENTRIES] = entries;
- params[gadgets.io.RequestParameters.GET_SUMMARIES] = true;
- gadgets.io.makeRequest(prefs.getString("rssurl"), function(feedObj)
{rssAggregator.renderFeed(feedObj);}, params);
+ _IG_FetchFeedAsJSON(prefs.getString("rssurl"), function(feed)
{rssAggregator.renderFeed(feed);}, entries, true);
}
Modified:
exo/portal/branches/3.1.x/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIPortletManagement.java
===================================================================
---
exo/portal/branches/3.1.x/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIPortletManagement.java 2010-08-13
12:43:07 UTC (rev 3825)
+++
exo/portal/branches/3.1.x/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIPortletManagement.java 2010-08-13
13:24:00 UTC (rev 3826)
@@ -313,38 +313,17 @@
public String getDisplayName()
{
- try
- {
- return getMetaValue(MetaInfo.DISPLAY_NAME, name_);
- }
- catch (Exception ex)
- {
- return "COULD NOT GET DISPLAY NAME OF THE PORTLET";
- }
+ return getMetaValue(MetaInfo.DISPLAY_NAME, name_);
}
public String getDescription()
{
- try
- {
- return getMetaValue(MetaInfo.DESCRIPTION, name_);
- }
- catch (Exception ex)
- {
- return "COULD NOT GET DESCRIPTION OF THE PORTLET";
- }
+ return getMetaValue(MetaInfo.DESCRIPTION, name_);
}
public PreferencesInfo getPortletPreferences()
{
- try
- {
- return portletInfo_.getPreferences();
- }
- catch (Exception ex)
- {
- return null;
- }
+ return portletInfo_.getPreferences();
}
private String getMetaValue(String metaKey, String defaultValue)
Modified:
exo/portal/branches/3.1.x/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalDragDrop.js
===================================================================
---
exo/portal/branches/3.1.x/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalDragDrop.js 2010-08-13
12:43:07 UTC (rev 3825)
+++
exo/portal/branches/3.1.x/web/eXoResources/src/main/webapp/javascript/eXo/portal/PortalDragDrop.js 2010-08-13
13:24:00 UTC (rev 3826)
@@ -32,10 +32,6 @@
*/
PortalDragDrop.prototype.init = function(e) {
- if (eXo.core.DragDrop.dndEvent && eXo.core.DragDrop.dndEvent.clickObject ==
this){
- return;
- }
-
if (!e) e = window.event;
if(((e.which) && (e.which == 2 || e.which == 3)) || ((e.button) &&
(e.button == 2))) return;
@@ -198,9 +194,7 @@
this.origDragObjectStyle.setProperties(dndEvent.dragObject.style, false) ;
if(dndEvent.foundTargetObject != null || (dndEvent.backupMouseEvent &&
dndEvent.backupMouseEvent.keyCode != 27)) {
- if (dndEvent.foundTargetObject.foundIndex != null) {
- eXo.portal.PortalDragDrop.doDropCallback(dndEvent) ;
- }
+ eXo.portal.PortalDragDrop.doDropCallback(dndEvent) ;
} else {
if(dndEvent.dragObject.parentNode.nodeName.toLowerCase() == "td") {
dndEvent.dragObject.parentNode.style.width = "auto";
@@ -226,6 +220,12 @@
dndEvent.dragObject.style.width = "auto" ;
};
+ DragDrop.cancelCallback = function(dndEvent) {
+ if(Browser.browserType == "ie" &&
Browser.findMouseYInClient(dndEvent.backupMouseEvent) < 0) {
+ DragDrop.onDrop(dndEvent.backupMouseEvent);
+ }
+ };
+
var clickObject = this;
var componentBlock = DOMUtil.findAncestorByClass(clickObject,
"UIComponentBlock") ;
@@ -284,7 +284,7 @@
] ;
try {
- dndEvent.lastFoundTargetObject.foundIndex = null;
+ dndEvent.lastFoundTargetObject.foundIndex = -1;
} catch(err) {
}
Modified:
exo/portal/branches/3.1.x/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortal.js
===================================================================
---
exo/portal/branches/3.1.x/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortal.js 2010-08-13
12:43:07 UTC (rev 3825)
+++
exo/portal/branches/3.1.x/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortal.js 2010-08-13
13:24:00 UTC (rev 3826)
@@ -98,56 +98,6 @@
}
newLayer.parentNode.style.top = -height + "px";
editBlock.style.display = "block";
-
- //resize width of portlet/container control if IE + LTR align BEGIN
-
- var uiInfoBar = DOMUtil.findFirstDescendantByClass(editBlock, "div",
"UIInfoBar");
-
- if( uiInfoBar && (eXo.core.Browser.isIE6() || (eXo.core.Browser.isIE7()
&& eXo.core.I18n.isRT()))){
- //resize width of portlet/container only one time
- if(uiInfoBar.style.width == ""){
- var dragControlArea = DOMUtil.findFirstDescendantByClass(uiInfoBar, "div",
"DragControlArea");
-
- var portletIcon = DOMUtil.findFirstDescendantByClass(uiInfoBar, "div",
"PortletIcon");
- var editPortletPropertiesIcon = DOMUtil.findFirstDescendantByClass(uiInfoBar,
"a", "EditPortletPropertiesIcon");
- var deletePortletIcon = DOMUtil.findFirstDescendantByClass(uiInfoBar, "a",
"DeletePortletIcon");
-
- var contarnerIcon = DOMUtil.findFirstDescendantByClass(uiInfoBar, "div",
"ContainerIcon");
- var editContainerIcon = DOMUtil.findFirstDescendantByClass(uiInfoBar, "a",
"EditContainerIcon");
- var deleteContainerIcon = DOMUtil.findFirstDescendantByClass(uiInfoBar,
"a", "DeleteContainerIcon");
-
- var uiInfoBarWidth = dragControlArea.offsetWidth;
-
- if(DOMUtil.hasClass(portlet, "UIPortlet")){
- uiInfoBarWidth += portletIcon.offsetWidth;
-
- if(editPortletPropertiesIcon){
- uiInfoBarWidth += editPortletPropertiesIcon.offsetWidth;
- }
-
- if(deletePortletIcon){
- uiInfoBarWidth += deletePortletIcon.offsetWidth;
- }
- }
-
- if(DOMUtil.hasClass(portlet, "UIContainer")){
- uiInfoBarWidth += contarnerIcon.offsetWidth
-
- if(editContainerIcon){
- uiInfoBarWidth += editContainerIcon.offsetWidth;
- }
-
- if(deleteContainerIcon){
- uiInfoBarWidth += deleteContainerIcon.offsetWidth;
- }
- }
-
- uiInfoBar.style.width= uiInfoBarWidth + 35 + "px";
- }
-
- }
- //resize width of portlet/container control if IE + LTR align END
-
} else {
editBlock.style.display = "none";
if(!DOMUtil.hasClass(portlet, "UIPortlet")) {
Modified:
exo/portal/branches/3.1.x/web/portal/src/main/webapp/groovy/portal/webui/application/UIPortlet.gtmpl
===================================================================
---
exo/portal/branches/3.1.x/web/portal/src/main/webapp/groovy/portal/webui/application/UIPortlet.gtmpl 2010-08-13
12:43:07 UTC (rev 3825)
+++
exo/portal/branches/3.1.x/web/portal/src/main/webapp/groovy/portal/webui/application/UIPortlet.gtmpl 2010-08-13
13:24:00 UTC (rev 3826)
@@ -37,14 +37,12 @@
<div class="FixHeight">
<%
if(hasPermission) {
- if(portletTitle == null || portletTitle.trim().length() < 1) {
- try {
- String portletName =
uicomponent.getProducedOfferedPortlet().getInfo().getName();
- print
_ctx.getRequestContext().getApplicationResourceBundle().getString("UIPortlet.description."
+ portletName);
- } catch(Exception e){
- print uicomponent.getDisplayName();
- }
- } else print portletTitle;
+ try {
+ String portletName =
uicomponent.getProducedOfferedPortlet().getInfo().getName();
+ print
_ctx.getRequestContext().getApplicationResourceBundle().getString("UIPortlet.description."
+ portletName);
+ } catch(Exception e){
+ print uicomponent.getDisplayName();
+ }
} else print "<div
class='ProtectedContent'>"+_ctx.appRes("UIPortlet.label.protectedContent")+"</div>";
%>
</div>
@@ -62,12 +60,10 @@
if(portalMode != uiPortalApp.CONTAINER_BLOCK_EDIT_MODE && portalMode !=
uiPortalApp.APP_BLOCK_EDIT_MODE) {
if(uicomponent.getShowInfoBar()) {
- String title = portletTitle;
- if(title == null || title.trim().length() < 1)
- title = uicomponent.getTitle();
- if(title == null || title.trim().length() < 1)
+ String title = uicomponent.getTitle();
+ if(title == null || title.trim().length() < 1)
title = uicomponent.getDisplayName();
- if(title == null || title.trim().length() < 1)
+ if(title == null || title.trim().length() < 1)
title = portletId;
/*Begin Window Portlet Bar*/
String visibility = "visible";
@@ -292,9 +288,7 @@
String portletIcon = uicomponent.getIcon();
if(portletIcon == null) portletIcon = "PortletIcon";
- String title = portletTitle;
- if(title == null || title.trim().length() < 1)
- title = uicomponent.getDisplayTitle();
+ String title = uicomponent.getDisplayTitle();
if(title.length() > 30) title = title.substring(0,27) +
"...";
%>
<div class="PortletIcon $portletIcon"><%=hasPermission
? title : _ctx.appRes("UIPortlet.label.protectedContent")%></div>
Modified:
exo/portal/branches/3.1.x/webui/core/src/main/java/org/exoplatform/webui/form/validator/DateTimeValidator.java
===================================================================
---
exo/portal/branches/3.1.x/webui/core/src/main/java/org/exoplatform/webui/form/validator/DateTimeValidator.java 2010-08-13
12:43:07 UTC (rev 3825)
+++
exo/portal/branches/3.1.x/webui/core/src/main/java/org/exoplatform/webui/form/validator/DateTimeValidator.java 2010-08-13
13:24:00 UTC (rev 3826)
@@ -73,16 +73,17 @@
{
// Specify whether or not date/time parsing is to be lenient.
sdf.setLenient(false);
- sdf.parse(s);
+ Date stDate = sdf.parse(s);
+ s = stFormat.format(stDate);
}
catch (Exception e)
{
- throw new MessageException(new
ApplicationMessage("DateTimeValidator.msg.Invalid-input", args,
ApplicationMessage.WARNING));
+ throw new MessageException(new
ApplicationMessage("DateTimeValidator.msg.Invalid-input", args));
}
if (s.matches(DATETIME_REGEX) && isValidDateTime(s))
return;
- throw new MessageException(new
ApplicationMessage("DateTimeValidator.msg.Invalid-input", args,
ApplicationMessage.WARNING));
+ throw new MessageException(new
ApplicationMessage("DateTimeValidator.msg.Invalid-input", args));
}
private boolean isValidDateTime(String dateTime)
Modified:
exo/portal/branches/3.1.x/webui/portal/src/main/java/org/exoplatform/portal/webui/application/ExoPortletInvocationContext.java
===================================================================
---
exo/portal/branches/3.1.x/webui/portal/src/main/java/org/exoplatform/portal/webui/application/ExoPortletInvocationContext.java 2010-08-13
12:43:07 UTC (rev 3825)
+++
exo/portal/branches/3.1.x/webui/portal/src/main/java/org/exoplatform/portal/webui/application/ExoPortletInvocationContext.java 2010-08-13
13:24:00 UTC (rev 3826)
@@ -199,7 +199,7 @@
}
Mode mode = renderURL.getMode();
- if (mode != null)
+ if (mode != null && !mode.equals(Mode.VIEW))
{
appendParameter(baseURL, Constants.PORTLET_MODE_PARAMETER, mode.toString());
}
Modified:
exo/portal/branches/3.1.x/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIGadget.java
===================================================================
---
exo/portal/branches/3.1.x/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIGadget.java 2010-08-13
12:43:07 UTC (rev 3825)
+++
exo/portal/branches/3.1.x/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIGadget.java 2010-08-13
13:24:00 UTC (rev 3826)
@@ -21,7 +21,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;
@@ -313,24 +312,50 @@
public boolean isNoCache()
{
- if(PropertyManager.isDevelopping())
- return true;
- return false;
+ /*
+ * try { UserGadgetStorage userGadgetStorage = getGadgetStorage(); String
+ * username = Util.getPortalRequestContext().getRemoteUser(); if(username !=
+ * null) { String prefs = userGadgetStorage.get(username,
+ * getApplicationName(), getApplicationInstanceUniqueId(), PREF_NO_CACHE);
+ * return prefs.equals("1"); } } catch (Exception e) {} return false;
+ */
+ return true;
}
public void setNoCache(boolean value)
{
+ /*
+ * try { UserGadgetStorage userGadgetStorage = getGadgetStorage(); String
+ * username = Util.getPortalRequestContext().getRemoteUser(); if(username !=
+ * null && getGadgetRegistryService().isGadgetDeveloper(username)) {
+ * userGadgetStorage.save(username, getApplicationName(),
+ * getApplicationInstanceUniqueId(), PREF_NO_CACHE, value ? "1" :
"0"); } }
+ * catch (Exception e) {}
+ */
}
public boolean isDebug()
{
- if(PropertyManager.isDevelopping())
- return true;
- return false;
+ /*
+ * try { UserGadgetStorage userGadgetStorage = getGadgetStorage(); String
+ * username = Util.getPortalRequestContext().getRemoteUser(); if(username !=
+ * null) { String prefs = userGadgetStorage.get(username,
+ * getApplicationName(), getApplicationInstanceUniqueId(), PREF_DEBUG);
+ * return prefs.equals("1"); } } catch (Exception e) {} return false;
+ */
+ return true;
}
public void setDebug(boolean value)
{
+ /*
+ * try { UserGadgetStorage userGadgetStorage = getGadgetStorage(); String
+ * username = Util.getPortalRequestContext().getRemoteUser(); if(username !=
+ * null && getGadgetRegistryService().isGadgetDeveloper(username)) {
+ * userGadgetStorage.save(username, getApplicationName(),
+ * getApplicationInstanceUniqueId(), PREF_DEBUG, value ? "1" :
"0"); } }
+ * catch (Exception e) {}
+ */
}
public boolean isGadgetDeveloper()
@@ -366,7 +391,11 @@
public void addUserPref(String addedUserPref) throws Exception
{
DataStorage service = getApplicationComponent(DataStorage.class);
- org.exoplatform.portal.pom.spi.gadget.Gadget gadget = new
org.exoplatform.portal.pom.spi.gadget.Gadget();
+ org.exoplatform.portal.pom.spi.gadget.Gadget gadget = service.load(state,
ApplicationType.GADGET);
+ if (gadget == null)
+ {
+ gadget = new org.exoplatform.portal.pom.spi.gadget.Gadget();
+ }
//
gadget.addUserPref(addedUserPref);
Modified:
exo/portal/branches/3.1.x/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletLifecycle.java
===================================================================
---
exo/portal/branches/3.1.x/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletLifecycle.java 2010-08-13
12:43:07 UTC (rev 3825)
+++
exo/portal/branches/3.1.x/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletLifecycle.java 2010-08-13
13:24:00 UTC (rev 3826)
@@ -325,6 +325,12 @@
}
//
+ if (portletTitle == null)
+ {
+ portletTitle = "Portlet";
+ }
+
+ //
if (context.useAjax() && !prcontext.getFullRender())
{
if (markup != null)