Author: kien_nguyen
Date: 2011-05-11 00:41:49 -0400 (Wed, 11 May 2011)
New Revision: 6466
Modified:
portal/branches/branch-showinfobar/component/portal/src/main/java/org/exoplatform/portal/config/model/Application.java
portal/branches/branch-showinfobar/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java
portal/branches/branch-showinfobar/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalProperties.java
portal/branches/branch-showinfobar/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties
portal/branches/branch-showinfobar/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_fr.properties
portal/branches/branch-showinfobar/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_vi.properties
portal/branches/branch-showinfobar/web/portal/src/main/webapp/WEB-INF/conf/portal/portal/classic/portal.xml
portal/branches/branch-showinfobar/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIApplication.java
portal/branches/branch-showinfobar/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortal.java
portal/branches/branch-showinfobar/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java
portal/branches/branch-showinfobar/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java
Log:
GTNPORTAL-1558 Have an option to set the default value for Show Info Bar and make it
disable by default
Modified:
portal/branches/branch-showinfobar/component/portal/src/main/java/org/exoplatform/portal/config/model/Application.java
===================================================================
---
portal/branches/branch-showinfobar/component/portal/src/main/java/org/exoplatform/portal/config/model/Application.java 2011-05-11
03:41:29 UTC (rev 6465)
+++
portal/branches/branch-showinfobar/component/portal/src/main/java/org/exoplatform/portal/config/model/Application.java 2011-05-11
04:41:49 UTC (rev 6466)
@@ -46,7 +46,7 @@
private String description;
- private boolean showInfoBar = true;
+ private boolean showInfoBar;
private boolean showApplicationState = true;
Modified:
portal/branches/branch-showinfobar/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java
===================================================================
---
portal/branches/branch-showinfobar/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java 2011-05-11
03:41:29 UTC (rev 6465)
+++
portal/branches/branch-showinfobar/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java 2011-05-11
04:41:49 UTC (rev 6466)
@@ -243,7 +243,22 @@
{
setProperty(PortalProperties.SESSION_ALIVE, type);
}
-
+
+ public Boolean isShowInfobar() {
+ String value = getProperty(PortalProperties.SHOW_PORTLET_INFO, "1");
+ if(Integer.parseInt(value) == 1) {
+ return true;
+ }
+ return false;
+ }
+
+ public void setShowInfobar(Boolean value) {
+ if(value)
+ setProperty(PortalProperties.SHOW_PORTLET_INFO, "1");
+ else
+ setProperty(PortalProperties.SHOW_PORTLET_INFO, "0");
+ }
+
public void setDescription(String description)
{
this.description = description;
Modified:
portal/branches/branch-showinfobar/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalProperties.java
===================================================================
---
portal/branches/branch-showinfobar/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalProperties.java 2011-05-11
03:41:29 UTC (rev 6465)
+++
portal/branches/branch-showinfobar/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalProperties.java 2011-05-11
04:41:49 UTC (rev 6466)
@@ -35,4 +35,6 @@
final public static String SESSION_NEVER = "never";
final public static String GADGET_SERVER = "gadgetServer";
+
+ final public static String SHOW_PORTLET_INFO = "showPortletInfo";
}
Modified:
portal/branches/branch-showinfobar/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties
===================================================================
---
portal/branches/branch-showinfobar/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties 2011-05-11
03:41:29 UTC (rev 6465)
+++
portal/branches/branch-showinfobar/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties 2011-05-11
04:41:49 UTC (rev 6466)
@@ -364,6 +364,7 @@
UIPortalForm.label.option.always=Always
UIPortalForm.label.option.onDemand=On Demand
UIPortalForm.label.option.never=Never
+UIPortalForm.label.showInfobar=Show info bar by default
UIPortalForm.tab.label.PortalSetting=Portal Setting
UIPortalForm.tab.label.PortalTemplate=Portal Templates
UIPortalForm.tab.label.PermissionSetting=Permission Setting
Modified:
portal/branches/branch-showinfobar/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_fr.properties
===================================================================
---
portal/branches/branch-showinfobar/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_fr.properties 2011-05-11
03:41:29 UTC (rev 6465)
+++
portal/branches/branch-showinfobar/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_fr.properties 2011-05-11
04:41:49 UTC (rev 6466)
@@ -336,6 +336,7 @@
UIPortalForm.label.option.always=Always
UIPortalForm.label.option.onDemand=On Demand
UIPortalForm.label.option.never=Never
+UIPortalForm.label.showInfobar=Afficher la barre d'info par défaut
UIPortalForm.tab.label.PortalSetting=Configuration du portal
UIPortalForm.tab.label.PortalTemplate=Modèles de portails
UIPortalForm.tab.label.PermissionSetting=Configuration des permissions
Modified:
portal/branches/branch-showinfobar/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_vi.properties
===================================================================
---
portal/branches/branch-showinfobar/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_vi.properties 2011-05-11
03:41:29 UTC (rev 6465)
+++
portal/branches/branch-showinfobar/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_vi.properties 2011-05-11
04:41:49 UTC (rev 6466)
@@ -331,6 +331,7 @@
UIPortalForm.label.option.always=Luôn luôn
UIPortalForm.label.option.onDemand=Theo yêu cầu
UIPortalForm.label.option.never=Không bao giờ
+UIPortalForm.label.showInfobar=Mặc định hiển thị thanh thông tin
UIPortalForm.tab.label.PortalSetting=Cấu hình Portal
UIPortalForm.tab.label.PortalTemplate=Các Portal mẫu
UIPortalForm.tab.label.PermissionSetting=Tùy chọn phân quyền sử dụng
Modified:
portal/branches/branch-showinfobar/web/portal/src/main/webapp/WEB-INF/conf/portal/portal/classic/portal.xml
===================================================================
---
portal/branches/branch-showinfobar/web/portal/src/main/webapp/WEB-INF/conf/portal/portal/classic/portal.xml 2011-05-11
03:41:29 UTC (rev 6465)
+++
portal/branches/branch-showinfobar/web/portal/src/main/webapp/WEB-INF/conf/portal/portal/classic/portal.xml 2011-05-11
04:41:49 UTC (rev 6466)
@@ -30,6 +30,7 @@
<edit-permission>*:/platform/administrators</edit-permission>
<properties>
<entry key="sessionAlive">onDemand</entry>
+ <entry key="showPortletInfo">1</entry>
</properties>
<portal-layout>
Modified:
portal/branches/branch-showinfobar/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIApplication.java
===================================================================
---
portal/branches/branch-showinfobar/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIApplication.java 2011-05-11
03:41:29 UTC (rev 6465)
+++
portal/branches/branch-showinfobar/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIApplication.java 2011-05-11
04:41:49 UTC (rev 6466)
@@ -33,7 +33,7 @@
private Properties properties;
- private boolean showInfoBar = true;
+ private boolean showInfoBar;
private boolean showWindowState = true;
Modified:
portal/branches/branch-showinfobar/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortal.java
===================================================================
---
portal/branches/branch-showinfobar/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortal.java 2011-05-11
03:41:29 UTC (rev 6465)
+++
portal/branches/branch-showinfobar/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortal.java 2011-05-11
04:41:49 UTC (rev 6466)
@@ -382,6 +382,21 @@
setProperty(PortalProperties.SESSION_ALIVE, type);
}
+ public Boolean isShowInfobar() {
+ String value = getProperty(PortalProperties.SHOW_PORTLET_INFO, "1");
+ if(Integer.parseInt(value) == 1) {
+ return true;
+ }
+ return false;
+ }
+
+ public void setShowInfobar(Boolean value) {
+ if(value)
+ setProperty(PortalProperties.SHOW_PORTLET_INFO, "1");
+ else
+ setProperty(PortalProperties.SHOW_PORTLET_INFO, "0");
+ }
+
public String getLabel()
{
return label;
Modified:
portal/branches/branch-showinfobar/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java
===================================================================
---
portal/branches/branch-showinfobar/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java 2011-05-11
03:41:29 UTC (rev 6465)
+++
portal/branches/branch-showinfobar/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComponentActionListener.java 2011-05-11
04:41:49 UTC (rev 6466)
@@ -332,6 +332,11 @@
}
uiPortlet.setPortletInPortal(uiTarget instanceof UIPortal);
uiPortlet.setShowEditControl(true);
+
+ //TODO Wait to fix issue EXOGTN-213 and then
+ //we should get "showInfobar" from current UI portal
+ UserPortalConfigService service =
uiApp.getApplicationComponent(UserPortalConfigService.class);
+
uiPortlet.setShowInfoBar(service.getUserPortalConfig(Util.getUIPortal().getOwner(),
pcontext.getRemoteUser()).getPortalConfig().isShowInfobar());
uiSource = uiPortlet;
}
List<UIComponent> children = uiTarget.getChildren();
Modified:
portal/branches/branch-showinfobar/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java
===================================================================
---
portal/branches/branch-showinfobar/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java 2011-05-11
03:41:29 UTC (rev 6465)
+++
portal/branches/branch-showinfobar/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java 2011-05-11
04:41:49 UTC (rev 6466)
@@ -55,6 +55,7 @@
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
import org.exoplatform.webui.event.Event.Phase;
+import org.exoplatform.webui.form.UIFormCheckBoxInput;
import org.exoplatform.webui.form.UIFormInputItemSelector;
import org.exoplatform.webui.form.UIFormInputSet;
import org.exoplatform.webui.form.UIFormSelectBox;
@@ -84,7 +85,8 @@
@ComponentConfig(id = "CreatePortal", lifecycle = UIFormLifecycle.class,
template = "system:/groovy/webui/form/UIFormTabPane.gtmpl", initParams =
@ParamConfig(name = "PortalTemplateConfigOption", value =
"system:/WEB-INF/conf/uiconf/portal/webui/portal/PortalTemplateConfigOption.groovy"),
events = {
@EventConfig(name = "Save", listeners =
UIPortalForm.CreateActionListener.class),
@EventConfig(listeners = UIPortalForm.SelectItemOptionActionListener.class, phase =
Phase.DECODE),
- @EventConfig(listeners = UIMaskWorkspace.CloseActionListener.class, phase =
Phase.DECODE)}),
+ @EventConfig(listeners = UIMaskWorkspace.CloseActionListener.class, phase =
Phase.DECODE),
+ @EventConfig(listeners = UIPortalForm.CheckShowActionListener.class)}),
@ComponentConfig(type = UIFormInputSet.class, id = "PermissionSetting",
template = "system:/groovy/webui/core/UITabSelector.gtmpl", events =
{@EventConfig(listeners = UIFormInputSet.SelectComponentActionListener.class)})})
public class UIPortalForm extends UIFormTabPane
{
@@ -100,6 +102,8 @@
private static final String FIELD_LABEL = "label";
private static final String FIELD_DESCRIPTION = "description";
+
+ private static final String FIELD_SHOW_INFOBAR = "showInfobar";
private String portalOwner_;
@@ -270,6 +274,11 @@
new UIFormSelectBox(FIELD_SESSION_ALIVE, FIELD_SESSION_ALIVE,
listSessionAlive);
uiSessionAliveBox.setValue(PortalProperties.SESSION_ON_DEMAND);
uiPropertiesSet.addUIFormInput(uiSessionAliveBox);
+
+ //TODO add more box for showPortletMode and showWindowState if needed
+ UIFormCheckBoxInput<Boolean> uiShowInfobarBox = new
UIFormCheckBoxInput<Boolean>(FIELD_SHOW_INFOBAR, FIELD_SHOW_INFOBAR, true);
+ uiShowInfobarBox.setOnChange("CheckShowInfobar");
+ uiPropertiesSet.addChild(uiShowInfobarBox);
addUIFormInput(uiPropertiesSet);
UIFormInputSet uiPermissionSetting = createUIComponent(UIFormInputSet.class,
"PermissionSetting", null);
@@ -412,6 +421,21 @@
event.getRequestContext().addUIComponentToUpdateByAjax(uiForm);
}
}
+
+ static public class CheckShowActionListener extends EventListener<UIPortalForm>
+ {
+ public void execute(Event<UIPortalForm> event) throws Exception
+ {
+ UIPortalForm uiForm = event.getSource();
+ UIFormInputSet InfoForm = uiForm.getChildById("Properties");
+ UIFormCheckBoxInput<Boolean> showInfobarForm =
InfoForm.getUIFormCheckBoxInput(UIPortalForm.FIELD_SHOW_INFOBAR);
+
+ //TODO: When we need to implement for showPortletMode or showWindowState
+ // we can change how to get/set value for showInfobarForm (as well as of
PortalConfig)
+ showInfobarForm.setValue(showInfobarForm.isChecked());
+ event.getRequestContext().addUIComponentToUpdateByAjax(uiForm);
+ }
+ }
private String capitalizeFirstLetter(String word)
{