Author: liem_nguyen
Date: 2009-10-26 00:14:57 -0400 (Mon, 26 Oct 2009)
New Revision: 430
Modified:
portal/trunk/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UILogoEditMode.java
Log:
PORTAL-3554 Check some case in logo portlet
Modified:
portal/trunk/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UILogoEditMode.java
===================================================================
---
portal/trunk/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UILogoEditMode.java 2009-10-26
03:09:01 UTC (rev 429)
+++
portal/trunk/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UILogoEditMode.java 2009-10-26
04:14:57 UTC (rev 430)
@@ -19,8 +19,12 @@
package org.exoplatform.portal.webui.component;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletPreferences;
+
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.webui.workspace.UIPortalApplication;
+import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.application.portlet.PortletRequestContext;
import org.exoplatform.webui.config.annotation.ComponentConfig;
@@ -28,13 +32,12 @@
import org.exoplatform.webui.core.lifecycle.UIFormLifecycle;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
+import org.exoplatform.webui.exception.MessageException;
import org.exoplatform.webui.form.UIForm;
import org.exoplatform.webui.form.UIFormStringInput;
import org.exoplatform.webui.form.validator.MandatoryValidator;
+import org.exoplatform.webui.form.validator.URLValidator;
-import javax.portlet.PortletMode;
-import javax.portlet.PortletPreferences;
-
/**
* Created by The eXo Platform SAS Author : eXoPlatform October 2, 2009
*/
@@ -58,6 +61,12 @@
{
UILogoEditMode uiForm = event.getSource();
String url = uiForm.getUIStringInput(FIELD_URL).getValue();
+ if (url != null && !url.trim().matches(URLValidator.URL_REGEX)) {
+ UILogoPortlet uiPortlet = uiForm.getParent();
+ uiForm.getUIStringInput(FIELD_URL).setValue(uiPortlet.getURL());
+ Object[] args = {FIELD_URL, "URL"};
+ throw new MessageException(new
ApplicationMessage("ExpressionValidator.msg.value-invalid", args));
+ }
PortletRequestContext pcontext =
(PortletRequestContext)WebuiRequestContext.getCurrentInstance();
PortletPreferences pref = pcontext.getRequest().getPreferences();
pref.setValue("url", uiForm.getUIStringInput(FIELD_URL).getValue());
Show replies by date