Author: hoang_to
Date: 2011-10-25 02:59:20 -0400 (Tue, 25 Oct 2011)
New Revision: 7855
Removed:
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/uiconf/portal/webui/portal/PortalTemplateConfigOption.groovy
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/PortalTemplateConfigOption.java
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java
portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UISelector/UIItemSelector/Stylesheet.css
portal/trunk/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties
portal/trunk/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_fr.properties
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/portal/template/basic/portal.xml
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/portal/template/classic/portal.xml
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java
Log:
GTNPORTAL-2197: Allow to tune cache easily
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java 2011-10-25
03:18:40 UTC (rev 7854)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java 2011-10-25
06:59:20 UTC (rev 7855)
@@ -44,7 +44,6 @@
import org.exoplatform.services.organization.Group;
import org.exoplatform.services.organization.OrganizationService;
import org.picocontainer.Startable;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
@@ -673,4 +672,14 @@
{
return newPortalConfigListener_.getDefaultPortal();
}
+
+ public Set<String> getPortalTemplates()
+ {
+ return newPortalConfigListener_.getTemplateConfigs(PortalConfig.PORTAL_TYPE);
+ }
+
+ public PortalConfig getPortalConfigFromTemplate(String templateName)
+ {
+ return
newPortalConfigListener_.getPortalConfigFromTemplate(PortalConfig.PORTAL_TYPE,
templateName);
+ }
}
Modified:
portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UISelector/UIItemSelector/Stylesheet.css
===================================================================
---
portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UISelector/UIItemSelector/Stylesheet.css 2011-10-25
03:18:40 UTC (rev 7854)
+++
portal/trunk/web/eXoResources/src/main/webapp/skin/DefaultSkin/webui/component/UISelector/UIItemSelector/Stylesheet.css 2011-10-25
06:59:20 UTC (rev 7855)
@@ -1,22 +1,22 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
.UIItemSelector {
margin: 2px 0px 2px 2px; /* orientation=lt */
margin: 2px 2px 2px 0px; /* orientation=rt */
@@ -42,7 +42,7 @@
background: url('background/TemplateContainer.jpg') no-repeat center -836px;
}
-.UIItemSelector .ItemDetailList .TemplateContainer .ClassicPortalImage {
+.UIItemSelector .ItemDetailList .TemplateContainer .classicImage {
height: 222px;
background: url('background/TemplateContainer.jpg') no-repeat center -392px;
margin-top: 9px;
@@ -53,13 +53,13 @@
background: url('background/TemplateContainer.jpg') no-repeat center -170px;
margin-top: 9px;
}
-
-.UIItemSelector .ItemDetailList .TemplateContainer .BasicPortalImage {
- height: 222px;
- background: url('background/TemplateContainer.jpg') no-repeat center -1059px;
- margin-top: 9px;
-}
+.UIItemSelector .ItemDetailList .TemplateContainer .basicImage {
+ height: 222px;
+ background: url('background/TemplateContainer.jpg') no-repeat center -1052px;
+ margin-top: 9px;
+}
+
.UIItemSelector .TemplateContainer .DefaultImage {
height: 222px;
background: url('background/TemplateContainer.jpg') no-repeat center -392px;
@@ -156,15 +156,15 @@
margin: 0px 5px 0px 5px;
}
-.UIItemSelector .RightColumnStyle .ItemDetailList .Title {
- width: 300px; overflow: hidden;
-}
-
+.UIItemSelector .RightColumnStyle .ItemDetailList .Title {
+ width: 300px; overflow: hidden;
+}
+
.UIItemSelector .RightColumnStyle .ItemListContainer .Title {
- width: 143px; overflow: hidden;
-}
-
-.UIItemSelector .RightColumnStyle .Title {
+ width: 143px; overflow: hidden;
+}
+
+.UIItemSelector .RightColumnStyle .Title {
line-height: 22px; white-space: nowrap;
font-weight: bold; color: #5c5c5c;
float: left; /* orientation=lt */
Modified:
portal/trunk/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties
===================================================================
---
portal/trunk/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties 2011-10-25
03:18:40 UTC (rev 7854)
+++
portal/trunk/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties 2011-10-25
06:59:20 UTC (rev 7855)
@@ -888,8 +888,8 @@
UIPortalBrowser.msg.Invalid-createPermission=You do not have the right to create a new
portal. Contact the administrator.
UIPortalBrowser.deletePortal=Are you sure you want to delete this portal?
SitePortal.label=Site Portal
-ClassicPortal.label=Classic Portal
-BasicPortal.label=Basic Portal
+classic.label=Classic Portal
+basic.label=Basic Portal
############################################################################
Modified:
portal/trunk/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_fr.properties
===================================================================
---
portal/trunk/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_fr.properties 2011-10-25
03:18:40 UTC (rev 7854)
+++
portal/trunk/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_fr.properties 2011-10-25
06:59:20 UTC (rev 7855)
@@ -809,7 +809,8 @@
UIPortalBrowser.msg.Invalid-createPermission=Vous n'avez pas le droit de créer un
nouveau portail. Contactez un administrateur SVP.
UIPortalBrowser.deletePortal=Confirmez-vous la suppression de ce portail ?
SitePortal.label=Portail Site
-ClassicPortal.label=Portal Classique
+classic.label=Portal Classique
+basic.label=Portal Base
############################################################################
Modified:
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/portal/template/basic/portal.xml
===================================================================
---
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/portal/template/basic/portal.xml 2011-10-25
03:18:40 UTC (rev 7854)
+++
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/portal/template/basic/portal.xml 2011-10-25
06:59:20 UTC (rev 7855)
@@ -25,6 +25,8 @@
xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2
http://www.gatein.org/xml/ns/gatein_objects_1_2"
xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2">
<portal-name>@owner@</portal-name>
+ <label>Basic Portal</label>
+ <description>This is basic portal template</description>
<locale>en</locale>
<access-permissions>Everyone</access-permissions>
<edit-permission>*:/platform/administrators</edit-permission>
Modified:
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/portal/template/classic/portal.xml
===================================================================
---
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/portal/template/classic/portal.xml 2011-10-25
03:18:40 UTC (rev 7854)
+++
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/portal/portal/template/classic/portal.xml 2011-10-25
06:59:20 UTC (rev 7855)
@@ -25,6 +25,8 @@
xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_objects_1_2
http://www.gatein.org/xml/ns/gatein_objects_1_2"
xmlns="http://www.gatein.org/xml/ns/gatein_objects_1_2">
<portal-name>@owner@</portal-name>
+ <label>Classic Portal</label>
+ <description>This is classic portal template</description>
<locale>en</locale>
<access-permissions>Everyone</access-permissions>
<edit-permission>*:/platform/administrators</edit-permission>
Deleted:
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/uiconf/portal/webui/portal/PortalTemplateConfigOption.groovy
===================================================================
---
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/uiconf/portal/webui/portal/PortalTemplateConfigOption.groovy 2011-10-25
03:18:40 UTC (rev 7854)
+++
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/uiconf/portal/webui/portal/PortalTemplateConfigOption.groovy 2011-10-25
06:59:20 UTC (rev 7855)
@@ -1,40 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-import java.util.List;
-import java.util.ArrayList;
-import org.exoplatform.portal.webui.portal.PortalTemplateConfigOption ;
-import org.exoplatform.webui.core.model.SelectItemCategory;
-
-List options = new ArrayList();
-
- SelectItemCategory basic = new SelectItemCategory("BasicPortal");
- basic.addSelectItemOption(
- new PortalTemplateConfigOption("Basic Portal", "basic",
"Basic Portal", "BasicPortal").addGroup("/platform/guest")
- );
- options.add(basic);
-
- SelectItemCategory guest = new SelectItemCategory("ClassicPortal");
- guest.addSelectItemOption(
- //new PortalTemplateConfigOption("", "site", "Site
Portal", "SitePortal").addGroup("/guest")
- new PortalTemplateConfigOption("", "classic", "Classic
Portal", "ClassicPortal").addGroup("/platform/guests")
- );
- options.add(guest);
-
-return options ;
Deleted:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/PortalTemplateConfigOption.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/PortalTemplateConfigOption.java 2011-10-25
03:18:40 UTC (rev 7854)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/PortalTemplateConfigOption.java 2011-10-25
06:59:20 UTC (rev 7855)
@@ -1,54 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.exoplatform.portal.webui.portal;
-
-import org.exoplatform.webui.core.model.SelectItemOption;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Created by The eXo Platform SARL
- * Author : Pham Dung Ha
- * ha.pham(a)exoplatform.com
- * May 11, 2007
- */
-public class PortalTemplateConfigOption extends SelectItemOption<String>
-{
-
- private List<String> accessGroup_;
-
- public PortalTemplateConfigOption(String label, String value, String desc, String
icon) throws Exception
- {
- super(label, value, desc, icon);
- accessGroup_ = new ArrayList<String>();
- }
-
- public List<String> getGroups()
- {
- return accessGroup_;
- }
-
- public PortalTemplateConfigOption addGroup(String accessGroup)
- {
- accessGroup_.add(accessGroup);
- return this;
- }
-}
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java 2011-10-25
03:18:40 UTC (rev 7854)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java 2011-10-25
06:59:20 UTC (rev 7855)
@@ -17,7 +17,7 @@
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
-package org.exoplatform.portal.webui.portal;
+package org.exoplatform.portal.webui.portal;
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.ExoContainerContext;
@@ -35,19 +35,14 @@
import org.exoplatform.portal.webui.workspace.UIMaskWorkspace;
import org.exoplatform.portal.webui.workspace.UIPortalApplication;
import org.exoplatform.portal.webui.workspace.UIWorkingWorkspace;
-import org.exoplatform.services.organization.Group;
-import org.exoplatform.services.organization.OrganizationService;
import org.exoplatform.services.resources.LocaleConfig;
import org.exoplatform.services.resources.LocaleConfigService;
import org.exoplatform.services.resources.ResourceBundleService;
import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.webui.application.WebuiRequestContext;
-import org.exoplatform.webui.config.InitParams;
-import org.exoplatform.webui.config.Param;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.ComponentConfigs;
import org.exoplatform.webui.config.annotation.EventConfig;
-import org.exoplatform.webui.config.annotation.ParamConfig;
import org.exoplatform.webui.core.UIApplication;
import org.exoplatform.webui.core.lifecycle.UIFormLifecycle;
import org.exoplatform.webui.core.model.SelectItemCategory;
@@ -78,13 +73,14 @@
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
+import java.util.Set;
@ComponentConfigs({
@ComponentConfig(lifecycle = UIFormLifecycle.class, template =
"system:/groovy/webui/form/UIFormTabPane.gtmpl", events = {
@EventConfig(listeners = UIPortalForm.SaveActionListener.class),
@EventConfig(listeners = UIMaskWorkspace.CloseActionListener.class, phase =
Phase.DECODE),
@EventConfig(listeners = UIPortalForm.CheckShowActionListener.class)}),
- @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 = {
+ @ComponentConfig(id = "CreatePortal", lifecycle = UIFormLifecycle.class,
template = "system:/groovy/webui/form/UIFormTabPane.gtmpl", events = {
@EventConfig(name = "Save", listeners =
UIPortalForm.CreateActionListener.class),
@EventConfig(listeners = UIPortalForm.SelectItemOptionActionListener.class, phase =
Phase.DECODE),
@EventConfig(listeners = UIMaskWorkspace.CloseActionListener.class, phase =
Phase.DECODE)}),
@@ -110,14 +106,11 @@
private List<SelectItemOption<String>> languages = new
ArrayList<SelectItemOption<String>>();
- @SuppressWarnings("unchecked")
- public UIPortalForm(InitParams initParams) throws Exception
+ public void initPortalTemplateTab() throws Exception
{
- super("UIPortalForm");
UIFormInputItemSelector uiTemplateInput = new
UIFormInputItemSelector("PortalTemplate", null);
addUIFormInput(uiTemplateInput);
setSelectedTab(uiTemplateInput.getId());
- createDefaultItem();
UIFormInputSet uiPortalSetting = this.<UIFormInputSet>
getChildById("PortalSetting");
UIFormStringInput uiNameInput = uiPortalSetting.getUIStringInput(FIELD_NAME);
@@ -127,17 +120,19 @@
setActions(new String[]{"Save", "Close"});
- if (initParams == null)
+ UserPortalConfigService configService =
this.getApplicationComponent(UserPortalConfigService.class);
+ Set<String> portalTemplates = configService.getPortalTemplates();
+ for (String tempName : portalTemplates)
{
- return;
+ SelectItemCategory category = new SelectItemCategory(tempName);
+ PortalConfig config = configService.getPortalConfigFromTemplate(tempName);
+ if(config != null)
+ {
+ SelectItemOption<String> option = new
SelectItemOption<String>(config.getLabel(), tempName, config.getDescription(),
tempName);
+ category.addSelectItemOption(option);
+ uiTemplateInput.getItemCategories().add(category);
+ }
}
- WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
- Param param = initParams.getParam("PortalTemplateConfigOption");
- List<SelectItemCategory> portalTemplates =
(List<SelectItemCategory>)param.getFreshObject(context);
- for (SelectItemCategory itemCategory : portalTemplates)
- {
- uiTemplateInput.getItemCategories().add(itemCategory);
- }
if (uiTemplateInput.getSelectedItemOption() == null)
{
uiTemplateInput.getItemCategories().get(0).setSelected(true);
@@ -149,7 +144,6 @@
super("UIPortalForm");
createDefaultItem();
setSelectedTab("PortalSetting");
-
}
public void setBindingBean() throws Exception
@@ -413,15 +407,6 @@
UIPortalForm uiForm = event.getSource();
UIFormInputItemSelector templateInput =
uiForm.getChild(UIFormInputItemSelector.class);
uiForm.setSelectedTab(templateInput.getId());
- PortalTemplateConfigOption selectItem =
-
(PortalTemplateConfigOption)templateInput.getSelectedCategory().getSelectItemOptions().get(0);
- List<String> groupIds = selectItem.getGroups();
- Group[] groups = new Group[groupIds.size()];
- OrganizationService service =
uiForm.getApplicationComponent(OrganizationService.class);
- for (int i = 0; i < groupIds.size(); i++)
- {
- groups[i] = service.getGroupHandler().findGroupById(groupIds.get(i));
- }
event.getRequestContext().addUIComponentToUpdateByAjax(uiForm);
}
}
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java 2011-10-25
03:18:40 UTC (rev 7854)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java 2011-10-25
06:59:20 UTC (rev 7855)
@@ -248,6 +248,7 @@
}
UIMaskWorkspace uiMaskWS =
uiApp.getChildById(UIPortalApplication.UI_MASK_WS_ID);
UIPortalForm uiNewPortal = uiMaskWS.createUIComponent(UIPortalForm.class,
"CreatePortal", "UIPortalForm");
+ uiNewPortal.initPortalTemplateTab();
uiMaskWS.setUIComponent(uiNewPortal);
uiMaskWS.setShow(true);
prContext.addUIComponentToUpdateByAjax(uiMaskWS);