Author: theute
Date: 2011-03-16 17:04:51 -0400 (Wed, 16 Mar 2011)
New Revision: 6051
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/component/common/src/main/java/org/exoplatform/commons/utils/Safe.java
epp/portal/branches/EPP_5_1_RH_Branch/component/common/src/test/java/org/exoplatform/commons/utils/TestSafe.java
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/config/UserACL.java
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfig.java
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/ExecutorDispatcher.java
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/SearchTask.java
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/MappedAttributes.java
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/ModelDataStorage.java
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestLoadedPOM.java
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSavedPOM.java
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/test/resources/conf/exo.portal.component.portal-configuration1.xml
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/test/resources/conf/exo.portal.component.portal-configuration2.xml
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/test/resources/portal/portal/test/navigation.xml
epp/portal/branches/EPP_5_1_RH_Branch/examples/skins/simpleskin/src/main/webapp/WEB-INF/gatein-resources.xml
epp/portal/branches/EPP_5_1_RH_Branch/pom.xml
epp/portal/branches/EPP_5_1_RH_Branch/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardPortlet.java
epp/portal/branches/EPP_5_1_RH_Branch/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UITabPaneDashboard.java
epp/portal/branches/EPP_5_1_RH_Branch/portlet/dashboard/src/main/webapp/groovy/dashboard/webui/component/UITabPaneDashboard.gtmpl
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIGroupNavigationManagement.java
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UISiteManagement.java
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIAdminToolbarPortlet.java
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarDashboardPortlet.java
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarGroupPortlet.java
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarSitePortlet.java
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIAdminToolbarPortlet.gtmpl
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarDashboardPortlet.gtmpl
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarGroupPortlet.gtmpl
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarSitePortlet.gtmpl
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/webapp/groovy/navigation/webui/component/UINavigationGrid.gtmpl
epp/portal/branches/EPP_5_1_RH_Branch/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UIBreadcumbsPortlet.java
epp/portal/branches/EPP_5_1_RH_Branch/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UILogoPortlet.java
epp/portal/branches/EPP_5_1_RH_Branch/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UISitemapPortlet.java
epp/portal/branches/EPP_5_1_RH_Branch/portlet/web/src/main/webapp/groovy/portal/webui/component/UIPortalNavigation.gtmpl
epp/portal/branches/EPP_5_1_RH_Branch/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortal.js
epp/portal/branches/EPP_5_1_RH_Branch/web/eXoResources/src/main/webapp/javascript/eXo/webui/UITabbedDashboard.js
epp/portal/branches/EPP_5_1_RH_Branch/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIVirtualList.js
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ar.xml
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_de.properties
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_es.properties
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_fr.properties
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_it.properties
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ja.properties
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ko.xml
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ne.properties
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_nl.properties
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_pt_BR.properties
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ru.properties
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_uk.properties
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_vi.properties
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_zh.xml
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_zh_TW.xml
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/groovy/portal/webui/navigation/UIPageNodeSelector.gtmpl
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/groovy/portal/webui/page/UIPageSelector.gtmpl
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/groovy/portal/webui/page/UIWizardPageSetInfo.gtmpl
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/groovy/webui/core/UISitemap.gtmpl
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/groovy/webui/core/UISitemapTree.gtmpl
epp/portal/branches/EPP_5_1_RH_Branch/webui/core/src/main/java/org/exoplatform/webui/core/UITree.java
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalStateManager.java
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/localization/LocalizationLifecycle.java
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/state/PublicPropertiesPlugin.java
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/TreeNode.java
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIAddGroupNavigation.java
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationManagement.java
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationNodeSelector.java
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPageNavigationForm.java
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPageNodeSelector.java
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPortalNavigation.java
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/PageQueryAccessList.java
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIDesktopPage.java
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBody.java
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBrowser.java
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageNodeForm.java
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageSelector.java
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIWizardPageSetInfo.java
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UILanguageSelector.java
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortal.java
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/util/Util.java
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java
Log:
JBEPP-853: Performance issues with the shipped-in applications when the portal has many
nodes or pages
Applying patch
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/component/common/src/main/java/org/exoplatform/commons/utils/Safe.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/component/common/src/main/java/org/exoplatform/commons/utils/Safe.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/component/common/src/main/java/org/exoplatform/commons/utils/Safe.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -26,6 +26,8 @@
import java.io.InputStream;
import java.lang.reflect.Field;
import java.lang.reflect.UndeclaredThrowableException;
+import java.util.Collections;
+import java.util.Set;
/**
* A class that contains utility method that make the caller not worry much about the
unexpectable expected such as
@@ -113,6 +115,26 @@
}
}
+ /**
+ * Wrap the set so that it is unmodifiable when it is not null, otherwise returns
null.
+ *
+ * @todo it would be nice to avoid to rewrap unmodifiable set (not sure it is non
proprietary possible)
+ * @param set the set to wrap
+ * @param <E> the set generic element type
+ * @return the unmodifiable set
+ */
+ public static <E> Set<E> unmodifiableSet(Set<E> set)
+ {
+ if (set == null)
+ {
+ return null;
+ }
+ else
+ {
+ return Collections.unmodifiableSet(set);
+ }
+ }
+
// THIS CODE IS TEMPORARY
/** . */
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/component/common/src/test/java/org/exoplatform/commons/utils/TestSafe.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/component/common/src/test/java/org/exoplatform/commons/utils/TestSafe.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/component/common/src/test/java/org/exoplatform/commons/utils/TestSafe.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -25,6 +25,9 @@
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.IOException;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
@@ -139,4 +142,21 @@
}
}
+ public void testSetUnmodifiable()
+ {
+ assertNull(Safe.unmodifiableSet(null));
+ Set<String> strings = new HashSet<String>();
+ strings.add("a");
+ strings = Safe.unmodifiableSet(strings);
+ try
+ {
+ strings.add("b");
+ fail();
+ }
+ catch (Exception e)
+ {
+ }
+ assertEquals(Collections.singleton("a"), strings);
+ }
+
}
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/config/DataStorageImpl.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -225,23 +225,27 @@
private List<D> sort(List<D> list, final Comparator<O>
comparator) {
- List<D> tmpList = new ArrayList<D>();
- for (int i=0; i<list.size();i++) {
- tmpList.add(list.get(i));
+ if (comparator != null)
+ {
+ List<D> tmpList = new ArrayList<D>();
+ for (int i=0; i<list.size();i++) {
+ tmpList.add(list.get(i));
+ }
+ Collections.sort(tmpList, new Comparator<D>() {
+ public int compare(D d1, D d2)
+ {
+ O o1 = create(d1);
+ O o2 = create(d2);
+ return comparator.compare(o1, o2);
+ }
+
+ });
+ return tmpList;
}
- Collections.sort(tmpList, new Comparator<D>() {
- public int compare(D d1, D d2)
- {
- if (comparator == null) {
- return d1.getStorageId().compareTo(d2.getStorageId());
- }
- O o1 = create(d1);
- O o2 = create(d2);
- return comparator.compare(o1, o2);
- }
-
- });
- return tmpList;
+ else
+ {
+ return list;
+ }
}
}
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfigListener.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -32,6 +32,7 @@
import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.config.model.Page.PageSet;
+import org.exoplatform.portal.pom.config.POMSessionManager;
import org.gatein.common.logging.Logger;
import org.gatein.common.logging.LoggerFactory;
import org.jibx.runtime.*;
@@ -84,7 +85,10 @@
/** . */
private Logger log = LoggerFactory.getLogger(getClass());
- public NewPortalConfigListener(DataStorage dataStorage, ConfigurationManager cmanager,
InitParams params)
+ /** . */
+ private final POMSessionManager pomMgr;
+
+ public NewPortalConfigListener(POMSessionManager pomMgr, DataStorage dataStorage,
ConfigurationManager cmanager, InitParams params)
throws Exception
{
cmanager_ = cmanager;
@@ -125,6 +129,7 @@
isUseTryCatch = true;
}
+ this.pomMgr = pomMgr;
}
public void run() throws Exception
@@ -370,6 +375,7 @@
for (Page page : list)
{
dataStorage_.create(page);
+ pomMgr.getSession().save();
}
}
@@ -384,11 +390,13 @@
if (currentNavigation == null)
{
dataStorage_.create(navigation);
+// pomMgr.getSession().save();
}
else
{
navigation.merge(currentNavigation);
dataStorage_.save(navigation);
+ pomMgr.getSession().save();
}
}
@@ -403,6 +411,7 @@
for (PortletPreferences portlet : list)
{
dataStorage_.save(portlet);
+ pomMgr.getSession().save();
}
}
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/config/UserACL.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/config/UserACL.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/config/UserACL.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -25,6 +25,7 @@
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.SiteKey;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.exoplatform.services.security.ConversationState;
@@ -292,6 +293,48 @@
return false;
}
+ // copied from @link{#hasEditPermission}
+ public boolean hasEditPermissionOnNavigation(SiteKey siteKey)
+ {
+ Identity identity = getIdentity();
+ if (superUser_.equals(identity.getUserId()))
+ {
+ return true;
+ }
+
+ //
+ switch (siteKey.getType())
+ {
+ case PORTAL:
+ //TODO: We should also take care of Portal's navigation
+ return false;
+ case GROUP:
+ String temp = siteKey.getName().trim();
+ String expAdminGroup = getAdminGroups();
+ String expPerm = null;
+
+ // Check to see whether current user is member of admin group or not,
+ // if so grant
+ // edit permission for group navigation for that user.
+ if (expAdminGroup != null)
+ {
+ expAdminGroup = expAdminGroup.startsWith("/") ? expAdminGroup :
"/" + expAdminGroup;
+ expPerm = temp.startsWith("/") ? temp : "/" + temp;
+ if (isUserInGroup(expPerm) && isUserInGroup(expAdminGroup))
+ {
+ return true;
+ }
+ }
+
+ expPerm = navigationCreatorMembershipType_ + (temp.startsWith("/")
? ":" + temp : ":/" + temp);
+ return hasPermission(identity, expPerm);
+ case USER:
+ return siteKey.getName().equals(identity.getUserId());
+ default:
+ return false;
+ }
+ }
+
public boolean hasEditPermission(PageNavigation pageNav)
{
Identity identity = getIdentity();
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfig.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfig.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfig.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -21,31 +21,75 @@
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.user.UserPortalContext;
+import org.exoplatform.portal.mop.user.UserPortal;
+import org.exoplatform.portal.mop.user.UserPortalImpl;
+import org.exoplatform.services.organization.Group;
+import java.lang.reflect.UndeclaredThrowableException;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.List;
public class UserPortalConfig
{
- private PortalConfig portal;
+ PortalConfig portal;
private List<PageNavigation> navigations;
-
+
+ final UserPortalConfigService service;
+
+ final String portalName;
+
+ final String accessUser;
+
/** Added by Minh Hoang TO */
private PageNavigation selectedNavigation;
+ /** . */
+ private UserPortalImpl userPortal;
+
+ /** . */
+ private UserPortalContext bundleResolver;
+
public UserPortalConfig()
{
-
+ this.portal = null;
+ this.navigations = new ArrayList<PageNavigation>();
+ this.service = null;
+ this.portalName = null;
+ this.accessUser = null;
+ this.bundleResolver = null;
}
- public UserPortalConfig(PortalConfig portal, List<PageNavigation> navigations)
+ public UserPortalConfig(PortalConfig portal, UserPortalConfigService service, String
portalName, String accessUser, UserPortalContext bundleResolver)
{
this.portal = portal;
- this.navigations = navigations;
+ this.navigations = null;
+ this.service = service;
+ this.portalName = portalName;
+ this.accessUser = accessUser;
+ this.bundleResolver = bundleResolver;
}
+ public UserPortal getUserPortal()
+ {
+ userPortal = new UserPortalImpl(
+ service,
+ service.navService,
+ service.orgService_,
+ service.userACL_,
+ portalName,
+ portal,
+ accessUser,
+ bundleResolver
+ );
+ return userPortal;
+ }
+
public PortalConfig getPortalConfig()
{
return portal;
@@ -55,56 +99,103 @@
{
this.portal = portal;
}
-
- public void setSelectedNavigation(PageNavigation _selectedNavigation)
+
+ public void setNavigations(List<PageNavigation> navs)
{
- this.selectedNavigation = _selectedNavigation;
+ navigations = navs;
}
- /** Fetch navigation (specified by ownerType, ownerId) from the list of all
navigations and set it as selected navigation **/
- public void updateSelectedNavigation(String ownerType, String ownerId)
+ public List<PageNavigation> getNavigations()
{
- PageNavigation targetNavigation = null;
- for (PageNavigation nav : navigations)
+
+ if (navigations == null)
{
- if (nav.getOwnerType().equals(ownerType) &&
nav.getOwnerId().equals(ownerId))
+ try
{
- targetNavigation = nav;
- break;
+ List<PageNavigation> navigations = new
ArrayList<PageNavigation>();
+ PageNavigation navigation =
service.storage_.getPageNavigation(PortalConfig.PORTAL_TYPE, portalName);
+ if (navigation != null)
+ {
+
navigation.setModifiable(service.userACL_.hasPermission(portal.getEditPermission()));
+ navigations.add(navigation);
+ }
+
+ if (accessUser == null)
+ {
+ // navigation = getPageNavigation(PortalConfig.GROUP_TYPE,
+ // userACL_.getGuestsGroup());
+ // if (navigation != null)
+ // navigations.add(navigation);
+ }
+ else
+ {
+ navigation = service.storage_.getPageNavigation(PortalConfig.USER_TYPE,
accessUser);
+ if (navigation != null)
+ {
+ navigation.setModifiable(true);
+ navigations.add(navigation);
+ }
+
+ Collection<?> groups = null;
+ if (service.userACL_.getSuperUser().equals(accessUser))
+ {
+ groups = service.orgService_.getGroupHandler().getAllGroups();
+ }
+ else
+ {
+ groups =
service.orgService_.getGroupHandler().findGroupsOfUser(accessUser);
+ }
+ for (Object group : groups)
+ {
+ Group m = (Group)group;
+ String groupId = m.getId().trim();
+ if (groupId.equals(service.userACL_.getGuestsGroup()))
+ {
+ continue;
+ }
+ navigation =
service.storage_.getPageNavigation(PortalConfig.GROUP_TYPE, groupId);
+ if (navigation == null)
+ {
+ continue;
+ }
+
navigation.setModifiable(service.userACL_.hasEditPermission(navigation));
+ navigations.add(navigation);
+ }
+ }
+ Collections.sort(navigations, new Comparator<PageNavigation>()
+ {
+ public int compare(PageNavigation nav1, PageNavigation nav2)
+ {
+ return nav1.getPriority() - nav2.getPriority();
+ }
+ });
+
+ //
+ this.navigations = navigations;
}
+ catch (Exception e)
+ {
+ throw new UndeclaredThrowableException(e);
+ }
}
- if (targetNavigation != null)
- {
- this.setSelectedNavigation(targetNavigation);
- }
- }
-
- public PageNavigation getSelectedNavigation()
- {
- if(this.selectedNavigation != null)
- {
- return this.selectedNavigation;
- }
- return navigations.get(0);
- }
-
- public void setNavigations(List<PageNavigation> navs)
- {
- navigations = navs;
- }
-
- public List<PageNavigation> getNavigations()
- {
return navigations;
}
public void addNavigation(PageNavigation nav)
{
- if (navigations == null)
- navigations = new ArrayList<PageNavigation>();
- if (nav == null)
- return;
+ if (service == null)
+ {
+ if (navigations == null)
+ navigations = new ArrayList<PageNavigation>();
+ if (nav == null)
+ return;
+ }
+ else
+ {
+ // Ensure navs are loaded
+ getNavigations();
+ }
navigations.add(nav);
}
}
\ No newline at end of file
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/config/UserPortalConfigService.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -31,6 +31,8 @@
import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.config.model.TransientApplicationState;
+import org.exoplatform.portal.mop.navigation.NavigationService;
+import org.exoplatform.portal.mop.user.UserPortalContext;
import org.exoplatform.portal.pom.data.ModelChange;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -46,23 +48,28 @@
*/
public class UserPortalConfigService implements Startable
{
- private DataStorage storage_;
+ DataStorage storage_;
- private UserACL userACL_;
+ UserACL userACL_;
- private OrganizationService orgService_;
+ OrganizationService orgService_;
private NewPortalConfigListener newPortalConfigListener_;
+
+ /** . */
+ final NavigationService navService;
private Log log = ExoLogger.getLogger("Portal:UserPortalConfigService");
public UserPortalConfigService(
UserACL userACL, DataStorage storage,
- OrganizationService orgService) throws Exception
+ OrganizationService orgService,
+ NavigationService navService) throws Exception
{
this.storage_ = storage;
this.orgService_ = orgService;
this.userACL_ = userACL;
+ this.navService = navService;
}
/**
@@ -92,71 +99,19 @@
*/
public UserPortalConfig getUserPortalConfig(String portalName, String accessUser)
throws Exception
{
+ return getUserPortalConfig(portalName, accessUser, null);
+ }
+
+ public UserPortalConfig getUserPortalConfig(String portalName, String accessUser,
UserPortalContext bundleResolver) throws Exception
+ {
PortalConfig portal = storage_.getPortalConfig(portalName);
if (portal == null || !userACL_.hasPermission(portal))
{
return null;
}
- List<PageNavigation> navigations = new ArrayList<PageNavigation>();
- PageNavigation navigation = storage_.getPageNavigation(PortalConfig.PORTAL_TYPE,
portalName);
- if (navigation != null)
- {
- navigation.setModifiable(userACL_.hasPermission(portal.getEditPermission()));
- navigations.add(navigation);
- }
- if (accessUser == null)
- {
- // navigation = getPageNavigation(PortalConfig.GROUP_TYPE,
- // userACL_.getGuestsGroup());
- // if (navigation != null)
- // navigations.add(navigation);
- }
- else
- {
- navigation = storage_.getPageNavigation(PortalConfig.USER_TYPE, accessUser);
- if (navigation != null)
- {
- navigation.setModifiable(true);
- navigations.add(navigation);
- }
-
- Collection<?> groups = null;
- if (userACL_.getSuperUser().equals(accessUser))
- {
- groups = orgService_.getGroupHandler().getAllGroups();
- }
- else
- {
- groups = orgService_.getGroupHandler().findGroupsOfUser(accessUser);
- }
- for (Object group : groups)
- {
- Group m = (Group)group;
- String groupId = m.getId().trim();
- if (groupId.equals(userACL_.getGuestsGroup()))
- {
- continue;
- }
- navigation = storage_.getPageNavigation(PortalConfig.GROUP_TYPE, groupId);
- if (navigation == null)
- {
- continue;
- }
- navigation.setModifiable(userACL_.hasEditPermission(navigation));
- navigations.add(navigation);
- }
- }
- Collections.sort(navigations, new Comparator<PageNavigation>()
- {
- public int compare(PageNavigation nav1, PageNavigation nav2)
- {
- return nav1.getPriority() - nav2.getPriority();
- }
- });
-
- return new UserPortalConfig(portal, navigations);
+ return new UserPortalConfig(portal, this, portalName, accessUser, bundleResolver);
}
/**
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/PageNode.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -186,6 +186,7 @@
children = list;
}
+ // Remove this which seems to be not used
public boolean isModifiable()
{
return modifiable;
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -19,6 +19,7 @@
package org.exoplatform.portal.config.model;
+import org.exoplatform.portal.mop.SiteType;
import org.exoplatform.portal.pom.config.Utils;
import org.exoplatform.portal.pom.data.PortalData;
@@ -35,11 +36,11 @@
public class PortalConfig extends ModelObject
{
- final public static String USER_TYPE = "user";
+ final public static String USER_TYPE = SiteType.USER.getName();
- final public static String GROUP_TYPE = "group";
+ final public static String GROUP_TYPE = SiteType.GROUP.getName();
- final public static String PORTAL_TYPE = "portal";
+ final public static String PORTAL_TYPE = SiteType.PORTAL.getName();
final public static Container DEFAULT_LAYOUT = initDefaultLayout();
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/ExecutorDispatcher.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/ExecutorDispatcher.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/ExecutorDispatcher.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -36,20 +36,28 @@
public <V> V execute(POMSession session, POMTask<V> task) throws
Exception
{
- String s = task.toString();
- long t0 = System.currentTimeMillis();
- V v = session.execute(task);
- long t1 = System.currentTimeMillis();
- String t = "" + (t1 - t0);
- if (t.length() < 4)
+ if (log.isDebugEnabled())
{
- t = padding[t.length()] + t;
- log.debug("Executed [" + t + "] " + s + "");
+ String s = task.toString();
+ log.debug("Executing " + s + "");
+ long t0 = System.currentTimeMillis();
+ V v = session.execute(task);
+ long t1 = System.currentTimeMillis();
+ String t = "" + (t1 - t0);
+ if (t.length() < 4)
+ {
+ t = padding[t.length()] + t;
+ log.debug("Executed [" + t + "] " + s + "");
+ }
+ else
+ {
+ log.debug("Executed in " + t + " " + s + "");
+ }
+ return v;
}
else
{
- log.debug("Executed in " + t + " " + s + "");
+ return session.execute(task);
}
- return v;
}
}
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMDataStorage.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -39,6 +39,8 @@
import org.exoplatform.portal.config.model.PersistentApplicationState;
import org.exoplatform.portal.config.model.TransientApplicationState;
import org.exoplatform.portal.pom.config.tasks.DashboardTask;
+import org.exoplatform.portal.pom.config.tasks.MOPAccess;
+import org.exoplatform.portal.pom.config.tasks.NodeTask;
import org.exoplatform.portal.pom.config.tasks.PageNavigationTask;
import org.exoplatform.portal.pom.config.tasks.PageTask;
import org.exoplatform.portal.pom.config.tasks.PortalConfigTask;
@@ -51,6 +53,7 @@
import org.exoplatform.portal.pom.data.ModelDataStorage;
import org.exoplatform.portal.pom.data.NavigationData;
import org.exoplatform.portal.pom.data.NavigationKey;
+import org.exoplatform.portal.pom.data.NodeData;
import org.exoplatform.portal.pom.data.PageData;
import org.exoplatform.portal.pom.data.PageKey;
import org.exoplatform.portal.pom.data.PortalData;
@@ -145,6 +148,17 @@
pomMgr.execute(new PageNavigationTask.Remove(navigation));
}
+
+ public NodeData loadNode(NavigationKey key) throws Exception
+ {
+ return pomMgr.execute(new
NodeTask.Load<NavigationKey>(NodeTask.KeyType.NAVIGATION, key));
+ }
+
+ public NodeData loadNode(String key) throws Exception
+ {
+ return pomMgr.execute(new NodeTask.Load<String>(NodeTask.KeyType.STRING,
key));
+ }
+
public void save(PortletPreferences portletPreferences) throws Exception
{
pomMgr.execute(new PortletPreferencesTask.Save(portletPreferences));
@@ -237,11 +251,11 @@
Class<T> type = q.getClassType();
if (PageData.class.equals(type))
{
- return (LazyPageList<T>)pomMgr.execute(new
SearchTask.FindPage((Query<PageData>)q));
+ return (LazyPageList<T>)new LazyPageList<PageData>(new
MOPAccess.PageAccess(pomMgr, (Query<PageData>)q), 10);
}
else if (NavigationData.class.equals(type))
{
- return (LazyPageList<T>)pomMgr.execute(new
SearchTask.FindNavigation((Query<NavigationData>)q));
+ return (LazyPageList<T>)new LazyPageList<NavigationData>(new
MOPAccess.NavigationAccess(pomMgr, (Query<NavigationData>)q), 10);
}
else if (PortletPreferences.class.equals(type))
{
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSession.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -21,6 +21,7 @@
import org.chromattic.api.ChromatticSession;
import org.chromattic.api.UndeclaredRepositoryException;
+import org.chromattic.api.query.QueryResult;
import org.exoplatform.commons.chromattic.SessionContext;
import org.exoplatform.commons.chromattic.SynchronizationListener;
import org.exoplatform.commons.chromattic.SynchronizationStatus;
@@ -239,8 +240,13 @@
return prefs;
}
- public <O extends WorkspaceObject> Iterator<O>
findObjects(ObjectType<O> type, ObjectType<? extends Site> siteType,
- String ownerId, String title)
+ public <O extends WorkspaceObject> QueryResult<O> findObjects(
+ ObjectType<O> type,
+ ObjectType<Site> siteType,
+ String ownerId,
+ String title,
+ int offset,
+ int limit)
{
this.save();
//
@@ -351,7 +357,7 @@
throw new Error(e);
}
Class<O> mappedClass = (Class<O>)mapping.get(type);
- return session.createQueryBuilder(mappedClass).where(statement).get().objects();
+ return
session.createQueryBuilder(mappedClass).where(statement).get().objects((long)offset,
(long)limit);
}
private final SynchronizationListener listener = new SynchronizationListener()
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/POMSessionManager.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -73,6 +73,11 @@
this.executor = new PortalNamesCache(new DataCache(new ExecutorDispatcher()));
}
+ public ChromatticLifeCycle getLifeCycle()
+ {
+ return configurator;
+ }
+
public void cachePut(Serializable key, Object value)
{
GlobalKey globalKey = GlobalKey.wrap(configurator.getRepositoryName(), key);
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/SearchTask.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/SearchTask.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/config/tasks/SearchTask.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -25,20 +25,14 @@
import org.exoplatform.portal.config.Query;
import org.exoplatform.portal.pom.config.POMTask;
import org.exoplatform.portal.pom.data.Mapper;
-import org.exoplatform.portal.pom.data.NavigationData;
-import org.exoplatform.portal.pom.data.PageData;
import org.exoplatform.portal.pom.data.PortalData;
import org.exoplatform.portal.pom.data.PortalKey;
import org.exoplatform.portal.pom.config.POMSession;
-import org.gatein.mop.api.workspace.Navigation;
import org.gatein.mop.api.workspace.ObjectType;
import org.gatein.mop.api.workspace.Site;
import org.gatein.mop.api.workspace.Workspace;
-import org.gatein.mop.api.workspace.WorkspaceObject;
-import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.Iterator;
/**
@@ -56,124 +50,6 @@
this.q = query;
}
- public abstract static class FindSiteObject<W extends WorkspaceObject, T>
extends SearchTask<T>
- {
-
- public FindSiteObject(Query<T> query)
- {
- super(query);
- }
-
- public LazyPageList<T> run(final POMSession session) throws Exception
- {
- Iterator<W> ite;
- try
- {
- String ownerType = q.getOwnerType();
- ObjectType<? extends Site> siteType = null;
- if (ownerType != null)
- {
- siteType = Mapper.parseSiteType(ownerType);
- }
- ite = findW(session, siteType, q.getOwnerId(), q.getTitle());
-
- }
- catch (IllegalArgumentException e)
- {
- ite = Collections.<W> emptyList().iterator();
- }
-
- //
- final ArrayList<W> array = new ArrayList<W>();
- while (ite.hasNext())
- {
- array.add(ite.next());
- }
-
- //
- final Iterator<W> it = array.iterator();
- ListAccess<T> la = new ListAccess<T>()
- {
- public T[] load(int index, int length) throws Exception,
IllegalArgumentException
- {
- T[] result = createT(length);
- for (int i = 0; i < length; i++)
- {
- T t = loadT(session, it.next());
- result[i] = t;
- }
- return result;
- }
-
- public int getSize() throws Exception
- {
- return array.size();
- }
- };
-
- //
- return new LazyPageList<T>(la, 10);
- }
-
- protected abstract Iterator<W> findW(POMSession session, ObjectType<?
extends Site> siteType, String ownerId,
- String title);
-
- protected abstract T[] createT(int length);
-
- protected abstract T loadT(POMSession session, W w);
-
- }
-
- public static class FindPage extends
FindSiteObject<org.gatein.mop.api.workspace.Page, PageData>
- {
-
- public FindPage(Query<PageData> pageQuery)
- {
- super(pageQuery);
- }
-
- protected Iterator<org.gatein.mop.api.workspace.Page> findW(POMSession
session,
- ObjectType<? extends Site> siteType, String ownerId, String title)
- {
- return session.findObjects(ObjectType.PAGE, siteType, q.getOwnerId(),
q.getTitle());
- }
-
- protected PageData[] createT(int length)
- {
- return new PageData[length];
- }
-
- protected PageData loadT(POMSession session, org.gatein.mop.api.workspace.Page w)
- {
- return new Mapper(session).load(w);
- }
- }
-
- public static class FindNavigation extends FindSiteObject<Navigation,
NavigationData>
- {
-
- public FindNavigation(Query<NavigationData> pageQuery)
- {
- super(pageQuery);
- }
-
- protected Iterator<Navigation> findW(POMSession session, ObjectType<?
extends Site> siteType, String ownerId,
- String title)
- {
- return session.findObjects(ObjectType.NAVIGATION, siteType, q.getOwnerId(),
q.getTitle());
- }
-
- protected NavigationData[] createT(int length)
- {
- return new NavigationData[length];
- }
-
- protected NavigationData loadT(POMSession session, Navigation w)
- {
- return new Mapper(session).load(w);
- }
- }
-
public static class FindPortletPreferences extends
SearchTask<PortletPreferences>
{
@@ -273,4 +149,10 @@
return new LazyPageList<PortalKey>(la, 10);
}
}
+
+ @Override
+ public String toString()
+ {
+ return getClass().getSimpleName() + "[query=" + q + "]";
+ }
}
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/MappedAttributes.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/MappedAttributes.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/MappedAttributes.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -30,7 +30,7 @@
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
* @version $Revision$
*/
-class MappedAttributes
+public class MappedAttributes
{
private MappedAttributes()
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -32,6 +32,8 @@
import org.exoplatform.portal.pom.config.POMSession;
import org.exoplatform.portal.pom.config.Utils;
import org.exoplatform.portal.pom.spi.portlet.Portlet;
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
import org.gatein.mop.api.Attributes;
import org.gatein.mop.api.content.ContentType;
import org.gatein.mop.api.content.Customization;
@@ -96,13 +98,17 @@
public NavigationData load(Navigation src)
{
- return load(src, NavigationData.class);
+ long t = System.currentTimeMillis();
+ NavigationData data = load(src, NavigationData.class);
+ t = System.currentTimeMillis() - t;
+ Logger log = LoggerFactory.getLogger(Mapper.class);
+ log.warn("Accessed legacy navigation service (loading took " + t / 1000 +
" seconds)");
+ log.debug("Accessed legacy navigation service (loading took " + t / 1000
+ " seconds)", new Exception());
+ return data;
}
private <T extends NavigationNodeContainerData> T load(Navigation src,
Class<T> type)
{
-
- //
ArrayList<NavigationNodeData> children = new
ArrayList<NavigationNodeData>(src.getChildren().size());
for (Navigation srcChild : src.getChildren())
{
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/ModelDataStorage.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/ModelDataStorage.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/main/java/org/exoplatform/portal/pom/data/ModelDataStorage.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -88,6 +88,14 @@
public void remove(NavigationData navigation) throws Exception;
+
+
+ public NodeData loadNode(NavigationKey key) throws Exception;
+
+ public NodeData loadNode(String key) throws Exception;
+
+
+
public void save(PortletPreferences portletPreferences) throws Exception;
public <S> String getId(ApplicationState<S> state) throws Exception;
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestLoadedPOM.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestLoadedPOM.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestLoadedPOM.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -130,7 +130,7 @@
assertEquals(1, nav.getPriority());
//
- assertEquals(2, nav.getNodes().size());
+ assertEquals(5, nav.getNodes().size());
//
PageNode nodeNavigation = nav.getNodes().get(0);
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSavedPOM.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSavedPOM.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/test/java/org/exoplatform/portal/config/TestSavedPOM.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -97,7 +97,7 @@
//
Collection<? extends Navigation> childrenNavigations =
defaultNav.getChildren();
assertNotNull(childrenNavigations);
- assertEquals(2, childrenNavigations.size());
+ assertEquals(5, childrenNavigations.size());
Iterator<? extends Navigation> i = childrenNavigations.iterator();
//
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/test/resources/conf/exo.portal.component.portal-configuration1.xml
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/test/resources/conf/exo.portal.component.portal-configuration1.xml 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/test/resources/conf/exo.portal.component.portal-configuration1.xml 2011-03-16
21:04:51 UTC (rev 6051)
@@ -101,6 +101,11 @@
</component>
<component>
+ <key>org.exoplatform.portal.mop.navigation.NavigationService</key>
+
<type>org.exoplatform.portal.mop.navigation.NavigationServiceWrapper</type>
+ </component>
+
+ <component>
<key>org.exoplatform.portal.config.UserPortalConfigService</key>
<type>org.exoplatform.portal.config.UserPortalConfigService</type>
</component>
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/test/resources/conf/exo.portal.component.portal-configuration2.xml
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/test/resources/conf/exo.portal.component.portal-configuration2.xml 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/test/resources/conf/exo.portal.component.portal-configuration2.xml 2011-03-16
21:04:51 UTC (rev 6051)
@@ -95,6 +95,9 @@
<value>
<string>system</string>
</value>
+ <value>
+ <string>large</string>
+ </value>
</collection>
</field>
<field name="ownerType">
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/test/resources/portal/portal/test/navigation.xml
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/test/resources/portal/portal/test/navigation.xml 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/component/portal/src/test/resources/portal/portal/test/navigation.xml 2011-03-16
21:04:51 UTC (rev 6051)
@@ -1,46 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
+<!-- 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.
-
--->
-
<node-navigation>
- <owner-type>portal</owner-type>
- <owner-id>test</owner-id>
- <priority>1</priority>
+ <owner-type>portal</owner-type>
+ <owner-id>test</owner-id>
+ <priority>1</priority>
- <page-nodes>
- <node>
- <uri>node_uri</uri>
- <name>node_name</name>
- <label>node_label</label>
- <icon>node_icon</icon>
- <start-publication-date>2000-03-21T01:33:00</start-publication-date>
- <end-publication-date>2009-03-21T01:33:00</end-publication-date>
- <visibility>TEMPORAL</visibility>
- <page-reference>portal::test::test</page-reference>
- </node>
- <node>
- <uri>node_uri2</uri>
- <name>node_name2</name>
- <label>node_label2</label>
- <page-reference>portal::test::test</page-reference>
- </node>
- </page-nodes>
+ <page-nodes>
+ <node>
+ <uri>node_uri</uri>
+ <name>node_name</name>
+ <label>node_label</label>
+ <icon>node_icon</icon>
+
<start-publication-date>2000-03-21T01:33:00</start-publication-date>
+ <end-publication-date>2009-03-21T01:33:00</end-publication-date>
+ <visibility>TEMPORAL</visibility>
+ <page-reference>portal::test::test1</page-reference>
+ </node>
+ <node>
+ <uri>node_uri</uri>
+ <name>node_name1</name>
+ <label>node_label</label>
+ <icon>node_icon</icon>
+
<start-publication-date>2000-03-21T01:33:00</start-publication-date>
+ <end-publication-date>2050-03-21T01:33:00</end-publication-date>
+ <visibility>TEMPORAL</visibility>
+ <page-reference>portal::test::test1</page-reference>
+ </node>
+ <node>
+ <uri>node_uri</uri>
+ <name>node_name2</name>
+ <label>node_label</label>
+ <icon>node_icon</icon>
+
<start-publication-date>2050-03-21T01:33:00</start-publication-date>
+ <visibility>TEMPORAL</visibility>
+ <page-reference>portal::test::test1</page-reference>
+ </node>
+ <node>
+ <uri>node_uri</uri>
+ <name>node_name3</name>
+ <label>node_label</label>
+ <icon>node_icon</icon>
+ <end-publication-date>2050-03-21T01:33:00</end-publication-date>
+ <visibility>TEMPORAL</visibility>
+ <page-reference>portal::test::test1</page-reference>
+ </node>
+ <node>
+ <uri>node_uri</uri>
+ <name>node_name4</name>
+ <label>node_label4</label>
+ <page-reference>portal::test::test1</page-reference>
+ </node>
+ </page-nodes>
</node-navigation>
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/examples/skins/simpleskin/src/main/webapp/WEB-INF/gatein-resources.xml
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/examples/skins/simpleskin/src/main/webapp/WEB-INF/gatein-resources.xml 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/examples/skins/simpleskin/src/main/webapp/WEB-INF/gatein-resources.xml 2011-03-16
21:04:51 UTC (rev 6051)
@@ -54,13 +54,6 @@
<portlet-skin>
<application-name>web</application-name>
- <portlet-name>PortalNavigationPortlet</portlet-name>
- <skin-name>SimpleSkin</skin-name>
- <css-path>/skin/webPortlet/webui/component/UIPortalNavigationPortlet/Stylesheet.css</css-path>
- </portlet-skin>
-
- <portlet-skin>
- <application-name>web</application-name>
<portlet-name>SiteMapPortlet</portlet-name>
<skin-name>SimpleSkin</skin-name>
<css-path>/skin/webPortlet/webui/component/UISiteMap/Stylesheet.css</css-path>
Modified: epp/portal/branches/EPP_5_1_RH_Branch/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_1_RH_Branch/pom.xml 2011-03-16 21:01:52 UTC (rev 6050)
+++ epp/portal/branches/EPP_5_1_RH_Branch/pom.xml 2011-03-16 21:04:51 UTC (rev 6051)
@@ -54,7 +54,7 @@
<rhino.version>1.6R5</rhino.version>
<org.codehaus.groovy.version>1.6.5</org.codehaus.groovy.version>
<javax.servlet.version>2.5</javax.servlet.version>
- <version.chromattic>1.0.3</version.chromattic>
+ <version.chromattic>1.0.8</version.chromattic>
<version.reflect>1.0.0</version.reflect>
<jcip.version>1.0</jcip.version>
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardPortlet.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardPortlet.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardPortlet.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -23,10 +23,8 @@
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.UserACL;
import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNode;
+import org.exoplatform.portal.mop.user.UserNode;
import org.exoplatform.portal.webui.container.UIContainer;
-import org.exoplatform.portal.webui.page.UIPage;
-import org.exoplatform.portal.webui.page.UIPageBody;
import org.exoplatform.portal.webui.portal.UIPortal;
import org.exoplatform.portal.webui.workspace.UIPortalApplication;
import org.exoplatform.webui.application.WebuiRequestContext;
@@ -75,10 +73,10 @@
//
try
{
- PageNode node = portal.getSelectedNode();
+ UserNode node = portal.getSelectedUserNode();
if (node != null)
{
- String pageRef = node.getPageReference();
+ String pageRef = node.getPageRef();
DataStorage storage = portal.getApplicationComponent(DataStorage.class);
Page page = storage.getPage(pageRef);
if (page != null)
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UITabPaneDashboard.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UITabPaneDashboard.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UITabPaneDashboard.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -23,11 +23,19 @@
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.Visibility;
+import org.exoplatform.portal.mop.navigation.NodeFilter;
+import org.exoplatform.portal.mop.navigation.Scope;
+import org.exoplatform.portal.mop.user.NavigationPath;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserNode;
+import org.exoplatform.portal.mop.user.UserNodePredicate;
+import org.exoplatform.portal.mop.user.UserPortal;
import org.exoplatform.portal.webui.page.UIPageBody;
import org.exoplatform.portal.webui.portal.UIPortal;
import org.exoplatform.portal.webui.util.Util;
+import org.exoplatform.portal.webui.workspace.UIPortalApplication;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.exoplatform.web.application.ApplicationMessage;
@@ -39,9 +47,11 @@
import org.exoplatform.webui.core.UIContainer;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
-
+import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
import java.util.List;
/**
@@ -73,47 +83,29 @@
private DataStorage dataService;
- private PageNavigation pageNavigation;
-
private UIPortal uiPortal;
final private static int MAX_SHOWED_TAB_NUMBER = 6;
final public static String PAGE_TEMPLATE = "dashboard";
+ final private NodeFilter TAB_PANE_DASHBOARD_FILTER;
+ static final private Scope TAB_PANE_DASHBOARD_SCOPE = Scope.CHILDREN;
+
public UITabPaneDashboard() throws Exception
{
configService = getApplicationComponent(UserPortalConfigService.class);
dataService = getApplicationComponent(DataStorage.class);
uiPortal = Util.getUIPortal();
- initPageNavigation();
- }
- private void initPageNavigation() throws Exception
- {
- //String remoteUser = Util.getPortalRequestContext().getRemoteUser();
- //pageNavigation = getPageNavigation(PortalConfig.USER_TYPE + "::" +
remoteUser);
- //TODO: Check this part carefully
- this.pageNavigation = uiPortal.getSelectedNavigation();
+ UserNodePredicate.Builder scopeBuilder = UserNodePredicate.builder();
+ scopeBuilder.withAuthorizationCheck().withVisibility(Visibility.DISPLAYED,
Visibility.TEMPORAL);
+ scopeBuilder.withTemporalCheck();
+ TAB_PANE_DASHBOARD_FILTER = getUserPortal().createFilter(scopeBuilder.build());
}
- /*
- private PageNavigation getPageNavigation(String owner) throws Exception
- {
- List<PageNavigation> allNavigations = uiPortal.getNavigations();
- for (PageNavigation nav : allNavigations)
- {
- if (nav.getOwner().equals(owner))
- return nav;
- }
- return null;
- }
-
- */
-
public int getCurrentNumberOfTabs() throws Exception
{
-
return getSameSiblingsNode().size();
}
@@ -134,84 +126,88 @@
}
}
- public List<PageNode> getSameSiblingsNode() throws Exception
+ public UserNode getParentTab() throws Exception
{
- List<PageNode> siblings = getPageNavigation().getNodes();
- List<PageNode> selectedPath = Util.getUIPortal().getSelectedPath();
- if (selectedPath != null && selectedPath.size() > 1)
+ NavigationPath navPath = uiPortal.getNavPath();
+ UserNode selectedNode = navPath.getTarget();
+
+ UserPortal userPortal = getUserPortal();
+ UserNode parent = userPortal.getNode(selectedNode.getParent(),
TAB_PANE_DASHBOARD_SCOPE);
+ if (parent == null)
{
- PageNode currentParent = selectedPath.get(selectedPath.size() - 2);
- siblings = currentParent.getChildren();
+ uiPortal.setNavPath(null);
+ return null;
}
- return siblings;
+ parent.filter(TAB_PANE_DASHBOARD_FILTER);
+
+ return parent;
}
- public PageNavigation getPageNavigation() throws Exception
- {
- if (pageNavigation == null)
+ public Collection<UserNode> getSameSiblingsNode() throws Exception
+ {
+ UserNode parentTab = getParentTab();
+
+ if (parentTab == null)
{
- initPageNavigation();
+ return Collections.emptyList();
}
- return pageNavigation;
+ return parentTab.getChildren();
+ }
+
+ public UserNavigation getCurrentUserNavigation() throws Exception
+ {
+ UserPortal userPortal = getUserPortal();
+ WebuiRequestContext rcontext = WebuiRequestContext.getCurrentInstance();
+ return userPortal.getNavigation(SiteKey.user(rcontext.getRemoteUser()));
}
+ private UserPortal getUserPortal()
+ {
+ UIPortalApplication uiApp = Util.getUIPortalApplication();
+ return uiApp.getUserPortalConfig().getUserPortal();
+ }
+
/**
- * Remove node specified by nodeIndex and returns the node to switch to
- * @param nodeIndex
- * @return
+ * Remove node specified by nodeName and returns the node to switch to
+ * @param nodeName - name of the Node that will be remove
+ * @return return the node that should be selected after remove node
*/
- public PageNode removePageNode(int nodeIndex)
+ public UserNode removePageNode(String nodeName)
{
try
- {
- List<PageNode> nodes = pageNavigation.getNodes();
- PageNode tobeRemoved = nodes.get(nodeIndex);
- PageNode selectedNode = uiPortal.getSelectedNode();
-
- boolean isRemoved = true; // To check
- PageNavigation updateNav =
- dataService.getPageNavigation(pageNavigation.getOwnerType(),
pageNavigation.getOwnerId());
- for (PageNode pageNode : updateNav.getNodes())
+ {
+ UserNode parentNode = getParentTab();
+ if (parentNode == null || parentNode.getChild(nodeName) == null)
{
- if (pageNode.getUri().equals(tobeRemoved.getUri()))
- {
- isRemoved = false;
- break;
- }
+ return null;
}
- if (nodes.size() >= 2)
- {
- // Remove node
- nodes.remove(tobeRemoved);
+ UserNode tobeRemoved = parentNode.getChild(nodeName);
+ UserNode prevNode = null;
- // Choose selected Node
- if (tobeRemoved.getUri().equals(selectedNode.getUri()))
+ if (parentNode.getChildrenCount() >= 2)
+ {
+ for (UserNode child : parentNode.getChildren())
{
- selectedNode = nodes.get(Math.max(0, nodeIndex - 1));
-
+ if (child.getName().equals(nodeName))
+ {
+ parentNode.removeChild(nodeName);
+ break;
+ }
+ prevNode = child;
}
- else if (!nodes.contains(selectedNode))
- {
- selectedNode = nodes.get(0);
- }
- // Update
- if (!isRemoved)
+ String pageRef = tobeRemoved.getPageRef();
+ if (pageRef != null && pageRef.length() > 0)
{
- String pageRef = tobeRemoved.getPageReference();
- if (pageRef != null && pageRef.length() > 0)
- {
- Page page = configService.getPage(pageRef);
- if (page != null)
- dataService.remove(page);
- UIPortal uiPortal = Util.getUIPortal();
- // Remove from cache
- uiPortal.setUIPage(pageRef, null);
- }
- //uiPortal.setSelectedNode(selectedNode);
- dataService.save(pageNavigation);
+ Page page = configService.getPage(pageRef);
+ if (page != null)
+ dataService.remove(page);
+ UIPortal uiPortal = Util.getUIPortal();
+ // Remove from cache
+ uiPortal.setUIPage(pageRef, null);
}
+ parentNode.save();
}
else
{
@@ -220,6 +216,11 @@
return null;
}
+ UserNode selectedNode = uiPortal.getNavPath().getTarget();
+ if (nodeName.equals(selectedNode.getName()))
+ {
+ selectedNode = prevNode != null ? prevNode :
parentNode.getChildren().iterator().next();
+ }
return selectedNode;
}
catch (Exception ex)
@@ -236,48 +237,35 @@
{
nodeLabel = "Tab_" + getCurrentNumberOfTabs();
}
- Page page =
- configService.createPageTemplate(UITabPaneDashboard.PAGE_TEMPLATE,
pageNavigation.getOwnerType(),
- pageNavigation.getOwnerId());
- page.setTitle(nodeLabel);
- List<PageNode> selectedPath = uiPortal.getSelectedPath();
- PageNode parentNode = null;
- if (selectedPath != null && selectedPath.size() > 1)
+ UserNavigation userNav = getCurrentUserNavigation();
+ UserNode parentNode = getParentTab();
+ if (userNav == null || parentNode == null)
{
- parentNode = selectedPath.get(selectedPath.size() - 2);
+ return null;
}
- PageNode pageNode = new PageNode();
- pageNode.setLabel(nodeLabel);
String uniqueNodeName = nodeLabel.toLowerCase().replace(' ',
'_');
- if (nameExisted(uniqueNodeName))
- {
- uniqueNodeName = uniqueNodeName + "_" +
System.currentTimeMillis();
- }
- String fullName = (parentNode != null) ? parentNode.getUri() + "/" +
uniqueNodeName : uniqueNodeName;
+ SiteKey siteKey = userNav.getKey();
+ Page page =
+ configService.createPageTemplate(UITabPaneDashboard.PAGE_TEMPLATE,
siteKey.getTypeName(), siteKey.getName());
+ page.setTitle(nodeLabel);
+ page.setName(uniqueNodeName + page.hashCode());
+ dataService.create(page);
- page.setName(uniqueNodeName);
- pageNode.setName(uniqueNodeName);
- pageNode.setUri(fullName);
- pageNode.setPageReference(page.getPageId());
-
- if (parentNode == null)
+ if (parentNode.getChild(uniqueNodeName) != null)
{
- pageNavigation.addNode(pageNode);
+ uniqueNodeName = uniqueNodeName + "_" +
System.currentTimeMillis();
}
- else if (parentNode.getChildren() != null)
- {
- parentNode.getChildren().add(pageNode);
- }
- //uiPortal.setSelectedNode(pageNode);
+ UserNode tabNode = parentNode.addChild(uniqueNodeName);
+ tabNode.setLabel(nodeLabel);
+ tabNode.setPageRef(page.getPageId());
- dataService.create(page);
- dataService.save(pageNavigation);
+ parentNode.save();
- return fullName;
+ return tabNode.getURI();
}
catch (Exception ex)
{
@@ -309,57 +297,34 @@
return true;
}
- private boolean nameExisted(String nodeName)
+ public String renamePageNode(String nodeName, String newNodeLabel)
{
- for (PageNode node : pageNavigation.getNodes())
- {
- if (node.getName().equals(nodeName))
- {
- return true;
- }
- }
- return false;
- }
-
- public String renamePageNode(int nodeIndex, String newNodeLabel)
- {
try
{
- List<PageNode> nodes = pageNavigation.getNodes();
- List<PageNode> selectedPath = uiPortal.getSelectedPath();
- PageNode parentNode = null;
- if (selectedPath != null && selectedPath.size() > 1)
+ UserNode parentNode = getParentTab();
+ if (parentNode == null || parentNode.getChild(nodeName) == null)
{
- parentNode = selectedPath.get(selectedPath.size() - 2);
- nodes = parentNode.getChildren();
- }
-
- PageNode renamedNode = nodes.get(nodeIndex);
- if (renamedNode == null || newNodeLabel.length() == 0)
- {
return null;
}
-
+ UserNode renamedNode = parentNode.getChild(nodeName);
renamedNode.setLabel(newNodeLabel);
String newNodeName = newNodeLabel.toLowerCase().replace(' ',
'_');
- if (nameExisted(newNodeName))
+ if (parentNode.getChild(newNodeName) != null)
{
newNodeName = newNodeName + "_" + System.currentTimeMillis();
}
renamedNode.setName(newNodeName);
- String newUri = (parentNode != null) ? parentNode.getUri() + "/" +
newNodeName : newNodeName;
-
- renamedNode.setUri(newUri);
-
- Page page = configService.getPage(renamedNode.getPageReference());
- page.setTitle(newNodeLabel);
+ Page page = configService.getPage(renamedNode.getPageRef());
if (page != null)
+ {
+ page.setTitle(newNodeLabel);
dataService.save(page);
-
- dataService.save(pageNavigation);
- return newUri;
+ }
+
+ parentNode.save();
+ return renamedNode.getURI();
}
catch (Exception ex)
{
@@ -372,10 +337,11 @@
*
* @param firstIndex
* @param secondIndex
- * @return
*/
- public boolean permutePageNode(int firstIndex, int secondIndex)
+ public boolean permutePageNode(int firstIndex, int secondIndex) throws Exception
{
+ UserNode parentNode = getParentTab();
+ List<UserNode> siblings = new
ArrayList<UserNode>(getSameSiblingsNode());
if (firstIndex == secondIndex)
{
return false;
@@ -383,13 +349,10 @@
try
{
- ArrayList<PageNode> nodes = pageNavigation.getNodes();
- PageNode firstNode = nodes.get(firstIndex);
- PageNode secondNode = nodes.get(secondIndex);
- nodes.set(firstIndex, secondNode);
- nodes.set(secondIndex, firstNode);
+ UserNode firstNode = siblings.get(firstIndex);
+ parentNode.addChild(secondIndex, firstNode);
- dataService.save(pageNavigation);
+ parentNode.save();
return true;
}
catch (Exception ex)
@@ -398,14 +361,33 @@
}
}
+ private String encodeURI(String uri) throws UnsupportedEncodingException
+ {
+ if (uri == null || uri.isEmpty())
+ {
+ return "";
+ }
+ String[] path = uri.split("/");
+ StringBuilder uriBuilder = new StringBuilder();
+ for (String name : path)
+ {
+ uriBuilder.append("/").append(URLEncoder.encode(name,
"UTF-8"));
+ }
+ if (uriBuilder.indexOf("/") == 0)
+ {
+ uriBuilder.deleteCharAt(0);
+ }
+ return uriBuilder.toString();
+ }
+
static public class DeleteTabActionListener extends
EventListener<UITabPaneDashboard>
{
public void execute(Event<UITabPaneDashboard> event) throws Exception
{
UITabPaneDashboard source = event.getSource();
WebuiRequestContext context = event.getRequestContext();
- int removedNodeIndex =
Integer.parseInt(context.getRequestParameter(UIComponent.OBJECTID));
- PageNode selectedNode = source.removePageNode(removedNodeIndex);
+ String nodeName = context.getRequestParameter(UIComponent.OBJECTID);
+ UserNode selectedNode = source.removePageNode(nodeName);
//If the node is removed successfully, then redirect to the node specified by
tab on the left
if (selectedNode != null)
@@ -420,7 +402,7 @@
PortalRequestContext prContext = Util.getPortalRequestContext();
prContext.setResponseComplete(true);
- prContext.getResponse().sendRedirect(prContext.getPortalURI() +
URLEncoder.encode(selectedNode.getUri(), "UTF-8"));
+ prContext.getResponse().sendRedirect(prContext.getPortalURI() +
source.encodeURI(selectedNode.getURI()));
}
}
}
@@ -436,9 +418,10 @@
{
//TODO nguyenanhkien2a(a)gmail.com
//We should redirect to current node while adding new tab fails
- PageNode currentNode = tabPane.uiPortal.getSelectedNode();
+ UserNode currentNode = tabPane.uiPortal.getNavPath().getTarget();
PortalRequestContext prContext = Util.getPortalRequestContext();
- prContext.getResponse().sendRedirect(prContext.getPortalURI() +
URLEncoder.encode(currentNode.getUri(), "UTF-8"));
+
+ prContext.getResponse().sendRedirect(prContext.getPortalURI() +
tabPane.encodeURI(currentNode.getURI()));
Object[] args = {newTabLabel};
context.getUIApplication().addMessage(new
ApplicationMessage("UITabPaneDashboard.msg.wrongTabName", args));
@@ -451,7 +434,7 @@
{
PortalRequestContext prContext = Util.getPortalRequestContext();
prContext.setResponseComplete(true);
- prContext.getResponse().sendRedirect(prContext.getPortalURI() +
URLEncoder.encode(uri, "UTF-8"));
+ prContext.getResponse().sendRedirect(prContext.getPortalURI() +
tabPane.encodeURI(uri));
}
}
}
@@ -472,26 +455,27 @@
{
UITabPaneDashboard tabPane = event.getSource();
WebuiRequestContext context = event.getRequestContext();
- int nodeIndex =
Integer.parseInt(context.getRequestParameter(UIComponent.OBJECTID));
+ String nodeName = context.getRequestParameter(UIComponent.OBJECTID);
String newTabLabel = context.getRequestParameter(RENAMED_TAB_LABEL_PARAMETER);
if (!tabPane.validateName(newTabLabel))
{
//We should redirect to current node while renaming fails
- PageNode currentNode = tabPane.uiPortal.getSelectedNode();
+ UserNode currentNode = tabPane.uiPortal.getNavPath().getTarget();
PortalRequestContext prContext = Util.getPortalRequestContext();
- prContext.getResponse().sendRedirect(prContext.getPortalURI() +
URLEncoder.encode(currentNode.getUri(), "UTF-8"));
+ prContext.getResponse().sendRedirect(prContext.getPortalURI() +
tabPane.encodeURI(currentNode.getURI()));
Object[] args = {newTabLabel};
context.getUIApplication().addMessage(new
ApplicationMessage("UITabPaneDashboard.msg.wrongTabName", args));
return;
}
- String newUri = tabPane.renamePageNode(nodeIndex, newTabLabel);
+ String newUri = tabPane.renamePageNode(nodeName, newTabLabel);
//If page node is renamed with success, then redirect to new URL
- if (newUri != null)
+ if (newUri != null)
{
PortalRequestContext prContext = Util.getPortalRequestContext();
- prContext.getResponse().sendRedirect(prContext.getPortalURI() +
URLEncoder.encode(newUri, "UTF-8"));
+ prContext.getResponse().sendRedirect(prContext.getPortalURI() +
tabPane.encodeURI(newUri));
+ prContext.setResponseComplete(true);
}
}
}
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/portlet/dashboard/src/main/webapp/groovy/dashboard/webui/component/UITabPaneDashboard.gtmpl
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/portlet/dashboard/src/main/webapp/groovy/dashboard/webui/component/UITabPaneDashboard.gtmpl 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/portlet/dashboard/src/main/webapp/groovy/dashboard/webui/component/UITabPaneDashboard.gtmpl 2011-03-16
21:04:51 UTC (rev 6051)
@@ -1,22 +1,18 @@
<%
import java.util.ArrayList;
- import org.exoplatform.portal.config.model.PageNavigation;
- import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.webui.portal.UIPortal;
import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.web.application.JavascriptManager;
+ import org.exoplatform.portal.mop.user.UserNode;
- //PageNavigation pageNavigation = uicomponent.getPageNavigation();
- //ArrayList<PageNode> nodes = pageNavigation.getNodes();
- ArrayList<PageNode> nodes = uicomponent.getSameSiblingsNode();
+ def nodes = uicomponent.getSameSiblingsNode();
def tabNbs = nodes.size();
PortalRequestContext pcontext = Util.getPortalRequestContext();
def String portalURI = pcontext.getPortalURI();
- PageNode selectedNode = Util.getUIPortal().getSelectedNode();
- PageNode node;
+ def selectedNode = Util.getUIPortal().getSelectedUserNode();
JavascriptManager jsManager = pcontext.getJavascriptManager();
jsManager.importJavascript("eXo.webui.UITabbedDashboard");
@@ -28,11 +24,12 @@
<div class="CtTabDashboard">
<div class="UIHorizontalTabs">
<div class="TabsContainer ClearFix">
- <% for(int i = 0;i < tabNbs;i++){
- node = nodes.get(i);
+ <%
+ int i = 0;
+ for(UserNode node : nodes){
String tabLabel = node.getResolvedLabel();
- String param = "" + i;
- if(node.getUri().equals(selectedNode.getUri())){
+ String param = node.getName();
+ if(node.getURI().equals(selectedNode.getURI())){
%>
<div class="UITab GrayTabStyle">
<div class="SelectedTab">
@@ -40,7 +37,7 @@
<div class="RightTab">
<div class="MiddleTab">
<%
- String ondblclick =
"eXo.webui.UITabbedDashboard.showEditLabelInput(this," + i +
",\"" + node.getResolvedLabel() + "\")";
+ String ondblclick =
"eXo.webui.UITabbedDashboard.showEditLabelInput(this,\"" + param +
"\",\"" + node.getResolvedLabel() + "\")";
%>
<span ondblclick='$ondblclick'>$tabLabel</span>
<a href="<%= uicomponent.url("DeleteTab",param);
%>">
@@ -57,7 +54,7 @@
<div class="LeftTab">
<div class="RightTab">
<div class="MiddleTab">
- <a href="<%= portalURI + node.getUri();
%>"><span>$tabLabel</span></a>
+ <a href="<%= portalURI + node.getURI();
%>"><span>$tabLabel</span></a>
<a href="<%= uicomponent.url("DeleteTab",param);
%>">
<img class="CloseIcon"
src="/eXoResources/skin/sharedImages/Blank.gif" alt="DEL" />
</a>
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIGroupNavigationManagement.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIGroupNavigationManagement.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIGroupNavigationManagement.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -21,17 +21,17 @@
import org.exoplatform.commons.utils.ObjectPageList;
import org.exoplatform.portal.application.PortalRequestContext;
-import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.UserACL;
-import org.exoplatform.portal.config.UserPortalConfigService;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.SiteType;
+import org.exoplatform.portal.mop.navigation.NavigationService;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserPortal;
import org.exoplatform.portal.webui.navigation.UIAddGroupNavigation;
import org.exoplatform.portal.webui.navigation.UINavigationManagement;
import org.exoplatform.portal.webui.navigation.UINavigationNodeSelector;
import org.exoplatform.portal.webui.navigation.UIPageNavigationForm;
import org.exoplatform.portal.webui.page.UIPageNodeForm;
-import org.exoplatform.portal.webui.portal.UIPortal;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.webui.workspace.UIMaskWorkspace;
import org.exoplatform.portal.webui.workspace.UIPortalApplication;
@@ -49,9 +49,8 @@
import org.exoplatform.webui.core.UIVirtualList;
import org.exoplatform.webui.core.lifecycle.UIFormLifecycle;
import org.exoplatform.webui.event.Event;
-import org.exoplatform.webui.event.EventListener;
import org.exoplatform.webui.event.Event.Phase;
-
+import org.exoplatform.webui.event.EventListener;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -76,14 +75,14 @@
@EventConfig(listeners = UIPageNodeForm.SwitchPublicationDateActionListener.class,
phase = Phase.DECODE),
@EventConfig(listeners = UIPageNodeForm.SwitchVisibleActionListener.class, phase =
Phase.DECODE),
@EventConfig(listeners = UIPageNodeForm.ClearPageActionListener.class, phase =
Phase.DECODE),
- @EventConfig(listeners = UIPageNodeForm.CreatePageActionListener.class, phase =
Phase.DECODE)})})
+ @EventConfig(listeners = UIPageNodeForm.CreatePageActionListener.class, phase =
Phase.DECODE)}),
+ @ComponentConfig(type = UIPopupWindow.class, template =
"system:/groovy/webui/core/UIPopupWindow.gtmpl",
+ events = @EventConfig(listeners =
UIGroupNavigationManagement.CloseActionListener.class, name = "ClosePopup"))})
public class UIGroupNavigationManagement extends UIContainer
{
- private List<PageNavigation> navigations;
+ private UINavigationManagement naviManager;
- private PageNavigation selectedNavigation;
-
public UIGroupNavigationManagement() throws Exception
{
UIVirtualList virtualList = addChild(UIVirtualList.class, null,
"GroupNavigationList");
@@ -96,80 +95,22 @@
public void loadNavigations() throws Exception
{
- UserPortalConfigService userPortalConfigService =
getApplicationComponent(UserPortalConfigService.class);
- navigations = userPortalConfigService.loadEditableNavigations();
- UIVirtualList virtualList = getChild(UIVirtualList.class);
- virtualList.dataBind(new ObjectPageList<PageNavigation>(navigations,
navigations.size()));
- }
+ UserPortal userPortal =
Util.getUIPortalApplication().getUserPortalConfig().getUserPortal();
- public List<PageNavigation> getNavigations()
- {
- return navigations;
- }
-
- public void addPageNavigation(PageNavigation navigation)
- {
- if (navigations == null)
+ List<UserNavigation> allNavs = userPortal.getNavigations();
+ List<UserNavigation> groupNav = new ArrayList<UserNavigation>();
+ for (UserNavigation nav : allNavs)
{
- navigations = new ArrayList<PageNavigation>();
- }
- navigations.add(navigation);
- }
-
- public void deletePageNavigation(PageNavigation navigation)
- {
- if (navigations == null || navigations.size() < 1)
- {
- return;
- }
- navigations.remove(navigation);
- }
-
- public PageNavigation getPageNavigation(int id)
- {
- for (PageNavigation ele : getPageNavigations())
- {
- if (ele.getId() == id)
+ if (nav.getKey().getType().equals(SiteType.GROUP) &&
nav.isModifiable())
{
- return ele;
+ groupNav.add(nav);
}
}
- return null;
- }
- public List<PageNavigation> getPageNavigations()
- {
- if (navigations == null)
- {
- navigations = new ArrayList<PageNavigation>();
- }
- return navigations;
+ UIVirtualList virtualList = getChild(UIVirtualList.class);
+ virtualList.dataBind(new ObjectPageList<UserNavigation>(groupNav,
groupNav.size()));
}
- public PageNavigation getNavigationById(Integer navId)
- {
- PageNavigation navigation = new PageNavigation();
- for (PageNavigation nav : navigations)
- {
- if (nav.getId() == navId)
- {
- navigation = nav;
- break;
- }
- }
- return navigation;
- }
-
- public PageNavigation getSelectedNavigation()
- {
- return selectedNavigation;
- }
-
- public void setSelectedNavigation(PageNavigation navigation)
- {
- selectedNavigation = navigation;
- }
-
/**
* User has right to add navigation to a group in below cases
*
@@ -177,7 +118,7 @@
*
* 2. He/She is manager of the group
*
- * @param pcontext
+ * @param
* @return
*/
private boolean userHasRightToAddNavigation()
@@ -199,172 +140,117 @@
try
{
Collection<?> groups =
orgService.getGroupHandler().findGroupByMembership(remoteUser, userACL.getMakableMT());
- if (groups != null && groups.size() > 0)
- {
- return true;
- }
- else
- {
- return false;
- }
+ return groups != null && groups.size() > 0;
}
catch (Exception ex)
{
return false;
}
}
-
- static public class EditNavigationActionListener extends
EventListener<UIGroupNavigationManagement>
+
+ static public abstract class BaseEditAction extends
EventListener<UIGroupNavigationManagement>
{
public void execute(Event<UIGroupNavigationManagement> event) throws
Exception
{
-
+ UserPortal userPortal =
Util.getUIPortalApplication().getUserPortalConfig().getUserPortal();
UIGroupNavigationManagement uicomp = event.getSource();
-
- // get navigation id
- String id = event.getRequestContext().getRequestParameter(OBJECTID);
- Integer navId = Integer.parseInt(id);
- // get PageNavigation by navigation id
- PageNavigation navigation = uicomp.getNavigationById(navId);
- uicomp.setSelectedNavigation(navigation);
WebuiRequestContext context = event.getRequestContext();
UIApplication uiApplication = context.getUIApplication();
+ // get navigation id
+ String groupName = event.getRequestContext().getRequestParameter(OBJECTID);
+ SiteKey siteKey = SiteKey.group(groupName);
+ UserNavigation navigation = userPortal.getNavigation(siteKey);
+ if (navigation == null)
+ {
+ uiApplication.addMessage(new
ApplicationMessage("UIGroupNavigationManagement.msg.navigation-not-exist",
null));
+ return;
+ }
+
// check edit permission, ensure that user has edit permission on that
// navigation
UserACL userACL = uicomp.getApplicationComponent(UserACL.class);
-
- if (!userACL.hasEditPermission(navigation))
+ if (!userACL.hasEditPermissionOnNavigation(siteKey))
{
uiApplication.addMessage(new
ApplicationMessage("UIGroupNavigationManagement.msg.Invalid-editPermission",
null));
return;
}
- // ensure this navigation is exist
- DataStorage service = uicomp.getApplicationComponent(DataStorage.class);
- if (service.getPageNavigation(navigation.getOwnerType(),
navigation.getOwnerId()) == null)
+ doEdit(navigation, event);
+ }
+
+ protected abstract void doEdit(UserNavigation navigation,
Event<UIGroupNavigationManagement> event) throws Exception;
+ }
+
+ static public class EditNavigationActionListener extends BaseEditAction
+ {
+ @Override
+ protected void doEdit(UserNavigation nav, Event<UIGroupNavigationManagement>
event) throws Exception
+ {
+ UserPortal userPortal =
Util.getUIPortalApplication().getUserPortalConfig().getUserPortal();
+ UIGroupNavigationManagement uicomp = event.getSource();
+ SiteKey siteKey = nav.getKey();
+
+ UIPopupWindow popUp = uicomp.getChild(UIPopupWindow.class);
+ UINavigationManagement naviManager = uicomp.naviManager;
+ if (naviManager == null)
{
- uiApplication.addMessage(new
ApplicationMessage("UIGroupNavigationManagement.msg.navigation-not-exist",
null));
- return;
+ naviManager = popUp.createUIComponent(UINavigationManagement.class, null,
null, popUp);
+ uicomp.naviManager = naviManager;
}
+ naviManager.setOwner(siteKey.getName());
+ naviManager.setOwnerType(siteKey.getTypeName());
- UIPopupWindow popUp = uicomp.getChild(UIPopupWindow.class);
-
- UINavigationManagement pageManager =
popUp.createUIComponent(UINavigationManagement.class, null, null, popUp);
- pageManager.setOwner(navigation.getOwnerId());
- pageManager.setOwnerType(navigation.getOwnerType());
-
- UINavigationNodeSelector selector =
pageManager.getChild(UINavigationNodeSelector.class);
-
- selector.setEdittedNavigation(navigation);
+ UINavigationNodeSelector selector =
naviManager.getChild(UINavigationNodeSelector.class);
+ selector.setEdittedNavigation(nav);
+ selector.setUserPortal(userPortal);
selector.initTreeData();
- popUp.setUIComponent(pageManager);
+
+ popUp.setUIComponent(naviManager);
popUp.setWindowSize(400, 400);
popUp.setShowMask(true);
popUp.setShow(true);
}
}
- static public class EditPropertiesActionListener extends
EventListener<UIGroupNavigationManagement>
+ static public class EditPropertiesActionListener extends BaseEditAction
{
- public void execute(Event<UIGroupNavigationManagement> event) throws
Exception
+ @Override
+ protected void doEdit(UserNavigation navigation,
Event<UIGroupNavigationManagement> event) throws Exception
{
-
UIGroupNavigationManagement uicomp = event.getSource();
+ SiteKey siteKey = navigation.getKey();
- // get navigation id
- String id = event.getRequestContext().getRequestParameter(OBJECTID);
- Integer navId = Integer.parseInt(id);
-
- // get PageNavigation by navigation id
- PageNavigation navigation = uicomp.getNavigationById(navId);
-
// open a add navigation popup
UIPopupWindow popUp = uicomp.getChild(UIPopupWindow.class);
UIPageNavigationForm pageNavigation =
popUp.createUIComponent(UIPageNavigationForm.class, null, null, popUp);
- pageNavigation.setOwnerId(navigation.getOwnerId());
- pageNavigation.setOwnerType(navigation.getOwnerType());
+ pageNavigation.setOwnerId(siteKey.getName());
+ pageNavigation.setOwnerType(siteKey.getTypeName());
pageNavigation.setPriority(String.valueOf(navigation.getPriority()));
pageNavigation.addFormInput();
- pageNavigation.setPageNav(navigation);
+ pageNavigation.setUserNav(navigation);
popUp.setUIComponent(pageNavigation);
popUp.setWindowSize(600, 400);
popUp.setShowMask(true);
- popUp.setShow(true);
+ popUp.setShow(true);
}
}
- static public class DeleteNavigationActionListener extends
EventListener<UIGroupNavigationManagement>
+ static public class DeleteNavigationActionListener extends BaseEditAction
{
- public void execute(Event<UIGroupNavigationManagement> event) throws
Exception
+ @Override
+ protected void doEdit(UserNavigation navigation,
Event<UIGroupNavigationManagement> event) throws Exception
{
UIGroupNavigationManagement uicomp = event.getSource();
+ NavigationService service =
uicomp.getApplicationComponent(NavigationService.class);
- WebuiRequestContext context = event.getRequestContext();
- UIApplication uiApplication = context.getUIApplication();
+ service.saveNavigation(navigation.getKey(), null);
- // get navigation id
- String id = event.getRequestContext().getRequestParameter(OBJECTID);
- Integer navId = Integer.parseInt(id);
-
- // get PageNavigation by navigation id
- PageNavigation navigation = uicomp.getNavigationById(navId);
-
- // check edit permission, ensure that user has edit permission on that
- // navigation
- UserACL userACL = uicomp.getApplicationComponent(UserACL.class);
-
- if (!userACL.hasEditPermission(navigation))
- {
- uiApplication.addMessage(new
ApplicationMessage("UIGroupNavigationManagement.msg.Invalid-editPermission",
null));
- return;
- }
-
- // TODO ensure this navigation is exist
- DataStorage service = uicomp.getApplicationComponent(DataStorage.class);
- if (service.getPageNavigation(navigation.getOwnerType(),
navigation.getOwnerId()) == null)
- {
- uiApplication.addMessage(new
ApplicationMessage("UIGroupNavigationManagement.msg.navigation-not-exist",
null));
- return;
- }
-
- // remove selected navigation
- if (uicomp.navigations == null || uicomp.navigations.size() < 1)
- {
- return;
- }
- uicomp.navigations.remove(navigation);
-
- // remove navigation from UIPortalApplication
- UIPortalApplication uiPortalApp = Util.getUIPortalApplication();
- removeNavigationByID(uiPortalApp.getUserPortalConfig().getNavigations(),
navigation);
- removeNavigationByID(uiPortalApp.getNavigations(), navigation);
-
-
- service.remove(navigation);
event.getRequestContext().addUIComponentToUpdateByAjax(uicomp);
-
//Update UserToolbarGroupPortlet
- UIWorkingWorkspace uiWorkingWS =
uiPortalApp.getChild(UIWorkingWorkspace.class);
- uiWorkingWS.updatePortletsByName("UserToolbarGroupPortlet");
+ UIWorkingWorkspace uiWorkingWS =
Util.getUIPortalApplication().getChild(UIWorkingWorkspace.class);
+ uiWorkingWS.updatePortletsByName("UserToolbarGroupPortlet");
}
-
- private void removeNavigationByID(List<PageNavigation> navs, PageNavigation
target)
- {
- if (navs == null)
- {
- return;
- }
- for (PageNavigation nav : navs)
- {
- if (nav.getId() == target.getId())
- {
- navs.remove(nav);
- return;
- }
- }
- }
-
}
static public class AddNavigationActionListener extends
EventListener<UIGroupNavigationManagement>
@@ -391,26 +277,15 @@
public void execute(Event<UIPageNodeForm> event) throws Exception
{
UIPageNodeForm uiPageNodeForm = event.getSource();
- PageNavigation contextNavigation = uiPageNodeForm.getContextPageNavigation();
-
UIGroupNavigationManagement uiGroupNavigation =
uiPageNodeForm.getAncestorOfType(UIGroupNavigationManagement.class);
- PageNavigation selectedNavigation = uiGroupNavigation.getSelectedNavigation();
- UIPopupWindow uiNavigationPopup =
uiGroupNavigation.getChild(UIPopupWindow.class);
- UINavigationManagement navigationManager =
- uiPageNodeForm.createUIComponent(UINavigationManagement.class, null, null);
- navigationManager.setOwner(contextNavigation.getOwnerId());
- navigationManager.setOwnerType(contextNavigation.getOwnerType());
- UINavigationNodeSelector selector =
navigationManager.getChild(UINavigationNodeSelector.class);
- selector.setEdittedNavigation(contextNavigation);
- selector.initTreeData();
+ UINavigationManagement navigationManager = uiGroupNavigation.naviManager;
- if (uiPageNodeForm.getSelectedParent() instanceof PageNode)
- {
- PageNode selectedParent = (PageNode)uiPageNodeForm.getSelectedParent();
- selector.selectPageNodeByUri(selectedParent.getUri());
- }
-
+ UINavigationNodeSelector selector =
navigationManager.getChild(UINavigationNodeSelector.class);
+ UINavigationNodeSelector.TreeNodeData selectedParent =
(UINavigationNodeSelector.TreeNodeData)uiPageNodeForm.getSelectedParent();
+ selector.selectNode(selectedParent);
+
+ UIPopupWindow uiNavigationPopup =
uiGroupNavigation.getChild(UIPopupWindow.class);
uiNavigationPopup.setUIComponent(navigationManager);
uiNavigationPopup.setWindowSize(400, 400);
uiNavigationPopup.setRendered(true);
@@ -419,4 +294,14 @@
}
}
+
+ static public class CloseActionListener extends UIPopupWindow.CloseActionListener
+ {
+ public void execute(Event<UIPopupWindow> event) throws Exception
+ {
+ UIPopupWindow popWindow = event.getSource();
+ popWindow.setUIComponent(null);
+ super.execute(event);
+ }
+ }
}
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UISiteManagement.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UISiteManagement.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UISiteManagement.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -27,10 +27,10 @@
import org.exoplatform.portal.config.UserACL;
import org.exoplatform.portal.config.UserPortalConfig;
import org.exoplatform.portal.config.UserPortalConfigService;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.webui.navigation.PageNavigationUtils;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserPortal;
import org.exoplatform.portal.webui.navigation.UINavigationManagement;
import org.exoplatform.portal.webui.navigation.UINavigationNodeSelector;
import org.exoplatform.portal.webui.page.UIPageNodeForm;
@@ -53,16 +53,14 @@
import org.exoplatform.webui.core.UIPopupWindow;
import org.exoplatform.webui.core.lifecycle.UIFormLifecycle;
import org.exoplatform.webui.event.Event;
-import org.exoplatform.webui.event.EventListener;
import org.exoplatform.webui.event.Event.Phase;
-
+import org.exoplatform.webui.event.EventListener;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
-
import javax.servlet.http.HttpServletRequest;
@ComponentConfigs({
@@ -76,7 +74,9 @@
@EventConfig(listeners = UIPageNodeForm.SwitchPublicationDateActionListener.class,
phase = Phase.DECODE),
@EventConfig(listeners = UIPageNodeForm.SwitchVisibleActionListener.class, phase =
Phase.DECODE),
@EventConfig(listeners = UIPageNodeForm.ClearPageActionListener.class, phase =
Phase.DECODE),
- @EventConfig(listeners = UIPageNodeForm.CreatePageActionListener.class, phase =
Phase.DECODE)})})
+ @EventConfig(listeners = UIPageNodeForm.CreatePageActionListener.class, phase =
Phase.DECODE)}),
+ @ComponentConfig(type = UIPopupWindow.class, template =
"system:/groovy/webui/core/UIPopupWindow.gtmpl",
+ events = @EventConfig(listeners = UISiteManagement.CloseActionListener.class, name
= "ClosePopup"))})
public class UISiteManagement extends UIContainer
{
@@ -84,7 +84,7 @@
private LazyPageList pageList;
- private PageNavigation selectedNavigation;
+ private UINavigationManagement naviManager;
public UISiteManagement() throws Exception
{
@@ -182,16 +182,6 @@
}
- public PageNavigation getOriginalSelectedNavigation()
- {
- return selectedNavigation;
- }
-
- public void setOriginalSelectedNavigation(PageNavigation navigation)
- {
- selectedNavigation = navigation;
- }
-
private boolean stillKeptInPageList(String portalName) throws Exception {
List<PortalConfig> portals = this.getPortalConfigs();
for(PortalConfig p : portals) {
@@ -312,9 +302,10 @@
// Check if edit current portal
if (uiPortal.getName().equals(editPortal.getName()))
{
- editPortal.setSelectedNode(uiPortal.getSelectedNode());
- editPortal.setSelectedNavigation(uiPortal.getSelectedNavigation());
- editPortal.setSelectedPath(uiPortal.getSelectedPath());
+// editPortal.setSelectedNode(uiPortal.getSelectedNode());
+// editPortal.setNavigation(uiPortal.getNavigation());
+// editPortal.setSelectedPath(uiPortal.getSelectedPath());
+ editPortal.setNavPath(uiPortal.getNavPath());
UISiteBody siteBody =
uiWorkingWS.findFirstComponentOfType(UISiteBody.class);
siteBody.setUIComponent(null);
}
@@ -330,18 +321,19 @@
static public class EditNavigationActionListener extends
EventListener<UISiteManagement>
{
+
public void execute(Event<UISiteManagement> event) throws Exception
{
UISiteManagement uicomp = event.getSource();
String portalName = event.getRequestContext().getRequestParameter(OBJECTID);
- DataStorage dataService = uicomp.getApplicationComponent(DataStorage.class);
WebuiRequestContext context = event.getRequestContext();
UIApplication uiApplication = context.getUIApplication();
//Minh Hoang TO: User could edit navigation if he/she has edit permissions on
PortalConfig. That is not
//at all logical and should be modified after release 3.1 GA
UserPortalConfigService configService =
uicomp.getApplicationComponent(UserPortalConfigService.class);
- UserPortalConfig userPortalConfig =
configService.getUserPortalConfig(portalName, context.getRemoteUser());
+ UserPortalConfig userPortalConfig =
configService.getUserPortalConfig(portalName, context.getRemoteUser(),
+ PortalRequestContext.USER_PORTAL_CONTEXT);
if(userPortalConfig == null)
{
uiApplication.addMessage(new
ApplicationMessage("UISiteManagement.msg.portal-not-exist",
@@ -352,13 +344,10 @@
UserACL userACL = uicomp.getApplicationComponent(UserACL.class);
if (!userACL.hasEditPermission(userPortalConfig.getPortalConfig()))
{
- uiApplication.addMessage(new
ApplicationMessage("UISiteManagement.msg.Invalid-editPermission", null));;
+ uiApplication.addMessage(new
ApplicationMessage("UISiteManagement.msg.Invalid-editPermission", null));
return;
}
- PageNavigation edittedNavigation =
dataService.getPageNavigation(PortalConfig.PORTAL_TYPE, portalName);
-
-
//Minh Hoang TO: For release 3.1, Edit Permission check would be rollback to
former checks on PortalConfig
/*
if (edittedNavigation == null)
@@ -377,18 +366,26 @@
*/
UIPopupWindow popUp = uicomp.getChild(UIPopupWindow.class);
- UINavigationManagement naviManager =
popUp.createUIComponent(UINavigationManagement.class, null, null, popUp);
+ UINavigationManagement naviManager = uicomp.naviManager;
+ if (naviManager == null)
+ {
+ naviManager = popUp.createUIComponent(UINavigationManagement.class, null,
null, popUp);
+ uicomp.naviManager = naviManager;
+ }
naviManager.setOwner(portalName);
naviManager.setOwnerType(PortalConfig.PORTAL_TYPE);
+ UserPortal userPortal = userPortalConfig.getUserPortal();
+ UserNavigation edittedNavigation =
userPortal.getNavigation(SiteKey.portal(portalName));
+
UINavigationNodeSelector selector =
naviManager.getChild(UINavigationNodeSelector.class);
selector.setEdittedNavigation(edittedNavigation);
+ selector.setUserPortal(userPortal);
selector.initTreeData();
-
popUp.setUIComponent(naviManager);
popUp.setShowMask(true);
popUp.setShow(true);
-
+ popUp.setWindowSize(400, 400);
}
}
@@ -398,23 +395,14 @@
public void execute(Event<UIPageNodeForm> event) throws Exception
{
UIPageNodeForm uiPageNodeForm = event.getSource();
- PageNavigation contextNavigation = uiPageNodeForm.getContextPageNavigation();
UISiteManagement uiSiteManagement =
uiPageNodeForm.getAncestorOfType(UISiteManagement.class);
- UIPopupWindow uiNavigationPopup =
uiSiteManagement.getChild(UIPopupWindow.class);
- UINavigationManagement navigationManager =
uiPageNodeForm.createUIComponent(UINavigationManagement.class, null, null);
- navigationManager.setOwner(contextNavigation.getOwnerId());
- navigationManager.setOwnerType(contextNavigation.getOwnerType());
+ UINavigationManagement navigationManager = uiSiteManagement.naviManager;
+
UINavigationNodeSelector selector =
navigationManager.getChild(UINavigationNodeSelector.class);
-
- selector.setEdittedNavigation(uiPageNodeForm.getContextPageNavigation());
- selector.initTreeData();
-
- if (uiPageNodeForm.getSelectedParent() instanceof PageNode)
- {
- PageNode selectedParent = (PageNode)uiPageNodeForm.getSelectedParent();
- selector.selectPageNodeByUri(selectedParent.getUri());
- }
-
+ UINavigationNodeSelector.TreeNodeData selectedParent =
(UINavigationNodeSelector.TreeNodeData)uiPageNodeForm.getSelectedParent();
+ selector.selectNode(selectedParent);
+
+ UIPopupWindow uiNavigationPopup =
uiSiteManagement.getChild(UIPopupWindow.class);
uiNavigationPopup.setUIComponent(navigationManager);
uiNavigationPopup.setWindowSize(400, 400);
event.getRequestContext().addUIComponentToUpdateByAjax(uiNavigationPopup.getParent());
@@ -422,4 +410,14 @@
}
+ static public class CloseActionListener extends UIPopupWindow.CloseActionListener
+ {
+ public void execute(Event<UIPopupWindow> event) throws Exception
+ {
+ UIPopupWindow popWindow = event.getSource();
+ popWindow.setUIComponent(null);
+ super.execute(event);
+ }
+ }
+
}
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIAdminToolbarPortlet.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIAdminToolbarPortlet.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIAdminToolbarPortlet.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -22,9 +22,8 @@
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.UserACL;
import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
-import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserNode;
import org.exoplatform.portal.webui.page.UIPage;
import org.exoplatform.portal.webui.page.UIPageBody;
import org.exoplatform.portal.webui.portal.UIPortal;
@@ -48,9 +47,9 @@
{
}
- public PageNavigation getSelectedNavigation() throws Exception
+ public UserNavigation getSelectedNavigation() throws Exception
{
- return Util.getUIPortal().getSelectedNavigation();
+ return Util.getUIPortal().getUserNavigation();
}
@Override
@@ -67,21 +66,8 @@
private boolean hasEditPermissionOnNavigation() throws Exception
{
- PageNavigation selectedNavigation = getSelectedNavigation();
- UIPortalApplication portalApp = Util.getUIPortalApplication();
- UserACL userACL = portalApp.getApplicationComponent(UserACL.class);
- if (selectedNavigation == null || userACL == null)
- {
- return false;
- }
- else
- {
- if (PortalConfig.PORTAL_TYPE.equals(selectedNavigation.getOwnerType()))
- {
- return hasEditPermissionOnPortal();
- }
- return userACL.hasEditPermission(selectedNavigation);
- }
+ UserNavigation selectedNavigation = getSelectedNavigation();
+ return selectedNavigation.isModifiable();
}
private boolean hasEditPermissionOnPortal() throws Exception
@@ -107,8 +93,8 @@
else
{
UIPortal currentUIPortal =
portalApp.<UIWorkingWorkspace>findComponentById(UIPortalApplication.UI_WORKING_WS_ID).findFirstComponentOfType(UIPortal.class);
- PageNode currentNode = currentUIPortal.getSelectedNode();
- String pageReference = currentNode.getPageReference();
+ UserNode currentNode = currentUIPortal.getSelectedUserNode();
+ String pageReference = currentNode.getPageRef();
if(pageReference == null)
{
return false;
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarDashboardPortlet.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarDashboardPortlet.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarDashboardPortlet.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -23,12 +23,19 @@
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
-import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.Visibility;
+import org.exoplatform.portal.mop.navigation.NodeFilter;
+import org.exoplatform.portal.mop.navigation.Scope;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserNode;
+import org.exoplatform.portal.mop.user.UserNodePredicate;
+import org.exoplatform.portal.mop.user.UserPortal;
import org.exoplatform.portal.webui.util.Util;
+import org.exoplatform.portal.webui.workspace.UIPortalApplication;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
+import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.UIComponent;
@@ -36,9 +43,9 @@
import org.exoplatform.webui.core.lifecycle.UIApplicationLifecycle;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
+import java.util.Collection;
+import java.util.Collections;
-import java.util.List;
-
/**
* Created by The eXo Platform SAS
* Author : Pham Thanh Tung
@@ -50,34 +57,52 @@
{
public static String DEFAULT_TAB_NAME = "Tab_0";
+ private final NodeFilter TOOLBAR_DASHBOARD_FILTER;
+ private static final Scope TOOLBAR_DASHBOARD_SCOPE = Scope.CHILDREN;
public UIUserToolBarDashboardPortlet() throws Exception
{
+ UserNodePredicate.Builder scopeBuilder = UserNodePredicate.builder();
+ scopeBuilder.withAuthorizationCheck().withVisibility(Visibility.DISPLAYED,
Visibility.TEMPORAL);
+ scopeBuilder.withTemporalCheck();
+ TOOLBAR_DASHBOARD_FILTER = getUserPortal().createFilter(scopeBuilder.build());
}
- public PageNavigation getCurrentUserNavigation() throws Exception
+ public Collection<UserNode> getUserNodes() throws Exception
{
- String remoteUser = Util.getPortalRequestContext().getRemoteUser();
- return getPageNavigation(PortalConfig.USER_TYPE + "::" + remoteUser);
+ UserPortal userPortal = getUserPortal();
+ UserNavigation userNav = getCurrentUserNavigation();
+ if (userNav != null)
+ {
+ UserNode rootNodes = userPortal.getNode(userNav, TOOLBAR_DASHBOARD_SCOPE);
+ if (rootNodes != null)
+ {
+ rootNodes.filter(TOOLBAR_DASHBOARD_FILTER);
+ return rootNodes.getChildren();
+ }
+ }
+
+ return Collections.emptyList();
}
- private PageNavigation getPageNavigation(String owner) throws Exception
+ public UserNode getSelectedNode() throws Exception
{
- //List<PageNavigation> allNavigations = Util.getUIPortal().getNavigations();
- List<PageNavigation> allNavigations =
Util.getUIPortalApplication().getNavigations();
- for (PageNavigation nav : allNavigations)
- {
- if (nav.getOwner().equals(owner))
- return nav;
- }
- return null;
+ return Util.getUIPortal().getNavPath().getTarget();
}
- public PageNode getSelectedPageNode() throws Exception
+ public UserNavigation getCurrentUserNavigation() throws Exception
{
- return Util.getUIPortal().getSelectedNode();
+ UserPortal userPortal = getUserPortal();
+ WebuiRequestContext rcontext = WebuiRequestContext.getCurrentInstance();
+ return userPortal.getNavigation(SiteKey.user(rcontext.getRemoteUser()));
}
+ private UserPortal getUserPortal()
+ {
+ UIPortalApplication uiApp = Util.getUIPortalApplication();
+ return uiApp.getUserPortalConfig().getUserPortal();
+ }
+
static public class AddDashboardActionListener extends
EventListener<UIUserToolBarDashboardPortlet>
{
@@ -90,29 +115,20 @@
UIUserToolBarDashboardPortlet toolBarPortlet = event.getSource();
String nodeName =
event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
- PageNavigation cachedNavigation = toolBarPortlet.getCurrentUserNavigation();
-
- // Update navigation for prevent create first node which already existed
- DataStorage dataStorage =
toolBarPortlet.getApplicationComponent(DataStorage.class);
- PageNavigation userNavigation =
- dataStorage.getPageNavigation(cachedNavigation.getOwnerType(),
cachedNavigation.getOwnerId());
- cachedNavigation.merge(userNavigation);
-
- UserPortalConfigService configService =
toolBarPortlet.getApplicationComponent(UserPortalConfigService.class);
- if (cachedNavigation != null && configService != null &&
cachedNavigation.getNodes().size() < 1)
+ Collection<UserNode> nodes = toolBarPortlet.getUserNodes();
+ if (nodes.size() < 1)
{
- createDashboard(nodeName, cachedNavigation, configService);
+ createDashboard(nodeName, toolBarPortlet);
}
else
{
PortalRequestContext prContext = Util.getPortalRequestContext();
prContext.getResponse().sendRedirect(
- prContext.getPortalURI() + cachedNavigation.getNodes().get(0).getName());
+ prContext.getPortalURI() + nodes.iterator().next());
}
}
- private static void createDashboard(String _nodeName, PageNavigation
_pageNavigation,
- UserPortalConfigService _configService)
+ private static void createDashboard(String _nodeName, UIUserToolBarDashboardPortlet
toolBarPortlet)
{
try
{
@@ -122,24 +138,34 @@
logger.debug("Parsed nodeName is null, hence use Tab_0 as default
name");
_nodeName = DEFAULT_TAB_NAME;
}
+
+ UserPortal userPortal = toolBarPortlet.getUserPortal();
+ UserNavigation userNav = toolBarPortlet.getCurrentUserNavigation();
+ if (userNav == null)
+ {
+ return;
+ }
+ SiteKey siteKey = userNav.getKey();
+
+ UserPortalConfigService _configService =
toolBarPortlet.getApplicationComponent(UserPortalConfigService.class);
Page page =
- _configService.createPageTemplate(PAGE_TEMPLATE,
_pageNavigation.getOwnerType(), _pageNavigation
- .getOwnerId());
+ _configService.createPageTemplate(PAGE_TEMPLATE, siteKey.getTypeName(),
siteKey.getName());
page.setTitle(_nodeName);
page.setName(_nodeName);
+ toolBarPortlet.getApplicationComponent(DataStorage.class).create(page);
- PageNode pageNode = new PageNode();
- pageNode.setName(_nodeName);
-
pageNode.setLabel(prContext.getApplicationResourceBundle().getString("UIUserToolBarDashboard.page.ClickAndType"));
- pageNode.setResolvedLabel(prContext.getApplicationResourceBundle());
- pageNode.setUri(_nodeName);
- pageNode.setPageReference(page.getPageId());
+ UserNode rootNode = userPortal.getNode(userNav, TOOLBAR_DASHBOARD_SCOPE);
+ if (rootNode == null)
+ {
+ return;
+ }
+ rootNode.filter(toolBarPortlet.TOOLBAR_DASHBOARD_FILTER);
+ UserNode tabNode = rootNode.addChild(_nodeName);
+
tabNode.setLabel(prContext.getApplicationResourceBundle().getString("UIUserToolBarDashboard.page.ClickAndType"));
+ tabNode.setPageRef(page.getPageId());
- _pageNavigation.addNode(pageNode);
- _configService.create(page);
- _configService.update(_pageNavigation);
-
- prContext.getResponse().sendRedirect(prContext.getPortalURI() + _nodeName);
+ rootNode.save();
+ prContext.getResponse().sendRedirect(prContext.getPortalURI() +
tabNode.getURI());
}
catch (Exception ex)
{
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarGroupPortlet.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarGroupPortlet.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarGroupPortlet.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -19,16 +19,22 @@
package org.exoplatform.toolbar.webui.component;
-import org.exoplatform.portal.config.model.PageNode;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.webui.navigation.PageNavigationUtils;
+import org.exoplatform.portal.mop.SiteType;
+import org.exoplatform.portal.mop.Visibility;
+import org.exoplatform.portal.mop.navigation.NodeFilter;
+import org.exoplatform.portal.mop.navigation.Scope;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserNode;
+import org.exoplatform.portal.mop.user.UserNodePredicate;
+import org.exoplatform.portal.mop.user.UserPortal;
import org.exoplatform.portal.webui.util.Util;
+import org.exoplatform.portal.webui.workspace.UIPortalApplication;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.core.UIPortletApplication;
import org.exoplatform.webui.core.lifecycle.UIApplicationLifecycle;
-
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
import java.util.List;
/**
@@ -41,28 +47,53 @@
public class UIUserToolBarGroupPortlet extends UIPortletApplication
{
+ private final NodeFilter TOOLBAR_GROUP_FILTER;
+ private static final Scope TOOLBAR_GROUP_SCOPE = Scope.GRANDCHILDREN;
+
public UIUserToolBarGroupPortlet() throws Exception
- {
+ {
+ UserNodePredicate.Builder scopeBuilder = UserNodePredicate.builder();
+ scopeBuilder.withAuthorizationCheck().withVisibility(Visibility.DISPLAYED,
Visibility.TEMPORAL);
+ scopeBuilder.withTemporalCheck();
+ TOOLBAR_GROUP_FILTER = getUserPortal().createFilter(scopeBuilder.build());
}
- public List<PageNavigation> getGroupNavigations() throws Exception
+ public List<UserNavigation> getGroupNavigations() throws Exception
{
- String remoteUser = Util.getPortalRequestContext().getRemoteUser();
- //List<PageNavigation> allNavigations = Util.getUIPortal().getNavigations();
- List<PageNavigation> allNavigations =
Util.getUIPortalApplication().getNavigations();
- List<PageNavigation> navigations = new ArrayList<PageNavigation>();
- for (PageNavigation navigation : allNavigations)
+ UserPortal userPortal = getUserPortal();
+ List<UserNavigation> allNavs = userPortal.getNavigations();
+
+ List<UserNavigation> groupNav = new ArrayList<UserNavigation>();
+ for (UserNavigation nav : allNavs)
{
- if (navigation.getOwnerType().equals(PortalConfig.GROUP_TYPE))
+ if (nav.getKey().getType().equals(SiteType.GROUP))
{
- navigations.add(PageNavigationUtils.filter(navigation, remoteUser));
+ groupNav.add(nav);
}
}
- return navigations;
+ return groupNav;
}
- public PageNode getSelectedPageNode() throws Exception
+ public Collection<UserNode> getNodes(UserNavigation groupNav) throws Exception
{
- return Util.getUIPortal().getSelectedNode();
+ UserPortal userPortal = getUserPortal();
+ UserNode rootNodes = userPortal.getNode(groupNav, TOOLBAR_GROUP_SCOPE);
+ if (rootNodes != null)
+ {
+ rootNodes.filter(TOOLBAR_GROUP_FILTER);
+ return rootNodes.getChildren();
+ }
+ return Collections.emptyList();
}
+
+ public UserNode getSelectedNode() throws Exception
+ {
+ return Util.getUIPortal().getNavPath().getTarget();
+ }
+
+ private UserPortal getUserPortal()
+ {
+ UIPortalApplication uiApp = Util.getUIPortalApplication();
+ return uiApp.getUserPortalConfig().getUserPortal();
+ }
}
\ No newline at end of file
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarSitePortlet.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarSitePortlet.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/java/org/exoplatform/toolbar/webui/component/UIUserToolBarSitePortlet.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -20,15 +20,21 @@
package org.exoplatform.toolbar.webui.component;
import org.exoplatform.portal.config.UserPortalConfigService;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
-import org.exoplatform.portal.config.model.PortalConfig;
-import org.exoplatform.portal.webui.navigation.PageNavigationUtils;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.Visibility;
+import org.exoplatform.portal.mop.navigation.NodeFilter;
+import org.exoplatform.portal.mop.navigation.Scope;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserNode;
+import org.exoplatform.portal.mop.user.UserNodePredicate;
+import org.exoplatform.portal.mop.user.UserPortal;
import org.exoplatform.portal.webui.util.Util;
+import org.exoplatform.portal.webui.workspace.UIPortalApplication;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.core.UIPortletApplication;
import org.exoplatform.webui.core.lifecycle.UIApplicationLifecycle;
-
+import java.util.Collection;
+import java.util.Collections;
import java.util.List;
/**
@@ -43,8 +49,17 @@
public class UIUserToolBarSitePortlet extends UIPortletApplication
{
+ private final NodeFilter TOOLBAR_SITE_FILTER;
+ private static final Scope TOOLBAR_SITE_SCOPE = Scope.GRANDCHILDREN;
+
public UIUserToolBarSitePortlet() throws Exception
{
+ UserPortal userPortal =
Util.getUIPortalApplication().getUserPortalConfig().getUserPortal();
+
+ UserNodePredicate.Builder scopeBuilder = UserNodePredicate.builder();
+ scopeBuilder.withAuthorizationCheck().withVisibility(Visibility.DISPLAYED,
Visibility.TEMPORAL);
+ scopeBuilder.withTemporalCheck();
+ TOOLBAR_SITE_FILTER = userPortal.createFilter(scopeBuilder.build());
}
public List<String> getAllPortalNames() throws Exception
@@ -64,27 +79,25 @@
return currentPortalURI.substring(0,
currentPortalURI.lastIndexOf(getCurrentPortal())) + portalName + "/";
}
- public PageNavigation getCurrentPortalNavigation() throws Exception
+ public Collection<UserNode> getCurrentPortalNavigation() throws Exception
{
- PageNavigation navi = getPageNavigation(PortalConfig.PORTAL_TYPE + "::" +
getCurrentPortal());
- String remoteUser = Util.getPortalRequestContext().getRemoteUser();
- return PageNavigationUtils.filter(navi, remoteUser);
- }
-
- private PageNavigation getPageNavigation(String owner) throws Exception
- {
- //List<PageNavigation> allNavigations = Util.getUIPortal().getNavigations();
- List<PageNavigation> allNavigations =
Util.getUIPortalApplication().getUserPortalConfig().getNavigations();
- for (PageNavigation nav : allNavigations)
+ UIPortalApplication uiApp = Util.getUIPortalApplication();
+ UserPortal userPortal = uiApp.getUserPortalConfig().getUserPortal();
+ UserNavigation nav = userPortal.getNavigation(SiteKey.portal(getCurrentPortal()));
+ if (nav != null)
{
- if (nav.getOwner().equals(owner))
- return nav;
+ UserNode rootNodes = userPortal.getNode(nav, TOOLBAR_SITE_SCOPE);
+ if (rootNodes != null)
+ {
+ rootNodes.filter(TOOLBAR_SITE_FILTER);
+ return rootNodes.getChildren();
+ }
}
- return null;
+ return Collections.emptyList();
}
- public PageNode getSelectedPageNode() throws Exception
+ public UserNode getSelectedNode() throws Exception
{
- return Util.getUIPortal().getSelectedNode();
+ return Util.getUIPortal().getNavPath().getTarget();
}
}
\ No newline at end of file
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIAdminToolbarPortlet.gtmpl
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIAdminToolbarPortlet.gtmpl 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIAdminToolbarPortlet.gtmpl 2011-03-16
21:04:51 UTC (rev 6051)
@@ -1,10 +1,10 @@
<%
import org.exoplatform.toolbar.webui.component.UIAdminToolbarPortlet;
import org.exoplatform.web.application.JavascriptManager;
- import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.services.organization.User;
import org.exoplatform.services.security.ConversationState;
import org.exoplatform.web.CacheUserProfileFilter;
+ import org.exoplatform.portal.mop.user.UserNavigation;
def rcontext = _ctx.getRequestContext();
@@ -24,9 +24,9 @@
boolean userCouldEditPage = uicomponent.hasEditPermissionOnPage();
boolean userCouldEditPortal = uicomponent.hasEditPermissionOnPortal();
- PageNavigation selectedNav = uicomponent.getSelectedNavigation();
+ UserNavigation selectedNav = uicomponent.getSelectedNavigation();
if (selectedNav != null) {
- editorLabel = _ctx.appRes("UIAdminToolbarPortlet.action." +
selectedNav.getOwnerType() + ".Editor");
+ editorLabel = _ctx.appRes("UIAdminToolbarPortlet.action." +
selectedNav.getKey().getTypeName() + ".Editor");
}
String accountSetting =
"javascript:if(document.getElementById('UIMaskWorkspace'))
ajaxGet(eXo.env.server.createPortalURL('UIPortal', 'AccountSettings',
true));"
%>
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarDashboardPortlet.gtmpl
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarDashboardPortlet.gtmpl 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarDashboardPortlet.gtmpl 2011-03-16
21:04:51 UTC (rev 6051)
@@ -1,124 +1,116 @@
-<%
- import org.exoplatform.portal.config.model.PageNavigation;
- import org.exoplatform.portal.config.model.PageNode;
- import org.exoplatform.web.application.JavascriptManager;
- import org.exoplatform.portal.webui.util.Util ;
- import org.exoplatform.webui.organization.OrganizationUtils;
-
- def rcontext = _ctx.getRequestContext() ;
- JavascriptManager jsmanager = rcontext.getJavascriptManager();
- jsmanager.importJavascript('eXo.portal.UIPortalNavigation');
- jsmanager.importJavascript('eXo.portal.UIAdminToolbar');
- jsmanager.addCustomizedOnLoadScript('eXo.portal.UIAdminToolbar.onLoad("' +
uicomponent.id + '");');
-
- def currentUserNavigation = uicomponent.getCurrentUserNavigation();
- def portalURI = Util.getPortalRequestContext().getPortalURI();
- void renderDashboards(){
- PageNavigation userNavigation = uicomponent.getCurrentUserNavigation();
- if(userNavigation == null){
- return;
- }
-
- nodes = userNavigation.getNodes();
- int size = nodes.size();
- if(size < 1){
- return;
- }
- String clazz = "";
-
- print """
- <div style="display:none" class="MenuItemContainer">
- <div class="SubBlock">
- """;
- for(int i = 0; i < size; i++) {
- renderPageNode( nodes.get(i), i%2 == 0);
- }
- print """
- </div>
- </div>
- """ ;
- }
-
- void renderPageNode(PageNode node, boolean flag) {
- PageNode selectedNode = uicomponent.getSelectedPageNode();
- String tabStyleNavigation = "";
- if(selectedNode != null && node.getUri() == selectedNode.getUri()) {
- tabStyleNavigation = "SelectedItem";
- }
-
- boolean hasChild = (node.getChildren() != null && node.getChildren().size()
> 0);
- String clazz = "";
- if(hasChild) clazz = "ArrowIcon";
- String href = Util.getPortalRequestContext().getPortalURI() + node.getUri();
- String icon = node.getIcon();
- if(icon == null) icon = "DefaultPageIcon";
- boolean toolong = (node.resolvedLabel.length() > 60);
- String label = ( toolong ? node.resolvedLabel.substring(0, 57) + "..." :
node.resolvedLabel);
- String title = "";
- if(toolong) title = "title='$node.resolvedLabel'";
- else title = "";
- print """
- <div class="MenuItem $tabStyleNavigation">
- <div class="$clazz">
- """;
- if(node.pageReference != null) {
- print """<a class="ItemIcon $icon"
href="$href" $title>$label</a>""";
- } else {
- print """<a class="ItemIcon $icon" href="#"
$title>$label</a>""";
- }
- print """
- </div>
- """ ;
- if(hasChild) {
- print """
- <div class="MenuItemContainer">
- <div class="SubBlock">
- """ ;
- for(int j = 0; j < node.getChildren().size(); j++) {
- renderPageNode(node.getChildren().get(j), j%2 == 0);
- }
- print """
- </div>
- </div>
- """ ;
-
- }
- print """
- </div>
- """ ;
- }
-%>
-
-<%
- String defaultDashboardPage;
- if(currentUserNavigation == null || currentUserNavigation.getNodes() == null ||
currentUserNavigation.getNodes().size() < 1){
- defaultDashboardPage =
org.exoplatform.toolbar.webui.component.UIUserToolBarDashboardPortlet.DEFAULT_TAB_NAME;
-%>
- <div class="UIUserToolBarDashboardPortlet"
id="$uicomponent.id">
- <div class="UIHorizontalTabs">
- <div class="TabsContainer">
- <div class="UITab NormalToolbarTab">
- <div class="">
- <a class="DashboardIcon TBIcon" href="<%=
uicomponent.url("AddDefaultDashboard", defaultDashboardPage);
%>">Dashboard</a>
- </div>
- </div>
- </div>
- </div>
- </div>
-<%
- }else{
- defaultDashboardPage = currentUserNavigation.getNodes().get(0).getName();
-%>
- <div class="UIUserToolBarDashboardPortlet" id="$uicomponent.id"
>
- <div class="UIHorizontalTabs">
- <div class="TabsContainer" >
- <div class="UITab NormalToolbarTab">
- <div class="">
- <a class="DashboardIcon TBIcon" href="<%= portalURI +
defaultDashboardPage %>">Dashboard</a>
- </div>
- <% renderDashboards(); %>
- </div>
- </div>
- </div>
- </div>
+<%
+ import org.exoplatform.web.application.JavascriptManager;
+ import org.exoplatform.portal.webui.util.Util ;
+ import org.exoplatform.webui.organization.OrganizationUtils;
+ import org.exoplatform.portal.mop.user.UserNode;
+ import java.util.Collection;
+
+ def rcontext = _ctx.getRequestContext() ;
+ JavascriptManager jsmanager = rcontext.getJavascriptManager();
+ jsmanager.importJavascript('eXo.portal.UIPortalNavigation');
+ jsmanager.importJavascript('eXo.portal.UIAdminToolbar');
+ jsmanager.addCustomizedOnLoadScript('eXo.portal.UIAdminToolbar.onLoad("' +
uicomponent.id + '");');
+
+ def portalURI = Util.getPortalRequestContext().getPortalURI();
+ void renderDashboards(Collection nodes) {
+ String clazz = "";
+
+ print """
+ <div style="display:none" class="MenuItemContainer">
+ <div class="SubBlock">
+ """;
+ int idx = 0;
+ for(UserNode node : nodes) {
+ renderPageNode(node, idx++ % 2 == 0);
+ }
+ print """
+ </div>
+ </div>
+ """ ;
+ }
+
+ void renderPageNode(UserNode node, boolean flag) {
+ UserNode selectedNode = uicomponent.getSelectedNode();
+ String tabStyleNavigation = "";
+ if(selectedNode != null && node.getURI() == selectedNode.getURI()) {
+ tabStyleNavigation = "SelectedItem";
+ }
+
+ boolean hasChild = (node.getChildren() != null && node.getChildren().size()
> 0);
+ String clazz = "";
+ if(hasChild) clazz = "ArrowIcon";
+ String href = Util.getPortalRequestContext().getPortalURI() + node.getURI();
+ String icon = node.getIcon();
+ if(icon == null) icon = "DefaultPageIcon";
+ boolean toolong = (node.resolvedLabel.length() > 60);
+ String label = ( toolong ? node.resolvedLabel.substring(0, 57) + "..." :
node.resolvedLabel);
+ String title = "";
+ if(toolong) title = "title='$node.resolvedLabel'";
+ else title = "";
+ print """
+ <div class="MenuItem $tabStyleNavigation">
+ <div class="$clazz">
+ """;
+ if(node.pageRef != null) {
+ print """<a class="ItemIcon $icon"
href="$href" $title>$label</a>""";
+ } else {
+ print """<a class="ItemIcon $icon" href="#"
$title>$label</a>""";
+ }
+ print """
+ </div>
+ """ ;
+ if(hasChild) {
+ print """
+ <div class="MenuItemContainer">
+ <div class="SubBlock">
+ """ ;
+ int idx = 0;
+ for(UserNode child : node.getChildren()) {
+ renderPageNode(child, idx++ % 2 == 0);
+ }
+ print """
+ </div>
+ </div>
+ """ ;
+
+ }
+ print """
+ </div>
+ """ ;
+ }
+%>
+
+<%
+ def userNodes = uicomponent.getUserNodes();
+ String defaultDashboardPage;
+ if(userNodes.size() < 1) {
+ defaultDashboardPage =
org.exoplatform.toolbar.webui.component.UIUserToolBarDashboardPortlet.DEFAULT_TAB_NAME;
+%>
+ <div class="UIUserToolBarDashboardPortlet"
id="$uicomponent.id">
+ <div class="UIHorizontalTabs">
+ <div class="TabsContainer">
+ <div class="UITab NormalToolbarTab">
+ <div class="">
+ <a class="DashboardIcon TBIcon" href="<%=
uicomponent.url("AddDefaultDashboard", defaultDashboardPage);
%>">Dashboard</a>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+<%
+ }else{
+ defaultDashboardPage =userNodes.iterator().next().getName();
+%>
+ <div class="UIUserToolBarDashboardPortlet" id="$uicomponent.id"
>
+ <div class="UIHorizontalTabs">
+ <div class="TabsContainer" >
+ <div class="UITab NormalToolbarTab">
+ <div class="">
+ <a class="DashboardIcon TBIcon" href="<%= portalURI +
defaultDashboardPage %>">Dashboard</a>
+ </div>
+ <% renderDashboards(userNodes); %>
+ </div>
+ </div>
+ </div>
+ </div>
<% } %>
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarGroupPortlet.gtmpl
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarGroupPortlet.gtmpl 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarGroupPortlet.gtmpl 2011-03-16
21:04:51 UTC (rev 6051)
@@ -1,10 +1,10 @@
<%
- import org.exoplatform.portal.config.model.PageNavigation;
- import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.web.application.JavascriptManager;
import org.exoplatform.portal.webui.util.Util ;
import org.exoplatform.webui.organization.OrganizationUtils;
import org.gatein.common.text.EntityEncoder;
+ import org.exoplatform.portal.mop.user.UserNode;
+ import org.exoplatform.portal.mop.user.UserNavigation;
def rcontext = _ctx.getRequestContext() ;
JavascriptManager jsmanager = rcontext.getJavascriptManager();
@@ -14,34 +14,36 @@
def groupNavigations = uicomponent.getGroupNavigations();
def portalURI = Util.getPortalRequestContext().getPortalURI();
- void renderGroupPageNavigation(PageNavigation navigation) {
- nodes = navigation.getNodes() ;
+ void renderGroupPageNavigation(UserNavigation navigation) {
+ nodes = uicomponent.getNodes(navigation);
if(nodes.size() < 1) return ;
String navTitle = _ctx.appRes("UIPageNavigation.label.titleBar") ;
- navTitle = navTitle.replace("{0}",
OrganizationUtils.getGroupLabel(navigation.ownerId));
+ def ownerId = navigation.getKey().getName();
+ navTitle = navTitle.replace("{0}",
OrganizationUtils.getGroupLabel(ownerId));
print """
- <div class="TitleBar"><div style="width: 99%"
title="$navigation.ownerId">$navTitle</div></div>
+ <div class="TitleBar"><div style="width: 99%"
title="$ownerId">$navTitle</div></div>
<div class="SubBlock">
""" ;
- for(int i = 0; i < nodes.size(); i++) {
- renderPageNode(nodes.get(i), i%2 == 0 ) ;
+ int idx = 0;
+ for(UserNode node : nodes) {
+ renderPageNode(node, idx++ % 2 == 0);
}
print """
</div>
""" ;
}
- void renderPageNode(PageNode node, boolean flag) {
- PageNode selectedNode = uicomponent.getSelectedPageNode();
+ void renderPageNode(UserNode node, boolean flag) {
+ UserNode selectedNode = uicomponent.getSelectedNode();
String tabStyleNavigation = "";
- if(selectedNode != null && node.getUri() == selectedNode.getUri()) {
+ if(selectedNode != null && node.getURI() == selectedNode.getURI()) {
tabStyleNavigation = "SelectedItem";
}
boolean hasChild = (node.getChildren() != null && node.getChildren().size()
> 0);
String clazz = "";
if(hasChild) clazz = "ArrowIcon";
- String href = Util.getPortalRequestContext().getPortalURI() + node.getUri();
+ String href = Util.getPortalRequestContext().getPortalURI() + node.getURI();
String icon = node.getIcon();
if(icon == null) icon = "DefaultPageIcon";
boolean toolong = (node.resolvedLabel.length() > 60);
@@ -55,7 +57,7 @@
<div class="MenuItem $tabStyleNavigation">
<div class="$clazz">
""";
- if(node.pageReference != null) {
+ if(node.pageRef != null) {
print """<a class="ItemIcon $icon"
href="$href" $title>$label</a>""";
} else {
print """<a class="ItemIcon $icon" href="#"
$title>$label</a>""";
@@ -68,8 +70,9 @@
<div class="MenuItemContainer" style="position: absolute;
display:none">
<div class="SubBlock">
""" ;
- for(int j = 0; j < node.getChildren().size(); j++) {
- renderPageNode(node.getChildren().get(j), j%2 == 0);
+ int idx = 0;
+ for(UserNode child : node.getChildren()) {
+ renderPageNode(child, idx++ % 2 == 0);
}
print """
</div>
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarSitePortlet.gtmpl
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarSitePortlet.gtmpl 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/webapp/groovy/admintoolbar/webui/component/UIUserToolBarSitePortlet.gtmpl 2011-03-16
21:04:51 UTC (rev 6051)
@@ -1,20 +1,20 @@
<%
- import org.exoplatform.portal.config.model.PageNavigation;
- import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.web.application.JavascriptManager;
import org.exoplatform.portal.webui.util.Util ;
import org.exoplatform.webui.organization.OrganizationUtils;
import org.gatein.common.text.EntityEncoder;
+ import org.exoplatform.portal.mop.user.UserNode;
def rcontext = _ctx.getRequestContext() ;
JavascriptManager jsmanager = rcontext.getJavascriptManager();
jsmanager.importJavascript('eXo.portal.UIPortalNavigation') ;
jsmanager.importJavascript('eXo.portal.UIAdminToolbar') ;
jsmanager.addCustomizedOnLoadScript('eXo.portal.UIAdminToolbar.onLoad("' +
uicomponent.id + '");');
-
+
def portalURI = Util.getPortalRequestContext().getPortalURI();
+
void renderPortalNavigations() {
-
+ def nodes = uicomponent.getCurrentPortalNavigation();
print """
<div style="position: absolute; display:none"
class="MenuItemContainer">
<div class="SubBlock">
@@ -22,9 +22,6 @@
boolean isCurrent = false;
String clazz = "";
String href = "#";
-
- def navigation = uicomponent.getCurrentPortalNavigation();
- def nodes = navigation.getNodes();
for(int i = 0; i < uicomponent.getAllPortalNames().size(); i++) {
String portal = uicomponent.getAllPortalNames().get(i);
@@ -55,16 +52,16 @@
</div>
""";
}
-
+
void renderCurrentPortal() {
- navigation = uicomponent.getCurrentPortalNavigation();
- nodes = navigation.getNodes();
+ def nodes = uicomponent.getCurrentPortalNavigation();
print """
<div style="position: absolute; display:none"
class="MenuItemContainer">
<div class="SubBlock">
""";
- for(int i = 0; i < nodes.size(); i++) {
- renderPageNode(nodes.get(i), i%2 == 0);
+ int idx = 0;
+ for(UserNode node : nodes) {
+ renderPageNode(node, idx++ % 2 == 0);
}
print """
</div>
@@ -72,17 +69,17 @@
""";
}
- void renderPageNode(PageNode node, boolean flag) {
- PageNode selectedNode = uicomponent.getSelectedPageNode();
+ void renderPageNode(UserNode node, boolean flag) {
+ UserNode selectedNode = uicomponent.getSelectedNode();
String tabStyleNavigation = "";
- if(selectedNode != null && node.getUri() == selectedNode.getUri()) {
+ if(selectedNode != null && node.getURI() == selectedNode.getURI()) {
tabStyleNavigation = "SelectedItem";
}
boolean hasChild = (node.getChildren() != null && node.getChildren().size()
> 0);
String clazz = "";
if(hasChild) clazz = "ArrowIcon";
- String href = Util.getPortalRequestContext().getPortalURI() + node.getUri();
+ String href = Util.getPortalRequestContext().getPortalURI() + node.getURI();
String icon = node.getIcon();
if(icon == null) icon = "DefaultPageIcon";
boolean toolong = (node.resolvedLabel.length() > 60);
@@ -96,7 +93,7 @@
<div class="MenuItem $tabStyleNavigation">
<div class="$clazz">
""";
- if(node.pageReference != null) {
+ if(node.pageRef != null) {
print """<a class="ItemIcon $icon"
href="$href" $title>$label</a>""";
} else {
print """<a class="ItemIcon $icon" href="#"
$title>$label</a>""";
@@ -109,8 +106,9 @@
<div class="MenuItemContainer" style="position: absolute;
display:none">
<div class="SubBlock">
""" ;
- for(int j = 0; j < node.getChildren().size(); j++) {
- renderPageNode(node.getChildren().get(j), j%2 == 0);
+ int idx = 0;
+ for(UserNode child : node.getChildren()) {
+ renderPageNode(child, idx++ % 2 == 0);
}
print """
</div>
@@ -121,7 +119,7 @@
print """
</div>
""" ;
- }
+ }
%>
<div class="UIUserToolBarSitePortlet" id="$uicomponent.id" >
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/webapp/groovy/navigation/webui/component/UINavigationGrid.gtmpl
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/webapp/groovy/navigation/webui/component/UINavigationGrid.gtmpl 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/portlet/exoadmin/src/main/webapp/groovy/navigation/webui/component/UINavigationGrid.gtmpl 2011-03-16
21:04:51 UTC (rev 6051)
@@ -1,25 +1,27 @@
<%
import java.util.List;
- import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.webui.organization.OrganizationUtils;
+ import org.exoplatform.portal.mop.SiteKey;
def parent = uicomponent.getParent();
- def navigations = (List<PageNavigation>) uicomponent.getBeans();
+ def navigations = uicomponent.getBeans();
%>
<div id="$uicomponent.id" class="FeedBox">
<%
boolean isEvenRow = true;
- for(navigation in navigations) {
- deleteLink =
parent.event("DeleteNavigation",String.valueOf(navigation.getId()));
- editProperties =
parent.event("EditProperties",String.valueOf(navigation.getId()));
- editLink =
parent.event("EditNavigation",String.valueOf(navigation.getId()));%>
+ SiteKey siteKey;
+ for(navigation in navigations) {
+ siteKey = navigation.getKey();
+ deleteLink =
parent.event("DeleteNavigation",String.valueOf(siteKey.getName()));
+ editProperties =
parent.event("EditProperties",String.valueOf(siteKey.getName()));
+ editLink =
parent.event("EditNavigation",String.valueOf(siteKey.getName()));%>
<table class="ManagementBlock <%=isEvenRow ?
"EvenRow":"OddRow"%>" style="table-layout:
fixed">
<tr>
<td class="Image"><img
src="/exoadmin/skin/navigation/webui/component/background/GroupImage.png"
alt="" /></td>
<td class="Content">
- <div class="Label" title="$navigation.ownerId"><%=
OrganizationUtils.getGroupLabel(navigation.ownerId) %></div>
-
<div><%=_ctx.appRes("UIGroupNavigationManagement.Label.Description")%>:
<%= OrganizationUtils.getGroupDescription(navigation.ownerId) %></div>
+ <div class="Label" title="$siteKey.name"><%=
OrganizationUtils.getGroupLabel(siteKey.getName()) %></div>
+
<div><%=_ctx.appRes("UIGroupNavigationManagement.Label.Description")%>:
<%= OrganizationUtils.getGroupDescription(siteKey.getName()) %></div>
</td>
<td class="ActionBlock">
<a href="<%=editLink%>"
class="EditNavIcon"><%=_ctx.appRes("UIGroupNavigationManagement.Label.EditNavigation")%></a>
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UIBreadcumbsPortlet.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UIBreadcumbsPortlet.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UIBreadcumbsPortlet.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -19,7 +19,7 @@
package org.exoplatform.portal.webui.component;
-import org.exoplatform.portal.config.model.PageNode;
+import org.exoplatform.portal.mop.user.UserNode;
import org.exoplatform.portal.webui.portal.PageNodeEvent;
import org.exoplatform.portal.webui.portal.UIPortal;
import org.exoplatform.portal.webui.util.Util;
@@ -28,14 +28,14 @@
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.UIBreadcumbs;
+import org.exoplatform.webui.core.UIBreadcumbs.LocalPath;
import org.exoplatform.webui.core.UIPortletApplication;
-import org.exoplatform.webui.core.UIBreadcumbs.LocalPath;
-import org.exoplatform.webui.core.UIBreadcumbs.SelectPathActionListener;
import org.exoplatform.webui.core.lifecycle.UIApplicationLifecycle;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import javax.portlet.PortletPreferences;
@@ -62,23 +62,27 @@
uiBreadCumbs.setTemplate(template);
}
- public void loadSelectedPath()
+ private void loadSelectedPath() throws Exception
{
- List<PageNode> nodes = Util.getUIPortal().getSelectedPath();
+ UserNode node = Util.getUIPortal().getSelectedUserNode();
List<LocalPath> paths = new ArrayList<LocalPath>();
- for (PageNode node : nodes)
+
+ do
{
- if (node == null)
- continue;
- if (node.getPageReference() == null)
+ if (node.getPageRef() == null)
{
paths.add(new LocalPath(null, node.getResolvedLabel()));
}
else
{
- paths.add(new LocalPath(node.getUri(), node.getResolvedLabel()));
+ paths.add(new LocalPath(node.getURI(), node.getResolvedLabel()));
}
+ node = node.getParent();
}
+ while (node != null && node.getParent() != null);
+
+ Collections.reverse(paths);
+
UIBreadcumbs uiBreadCumbs = getChild(UIBreadcumbs.class);
uiBreadCumbs.setPath(paths);
}
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UILogoPortlet.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UILogoPortlet.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UILogoPortlet.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -19,8 +19,9 @@
package org.exoplatform.portal.webui.component;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.SiteType;
+import org.exoplatform.portal.mop.user.NavigationPath;
+import org.exoplatform.portal.mop.user.UserNavigation;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.services.organization.User;
import org.exoplatform.services.security.ConversationState;
@@ -54,12 +55,13 @@
public String getNavigationTitle() throws Exception
{
- PageNavigation navigation = Util.getUIPortal().getSelectedNavigation();
- if (navigation.getOwnerType().equals(PortalConfig.GROUP_TYPE))
+ NavigationPath navPath = Util.getUIPortal().getNavPath();
+ UserNavigation nav = navPath.getNavigation();
+ if (nav.getKey().getType().equals(SiteType.GROUP))
{
- return OrganizationUtils.getGroupLabel(navigation.getOwnerId());
+ return OrganizationUtils.getGroupLabel(nav.getKey().getName());
}
- else if (navigation.getOwnerType().equals(PortalConfig.USER_TYPE))
+ else if (nav.getKey().getType().equals(SiteType.USER))
{
ConversationState state = ConversationState.getCurrent();
User user = (User)state.getAttribute(CacheUserProfileFilter.USER_PROFILE);
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UISitemapPortlet.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UISitemapPortlet.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/portlet/web/src/main/java/org/exoplatform/portal/webui/component/UISitemapPortlet.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -38,7 +38,7 @@
* Jul 3, 2006
*/
@ComponentConfigs({
- @ComponentConfig(lifecycle = UIApplicationLifecycle.class, template =
"system:/groovy/webui/core/UISitemap2.gtmpl"),
+ @ComponentConfig(lifecycle = UIApplicationLifecycle.class, template =
"system:/groovy/webui/core/UISitemap.gtmpl"),
@ComponentConfig(type = UIPortalNavigation.class, id = "UISiteMap", events =
{
@EventConfig(listeners = UIPortalNavigation.SelectNodeActionListener.class),
@EventConfig(listeners = UIPortalNavigation.ExpandAllNodeActionListener.class),
@@ -57,7 +57,6 @@
String template = prefers.getValue("template",
"system:/groovy/webui/core/UISitemapTree.gtmpl");
UIPortalNavigation uiPortalNavigation = addChild(UIPortalNavigation.class,
"UISiteMap", null);
- uiPortalNavigation.loadTreeNodes();
uiPortalNavigation.setTemplate(template);
}
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/portlet/web/src/main/webapp/groovy/portal/webui/component/UIPortalNavigation.gtmpl
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/portlet/web/src/main/webapp/groovy/portal/webui/component/UIPortalNavigation.gtmpl 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/portlet/web/src/main/webapp/groovy/portal/webui/component/UIPortalNavigation.gtmpl 2011-03-16
21:04:51 UTC (rev 6051)
@@ -1,6 +1,5 @@
<%
- import org.exoplatform.portal.config.model.PageNode;
- import org.exoplatform.portal.config.model.PageNavigation;
+ import org.exoplatform.portal.mop.user.UserNode;
import org.exoplatform.web.application.JavascriptManager;
import org.exoplatform.portal.webui.util.Util;
import org.gatein.common.text.EntityEncoder;
@@ -14,9 +13,9 @@
jsmanager.addOnLoadJavascript('eXo.portal.UIPortalNavigation.loadScroll');
//jsmanager.addOnResizeJavascript('eXo.portal.UIPortalNavigation.initScroll');
- navigations = uicomponent.getNavigations();
+ rootNodes = uicomponent.getNavigations();
- public void renderChildrenContainer(PageNavigation nav, PageNode node) {
+ public void renderChildrenContainer(UserNode parentNode, UserNode node) {
print """
<div class="MenuItemContainer" style="display: none;">
<div class="MenuItemDecorator">
@@ -30,7 +29,7 @@
<div class="CenterMiddleMenuDecorator">
""";
for(child in node.getChildren()) {
- renderChildNode(nav, child);
+ renderChildNode(parentNode, child);
}
print """
</div>
@@ -45,22 +44,22 @@
</div>
""";
}
- public void renderChildNode(PageNavigation nav, PageNode node) {
- PageNode selectedNode = uicomponent.getSelectedPageNode();
- PageNavigation selectedNav = uicomponent.getSelectedNavigation();
+ public void renderChildNode(UserNode parentNode, UserNode node) {
+ UserNode selectedNode = uicomponent.getSelectedPageNode();
+ UserNode selectedNav = uicomponent.getCurrentNavigation();
String tabStyleNavigation = "NormalItem"; // OverItem
if(selectedNode != null && selectedNav != null &&
- selectedNav.getId () == nav.getId() &&
- node.getUri() == selectedNode.getUri()) {
+ selectedNav.getId () == parentNode.getId() &&
+ node.getURI() == selectedNode.getURI()) {
tabStyleNavigation = "SelectedItem";
}
String icon = node.getIcon();
if(icon == null) icon = "DefaultPageIcon";
String arrowIcon = "";
- if (node.getChildren() != null && node.getChildren().size() > 0) arrowIcon =
"ArrowIcon";
+ if (node.getChildren().size() > 0) arrowIcon = "ArrowIcon";
- String label = node.resolvedLabel;
+ String label = node.getResolvedLabel();
String title = "";
if(label.length() > 40) {
title = label;
@@ -68,10 +67,10 @@
}
EntityEncoder entityEncoder = EntityEncoder.FULL;
label = entityEncoder.encode(label);
- String pageURI = Util.getPortalRequestContext().getPortalURI() + node.getUri();
- if(node.pageReference != null) {
+ String pageURI = Util.getPortalRequestContext().getPortalURI() + node.getURI();
+ if(node.getPageRef() != null) {
if(uicomponent.isUseAjax()) {
- String onclickEvt = uicomponent.event("SelectNode", nav.getId() +
"::" + node.getUri()) + ";return false;" ;
+ String onclickEvt = uicomponent.event("SelectNode", parentNode.getId() +
"::" + node.getURI()) + ";return false;" ;
print """
<div class="MenuItem $tabStyleNavigation">
<div class="$arrowIcon" title="$title">
@@ -101,8 +100,8 @@
""";
}
- if (node.getChildren() != null && node.getChildren().size() > 0) {
- renderChildrenContainer(nav, node);
+ if (node.getChildren().size() > 0) {
+ renderChildrenContainer(parentNode, node);
}
print "</div>";
}
@@ -115,21 +114,20 @@
<div class="UIHorizontalTabs">
<div class="TabsContainer">
<%
- PageNavigation selectedNav = uicomponent.getSelectedNavigation();
- PageNode selectedNode = uicomponent.getSelectedPageNode();
- if(navigations != null) {
- for(nav in navigations) {
+ UserNode selectedNav = uicomponent.getCurrentNavigation();
+ UserNode selectedNode = uicomponent.getSelectedPageNode();
+ if(rootNodes != null) {
+ for(nav in rootNodes) {
- def pageNodes = nav.getNodes();
- for(PageNode node in pageNodes) {
+ def pageNodes = nav.getChildren();
+
+ for(Node node in pageNodes) {
String tabStyleNavigation = "NormalNavigationTab";
if(selectedNode != null && selectedNav != null &&
selectedNav.getId() == nav.getId() &&
- node.getUri() == selectedNode.getUri()) {
+ node.getURI() == selectedNode.getURI()) {
tabStyleNavigation = "SelectedNavigationTab";
}
- String icon = node.getIcon();
- if(icon == null) icon = "DefaultPageIcon";
%>
<div class="UITab">
@@ -140,7 +138,7 @@
<div class="TabIcon">
<%
String arrowIcon = "";
- if (node.getChildren() != null && node.getChildren().size() >
0) {
+ if (node.getChildren().size() > 0) {
arrowIcon = "DropDownArrowIcon";
}
String iconType = node.getIcon();
@@ -148,14 +146,14 @@
%>
<div class="$arrowIcon">
<%
- String pageURI = Util.getPortalRequestContext().getPortalURI() +
node.getUri();
- String label = node.resolvedLabel;
+ String pageURI = Util.getPortalRequestContext().getPortalURI() +
node.getURI();
+ String label = node.getResolvedLabel();
if(label.length() > 30) label = label.substring(0,29) +
"...";
EntityEncoder entityEncoder = EntityEncoder.FULL;
label=entityEncoder.encode(label);
- if(node.pageReference != null) {
+ if(node.getPageRef() != null) {
if(uicomponent.isUseAjax()) {
- String onclickEvt =
uicomponent.event("SelectNode", nav.getId() + "::" + node.getUri()) +
";return false;";
+ String onclickEvt =
uicomponent.event("SelectNode", nav.getId() + "::" + node.getURI()) +
";return false;";
%>
<a class="TabLabel ${iconType}"
onclick="$onclickEvt" href="$pageURI">$label</a>
<%
@@ -174,7 +172,7 @@
</div>
<%
/*Render Popup Menu*/
- if (node.getChildren() != null && node.getChildren().size() > 0)
{
+ if (node.getChildren().size() > 0) {
renderChildrenContainer(nav, node);
}
%>
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortal.js
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortal.js 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortal.js 2011-03-16
21:04:51 UTC (rev 6051)
@@ -658,18 +658,25 @@
* Clollapse or expand an element (all its children) of tree
* @param {Object} element object to collapse or expand
*/
-UIPortal.prototype.collapseExpand = function(element) {
+UIPortal.prototype.collapseExpand = function(element, actExpand, actCollapse) {
var subGroup = eXo.core.DOMUtil.findFirstChildByClass(element.parentNode,
"div", "ChildrenContainer") ;
var className = element.className;
- if(!subGroup) return false;
+ if(!subGroup) return;
if(subGroup.style.display == "none") {
if (className.indexOf("ExpandIcon") == 0) element.className =
"CollapseIcon ClearFix" ;
- subGroup.style.display = "block" ;
+// subGroup.style.display = "block" ;
+ if (actExpand)
+ {
+ actExpand.call();
+ }
} else {
if (className.indexOf("CollapseIcon") == 0) element.className =
"ExpandIcon ClearFix" ;
subGroup.style.display = "none" ;
+ if (actCollapse)
+ {
+ actCollapse.call();
+ }
}
- return true;
};
/*
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/web/eXoResources/src/main/webapp/javascript/eXo/webui/UITabbedDashboard.js
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/web/eXoResources/src/main/webapp/javascript/eXo/webui/UITabbedDashboard.js 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/web/eXoResources/src/main/webapp/javascript/eXo/webui/UITabbedDashboard.js 2011-03-16
21:04:51 UTC (rev 6051)
@@ -37,7 +37,7 @@
var DOMUtil = eXo.core.DOMUtil;
var portletFrag = DOMUtil.findAncestorByClass(inputElement,
"PORTLET-FRAGMENT");
var compId = portletFrag.parentNode.id;
- var nodeIndex = inputElement.id;
+ var nodeName = inputElement.id;
//Send request to server to change node name
var href = eXo.env.server.portalBaseURL + "?portal:componentId=" + compId;
@@ -45,7 +45,7 @@
href += "&portal:isSecure=false";
href += "&uicomponent=UITabPaneDashboard";
href += "&op=RenameTabLabel";
- href += "&objectId=" + nodeIndex;
+ href += "&objectId=" + nodeName;
href += "&newTabLabel=" + encodeURIComponent(newTabLabel);
window.location = href;
}
@@ -59,7 +59,7 @@
}
},
- showEditLabelInput : function(selectedElement, nodeIndex, currentContent){
+ showEditLabelInput : function(selectedElement, nodeName, currentContent){
eXo.webui.UITabbedDashboard.backupElement = selectedElement;
var prNode = selectedElement.parentNode;
var tabContainer = eXo.core.DOMUtil.findAncestorByClass(prNode,
"TabsContainer");
@@ -67,7 +67,7 @@
var inputElement = document.createElement("input");
inputElement.type = "text";
- inputElement.id = nodeIndex;
+ inputElement.id = nodeName;
inputElement.name = currentContent; // To store old value
inputElement.value = currentContent;
inputElement.style.border = "1px solid #b7b7b7";
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIVirtualList.js
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIVirtualList.js 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIVirtualList.js 2011-03-16
21:04:51 UTC (rev 6051)
@@ -29,7 +29,7 @@
childrenHeight += children[i].offsetHeight;
}
- if (!uiVirtualList.isFinished && childrenHeight <=
uiVirtualList.offsetHeight) {
+ if (!uiVirtualList.isFinished && childrenHeight <=
uiVirtualList.offsetHeight && childrenHeight != 0) {
uiVirtualList.onscroll();
} else {
uiVirtualList.isInitiated = true;
@@ -50,7 +50,7 @@
UIVirtualList.prototype.scrollMove = function(uiVirtualList, url) {
if (uiVirtualList.isFinished || uiVirtualList.isLocked) return;
var DOMUtil = eXo.core.DOMUtil;
-var componentHeight = uiVirtualList.offsetHeight;
+ var componentHeight = uiVirtualList.offsetHeight;
var scrollPosition = uiVirtualList.scrollTop;
var scrollerHeight = uiVirtualList.scrollHeight;
var scrollable_gap = scrollerHeight - (scrollPosition + componentHeight);
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ar.xml
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ar.xml 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ar.xml 2011-03-16
21:04:51 UTC (rev 6051)
@@ -839,7 +839,7 @@
# org.exoplatform.portal.component.customization.UIPageSelector#
#############################################################################
-->
- <UIPageSelector2>
+ <UIPageSelector>
<header>
<name> اسم</name>
<id> صفحة رقم</id>
@@ -856,7 +856,7 @@
<name> #{word.name}</name>
<accessGroups> مجموعات الوصول</accessGroups>
</label>
- </UIPageSelector2>
+ </UIPageSelector>
<UIPageBrowser>
<msg>
<NoPermission> لا يوجد لديك إذن لدخول هذه الصفحة.</NoPermission>
@@ -1057,7 +1057,7 @@
<label>
<PageNodeSetting>عقدة إعداد الصفحة </PageNodeSetting>
<Icon>#{word.icon} </Icon>
- <UIPageSelector2>تحديد الصفحة </UIPageSelector2>
+ <UIPageSelector>تحديد الصفحة </UIPageSelector>
</label>
</tab>
<action>
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_de.properties
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_de.properties 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_de.properties 2011-03-16
21:04:51 UTC (rev 6051)
@@ -393,18 +393,18 @@
# org.exoplatform.portal.component.customization.UIPageSelector#
#############################################################################
-UIPageSelector2.header.name=Name
-UIPageSelector2.header.id=Seiten-ID
-UIPageSelector2.header.accessGroups=Gruppen
-UIPageSelector2.header.title=#{word.title}
-UIPageSelector2.header.action=#{word.action}
-UIPageSelector2.label.clearPage=Seiten leeren
-UIPageSelector2.label.createPage=Seite erstellen
-UIPageSelector2.label.searchandSelectPage=Seite suchen und ausw\u00e4hlen
-UIPageSelector2.label.currentSelectedPage=Ausgew\u00e4hlte Seite
-UIPageSelector2.label.title=Titel
-UIPageSelector2.label.name=#{word.name}
-UIPageSelector2.label.accessGroups=Gruppen
+UIPageSelector.header.name=Name
+UIPageSelector.header.id=Seiten-ID
+UIPageSelector.header.accessGroups=Gruppen
+UIPageSelector.header.title=#{word.title}
+UIPageSelector.header.action=#{word.action}
+UIPageSelector.label.clearPage=Seiten leeren
+UIPageSelector.label.createPage=Seite erstellen
+UIPageSelector.label.searchandSelectPage=Seite suchen und ausw\u00e4hlen
+UIPageSelector.label.currentSelectedPage=Ausgew\u00e4hlte Seite
+UIPageSelector.label.title=Titel
+UIPageSelector.label.name=#{word.name}
+UIPageSelector.label.accessGroups=Gruppen
UIPageBrowser.msg.NoPermission=Sie haben keine Zugriffsberechtigung f\u00fcr diese
Seite.
UIPageBrowser.msg.PageNotExist=Die Seite existiert nicht.
UIPageBrowser.msg.UserNotPermission=Sie haben keine Zugriffsberechtigung f\u00fcr die
Seite dieses Knotens.
@@ -516,7 +516,7 @@
UIPageNodeForm.Icon.title.SetDefault=Standardeinstellung
UIPageNodeForm.tab.label.PageNodeSetting=Seitenknoten-Eigenschaften
UIPageNodeForm.tab.label.Icon=#{word.icon}
-UIPageNodeForm.tab.label.UIPageSelector2=Seiten-Auswahl
+UIPageNodeForm.tab.label.UIPageSelector=Seiten-Auswahl
#############################################################################
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_en.properties 2011-03-16
21:04:51 UTC (rev 6051)
@@ -409,18 +409,18 @@
# org.exoplatform.portal.component.customization.UIPageSelector#
#############################################################################
-UIPageSelector2.header.name=Name
-UIPageSelector2.header.id=Page Id
-UIPageSelector2.header.accessGroups=Access groups
-UIPageSelector2.header.title=#{word.title}
-UIPageSelector2.header.action=#{word.action}
-UIPageSelector2.label.clearPage=Clear Page
-UIPageSelector2.label.createPage=Create Page
-UIPageSelector2.label.searchandSelectPage=Search and Select Page
-UIPageSelector2.label.currentSelectedPage=Selected Page Info
-UIPageSelector2.label.title=Title
-UIPageSelector2.label.name=#{word.name}
-UIPageSelector2.label.accessGroups=Access groups
+UIPageSelector.header.name=Name
+UIPageSelector.header.id=Page Id
+UIPageSelector.header.accessGroups=Access groups
+UIPageSelector.header.title=#{word.title}
+UIPageSelector.header.action=#{word.action}
+UIPageSelector.label.clearPage=Clear Page
+UIPageSelector.label.createPage=Create Page
+UIPageSelector.label.searchandSelectPage=Search and Select Page
+UIPageSelector.label.currentSelectedPage=Selected Page Info
+UIPageSelector.label.title=Title
+UIPageSelector.label.name=#{word.name}
+UIPageSelector.label.accessGroups=Access groups
UIPageBrowser.msg.NoPermission=You have no permission to access this page.
UIPageBrowser.msg.PageNotExist=Page doesn't exist.
UIPageBrowser.msg.UserNotPermission=You have no permission to access the node's
page.
@@ -544,7 +544,7 @@
UIPageNodeForm.Icon.title.SetDefault=Get Default
UIPageNodeForm.tab.label.PageNodeSetting=Page Node Setting
UIPageNodeForm.tab.label.Icon=#{word.icon}
-UIPageNodeForm.tab.label.UIPageSelector2=Page Selector
+UIPageNodeForm.tab.label.UIPageSelector=Page Selector
UIPageNodeForm.action.Save=#{word.save}
UIPageNodeForm.action.Back=#{word.back}
@@ -1292,6 +1292,7 @@
UIPortalNavigation.Label.Next=Next
UIPortalNavigation.Label.Previous=Previous
+UIPortalNavigation.msg.staleData=Node may be deleted
#############################################################################
# org.exoplatform.portal.component.customization.UIDropDownConfigs #
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_es.properties
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_es.properties 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_es.properties 2011-03-16
21:04:51 UTC (rev 6051)
@@ -391,18 +391,18 @@
# org.exoplatform.portal.component.customization.UIPageSelector#
#############################################################################
-UIPageSelector2.header.name=Nombre
-UIPageSelector2.header.id=Id de P\u00e1gina
-UIPageSelector2.header.accessGroups=Grupos de Acceso
-UIPageSelector2.header.title=#{word.title}
-UIPageSelector2.header.action=#{word.action}
-UIPageSelector2.label.clearPage=Limpiar P\u00e1gina
-UIPageSelector2.label.createPage=Crear P\u00e1gina
-UIPageSelector2.label.searchandSelectPage=Buscar y Seleccionar P\u00e1gina
-UIPageSelector2.label.currentSelectedPage=Informaci\u00f3n de la P\u00e1gina
Seleccionada
-UIPageSelector2.label.title=T\u00edtulo
-UIPageSelector2.label.name=#{word.name}
-UIPageSelector2.label.accessGroups=Grupos de Acceso
+UIPageSelector.header.name=Nombre
+UIPageSelector.header.id=Id de P\u00e1gina
+UIPageSelector.header.accessGroups=Grupos de Acceso
+UIPageSelector.header.title=#{word.title}
+UIPageSelector.header.action=#{word.action}
+UIPageSelector.label.clearPage=Limpiar P\u00e1gina
+UIPageSelector.label.createPage=Crear P\u00e1gina
+UIPageSelector.label.searchandSelectPage=Buscar y Seleccionar P\u00e1gina
+UIPageSelector.label.currentSelectedPage=Informaci\u00f3n de la P\u00e1gina Seleccionada
+UIPageSelector.label.title=T\u00edtulo
+UIPageSelector.label.name=#{word.name}
+UIPageSelector.label.accessGroups=Grupos de Acceso
UIPageBrowser.msg.NoPermission=No tienes permisos para acceder a esta p\u00e1gina.
UIPageBrowser.msg.PageNotExist=La p\u00e1gina no existe.
UIPageBrowser.msg.UserNotPermission=No tienes permisos para acceder a la p\u00e1gina del
nodo.
@@ -514,7 +514,7 @@
UIPageNodeForm.Icon.title.SetDefault=Obtener el por Defecto
UIPageNodeForm.tab.label.PageNodeSetting=Ajustes de Nodo de P\u00e1gina
UIPageNodeForm.tab.label.Icon=#{word.icon}
-UIPageNodeForm.tab.label.UIPageSelector2=Selector P\u00e1gina
+UIPageNodeForm.tab.label.UIPageSelector=Selector P\u00e1gina
#############################################################################
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_fr.properties
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_fr.properties 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_fr.properties 2011-03-16
21:04:51 UTC (rev 6051)
@@ -382,18 +382,18 @@
# org.exoplatform.portal.component.customization.UIPageSelector#
#############################################################################
-UIPageSelector2.header.name=Nom
-UIPageSelector2.header.id=Id Page
-UIPageSelector2.header.accessGroups=Groupe d'accès
-UIPageSelector2.header.title=#{word.title}
-UIPageSelector2.header.action=#{word.action}
-UIPageSelector2.label.searchandSelectPage=Recherche et Sélection d'une Page
-UIPageSelector2.label.currentSelectedPage=Information sur la page sélectionnée
-UIPageSelector2.label.title=Titre
-UIPageSelector2.label.name=#{word.name}
-UIPageSelector2.label.accessGroups=Groupes
-UIPageSelector2.label.createPage=Créer Page
-UIPageSelector2.label.clearPage=Clear Page
+UIPageSelector.header.name=Nom
+UIPageSelector.header.id=Id Page
+UIPageSelector.header.accessGroups=Groupe d'accès
+UIPageSelector.header.title=#{word.title}
+UIPageSelector.header.action=#{word.action}
+UIPageSelector.label.searchandSelectPage=Recherche et Sélection d'une Page
+UIPageSelector.label.currentSelectedPage=Information sur la page sélectionnée
+UIPageSelector.label.title=Titre
+UIPageSelector.label.name=#{word.name}
+UIPageSelector.label.accessGroups=Groupes
+UIPageSelector.label.createPage=Créer Page
+UIPageSelector.label.clearPage=Clear Page
UIPageBrowser.msg.NoPermission=Vous n'avez pas les droits d'accès à cette page!
UIPageBrowser.msg.PageNotExist=La page n'existe pas
UIPageBrowser.msg.UserNotPermission=Vous n'avez pas les droits d'accès à ce noeud
de page!
@@ -503,7 +503,7 @@
UIPageNodeForm.Icon.title.SetDefault=Valeur par défaut
UIPageNodeForm.tab.label.PageNodeSetting=Configuration du noeud
UIPageNodeForm.tab.label.Icon=#{word.icon}
-UIPageNodeForm.tab.label.UIPageSelector2=Sélecteur de page
+UIPageNodeForm.tab.label.UIPageSelector=Sélecteur de page
#############################################################################
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_it.properties
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_it.properties 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_it.properties 2011-03-16
21:04:51 UTC (rev 6051)
@@ -409,18 +409,18 @@
# org.exoplatform.portal.component.customization.UIPageSelector#
#############################################################################
-UIPageSelector2.header.name=Nome
-UIPageSelector2.header.id=Id della Pagina
-UIPageSelector2.header.accessGroups=Accesso ai Gruppi
-UIPageSelector2.header.title=#{word.title}
-UIPageSelector2.header.action=#{word.action}
-UIPageSelector2.label.clearPage=Azzera la pagina
-UIPageSelector2.label.createPage=Crea la Pagina
-UIPageSelector2.label.searchandSelectPage=Ricerca e seleziona la Pagina
-UIPageSelector2.label.currentSelectedPage=Info sulla Pagina selezionata
-UIPageSelector2.label.title=Titolo
-UIPageSelector2.label.name=#{word.name}
-UIPageSelector2.label.accessGroups=Accesso ai Gruppi
+UIPageSelector.header.name=Nome
+UIPageSelector.header.id=Id della Pagina
+UIPageSelector.header.accessGroups=Accesso ai Gruppi
+UIPageSelector.header.title=#{word.title}
+UIPageSelector.header.action=#{word.action}
+UIPageSelector.label.clearPage=Azzera la pagina
+UIPageSelector.label.createPage=Crea la Pagina
+UIPageSelector.label.searchandSelectPage=Ricerca e seleziona la Pagina
+UIPageSelector.label.currentSelectedPage=Info sulla Pagina selezionata
+UIPageSelector.label.title=Titolo
+UIPageSelector.label.name=#{word.name}
+UIPageSelector.label.accessGroups=Accesso ai Gruppi
UIPageBrowser.msg.NoPermission=Non hai i permessi per accedere alla pagina.
UIPageBrowser.msg.PageNotExist=La pagina non esiste.
UIPageBrowser.msg.UserNotPermission=Non hai i permessi per accedere al nodo della
pagina.
@@ -544,7 +544,7 @@
UIPageNodeForm.Icon.title.SetDefault=Ottieno il Default
UIPageNodeForm.tab.label.PageNodeSetting=Preferenze del Nodo della Pagina
UIPageNodeForm.tab.label.Icon=#{word.icon}
-UIPageNodeForm.tab.label.UIPageSelector2=Selettore della Pagina
+UIPageNodeForm.tab.label.UIPageSelector=Selettore della Pagina
UIPageNodeForm.action.Save=#{word.save}
UIPageNodeForm.action.Back=#{word.back}
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ja.properties
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ja.properties 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ja.properties 2011-03-16
21:04:51 UTC (rev 6051)
@@ -393,18 +393,18 @@
# org.exoplatform.portal.component.customization.UIPageSelector#
#############################################################################
-UIPageSelector2.header.name=\u540d\u524d
-UIPageSelector2.header.id=\u30da\u30fc\u30b8ID
-UIPageSelector2.header.accessGroups=\u30b0\u30eb\u30fc\u30d7\u306b\u30a2\u30af\u30bb\u30b9
-UIPageSelector2.header.title=#{word.title}
-UIPageSelector2.header.action=#{word.action}
-UIPageSelector2.label.clearPage=\u30da\u30fc\u30b8\u3092\u30af\u30ea\u30a2
-UIPageSelector2.label.createPage=\u30da\u30fc\u30b8\u3092\u4f5c\u6210
-UIPageSelector2.label.searchandSelectPage=\u30da\u30fc\u30b8\u3092\u691c\u7d22\u3057\u5909\u66f4
-UIPageSelector2.label.currentSelectedPage=\u9078\u629e\u3057\u305f\u30da\u30fc\u30b8\u60c5\u5831
-UIPageSelector2.label.title=\u30bf\u30a4\u30c8\u30eb
-UIPageSelector2.label.name=#{word.name}
-UIPageSelector2.label.accessGroups=\u30b0\u30eb\u30fc\u30d7\u306b\u30a2\u30af\u30bb\u30b9
+UIPageSelector.header.name=\u540d\u524d
+UIPageSelector.header.id=\u30da\u30fc\u30b8ID
+UIPageSelector.header.accessGroups=\u30b0\u30eb\u30fc\u30d7\u306b\u30a2\u30af\u30bb\u30b9
+UIPageSelector.header.title=#{word.title}
+UIPageSelector.header.action=#{word.action}
+UIPageSelector.label.clearPage=\u30da\u30fc\u30b8\u3092\u30af\u30ea\u30a2
+UIPageSelector.label.createPage=\u30da\u30fc\u30b8\u3092\u4f5c\u6210
+UIPageSelector.label.searchandSelectPage=\u30da\u30fc\u30b8\u3092\u691c\u7d22\u3057\u5909\u66f4
+UIPageSelector.label.currentSelectedPage=\u9078\u629e\u3057\u305f\u30da\u30fc\u30b8\u60c5\u5831
+UIPageSelector.label.title=\u30bf\u30a4\u30c8\u30eb
+UIPageSelector.label.name=#{word.name}
+UIPageSelector.label.accessGroups=\u30b0\u30eb\u30fc\u30d7\u306b\u30a2\u30af\u30bb\u30b9
UIPageBrowser.msg.NoPermission=\u3053\u306e\u30da\u30fc\u30b8\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u30d1\u30fc\u30df\u30c3\u30b7\u30e7\u30f3\u304c\u3042\u308a\u307e\u305b\u3093\u3002
UIPageBrowser.msg.PageNotExist=\u30da\u30fc\u30b8
\u306f\u5b58\u5728\u3057\u307e\u305b\u3093\u3002
UIPageBrowser.msg.UserNotPermission=\u305d\u306e\u30ce\u30fc\u30c9\u306e\u30da\u30fc\u30b8\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u30d1\u30fc\u30df\u30c3\u30b7\u30e7\u30f3\u304c\u3042\u308a\u307e\u305b\u3093\u3002
@@ -516,7 +516,7 @@
UIPageNodeForm.Icon.title.SetDefault=\u30c7\u30d5\u30a9\u30eb\u30c8
UIPageNodeForm.tab.label.PageNodeSetting=\u30da\u30fc\u30b8\u30ce\u30fc\u30c9\u8a2d\u5b9a
UIPageNodeForm.tab.label.Icon=#{word.icon}
-UIPageNodeForm.tab.label.UIPageSelector2=\u30da\u30fc\u30b8\u9078\u629e
+UIPageNodeForm.tab.label.UIPageSelector=\u30da\u30fc\u30b8\u9078\u629e
#############################################################################
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ko.xml
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ko.xml 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ko.xml 2011-03-16
21:04:51 UTC (rev 6051)
@@ -617,7 +617,7 @@
<done>완료</done>
</action>
</UIGroupSelector>
- <UIPageSelector2>
+ <UIPageSelector>
<header>
<name>이름</name>
<id>페이지 아이디</id>
@@ -634,7 +634,7 @@
<name>#{word.name}</name>
<accessGroups>액세스 그룹</accessGroups>
</label>
- </UIPageSelector2>
+ </UIPageSelector>
<UIPageBrowser>
<msg>
<NoPermission>이 페이지의 액세스 권한이 없습니다.</NoPermission>
@@ -818,7 +818,7 @@
<label>
<PageNodeSetting>페이지 노드 설정</PageNodeSetting>
<Icon>#{word.icon}</Icon>
- <UIPageSelector2>페이지 선택기</UIPageSelector2>
+ <UIPageSelector>페이지 선택기</UIPageSelector>
</label>
</tab>
</UIPageNodeForm>
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ne.properties
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ne.properties 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ne.properties 2011-03-16
21:04:51 UTC (rev 6051)
@@ -393,18 +393,18 @@
# org.exoplatform.portal.component.customization.UIPageSelector#
#############################################################################
-UIPageSelector2.header.name=\u0928\u093e\u092e
-UIPageSelector2.header.id=\u092a\u0947\u091c Id
-UIPageSelector2.header.accessGroups=\u0905\u0928\u0941\u092e\u0924\u0940
\u092a\u093e\u0909\u0928\u0947 \u0938\u092e\u0941\u0939\u0939\u0930\u0941
-UIPageSelector2.header.title=#{word.title}
-UIPageSelector2.header.action=#{word.action}
-UIPageSelector2.label.clearPage=\u092a\u0947\u091c \u0916\u093e\u0932\u0940
\u0917\u0930\u094d\u0928\u0941\u0939\u094b\u0938\u094d
-UIPageSelector2.label.createPage=\u092a\u0947\u091c
\u092c\u0928\u093e\u0909\u0928\u0941\u0939\u094b\u0938\u094d
-UIPageSelector2.label.searchandSelectPage=\u0916\u094b\u091c\u0947\u0930
\u092a\u0947\u091c \u091b\u0928\u094c\u091f
\u0917\u0930\u094d\u0928\u0941\u0939\u094b\u0938\u094d
-UIPageSelector2.label.currentSelectedPage=\u091b\u0928\u094c\u091f
\u0917\u0930\u093f\u090f\u0915\u094b \u092a\u0947\u091c\u0915\u094b
\u092a\u0930\u093f\u091a\u092f
-UIPageSelector2.label.title=\u0936\u093f\u0930\u094d\u0937\u0915
-UIPageSelector2.label.name=#{word.name}
-UIPageSelector2.label.accessGroups=\u0905\u0928\u0941\u092e\u0924\u0940
\u092a\u093e\u0909\u0928\u0947 \u0938\u092e\u0941\u0939\u0939\u0930\u0941
+UIPageSelector.header.name=\u0928\u093e\u092e
+UIPageSelector.header.id=\u092a\u0947\u091c Id
+UIPageSelector.header.accessGroups=\u0905\u0928\u0941\u092e\u0924\u0940
\u092a\u093e\u0909\u0928\u0947 \u0938\u092e\u0941\u0939\u0939\u0930\u0941
+UIPageSelector.header.title=#{word.title}
+UIPageSelector.header.action=#{word.action}
+UIPageSelector.label.clearPage=\u092a\u0947\u091c \u0916\u093e\u0932\u0940
\u0917\u0930\u094d\u0928\u0941\u0939\u094b\u0938\u094d
+UIPageSelector.label.createPage=\u092a\u0947\u091c
\u092c\u0928\u093e\u0909\u0928\u0941\u0939\u094b\u0938\u094d
+UIPageSelector.label.searchandSelectPage=\u0916\u094b\u091c\u0947\u0930
\u092a\u0947\u091c \u091b\u0928\u094c\u091f
\u0917\u0930\u094d\u0928\u0941\u0939\u094b\u0938\u094d
+UIPageSelector.label.currentSelectedPage=\u091b\u0928\u094c\u091f
\u0917\u0930\u093f\u090f\u0915\u094b \u092a\u0947\u091c\u0915\u094b
\u092a\u0930\u093f\u091a\u092f
+UIPageSelector.label.title=\u0936\u093f\u0930\u094d\u0937\u0915
+UIPageSelector.label.name=#{word.name}
+UIPageSelector.label.accessGroups=\u0905\u0928\u0941\u092e\u0924\u0940
\u092a\u093e\u0909\u0928\u0947 \u0938\u092e\u0941\u0939\u0939\u0930\u0941
UIPageBrowser.msg.NoPermission=\u0924\u092a\u093e\u0908\u0902\u0932\u093e\u0908
\u092f\u094b \u092a\u0947\u091c \u0939\u0947\u0930\u094d\u0928\u0947
\u0905\u0928\u0941\u092e\u0924\u0940 \u091b\u0948\u0928\u0964
UIPageBrowser.msg.PageNotExist=\u092a\u0947\u091c \u0909\u092a\u0932\u092c\u094d\u0927
\u091b\u0948\u0928\u0964
UIPageBrowser.msg.UserNotPermission=\u0924\u092a\u093e\u0908\u0902\u0932\u093e\u0908
\u092f\u094b \u0928\u094b\u0921\u0915\u094b \u092a\u0947\u091c
\u0939\u0947\u0930\u094d\u0928\u0947 \u0905\u0928\u0941\u092e\u0924\u0940
\u091b\u0948\u0928\u0964
@@ -516,7 +516,7 @@
UIPageNodeForm.Icon.title.SetDefault=\u0921\u093f\u092b\u094c\u0932\u094d\u091f
\u092a\u093e\u0909\u0928\u0941\u0939\u094b\u0938\u094d
UIPageNodeForm.tab.label.PageNodeSetting=\u092a\u0947\u091c \u0928\u094b\u0921
\u0935\u094d\u092f\u0935\u0938\u094d\u0925\u093e\u092a\u0928
UIPageNodeForm.tab.label.Icon=#{word.icon}
-UIPageNodeForm.tab.label.UIPageSelector2=\u092a\u0947\u091c\u0915\u094b
\u091b\u0928\u094c\u091f\u094d\u0915\u0930\u094d\u0924\u093e
+UIPageNodeForm.tab.label.UIPageSelector=\u092a\u0947\u091c\u0915\u094b
\u091b\u0928\u094c\u091f\u094d\u0915\u0930\u094d\u0924\u093e
#############################################################################
# org.exoplatform.portal.component.customization.UIPageBrowser #
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_nl.properties
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_nl.properties 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_nl.properties 2011-03-16
21:04:51 UTC (rev 6051)
@@ -393,18 +393,18 @@
# org.exoplatform.portal.component.customization.UIPageSelector#
#############################################################################
-UIPageSelector2.header.name=#{word.name}:
-UIPageSelector2.header.id=Page Id
-UIPageSelector2.header.accessGroups=Toegang groepen
-UIPageSelector2.header.title=#{word.title}
-UIPageSelector2.header.action=#{word.action}
-UIPageSelector2.label.clearPage=Wis pagina
-UIPageSelector2.label.createPage=Cre\u00EBer pagina
-UIPageSelector2.label.searchandSelectPage=Zoek en selecteer pagina
-UIPageSelector2.label.currentSelectedPage=Geselecteerde pagina informatie
-UIPageSelector2.label.title=#{word.title}
-UIPageSelector2.label.name=#{word.name}
-UIPageSelector2.label.accessGroups=Toegang groepen
+UIPageSelector.header.name=#{word.name}:
+UIPageSelector.header.id=Page Id
+UIPageSelector.header.accessGroups=Toegang groepen
+UIPageSelector.header.title=#{word.title}
+UIPageSelector.header.action=#{word.action}
+UIPageSelector.label.clearPage=Wis pagina
+UIPageSelector.label.createPage=Cre\u00EBer pagina
+UIPageSelector.label.searchandSelectPage=Zoek en selecteer pagina
+UIPageSelector.label.currentSelectedPage=Geselecteerde pagina informatie
+UIPageSelector.label.title=#{word.title}
+UIPageSelector.label.name=#{word.name}
+UIPageSelector.label.accessGroups=Toegang groepen
UIPageBrowser.msg.NoPermission=U heeft geen permissies om deze pagina te bezoeken.
UIPageBrowser.msg.PageNotExist=Pagina bestaat niet.
UIPageBrowser.msg.UserNotPermission=U heeft geen permissie op deze node van de pagina.
@@ -516,7 +516,7 @@
UIPageNodeForm.Icon.title.SetDefault=Standaard
UIPageNodeForm.tab.label.PageNodeSetting=Pagina node instellingen
UIPageNodeForm.tab.label.Icon=#{word.icon}
-UIPageNodeForm.tab.label.UIPageSelector2=Pagina selecteur
+UIPageNodeForm.tab.label.UIPageSelector=Pagina selecteur
#############################################################################
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_pt_BR.properties
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_pt_BR.properties 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_pt_BR.properties 2011-03-16
21:04:51 UTC (rev 6051)
@@ -389,18 +389,18 @@
# org.exoplatform.portal.component.customization.UIPageSelector#
#############################################################################
-UIPageSelector2.header.name=Nome
-UIPageSelector2.header.id=Id de Página
-UIPageSelector2.header.accessGroups=Grupos de Acesso
-UIPageSelector2.header.title=#{word.title}
-UIPageSelector2.header.action=#{word.action}
-UIPageSelector2.label.clearPage=Limpar Página
-UIPageSelector2.label.createPage=Criar Página
-UIPageSelector2.label.searchandSelectPage=Selecionar Página
-UIPageSelector2.label.currentSelectedPage=Informações da Página
-UIPageSelector2.label.title=Título
-UIPageSelector2.label.name=#{word.name}
-UIPageSelector2.label.accessGroups=Grupos de Acesso
+UIPageSelector.header.name=Nome
+UIPageSelector.header.id=Id de Página
+UIPageSelector.header.accessGroups=Grupos de Acesso
+UIPageSelector.header.title=#{word.title}
+UIPageSelector.header.action=#{word.action}
+UIPageSelector.label.clearPage=Limpar Página
+UIPageSelector.label.createPage=Criar Página
+UIPageSelector.label.searchandSelectPage=Selecionar Página
+UIPageSelector.label.currentSelectedPage=Informações da Página
+UIPageSelector.label.title=Título
+UIPageSelector.label.name=#{word.name}
+UIPageSelector.label.accessGroups=Grupos de Acesso
UIPageBrowser.msg.NoPermission=Usuário sem permissão para acessar essa página.
UIPageBrowser.msg.PageNotExist=Página não existente.
UIPageBrowser.msg.UserNotPermission=Usuário sem permissão para acessar o nodo dessa
página.
@@ -512,7 +512,7 @@
UIPageNodeForm.Icon.title.SetDefault=Usar padrão
UIPageNodeForm.tab.label.PageNodeSetting=Configurações de Nodo
UIPageNodeForm.tab.label.Icon=#{word.icon}
-UIPageNodeForm.tab.label.UIPageSelector2=Seletor de Página
+UIPageNodeForm.tab.label.UIPageSelector=Seletor de Página
#############################################################################
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ru.properties
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ru.properties 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_ru.properties 2011-03-16
21:04:51 UTC (rev 6051)
@@ -377,18 +377,18 @@
# org.exoplatform.portal.component.customization.UIPageSelector#
#############################################################################
-UIPageSelector2.header.name=Название
-UIPageSelector2.header.id=Идентификатор страницы
-UIPageSelector2.header.accessGroups=Группы доступа
-UIPageSelector2.header.title=#{word.title}
-UIPageSelector2.header.action=#{word.action}
-UIPageSelector2.label.clearPage=Очистить страницу
-UIPageSelector2.label.createPage=Создать страницу
-UIPageSelector2.label.searchandSelectPage=Поиск и выбор страницы
-UIPageSelector2.label.currentSelectedPage=Информация о выбранной странице
-UIPageSelector2.label.title=Заголовок
-UIPageSelector2.label.name=#{word.name}
-UIPageSelector2.label.accessGroups=Группы доступа
+UIPageSelector.header.name=Название
+UIPageSelector.header.id=Идентификатор страницы
+UIPageSelector.header.accessGroups=Группы доступа
+UIPageSelector.header.title=#{word.title}
+UIPageSelector.header.action=#{word.action}
+UIPageSelector.label.clearPage=Очистить страницу
+UIPageSelector.label.createPage=Создать страницу
+UIPageSelector.label.searchandSelectPage=Поиск и выбор страницы
+UIPageSelector.label.currentSelectedPage=Информация о выбранной странице
+UIPageSelector.label.title=Заголовок
+UIPageSelector.label.name=#{word.name}
+UIPageSelector.label.accessGroups=Группы доступа
UIPageBrowser.msg.NoPermission=У Вас нету прав доступа к этой странице.
UIPageBrowser.msg.PageNotExist=Страница не существует.
UIPageBrowser.msg.UserNotPermission=У Вас нету прав для доступа к страницам узла.
@@ -500,7 +500,7 @@
UIPageNodeForm.Icon.title.SetDefault=По умолчанию
UIPageNodeForm.tab.label.PageNodeSetting=Настройки узла страницы
UIPageNodeForm.tab.label.Icon=#{word.icon}
-UIPageNodeForm.tab.label.UIPageSelector2=Страницы
+UIPageNodeForm.tab.label.UIPageSelector=Страницы
#############################################################################
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_uk.properties
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_uk.properties 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_uk.properties 2011-03-16
21:04:51 UTC (rev 6051)
@@ -368,18 +368,18 @@
# org.exoplatform.portal.component.customization.UIPageSelector#
#############################################################################
-UIPageSelector2.header.name=Назва
-UIPageSelector2.header.id=Id сторінки
-UIPageSelector2.header.accessGroups=Привілейовані групи
-UIPageSelector2.header.title=#{word.title}
-UIPageSelector2.header.action=#{word.action}
-UIPageSelector2.label.clearPage=Почистити сторінку
-UIPageSelector2.label.createPage=Створити сторінку
-UIPageSelector2.label.searchandSelectPage=Пошук і вибір сторінки
-UIPageSelector2.label.currentSelectedPage=Інформація вибраної сторінки
-UIPageSelector2.label.title=Назва
-UIPageSelector2.label.name=#{word.name}
-UIPageSelector2.label.accessGroups=Привілейовані групи
+UIPageSelector.header.name=Назва
+UIPageSelector.header.id=Id сторінки
+UIPageSelector.header.accessGroups=Привілейовані групи
+UIPageSelector.header.title=#{word.title}
+UIPageSelector.header.action=#{word.action}
+UIPageSelector.label.clearPage=Почистити сторінку
+UIPageSelector.label.createPage=Створити сторінку
+UIPageSelector.label.searchandSelectPage=Пошук і вибір сторінки
+UIPageSelector.label.currentSelectedPage=Інформація вибраної сторінки
+UIPageSelector.label.title=Назва
+UIPageSelector.label.name=#{word.name}
+UIPageSelector.label.accessGroups=Привілейовані групи
UIPageBrowser.msg.NoPermission=У Вас недостатньо прав для доступу на цю сторінку.
UIPageBrowser.msg.PageNotExist=Сторінка не існує.
UIPageBrowser.msg.UserNotPermission=У Вас недостатньо прав для доступу на вузлову
сторінку.
@@ -491,7 +491,7 @@
UIPageNodeForm.Icon.title.SetDefault=Взяти за замовчуванням
UIPageNodeForm.tab.label.PageNodeSetting=Встановлення вузлової сторінки
UIPageNodeForm.tab.label.Icon=#{word.icon}
-UIPageNodeForm.tab.label.UIPageSelector2=Селектор сторінок
+UIPageNodeForm.tab.label.UIPageSelector=Селектор сторінок
#############################################################################
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_vi.properties
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_vi.properties 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_vi.properties 2011-03-16
21:04:51 UTC (rev 6051)
@@ -378,18 +378,18 @@
# org.exoplatform.portal.component.customization.UIPageSelector#
#############################################################################
-UIPageSelector2.header.name=Tên trang
-UIPageSelector2.header.id=Mã trang
-UIPageSelector2.header.accessGroups=Các nhóm truy nhập
-UIPageSelector2.header.title=#{word.title}
-UIPageSelector2.header.action=#{word.action}
-UIPageSelector2.label.clearPage=Xóa trang
-UIPageSelector2.label.createPage=Tạo trang
-UIPageSelector2.label.searchandSelectPage=Tìm kiếm và chọn trang
-UIPageSelector2.label.currentSelectedPage=Thông tin về trang bạn vừa chọn
-UIPageSelector2.label.title=Tiêu đề trang
-UIPageSelector2.label.name=#{word.name}
-UIPageSelector2.label.accessGroups=Các nhóm truy nhập
+UIPageSelector.header.name=Tên trang
+UIPageSelector.header.id=Mã trang
+UIPageSelector.header.accessGroups=Các nhóm truy nhập
+UIPageSelector.header.title=#{word.title}
+UIPageSelector.header.action=#{word.action}
+UIPageSelector.label.clearPage=Xóa trang
+UIPageSelector.label.createPage=Tạo trang
+UIPageSelector.label.searchandSelectPage=Tìm kiếm và chọn trang
+UIPageSelector.label.currentSelectedPage=Thông tin về trang bạn vừa chọn
+UIPageSelector.label.title=Tiêu đề trang
+UIPageSelector.label.name=#{word.name}
+UIPageSelector.label.accessGroups=Các nhóm truy nhập
UIPageBrowser.msg.NoPermission=Trang này không tồn tại hoặc bạn không được phân quyền để
truy cập!
UIPageBrowser.msg.PageNotExist=Trang này không tồn tại!
UIPageBrowser.msg.UserNotPermission=Bạn không được phép truy cập vào trang này!
@@ -506,7 +506,7 @@
UIPageNodeForm.Icon.title.SetDefault=Lấy mặc định
UIPageNodeForm.tab.label.PageNodeSetting=Cấu hình node
UIPageNodeForm.tab.label.Icon=#{word.icon}
-UIPageNodeForm.tab.label.UIPageSelector2=Tùy chọn trang
+UIPageNodeForm.tab.label.UIPageSelector=Tùy chọn trang
UIPageNodeForm.action.Save=#{word.save}
UIPageNodeForm.action.Back=#{word.back}
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_zh.xml
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_zh.xml 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_zh.xml 2011-03-16
21:04:51 UTC (rev 6051)
@@ -578,7 +578,7 @@
<done>完成</done>
</action>
</UIGroupSelector>
- <UIPageSelector2>
+ <UIPageSelector>
<header>
<name>名称</name>
<id>页面Id</id>
@@ -595,7 +595,7 @@
<name>#{word.name}</name>
<accessGroups>访问组</accessGroups>
</label>
- </UIPageSelector2>
+ </UIPageSelector>
<UIPageBrowser>
<msg>
<NoPermission>您无权访问这个页面。</NoPermission>
@@ -774,7 +774,7 @@
<label>
<PageNodeSetting>页面节点设置</PageNodeSetting>
<Icon>#{word.icon}</Icon>
- <UIPageSelector2>页面选择器</UIPageSelector2>
+ <UIPageSelector>页面选择器</UIPageSelector>
</label>
</tab>
</UIPageNodeForm>
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_zh_TW.xml
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_zh_TW.xml 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/classes/locale/portal/webui_zh_TW.xml 2011-03-16
21:04:51 UTC (rev 6051)
@@ -722,7 +722,7 @@
<done>完成</done>
</action>
</UIGroupSelector>
- <UIPageSelector2>
+ <UIPageSelector>
<header>
<name>名稱</name>
<id>頁面Id</id>
@@ -739,7 +739,7 @@
<name>#{word.name}</name>
<accessGroups>使用群組</accessGroups>
</label>
- </UIPageSelector2>
+ </UIPageSelector>
<UIPageBrowser>
<msg>
<NoPermission>您無權使用這個頁面。</NoPermission>
@@ -919,7 +919,7 @@
<label>
<PageNodeSetting>頁面節點設定</PageNodeSetting>
<Icon>#{word.icon}</Icon>
- <UIPageSelector2>頁面選擇器</UIPageSelector2>
+ <UIPageSelector>頁面選擇器</UIPageSelector>
</label>
</tab>
</UIPageNodeForm>
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml 2011-03-16
21:04:51 UTC (rev 6051)
@@ -94,6 +94,11 @@
</component>
<component>
+ <key>org.exoplatform.portal.mop.navigation.NavigationService</key>
+
<type>org.exoplatform.portal.mop.navigation.NavigationServiceWrapper</type>
+ </component>
+
+ <component>
<key>org.exoplatform.portal.config.UserPortalConfigService</key>
<type>org.exoplatform.portal.config.UserPortalConfigService</type>
<component-plugins>
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/groovy/portal/webui/navigation/UIPageNodeSelector.gtmpl
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/groovy/portal/webui/navigation/UIPageNodeSelector.gtmpl 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/groovy/portal/webui/navigation/UIPageNodeSelector.gtmpl 2011-03-16
21:04:51 UTC (rev 6051)
@@ -4,8 +4,6 @@
import org.exoplatform.webui.core.UIRightClickPopupMenu;
import org.exoplatform.web.application.JavascriptManager;
- def selectedNav = uicomponent.getSelectedNavigation();
-
UIRightClickPopupMenu uiPopupMenu = uicomponent.getChild(UIRightClickPopupMenu.class);
String popupMenu = "";
%>
@@ -16,11 +14,7 @@
JavascriptManager jsmanager = _ctx.getRequestContext().getJavascriptManager();
jsmanager.importJavascript('eXo.webui.UIRightClickPopupMenu');
- if(uicomponent.getCopyNode()!= null) {
- popupMenu = uiPopupMenu.getJSOnclickShowPopup("",
"AddNode,PasteNode,EditNavigation,SaveNavigation,DeleteNavigation");
- } else {
- popupMenu = uiPopupMenu.getJSOnclickShowPopup("",
"AddNode,EditNavigation,SaveNavigation,DeleteNavigation");
- }
+ popupMenu = uiPopupMenu.getJSOnclickShowPopup("",
"AddNode,EditNavigation,SaveNavigation,DeleteNavigation");
jsmanager.addJavascript("eXo.webui.UIRightClickPopupMenu.disableContextMenu('"+id+"');");
uicomponent.renderUIComponent(uiPopupMenu);
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/groovy/portal/webui/page/UIPageSelector.gtmpl
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/groovy/portal/webui/page/UIPageSelector.gtmpl 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/groovy/portal/webui/page/UIPageSelector.gtmpl 2011-03-16
21:04:51 UTC (rev 6051)
@@ -2,6 +2,7 @@
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.webui.core.UIPopupWindow;
import org.exoplatform.webui.form.UIForm;
+ import org.exoplatform.webui.form.UIFormInputSet;
Page page = uicomponent.getPage();
@@ -23,8 +24,10 @@
def rcontext = _ctx.getRequestContext();
rcontext.getJavascriptManager().importJavascript('eXo.webui.UIPopupWindow');
+
+ UIFormInputSet uiform = uicomponent.getChild(UIFormInputSet.class);
%>
-<div class="UIPageSelector" id="<%=uicomponent.getId();%>"
>
+<div class="UIPageSelector"
id="<%=uicomponent.getId();%>">
<div class="PageSelectorTitle">
<div class="Icon
BlueInfoBox16x16Icon"><span></span></div>
<div
class="Title"><%=_ctx.appRes(uicomponent.getId()+".label.currentSelectedPage")%></div>
@@ -32,21 +35,37 @@
</div>
<div class="UIFormInfo">
<div class="FormInfoBG">
- <div class="FormInfoIcon">
- <div class="UIPropertyInfo">
- <div class="OverflowContainer">
- <div
class="PropertyName"><%=_ctx.appRes(uicomponent.getId()+".header.id")%>:</div>
- <div class="PropertyValue">$pageId</div>
- </div>
- <div class="OverflowContainer">
- <div
class="PropertyName"><%=_ctx.appRes(uicomponent.getId()+".label.name")%>:</div>
- <div class="PropertyValue">$name</div>
- </div>
- <div class="OverflowContainer">
- <div
class="PropertyName"><%=_ctx.appRes(uicomponent.getId()+".label.title")%>:</div>
- <div class="PropertyValue">$title</div>
- </div>
- </div>
+ <div class="FormInfoIcon UIForm">
+ <table class="UIPropertyInfo UIFormGrid">
+ <tr>
+ <td
class="FieldLabel"><%=_ctx.appRes(uicomponent.getId()+".header.id")%>:</td>
+ <td class="FieldComponent">
+ <% if(page != null) { %>
+ $pageId
+ <% } %>
+ </td>
+ </tr>
+ <tr>
+ <td
class="FieldLabel"><%=_ctx.appRes(uicomponent.getId()+".label.name")%>:</td>
+ <td class="FieldComponent">
+ <% if(page == null) { %>
+ <% uiform.renderChild("pageName");%>
+ <% } else { %>
+ $name
+ <% } %>
+ </td>
+ </tr>
+ <tr>
+ <td
class="FieldLabel"><%=_ctx.appRes(uicomponent.getId()+".label.title")%>:</td>
+ <td class="FieldComponent">
+ <% if(page == null) { %>
+ <% uiform.renderChild("pageTitle");%>
+ <% } else { %>
+ $title
+ <% } %>
+ </td>
+ </tr>
+ </table>
</div>
</div>
</div>
@@ -55,9 +74,10 @@
<tr>
<td>
<%
- String clearPageEvent = "#";
+ String clearPageEvent = "javascript:void(0);";
String css = "FloatBlockHidden ActionButton SimpleStyle";
- def uiForm = uicomponent.getAncestorOfType(UIForm.class);
+ def uiForm = uicomponent.getAncestorOfType(UIForm.class);
+ createPageEvent = uiForm.event("CreatePage");
if(page != null) {
clearPageEvent = uiForm.event("ClearPage");
css = "ActionButton SimpleStyle";
@@ -73,8 +93,22 @@
</div>
</div>
</div>
+ </div>
+ <% if(page == null) { %>
+ <div onclick="<%=createPageEvent%>" class="ActionButton
SimpleStyle">
+ <div class="ButtonLeft">
+ <div class="ButtonRight">
+ <div class="ButtonMiddle">
+ <div class="GreenPlusPage16x16Icon Icon"
title="<%=_ctx.appRes(uicomponent.getId()+".label.createPage")%>">
+ <a
href="javascript:void(0);"><%=_ctx.appRes(uicomponent.getId() +
".label.createPage")%></a>
+ </div>
+ </div>
+ </div>
+ </div>
</div>
- <div class="ActionButton SimpleStyle" onclick="javascript:
eXo.webui.UIPopupWindow.show('<%=uicomponent.getChild(UIPopupWindow.class).getId();%>');">
+ <% } %>
+
+ <div class="ActionButton SimpleStyle"
onclick="<%=uicomponent.event("OpenSelectPagePopUp")%>">
<div class="ButtonLeft">
<div class="ButtonRight">
<div class="ButtonMiddle">
@@ -85,6 +119,7 @@
</div>
</div>
</div>
+
</td>
</tr>
</table>
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/groovy/portal/webui/page/UIWizardPageSetInfo.gtmpl
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/groovy/portal/webui/page/UIWizardPageSetInfo.gtmpl 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/groovy/portal/webui/page/UIWizardPageSetInfo.gtmpl 2011-03-16
21:04:51 UTC (rev 6051)
@@ -1,22 +1,21 @@
<%
import org.exoplatform.portal.webui.navigation.UIPageNodeSelector;
- import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.webui.core.UIComponent;
-%>
-<%
- PageNode pageNode = uicomponent.getSelectedPageNode();
- String nodeName = "";
- if(pageNode!=null ) nodeName = "/"+pageNode.getResolvedLabel();
+
+ String nodeName = "/";
boolean isNoSelecter = !uicomponent.getChild(UIPageNodeSelector.class).isRendered();
%>
<div class="UIWizardPageSetInfo">
<%uiform.begin()%>
<div class="<%=isNoSelecter ? "NoPageSelecter" :
""%>">
- <%if(!isNoSelecter) {%>
+ <%if(!isNoSelecter) {
+ def pageNode = uicomponent.getSelectedPageNode();
+ if( pageNode!=null && pageNode.getResolvedLabel() != null ) nodeName +=
pageNode.getResolvedLabel();
+ %>
<div class="PageNodeContainer">
<% uicomponent.renderChild(UIPageNodeSelector.class); %>
</div>
- <%}%>
+ <%}%>
<div class="SelectedPageInfo">
<div class="PageInfoContainer">
<div class="PageNodeInfo">
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/groovy/webui/core/UISitemap.gtmpl
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/groovy/webui/core/UISitemap.gtmpl 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/groovy/webui/core/UISitemap.gtmpl 2011-03-16
21:04:51 UTC (rev 6051)
@@ -1,236 +1,7 @@
-<div class="UISitemap">
- <div class="ClearFix">
- <div class="CollapseAll FloatLeft">Collapse All</div>
- <div class="ExpandAll FloatLeft">Expand All</div>
- </div>
- <div class="SitemapContent">
- <div class="UISiteTree">
-
- <div class="Node ClearFix">
- <div class="ExpandIcon FloatLeft">
- <a class="NodeIcon DefaultPageIcon"
href="#">Home</a>
- </div>
- </div>
-
- <div class="Node ClearFix">
- <div class="ExpandIcon FloatLeft">
- <a class="NodeIcon DefaultPageIcon" href="#">Web
Explorer</a>
- </div>
- </div>
-
- <div class="Node ClearFix">
- <div class="CollapseIcon FloatLeft">
- <a class="NodeIcon DefaultPageIcon" href="#">My
Link</a>
- </div>
-
- <div class="ChildrenContainer FloatLeft">
- <div class="Node ClearFix">
- <div class="ExpandIcon FloatLeft">
- <a class="NodeIcon DefaultPageIcon"
href="#">Blog</a>
- </div>
- </div>
- <div class="LastNode Node ClearFix">
- <div class="CollapseIcon FloatLeft">
- <a class="NodeIcon DefaultPageIcon"
href="#">Facebook</a>
- </div>
-
- <div class="ChildrenContainer FloatLeft">
- <div class="Node ClearFix">
- <div class="NullItem">
- <div class="">
- <a class="NodeIcon DefaultPageIcon" href="#">Samples
link</a>
- </div>
- </div>
- </div>
- <div class="LastNode Node ClearFix">
- <div class="NullItem"><a class="NodeIcon
DefaultPageIcon" href="#">Samples link</a></div>
- </div>
- </div>
-
- </div>
- </div><!--end ChildrenContainer-->
-
- </div><!--end Node-->
-
- <div class="Node ClearFix">
- <div class="ExpandIcon FloatLeft"><a class="NodeIcon
DefaultPageIcon" href="#">Register</a></div>
- </div>
-
- <div class="LastNode Node ClearFix">
- <div class="ExpandIcon"><a class="NodeIcon
DefaultPageIcon" href="#">Link</a></div>
- </div>
-
- </div>
- </div>
-</div>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-<!--
-<%
- import org.exoplatform.webui.core.UIPortletApplication;
- import org.exoplatform.portal.config.model.PageNode;
- import org.exoplatform.portal.application.PortalRequestContext;
- import org.exoplatform.portal.webui.util.Util;
-%>
-<%
- def navigations = uicomponent.getNavigations();
- PortalRequestContext pcontext = Util.getPortalRequestContext();
- def String portalURI = pcontext.getPortalURI();
-
- UIPortletApplication siteMapPortlet = uicomponent.getParent();
- def useAJAX = siteMapPortlet.isUseAjax();
-
- public void renderNextLevelNode(nav, children, int intLevel, String portalUri, boolean
useAjax) {
- if(intLevel > 4) return;
-
- for(PageNode node in children) {
- String actionLink;
- if(useAjax){
- actionLink = uicomponent.event("SelectNode", nav.getId() + "::" +
node.getUri());
- }else{
- actionLink = portalUri + node.getUri();
- }
- String iconType = node.getIcon();
- if(iconType == null) {
- iconType = "DefaultPageIcon";
- }
-
- if(intLevel == 4) {
- println """
- <div class="Item">
- <div class="Level$intLevel">
- <div class="OverflowContainer">
- <a class="IconItem ${iconType}" href="javascript:
void(0);">...</a>
- </div>
- </div>
- </div>
- """;
- break;
- }
-
- String label = node.resolvedLabel;
- String title = label;
- if(label.length() > 38) {
- label = label.substring(0,35) + "...";
- }
-
- println """
- <div class="Item">
- <div class="Level$intLevel">
- <div class="OverflowContainer">
- """;
- if(node.pageReference != null) {
- print """<a class="IconItem ${iconType}"
href="$actionLink"
title="$title">$label</a>""";
- } else {
- print """<a class="IconItem ${iconType}"
title="$title">$label</a>""";
- }
- println """
- </div>
- </div>
- </div>
- """;
- if (node.getChildren() != null) {
- renderNextLevelNode(nav, node.getChildren(), intLevel + 1, portalUri, useAjax);
- }
- }
- }
-%>
-<div class="UISitemap">
- <div class="SitemapContainer">
- <div class="SitemapBackground">
- <%
- boolean even = true;
- String cssfloat = "left";
- for(nav in navigations) {
- for(node in nav.getNodes()) {
- String iconType = node.getIcon();
- if(iconType == null) {
- iconType = "DefaultPageIcon";
- }
- if(even)cssfloat = "left";
- else cssfloat = "right";
- String blockFloat = "LeftBlock";
- if(useAJAX){
- actionLink = uicomponent.event("SelectNode", nav.getId() +
"::" + node.getUri());
- }else{
- actionLink = portalURI + node.getUri();
- }
-
- String label = node.resolvedLabel;
- String title = "";
- if(label.length() > 35) {
- title = label;
- label = label.substring(0,32) + "...";
- }
- %>
- <div class="SitemapItemBox" style="float:${cssfloat};">
- <div class="SitemapItemContainer">
- <div class="TitleBar">
- <%if(node.pageReference != null) {%>
- <a href="<%=actionLink%>" class="Icon ${iconType}"
title="$title">$label</a>
- <%} else {%>
- <a class="Icon ${iconType}"
title="$title">$label</a>
- <%}%>
- </div>
- <%if(node.getChildren() == null || node.getChildren().size() < 1) { %>
- <div class="NestedSitemapItemBox">
- <div class="SitemapItemBoxSelector BorderBox">
- <div class="Item">
- <div class="SubItem">
- <div class="Icon BlueInfoBox16x16Icon">
- <%=_ctx.appRes("UISitemap.label.message")%>
- </div>
- </div>
- </div>
- </div>
- </div>
- <%} else { %>
- <div class="NestedSitemapItemBox">
- <div class="SitemapItemBoxSelector">
- <div class="ItemContainer">
- <% renderNextLevelNode(nav, node.getChildren(), 1, portalURI, useAJAX);
%>
- </div>
- </div>
- </div>
- <%}%>
- </div>
- </div>
- <%
- if(!even) {
- %>
- <div class="ClearBoth"><span></span></div>
- <%
- }
- even = !even;
- }
- }
- if(!even){
- %>
- <div class="ClearBoth"><span></span></div>
- <% } %>
- </div>
- </div>
-</div>
--->
\ No newline at end of file
+<%
+ import org.exoplatform.portal.webui.navigation.UIPortalNavigation;
+
+ def uiPortalNavigation = uicomponent.getChild(UIPortalNavigation.class);
+ uiPortalNavigation.loadTreeNodes();
+ uicomponent.renderChildren();
+%>
\ No newline at end of file
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/groovy/webui/core/UISitemapTree.gtmpl
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/groovy/webui/core/UISitemapTree.gtmpl 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/web/portal/src/main/webapp/groovy/webui/core/UISitemapTree.gtmpl 2011-03-16
21:04:51 UTC (rev 6051)
@@ -1,80 +1,78 @@
<%
import org.exoplatform.webui.core.UIPortletApplication;
- import org.exoplatform.portal.config.model.PageNode;
+ import org.exoplatform.portal.mop.user.UserNode;
import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.webui.navigation.TreeNode;
-%>
+ import org.exoplatform.portal.mop.SiteKey;
+%>
<%
- def navigations = uicomponent.getNavigations();
-
- PortalRequestContext pcontext = Util.getPortalRequestContext();
+ PortalRequestContext pcontext = Util.getPortalRequestContext();
def String portalURI = pcontext.getPortalURI();
-
+
UIPortletApplication siteMapPortlet = uicomponent.getParent();
-
+
def useAJAX = siteMapPortlet.isUseAjax();
-
+
def actionExpandAll = uicomponent.event("ExpandAllNode");
def actionCollapseAll = uicomponent.event("CollapseAllNode");
-
+
public void renderNodes(TreeNode rootTree, String portalUri, boolean useAjax) {
- List childrenNodes=rootTree.getChildren();
- int childrenSize = childrenNodes.size() ;
- int size = 0;
- for(treeNode in childrenNodes) {
-
+ def childrenNodes=rootTree.getChildren();
+ int childrenSize = childrenNodes.size() ;
+ int size = 0;
+ for(treeNode in childrenNodes) {
+
// count size;
size++;
-
+
node = treeNode.getNode();
- nav = treeNode.getNavigation();
- String label = node.encodedResolvedLabel;
- actionExpand = uicomponent.event("ExpandNode", nav.getId() + "::"
+ node.getUri());
- def actionCollapse = "ajaxAsyncGetRequest('" +
uicomponent.url("CollapseNode",nav.getId() + "::" + node.getUri()) +
"', true)";
-
+ def treePath = node.getId();
+ String label = node.getEncodedResolvedLabel();
+ actionExpand = uicomponent.event("ExpandNode",
treePath).replace("javascript:", "");
+ def actionCollapse = "ajaxAsyncGetRequest('" +
uicomponent.url("CollapseNode", treePath) + "', true)";
if(useAjax){
- actionLink = uicomponent.event("SelectNode", nav.getId() + "::" +
node.getUri());
- }else{
- actionLink = portalUri + node.getUri();
- }
-
+ actionLink = uicomponent.event("SelectNode", treePath);
+ }else{
+ actionLink = portalUri + node.getURI();
+ }
+
lastNode = '';
-
+
if (size == childrenSize) {
lastNode = 'LastNode';
}
// if node have child
-
- if(treeNode.isHasChild()) {
+
+ if(treeNode.hasChild()) {
if (treeNode.isExpanded()) {
println """
<div class="$lastNode Node">
- <div class="CollapseIcon ClearFix"
onclick="eXo.portal.UIPortal.collapseExpand(this);$actionCollapse">
+ <div class="CollapseIcon ClearFix"
onclick="eXo.portal.UIPortal.collapseExpand(this, function() {$actionExpand},
function() {$actionCollapse})">
""";
- if(treeNode.getNode().getPageReference() == null) println "<a
class='NodeIcon DefaultPageIcon'
href='javascript:void(0);'>$label</a>";
+ if(treeNode.getNode().getPageRef() == null) println "<a
class='NodeIcon DefaultPageIcon'
href='javascript:void(0);'>$label</a>";
else println "<a class='NodeIcon DefaultPageIcon'
href='$actionLink'>$label</a>";
println """
</div>
<div class="ChildrenContainer" style="display: block">
""";
-
+
renderNodes(treeNode, portalUri, useAjax);
-
+
} else {
println """
<div class="$lastNode Node">
- <div class="ExpandIcon ClearFix"
onclick="if(eXo.portal.UIPortal.collapseExpand(this)){$actionExpand}">
+ <div class="ExpandIcon ClearFix"
onclick="eXo.portal.UIPortal.collapseExpand(this, function() {$actionExpand},
function() {$actionCollapse})">
""";
- if(treeNode.getNode().getPageReference() == null) println "<a
class='NodeIcon DefaultPageIcon'
href='javascript:void(0);'>$label</a>";
+ if(treeNode.getNode().getPageRef() == null) println "<a
class='NodeIcon DefaultPageIcon'
href='javascript:void(0);'>$label</a>";
else println "<a class='NodeIcon DefaultPageIcon'
href='$actionLink'>$label</a>";
println """
</div>
<div class="ChildrenContainer" style="display: none">
""";
}
-
-
+
+
println """
</div>
</div>
@@ -89,24 +87,24 @@
</div>
</div>
</div>
-
+
""";
-
+
}
- }
- }
+ }
+ }
%>
<div id="UISiteMap" class="UISitemap" >
<div class="ClearFix">
<div class="CollapseAll FloatLeft"
onclick="eXo.portal.UIPortal.collapseExpand(this);$actionCollapseAll">
<%=_ctx.appRes(siteMapPortlet.getName() + ".label.CollapseAll")%>
- </div>
- <div class="ExpandAll FloatLeft"
onclick="{$actionExpandAll}">
- <%=_ctx.appRes(siteMapPortlet.getName() + ".label.ExpandAll")%>
</div>
+ <div class="ExpandAll FloatLeft"
onclick="{$actionExpandAll}">
+ <%//_ctx.appRes(siteMapPortlet.getName() + ".label.ExpandAll")%>
</div>
+ </div>
<div class="SitemapContent">
<div class="UISiteTree">
<% TreeNode treeNodeRoot = uicomponent.getTreeNodes() ;%>
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/webui/core/src/main/java/org/exoplatform/webui/core/UITree.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/webui/core/src/main/java/org/exoplatform/webui/core/UITree.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/webui/core/src/main/java/org/exoplatform/webui/core/UITree.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -19,10 +19,9 @@
package org.exoplatform.webui.core;
-import org.exoplatform.portal.config.model.PageNode;
+import org.exoplatform.commons.serialization.api.annotations.Serialized;
import org.exoplatform.util.ReflectionUtil;
import org.exoplatform.webui.application.WebuiRequestContext;
-import org.exoplatform.commons.serialization.api.annotations.Serialized;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.event.Event;
@@ -30,6 +29,7 @@
import org.exoplatform.webui.form.UIForm;
import java.lang.reflect.Method;
+import java.util.Collection;
import java.util.List;
/**
@@ -73,6 +73,12 @@
private String beanIdField_;
/**
+ * The bean field that holds the count number of the children
+ * This help to express the node have childs or not
+ */
+ private String beanChildCountField_;
+
+ /**
* The bean field that holds the label of the bean
*/
private String beanLabelField_;
@@ -90,12 +96,12 @@
/**
* A list of sibling nodes
*/
- private List<?> sibbling;
+ private Collection<?> sibbling;
/**
* A list of children nodes
*/
- private List<?> children;
+ private Collection<?> children;
/**
* The selected node
@@ -107,8 +113,6 @@
*/
private Object parentSelected;
- private NodeMetaDataManager nodeMetadataManager;
-
/**
* A right click popup menu
*/
@@ -135,6 +139,11 @@
this.beanLabelField_ = beanLabelField_;
}
+ public void setBeanChildCountField(String beanChildCountField)
+ {
+ this.beanChildCountField_ = beanChildCountField;
+ }
+
public Object getId(Object object) throws Exception
{
return getFieldValue(object, beanIdField_);
@@ -197,12 +206,12 @@
this.selectedIcon = selectedIcon;
}
- public List<?> getChildren()
+ public Collection<?> getChildren()
{
return children;
}
- public void setChildren(List<?> children)
+ public void setChildren(Collection<?> children)
{
this.children = children;
}
@@ -229,12 +238,12 @@
this.parentSelected = parentSelected;
}
- public List<?> getSibbling()
+ public Collection<?> getSibbling()
{
return sibbling;
}
- public void setSibbling(List<?> sibbling)
+ public void setSibbling(Collection<?> sibbling)
{
this.sibbling = sibbling;
}
@@ -271,9 +280,16 @@
iconGroup = selectedIcon;
note = " NodeSelected";
}
- if(obj instanceof PageNode && ((PageNode)obj).getChildren().size() == 0) {
- nodeIcon = nullItemIcon;
+
+ if(getBeanChildCountField() != null) {
+ Object childCount = getFieldValue(obj, getBeanChildCountField());
+ if (childCount != null &&
childCount.getClass().isAssignableFrom(Integer.class) &&
+ (Integer)childCount == 0)
+ {
+ nodeIcon = nullItemIcon;
+ }
}
+
if (beanIconField_ != null && beanIconField_.length() > 0)
{
if (getFieldValue(obj, beanIconField_) != null)
@@ -363,6 +379,11 @@
return beanIdField_;
}
+ public String getBeanChildCountField()
+ {
+ return beanChildCountField_;
+ }
+
public String getBeanLabelField()
{
return beanLabelField_;
@@ -397,34 +418,4 @@
{
this.colapseIcon = colapseIcon;
}
-
- public String getNodeMetaData(Object nodeObject, WebuiRequestContext context)
- {
- if (nodeMetadataManager == null)
- {
- return null;
- }
- else
- {
- return nodeMetadataManager.getNodeMetaData(nodeObject, context);
- }
- }
-
- public void setNodeMetaDataManager(NodeMetaDataManager _nodeMetadataManager)
- {
- this.nodeMetadataManager = _nodeMetadataManager;
- }
-
- /**
- * A node metadata manager. Node 's metadata is used for action
informing/warning.
- *
- * @author <a href="mailto:hoang281283@gmail.com">Minh Hoang
TO</a>
- * @version $Id$
- *
- */
- public static interface NodeMetaDataManager
- {
- public String getNodeMetaData(Object nodeObject, WebuiRequestContext context);
- }
-
}
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -24,15 +24,19 @@
import org.exoplatform.commons.utils.PortalPrinter;
import org.exoplatform.commons.xml.DOMSerializer;
import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNode;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserNode;
+import org.exoplatform.portal.mop.user.UserPortalContext;
import org.exoplatform.portal.webui.portal.UIPortal;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.webui.workspace.UIPortalApplication;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.exoplatform.services.resources.Orientation;
+import org.exoplatform.services.resources.ResourceBundleManager;
import org.exoplatform.web.application.JavascriptManager;
import org.exoplatform.web.application.URLBuilder;
import org.exoplatform.webui.application.WebuiApplication;
@@ -52,6 +56,7 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.ResourceBundle;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
@@ -208,13 +213,13 @@
UIPortal uiportal = Util.getUIPortal();
//
- PageNode node = uiportal.getSelectedNode();
+ UserNode node = uiportal.getSelectedUserNode();
if (node != null)
{
ExoContainer container = getApplication().getApplicationServiceContainer();
container.getComponentInstanceOfType(UserPortalConfigService.class);
UserPortalConfigService configService =
(UserPortalConfigService)container.getComponentInstanceOfType(UserPortalConfigService.class);
- Page page = configService.getPage(node.getPageReference(), getRemoteUser());
+ Page page = configService.getPage(node.getPageRef(), getRemoteUser());
//
if (page != null)
@@ -461,5 +466,19 @@
this.extraMarkupHeaders.add(element);
}
+ final public static UserPortalContext USER_PORTAL_CONTEXT = new UserPortalContext()
+ {
+ public ResourceBundle getBundle(UserNavigation navigation)
+ {
+ ExoContainer container = ExoContainerContext.getCurrentContainer();
+ ResourceBundleManager rbMgr =
(ResourceBundleManager)container.getComponentInstanceOfType(ResourceBundleManager.class);
+ Locale locale = Util.getPortalRequestContext().getLocale();
+ return rbMgr.getNavigationResourceBundle(
+ locale.getLanguage(),
+ navigation.getKey().getTypeName(),
+ navigation.getKey().getName());
+ }
+ };
+
}
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalStateManager.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalStateManager.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalStateManager.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -147,7 +147,7 @@
UserPortalConfigService service_ =
(UserPortalConfigService)appContainer.getComponentInstanceOfType(UserPortalConfigService.class);
String remoteUser = context.getRemoteUser();
String ownerUser = context.getPortalOwner();
- return service_.getUserPortalConfig(ownerUser, remoteUser);
+ return service_.getUserPortalConfig(ownerUser, remoteUser,
PortalRequestContext.USER_PORTAL_CONTEXT);
}
private String getKey(WebuiRequestContext webuiRC)
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/localization/LocalizationLifecycle.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/localization/LocalizationLifecycle.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/localization/LocalizationLifecycle.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -41,12 +41,7 @@
import org.exoplatform.web.application.Phase;
import org.exoplatform.web.application.RequestFailure;
import org.exoplatform.webui.application.WebuiRequestContext;
-import org.exoplatform.webui.core.UIApplication;
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
@@ -54,6 +49,11 @@
import java.util.Locale;
import java.util.Set;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
/**
* This class takes care of loading / initializing / saving the current Locale.
* Current Locale is used to create properly localized response to current request.
@@ -205,10 +205,7 @@
if (refreshNeeded)
{
- UIApplication uiapp = context.getUIApplication();
- // we presume PortalRequestContext, and UIPortalApplication
resetOrientation(reqCtx, loc);
- ((UIPortalApplication) uiapp).localizeNavigations();
}
savePreviousLocale(reqCtx, loc);
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/state/PublicPropertiesPlugin.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/state/PublicPropertiesPlugin.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/state/PublicPropertiesPlugin.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -18,17 +18,17 @@
*/
package org.exoplatform.portal.application.state;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
import org.exoplatform.container.xml.InitParams;
-import org.exoplatform.portal.config.model.PageNode;
+import org.exoplatform.portal.mop.user.UserNode;
import org.exoplatform.portal.webui.application.UIPortlet;
import org.exoplatform.portal.webui.page.UIPage;
import org.exoplatform.portal.webui.portal.UIPortal;
import org.exoplatform.portal.webui.util.Util;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
/**
* This plugin setup properties that are publicly supported, hence this is part of a
public API
* and once published its contract must not change whatsoever.
@@ -79,13 +79,13 @@
try
{
UIPortal currentSite = Util.getUIPortalApplication().getShowedUIPortal();
- PageNode currentNode = currentSite.getSelectedNode();
+ UserNode currentNode = currentSite.getSelectedUserNode();
// Navigation related properties
- addProperty(properties, navigationURIQName, currentNode.getUri());
+ addProperty(properties, navigationURIQName, currentNode.getURI());
// Page related properties
- UIPage currentPage = currentSite.getUIPage(currentNode.getPageReference());
+ UIPage currentPage = currentSite.getUIPage(currentNode.getPageRef());
if(currentPage != null)
{
addProperty(properties, pageNameQName, currentPage.getTitle());
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/TreeNode.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/TreeNode.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/TreeNode.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -19,12 +19,13 @@
package org.exoplatform.portal.webui.navigation;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
-
-import java.util.ArrayList;
+import org.exoplatform.portal.mop.user.UserNode;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedList;
import java.util.List;
-
+import java.util.Map;
import javax.jcr.RepositoryException;
/**
@@ -36,31 +37,27 @@
*/
public class TreeNode
{
- //TODO Need use this class for BC TreeNode
private boolean isExpanded_;
- private boolean hasChild_;
+ private UserNode node_;
- private String path_;
+ private List<TreeNode> children_ = Collections.emptyList();
- private PageNode node_;
+ private Map<String, TreeNode> cachedTreeNodes_;
- private PageNavigation navigation_;
+ private TreeNode rootNode;
- private List<TreeNode> children_ = new ArrayList<TreeNode>();
-
- public TreeNode(PageNode node, PageNavigation nav, boolean hasChild)
+ public TreeNode()
{
- this(node, node.getUri(), nav, hasChild);
+ cachedTreeNodes_ = new HashMap<String, TreeNode>();
+ rootNode = this;
}
- private TreeNode(PageNode node, String path, PageNavigation nav, boolean hasChild)
+ private TreeNode(UserNode node, TreeNode rootNode)
{
node_ = node;
- navigation_ = nav;
isExpanded_ = false;
- path_ = path;
- hasChild_ = hasChild;
+ this.rootNode = rootNode;
}
public boolean isExpanded()
@@ -78,26 +75,11 @@
return node_.getName();
}
- public String getPath()
- {
- return path_;
- }
-
- public String getNodePath() throws RepositoryException
- {
- return node_.getUri();
- }
-
- public PageNode getNode()
- {
+ public UserNode getNode()
+ {
return node_;
}
- public void setNode(PageNode node)
- {
- node_ = node;
- }
-
public List<TreeNode> getChildren()
{
return children_;
@@ -108,61 +90,32 @@
return children_.size();
}
- public TreeNode getChildByPath(String path, TreeNode treeNode)
+ public void setChildren(Collection<UserNode> children) throws Exception
{
- TreeNode returnVal = null;
-
- for (TreeNode child : treeNode.getChildren())
+ if (children == null)
+ return;
+
+ children_ = new LinkedList<TreeNode>();
+ for (UserNode child : children)
{
-
- if (returnVal != null)
- continue;
-
- if (child.getPath().equals(path))
- {
- returnVal = child;
- }
- else if (child.getChildren() != null)
- {
- returnVal = child.getChildByPath(path, child);
- }
+ TreeNode node = new TreeNode(child, rootNode);
+ children_.add(node);
+ rootNode.cachedTreeNodes_.put(child.getId(), node);
}
-
- return returnVal;
}
- public void setChildren(List<PageNode> children, PageNavigation nav) throws
Exception
+ public boolean hasChild()
{
- setExpanded(true);
- for (PageNode child : children)
- {
- boolean isHasChild = (child.getChildren().size() > 0);
- children_.add(new TreeNode(child, nav.getId() + "::" + child.getUri(),
nav, isHasChild));
- }
+ return node_.getChildrenCount() > 0;
}
- public void addChildren(TreeNode treeNode)
+ /**
+ * Help to find nodes on the whole tree, not only in the childrens of this node
+ * @param nodeId - id of the UserNode
+ * @return null if not found
+ */
+ public TreeNode findNodes(String nodeId)
{
- children_.add(treeNode);
+ return rootNode.cachedTreeNodes_.get(nodeId);
}
-
- public void setNavigation(PageNavigation navigation_)
- {
- this.navigation_ = navigation_;
- }
-
- public PageNavigation getNavigation()
- {
- return navigation_;
- }
-
- public void setHasChild(boolean hasChild)
- {
- this.hasChild_ = hasChild;
- }
-
- public boolean isHasChild()
- {
- return hasChild_;
- }
}
\ No newline at end of file
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIAddGroupNavigation.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIAddGroupNavigation.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIAddGroupNavigation.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -27,6 +27,13 @@
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.SiteType;
+import org.exoplatform.portal.mop.navigation.Navigation;
+import org.exoplatform.portal.mop.navigation.NavigationService;
+import org.exoplatform.portal.mop.navigation.NavigationState;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserPortal;
import org.exoplatform.portal.webui.portal.UIPortal;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.webui.workspace.UIMaskWorkspace;
@@ -49,6 +56,7 @@
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.List;
import java.util.Set;
@@ -108,9 +116,18 @@
listGroup = new ArrayList<String>();
}
- UserPortalConfigService configService =
getApplicationComponent(UserPortalConfigService.class);
- Set<String> groupIdsHavingNavigation =
configService.findGroupHavingNavigation();
- listGroup.removeAll(groupIdsHavingNavigation);
+ //Filter all groups having navigation
+ NavigationService navigationService =
getApplicationComponent(NavigationService.class);
+ List<String> groupsHavingNavigation = new ArrayList<String>();
+ for(String groupName : listGroup)
+ {
+ Navigation navigation =
navigationService.loadNavigation(SiteKey.group(groupName));
+ if(navigation != null && navigation.getState() != null)
+ {
+ groupsHavingNavigation.add(groupName);
+ }
+ }
+ listGroup.removeAll(groupsHavingNavigation);
UIVirtualList virtualList = getChild(UIVirtualList.class);
virtualList.dataBind(new ObjectPageList<String>(listGroup,
listGroup.size()));
@@ -127,27 +144,20 @@
String ownerId = event.getRequestContext().getRequestParameter(OBJECTID);
ownerId = URLDecoder.decode(ownerId);
- //Add navigation
- PageNavigation pageNav = new PageNavigation();
-
- // set properties for navigation
- pageNav.setPriority(1);
- pageNav.setModifiable(true);
- pageNav.setOwnerId(ownerId);
- pageNav.setOwnerType(PortalConfig.GROUP_TYPE);
- //UIPortalApplication uiPortalApp =
uiForm.getAncestorOfType(UIPortalApplication.class);
UIPortalApplication uiPortalApp =
Util.getUIPortal().getAncestorOfType(UIPortalApplication.class);
- // ensure this navigation is not exist
- DataStorage dataService = uicomp.getApplicationComponent(DataStorage.class);
- if (dataService.getPageNavigation(pageNav.getOwnerType(), pageNav.getOwnerId())
!= null)
+ // ensure this navigation does not exist
+ NavigationService navigationService =
uicomp.getApplicationComponent(NavigationService.class);
+ Navigation navigation =
navigationService.loadNavigation(SiteKey.group(ownerId));
+ if (navigation != null && navigation.getState() != null)
{
uiPortalApp.addMessage(new
ApplicationMessage("UIPageNavigationForm.msg.existPageNavigation",
- new String[]{pageNav.getOwnerId()}));
+ new String[]{ownerId}));
return;
}
- // Create group when it does not exist
+ // Create portal config of the group when it does not exist
+ DataStorage dataService = uicomp.getApplicationComponent(DataStorage.class);
if (dataService.getPortalConfig("group", ownerId) == null)
{
UserPortalConfigService configService =
uicomp.getApplicationComponent(UserPortalConfigService.class);
@@ -155,12 +165,8 @@
}
// create navigation for group
- dataService.create(pageNav);
+ navigationService.saveNavigation(SiteKey.group(ownerId), new
NavigationState(0));
- uiPortalApp.getUserPortalConfig().getNavigations().add(0, pageNav);
- uiPortalApp.getNavigations().add(0, pageNav);
- uiPortalApp.localizeNavigations();
-
//Update group navigation list
ctx.addUIComponentToUpdateByAjax(uicomp);
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationManagement.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationManagement.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationManagement.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -25,8 +25,9 @@
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.PageNavigation;
import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.user.UserNavigation;
import org.exoplatform.portal.webui.page.UIPageNodeForm;
-import org.exoplatform.portal.webui.portal.UIPortal;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.webui.workspace.UIPortalApplication;
import org.exoplatform.portal.webui.workspace.UIWorkingWorkspace;
@@ -41,8 +42,6 @@
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
-import java.util.List;
-
@ComponentConfig(template =
"system:/groovy/portal/webui/navigation/UINavigationManagement.gtmpl", events =
{
@EventConfig(listeners = UINavigationManagement.SaveActionListener.class),
@EventConfig(listeners = UINavigationManagement.AddRootNodeActionListener.class)})
@@ -99,88 +98,49 @@
PortalRequestContext prContext = Util.getPortalRequestContext();
UINavigationManagement uiManagement = event.getSource();
UINavigationNodeSelector uiNodeSelector =
uiManagement.getChild(UINavigationNodeSelector.class);
- DataStorage dataService =
uiManagement.getApplicationComponent(DataStorage.class);
UserPortalConfigService portalConfigService =
uiManagement.getApplicationComponent(UserPortalConfigService.class);
-
- PageNavigation navigation = uiNodeSelector.getEdittedNavigation();
- String editedOwnerType = navigation.getOwnerType();
- String editedOwnerId = navigation.getOwnerId();
+
+ UIPopupWindow uiPopup = uiManagement.getParent();
+ uiPopup.setShow(false);
+ uiPopup.setUIComponent(null);
+ UIPortalApplication uiPortalApp =
(UIPortalApplication)prContext.getUIApplication();
+ UIWorkingWorkspace uiWorkingWS =
uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
+ prContext.addUIComponentToUpdateByAjax(uiWorkingWS);
+ prContext.setFullRender(true);
+
+ UserNavigation navigation = uiNodeSelector.getEdittedNavigation();
+
+ SiteKey siteKey = navigation.getKey();
+ String editedOwnerId = siteKey.getName();
+
// Check existed
- PageNavigation persistNavigation =
dataService.getPageNavigation(editedOwnerType, editedOwnerId);
- if (persistNavigation == null)
+ UserPortalConfig userPortalConfig;
+ if (PortalConfig.PORTAL_TYPE.equals(siteKey.getTypeName()))
{
- UIApplication uiApp = Util.getPortalRequestContext().getUIApplication();
- uiApp.addMessage(new
ApplicationMessage("UINavigationManagement.msg.NavigationNotExistAnymore",
null));
- UIPopupWindow uiPopup = uiManagement.getParent();
- uiPopup.setShow(false);
- UIPortalApplication uiPortalApp =
(UIPortalApplication)prContext.getUIApplication();
- UIWorkingWorkspace uiWorkingWS =
uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
- prContext.addUIComponentToUpdateByAjax(uiWorkingWS);
- prContext.setFullRender(true);
- return;
- }
-
- if(PortalConfig.PORTAL_TYPE.equals(navigation.getOwnerType()))
- {
- UserPortalConfig portalConfig =
portalConfigService.getUserPortalConfig(navigation.getOwnerId(),
prContext.getRemoteUser());
- if(portalConfig != null)
+ userPortalConfig = portalConfigService.getUserPortalConfig(editedOwnerId,
event.getRequestContext().getRemoteUser());
+
+ if (userPortalConfig == null)
{
- dataService.save(navigation);
- }
- else
- {
UIApplication uiApp = Util.getPortalRequestContext().getUIApplication();
uiApp.addMessage(new
ApplicationMessage("UIPortalForm.msg.notExistAnymore", null));
- UIPopupWindow uiPopup = uiManagement.getParent();
- uiPopup.setShow(false);
- UIPortalApplication uiPortalApp =
(UIPortalApplication)prContext.getUIApplication();
- UIWorkingWorkspace uiWorkingWS =
uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
- prContext.addUIComponentToUpdateByAjax(uiWorkingWS);
- prContext.setFullRender(true);
return;
}
}
else
{
- dataService.save(navigation);
+ userPortalConfig =
portalConfigService.getUserPortalConfig(prContext.getPortalOwner(),
event.getRequestContext().getRemoteUser());
}
- // Reload navigation here as some navigation could exist in the back end such as
system navigations
- // that would not be in the current edited UI navigation
- navigation = dataService.getPageNavigation(navigation.getOwnerType(),
navigation.getOwnerId());
-
- UIPortalApplication uiPortalApp = Util.getUIPortalApplication();
- setNavigation(uiPortalApp.getNavigations(), navigation);
-
- // Need to relocalize as it was loaded from storage
- uiPortalApp.localizeNavigations();
-
- //Update UIPortal corredponding to edited navigation
- UIPortal targetedUIPortal = uiPortalApp.getCachedUIPortal(editedOwnerType,
editedOwnerId);
- if(targetedUIPortal != null)
+ UserNavigation persistNavigation =
userPortalConfig.getUserPortal().getNavigation(siteKey);
+ if (persistNavigation == null)
{
- targetedUIPortal.setNavigation(navigation);
- }
-
- UIPopupWindow uiPopup = uiManagement.getParent();
- uiPopup.setShow(false);
- UIWorkingWorkspace uiWorkingWS =
uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
- prContext.addUIComponentToUpdateByAjax(uiWorkingWS);
- prContext.setFullRender(true);
- }
+ UIApplication uiApp = Util.getPortalRequestContext().getUIApplication();
+ uiApp.addMessage(new
ApplicationMessage("UINavigationManagement.msg.NavigationNotExistAnymore",
null));
+ return;
+ }
- private void setNavigation(List<PageNavigation> navs, PageNavigation nav)
- {
- for (int i = 0; i < navs.size(); i++)
- {
- if (navs.get(i).getId() == nav.getId())
- {
- navs.set(i, nav);
- return;
- }
- }
+ uiNodeSelector.getRootNode().save();
}
-
}
static public class AddRootNodeActionListener extends
EventListener<UINavigationManagement>
@@ -195,10 +155,9 @@
UIPageNodeForm uiNodeForm =
uiManagementPopup.createUIComponent(UIPageNodeForm.class, null, null);
uiNodeForm.setValues(null);
uiManagementPopup.setUIComponent(uiNodeForm);
- PageNavigation nav = uiNodeSelector.getEdittedNavigation();
- uiNodeForm.setSelectedParent(nav);
- uiNodeForm.setContextPageNavigation(nav);
+ uiNodeForm.setSelectedParent(uiNodeSelector.getSelectedNode());
+ uiNodeForm.setContextPageNavigation(uiNodeSelector.getEdittedNavigation());
uiManagementPopup.setWindowSize(800, 500);
event.getRequestContext().addUIComponentToUpdateByAjax(uiManagementPopup.getParent());
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationNodeSelector.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationNodeSelector.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UINavigationNodeSelector.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -19,14 +19,19 @@
package org.exoplatform.portal.webui.navigation;
+import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.UserACL;
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
-import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.SiteKey;
import org.exoplatform.portal.mop.Visibility;
-import org.exoplatform.portal.webui.navigation.ParentChildPair;
+import org.exoplatform.portal.mop.navigation.NavigationServiceException;
+import org.exoplatform.portal.mop.navigation.NodeFilter;
+import org.exoplatform.portal.mop.navigation.Scope;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserNode;
+import org.exoplatform.portal.mop.user.UserNodePredicate;
+import org.exoplatform.portal.mop.user.UserPortal;
import org.exoplatform.portal.webui.page.UIPage;
import org.exoplatform.portal.webui.page.UIPageNodeForm;
import org.exoplatform.portal.webui.portal.UIPortalComposer;
@@ -36,8 +41,6 @@
import org.exoplatform.portal.webui.workspace.UIPortalApplication;
import org.exoplatform.portal.webui.workspace.UIPortalToolPanel;
import org.exoplatform.portal.webui.workspace.UIWorkingWorkspace;
-import org.exoplatform.services.resources.LocaleConfig;
-import org.exoplatform.services.resources.LocaleConfigService;
import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.config.annotation.ComponentConfig;
@@ -46,17 +49,16 @@
import org.exoplatform.webui.core.UIApplication;
import org.exoplatform.webui.core.UIComponent;
import org.exoplatform.webui.core.UIContainer;
-import org.exoplatform.webui.core.UIFilterableTree;
import org.exoplatform.webui.core.UIPopupWindow;
import org.exoplatform.webui.core.UIRightClickPopupMenu;
import org.exoplatform.webui.core.UITree;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
-
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
import java.util.List;
-import java.util.Locale;
-import java.util.ResourceBundle;
+import java.util.Map;
/** Copied by The eXo Platform SARL Author May 28, 2009 3:07:15 PM */
@ComponentConfigs({
@@ -77,28 +79,33 @@
@EventConfig(listeners =
UINavigationNodeSelector.PasteNodeActionListener.class)})})
public class UINavigationNodeSelector extends UIContainer
{
-
- //private List<PageNavigation> navigations;
- private PageNavigation edittedNavigation;
-
- private TreeNodeData edittedTreeNodeData;
+ private UserNavigation edittedNavigation;
/** This field holds transient copy of edittedTreeNodeData, which is used when user
pastes the content to a new tree node */
private TreeNodeData copyOfTreeNodeData;
- private List<PageNavigation> deleteNavigations = new
ArrayList<PageNavigation>();
+ private TreeNodeData rootNode;
+
+ private UserPortal userPortal;
+ private NodeFilter nodeFilter;
+
+ private static final Scope NODE_SCOPE = Scope.CHILDREN;
+
+ private Map<String, TreeNodeData> cachedNodes = new HashMap<String,
TreeNodeData>();
+
public UINavigationNodeSelector() throws Exception
{
UIRightClickPopupMenu rightClickPopup =
addChild(UIRightClickPopupMenu.class,
"UINavigationNodeSelectorPopupMenu", null).setRendered(true);
rightClickPopup.setActions(new String[]{"AddNode",
"PasteNode"});
- UIFilterableTree uiTree = addChild(UIFilterableTree.class, null,
"TreeNodeSelector");
+ UITree uiTree = addChild(UITree.class, null, "TreeNodeSelector");
uiTree.setIcon("DefaultPageIcon");
uiTree.setSelectedIcon("DefaultPageIcon");
- uiTree.setBeanIdField("uri");
+ uiTree.setBeanIdField("Id");
+ uiTree.setBeanChildCountField("childrenCount");
uiTree.setBeanLabelField("encodedResolvedLabel");
uiTree.setBeanIconField("icon");
@@ -107,190 +114,143 @@
uiPopupMenu.setActions(new String[]{"AddNode", "EditPageNode",
"EditSelectedNode", "CopyNode", "CloneNode",
"CutNode", "DeleteNode", "MoveUp",
"MoveDown"});
uiTree.setUIRightClickPopupMenu(uiPopupMenu);
- setupTreeFilter();
}
-
- /**
- * Setup a filter on the tree node. In this case, SYSTEM node is not displayed if user
is not super user
- *
- */
- private void setupTreeFilter()
- {
- UIFilterableTree.TreeNodeFilter nodeFilter = new UIFilterableTree.TreeNodeFilter()
- {
- public boolean filterThisNode(Object nodeObject, WebuiRequestContext context)
- {
- boolean isSystemNode = (((PageNode)nodeObject).getVisibility() ==
Visibility.SYSTEM );
- if(!isSystemNode)
- {
- return false;
- }else
- {
- UserACL userACL =
context.getUIApplication().getApplicationComponent(UserACL.class);
- return !userACL.getSuperUser().equals(context.getRemoteUser());
- }
-
- }
- };
- this.getChild(UIFilterableTree.class).setTreeNodeFilter(nodeFilter);
- }
-
- public void setEdittedNavigation(PageNavigation _filteredEdittedNavigation) throws
Exception
- {
- this.edittedNavigation = _filteredEdittedNavigation;
- }
-
- public PageNavigation getEdittedNavigation()
- {
- return this.edittedNavigation;
- }
/**
* Init the UITree wrapped in UINavigationNodeSelector and localize the label
* @throws Exception
*/
public void initTreeData() throws Exception
+ {
+ if(edittedNavigation == null || userPortal == null)
+ {
+ throw new IllegalStateException("edittedNavigation and userPortal must be
initialized first");
+ }
+
+ cachedNodes.clear();
+
+ initRootNode();
+ selectNode(rootNode);
+ }
+
+ public TreeNodeData selectNode(String nodeID) throws Exception
{
- WebuiRequestContext requestContext = WebuiRequestContext.getCurrentInstance();
- localizeNavigation(requestContext.getLocale());
-
- initEdittedTreeNodeData();
+ TreeNodeData node = searchNode(nodeID);
+ return selectNode(node);
}
- /**
- * Init the edited node as well as its parent, navigation
- *
- */
- private void initEdittedTreeNodeData()
+ public TreeNodeData selectNode(TreeNodeData node) throws Exception
{
- if(edittedNavigation == null)
+ node = lazyLoadData(node);
+
+ if (node == null)
{
- return;
+ return null;
}
- if (edittedTreeNodeData == null)
+
+ UITree tree = getChild(UITree.class);
+ tree.setSelected(node);
+ if (node.getParent() == null)
{
- edittedTreeNodeData = new TreeNodeData(edittedNavigation);
- if(edittedTreeNodeData.getNode() != null)
- {
- selectPageNodeByUri(edittedTreeNodeData.getNode().getUri());
- }
+ tree.setChildren(null);
+ tree.setSibbling(node.getChildren());
+ tree.setParentSelected(null);
}
-
- UITree tree = getChild(UITree.class);
- tree.setSibbling(edittedNavigation.getNodes());
+ else
+ {
+ TreeNodeData parentNode = node.getParent();
+ tree.setChildren(node.getChildren());
+ tree.setSibbling(parentNode.getChildren());
+ tree.setParentSelected(parentNode);
+ }
+ return node;
}
-
- private void localizeNavigation(Locale locale)
+ public TreeNodeData searchNode(String nodeID)
{
- LocaleConfig localeConfig =
-
getApplicationComponent(LocaleConfigService.class).getLocaleConfig(locale.getLanguage());
- String ownerType = edittedNavigation.getOwnerType();
- if (!PortalConfig.USER_TYPE.equals(ownerType))
+ if (nodeID == null || nodeID.trim().isEmpty())
{
- String ownerId = edittedNavigation.getOwnerId();
- if (PortalConfig.GROUP_TYPE.equals(ownerType))
- {
- // Remove the trailing '/' for a group
- ownerId = ownerId.substring(1);
- }
- ResourceBundle res = localeConfig.getNavigationResourceBundle(ownerType,
ownerId);
- for (PageNode node : edittedNavigation.getNodes())
- {
- resolveLabel(res, node);
- }
+ nodeID = rootNode.getId();
}
+
+ return cachedNodes.get(nodeID);
}
- private void resolveLabel(ResourceBundle res, PageNode node)
+ private TreeNodeData initRootNode() throws Exception
{
- node.setResolvedLabel(res);
- if (node.getChildren() == null)
+ this.rootNode = new TreeNodeData(edittedNavigation,
userPortal.getNode(edittedNavigation, NODE_SCOPE).filter(nodeFilter), this);
+ rootNode.setLoaded(true);
+ return addToCached(rootNode);
+ }
+
+ private TreeNodeData addToCached(TreeNodeData node)
+ {
+ if (node == null)
{
- return;
+ return null;
}
- for (PageNode childNode : node.getChildren())
+ if (!cachedNodes.containsKey(node.getId()))
{
- resolveLabel(res, childNode);
+ cachedNodes.put(node.getId(), node);
}
- }
- public void selectPageNodeByUri(String uri)
- {
- if (edittedTreeNodeData == null)
+ for (TreeNodeData child : node.getChildren())
{
- return;
+ addToCached(child);
}
- UITree tree = getChild(UITree.class);
- List<?> sibbling = tree.getSibbling();
- tree.setSibbling(null);
- tree.setParentSelected(null);
-
edittedTreeNodeData.setNode(searchPageNodeByUri(edittedTreeNodeData.getPageNavigation(),
uri));
- if (edittedTreeNodeData.getNode() != null)
- {
- tree.setSelected(edittedTreeNodeData.getNode());
- tree.setChildren(edittedTreeNodeData.getNode().getChildren());
- return;
- }
- tree.setSelected(null);
- tree.setChildren(null);
- tree.setSibbling(sibbling);
+ return node;
}
- public PageNode searchPageNodeByUri(PageNavigation pageNav, String uri)
+ private TreeNodeData removeFromCached(TreeNodeData node)
{
- if (pageNav == null || uri == null)
+ if (node == null)
{
return null;
}
- List<PageNode> pageNodes = pageNav.getNodes();
- UITree uiTree = getChild(UITree.class);
- for (PageNode ele : pageNodes)
+
+ TreeNodeData currentCopy = getCopyNode();
+ if (currentCopy != null && currentCopy.getURI().equals(node.getURI()))
{
- PageNode returnPageNode = searchPageNodeByUri(ele, uri, uiTree);
- if (returnPageNode == null)
- {
- continue;
- }
- if (uiTree.getSibbling() == null)
- {
- uiTree.setSibbling(pageNodes);
- }
- return returnPageNode;
+ setCopyNode(null);
+ UIRightClickPopupMenu popup =
getChild(UITree.class).getUIRightClickPopupMenu();
+ popup.setActions(new String[]{"AddNode", "EditPageNode",
"EditSelectedNode", "CopyNode", "CutNode",
+ "CloneNode", "DeleteNode", "MoveUp",
"MoveDown"});
}
- return null;
+
+ cachedNodes.remove(node.getId());
+ for (TreeNodeData child : node.getChildren())
+ {
+ removeFromCached(child);
+ }
+ return node;
}
- private PageNode searchPageNodeByUri(PageNode pageNode, String uri, UITree tree)
+ private TreeNodeData lazyLoadData(TreeNodeData treeNode) throws Exception
{
- if (pageNode.getUri().equals(uri))
+ if (treeNode == null || treeNode.getNode() == null)
{
- return pageNode;
+ return treeNode;
}
- List<PageNode> children = pageNode.getChildren();
- if (children == null)
+
+ UserNode node = treeNode.getNode();
+ if (node.getId() == null || treeNode.isLoaded())
{
- return null;
+ return treeNode;
}
- for (PageNode ele : children)
+
+ if (userPortal.getNode(node, NODE_SCOPE) == null)
{
- PageNode returnPageNode = searchPageNodeByUri(ele, uri, tree);
- if (returnPageNode == null)
+ TreeNodeData parent = treeNode.getParent();
+ if (parent != null)
{
- continue;
+ parent.removeChild(treeNode);
+ selectNode(parent);
}
- if (tree.getSibbling() == null)
- {
- tree.setSibbling(children);
- }
- if (tree.getParentSelected() == null)
- {
- tree.setParentSelected(pageNode);
- }
- edittedTreeNodeData.setParentNode(pageNode);
- return returnPageNode;
+ return null;
}
- return null;
+ node.filter(nodeFilter);
+ treeNode.setLoaded(true);
+ return addToCached(treeNode);
}
public void processRender(WebuiRequestContext context) throws Exception
@@ -320,13 +280,48 @@
this.copyOfTreeNodeData = copyNode;
}
+ public TreeNodeData getRootNode()
+ {
+ if (userPortal == null)
+ {
+ throw new IllegalStateException("userPortal must be initialized
first");
+ }
+ return rootNode;
+ }
+
+ public void setUserPortal(UserPortal userPortal) throws Exception
+ {
+ if (edittedNavigation == null)
+ {
+ throw new IllegalStateException("edittedNavigation must be initialized
first");
+ }
+ this.userPortal = userPortal;
+
+
setNodeFilter(userPortal.createFilter(UserNodePredicate.builder().withAuthorizationCheck().build()));
+ }
+
+ private void setNodeFilter(NodeFilter nodeFilter)
+ {
+ this.nodeFilter = nodeFilter;
+ }
+
+ public void setEdittedNavigation(UserNavigation _filteredEdittedNavigation) throws
Exception
+ {
+ this.edittedNavigation = _filteredEdittedNavigation;
+ }
+
+ public UserNavigation getEdittedNavigation()
+ {
+ return this.edittedNavigation;
+ }
+
static public class ChangeNodeActionListener extends EventListener<UITree>
{
public void execute(Event<UITree> event) throws Exception
{
- String uri = event.getRequestContext().getRequestParameter(OBJECTID);
+ String nodeID = event.getRequestContext().getRequestParameter(OBJECTID);
UINavigationNodeSelector uiNodeSelector = event.getSource().getParent();
- uiNodeSelector.selectPageNodeByUri(uri);
+ uiNodeSelector.selectNode(nodeID);
UINavigationManagement nodeManager = uiNodeSelector.getParent();
event.getRequestContext().addUIComponentToUpdateByAjax(nodeManager);
@@ -341,36 +336,25 @@
{
public void execute(Event<UIRightClickPopupMenu> event) throws Exception
{
- String uri =
event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
+ String nodeID =
event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
UIRightClickPopupMenu uiPopupMenu = event.getSource();
UINavigationNodeSelector uiNodeSelector =
uiPopupMenu.getAncestorOfType(UINavigationNodeSelector.class);
+
+ TreeNodeData selectedNode = uiNodeSelector.searchNode(nodeID);
+ if (selectedNode == null || uiNodeSelector.lazyLoadData(selectedNode) == null)
+ {
+ return;
+ }
+
UIPopupWindow uiManagementPopup =
uiNodeSelector.getAncestorOfType(UIPopupWindow.class);
UIPageNodeForm uiNodeForm =
uiManagementPopup.createUIComponent(UIPageNodeForm.class, null, null);
uiNodeForm.setValues(null);
uiManagementPopup.setUIComponent(uiNodeForm);
- Object parent = null;
- PageNavigation edittedNavigation = uiNodeSelector.getEdittedNavigation();
- List<PageNode> pageNodes = edittedNavigation.getNodes();
- if (uri != null && uri.trim().length() > 0)
- {
- for (PageNode pageNode : pageNodes)
- {
- parent = PageNavigationUtils.searchPageNodeByUri(pageNode, uri);
- if (parent != null)
- {
- break;
- }
- }
- }
- if (parent == null)
- {
- parent = edittedNavigation;
- }
-
- uiNodeForm.setSelectedParent(parent);
+ uiNodeForm.setSelectedParent(selectedNode);
+ UserNavigation edittedNavigation = uiNodeSelector.getEdittedNavigation();
uiNodeForm.setContextPageNavigation(edittedNavigation);
uiManagementPopup.setWindowSize(800, 500);
event.getRequestContext().addUIComponentToUpdateByAjax(uiManagementPopup.getParent());
@@ -381,44 +365,27 @@
{
public void execute(Event<UIRightClickPopupMenu> event) throws Exception
{
- // get URI
- String uri =
event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
+ // get nodeID
+ String nodeID =
event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
// get UINavigationNodeSelector
UIRightClickPopupMenu uiPopupMenu = event.getSource();
-
UINavigationNodeSelector uiNodeSelector =
uiPopupMenu.getAncestorOfType(UINavigationNodeSelector.class);
- // get Selected PageNode
- PageNode selectedPageNode = null;
- List<PageNode> pageNodes =
uiNodeSelector.getEdittedNavigation().getNodes();
- if (uri != null && uri.trim().length() > 0)
- {
- for (PageNode pageNode : pageNodes)
- {
- selectedPageNode = PageNavigationUtils.searchPageNodeByUri(pageNode,
uri);
- if (selectedPageNode != null)
- {
- break;
- }
- }
- }
+ // get Selected Node
+ TreeNodeData selectedPageNode = uiNodeSelector.searchNode(nodeID);
UIPortalApplication uiApp = Util.getUIPortalApplication();
-
- if (selectedPageNode.getPageReference() == null)
+ if (selectedPageNode == null || selectedPageNode.getPageRef() == null)
{
uiApp.addMessage(new
ApplicationMessage("UIPageNodeSelector.msg.notAvailable", null));
return;
}
- UIWorkingWorkspace uiWorkingWS =
uiApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
- UIPortalToolPanel uiToolPanel =
-
uiWorkingWS.findFirstComponentOfType(UIPortalToolPanel.class).setRendered(true);
- UserPortalConfigService userService =
uiToolPanel.getApplicationComponent(UserPortalConfigService.class);
+ UserPortalConfigService userService =
uiNodeSelector.getApplicationComponent(UserPortalConfigService.class);
// get selected page
- String pageId = selectedPageNode.getPageReference();
+ String pageId = selectedPageNode.getPageRef();
Page selectPage = (pageId != null) ? userService.getPage(pageId) : null;
if (selectPage != null)
{
@@ -433,6 +400,9 @@
//uiWorkingWS.setRenderedChild(UIPortalToolPanel.class);
//uiWorkingWS.addChild(UIPortalComposer.class, "UIPageEditor",
null);
+ UIWorkingWorkspace uiWorkingWS =
uiApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
+ UIPortalToolPanel uiToolPanel =
+
uiWorkingWS.findFirstComponentOfType(UIPortalToolPanel.class).setRendered(true);
uiWorkingWS.setRenderedChild(UIEditInlineWorkspace.class);
UIPortalComposer portalComposer =
@@ -447,7 +417,6 @@
uiToolPanel.setWorkingComponent(UIPage.class, null);
UIPage uiPage = (UIPage)uiToolPanel.getUIComponent();
- WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
if(selectPage.getTitle() == null)
selectPage.setTitle(selectedPageNode.getLabel());
@@ -459,7 +428,6 @@
else
{
uiApp.addMessage(new
ApplicationMessage("UIPageNodeSelector.msg.notAvailable", null));
- return;
}
}
}
@@ -471,31 +439,36 @@
WebuiRequestContext ctx = event.getRequestContext();
UIRightClickPopupMenu popupMenu = event.getSource();
UIApplication uiApp = ctx.getUIApplication();
- String uri =
event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
+ String nodeID =
event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
UINavigationNodeSelector uiNodeSelector =
popupMenu.getAncestorOfType(UINavigationNodeSelector.class);
- PageNavigation edittedNav = uiNodeSelector.getEdittedNavigation();
- Object obj = PageNavigationUtils.searchParentNode(edittedNav, uri);
- PageNode selectedNode = PageNavigationUtils.searchPageNodeByUri(edittedNav,
uri);
- String pageId = selectedNode.getPageReference();
+ UserNavigation edittedNav = uiNodeSelector.getEdittedNavigation();
+ TreeNodeData selectedNode = uiNodeSelector.searchNode(nodeID);
+ if (selectedNode == null)
+ {
+ return;
+ }
+ String pageId = selectedNode.getPageRef();
+
UserPortalConfigService service =
uiApp.getApplicationComponent(UserPortalConfigService.class);
- Page node = (pageId != null) ? service.getPage(pageId) : null;
- if (node != null)
+ Page page = (pageId != null) ? service.getPage(pageId) : null;
+ if (page != null)
{
UserACL userACL = uiApp.getApplicationComponent(UserACL.class);
- if (!userACL.hasPermission(node))
+ if (!userACL.hasPermission(page))
{
- uiApp.addMessage(new
ApplicationMessage("UIPageBrowser.msg.UserNotPermission", new String[]{pageId},
1));;
+ uiApp.addMessage(new
ApplicationMessage("UIPageBrowser.msg.UserNotPermission", new String[]{pageId},
1));
return;
}
}
+
UIPopupWindow uiManagementPopup =
uiNodeSelector.getAncestorOfType(UIPopupWindow.class);
UIPageNodeForm uiNodeForm = uiApp.createUIComponent(UIPageNodeForm.class, null,
null);
uiManagementPopup.setUIComponent(uiNodeForm);
uiNodeForm.setContextPageNavigation(edittedNav);
uiNodeForm.setValues(selectedNode);
- uiNodeForm.setSelectedParent(obj);
+ uiNodeForm.setSelectedParent(selectedNode.getParent());
uiManagementPopup.setWindowSize(800, 500);
event.getRequestContext().addUIComponentToUpdateByAjax(uiManagementPopup.getParent());
}
@@ -505,26 +478,21 @@
{
public void execute(Event<UIRightClickPopupMenu> event) throws Exception
{
- String uri =
event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
+ String nodeID =
event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
UINavigationNodeSelector uiNodeSelector =
event.getSource().getAncestorOfType(UINavigationNodeSelector.class);
UINavigationManagement uiManagement = uiNodeSelector.getParent();
Class<?>[] childrenToRender = new
Class<?>[]{UINavigationNodeSelector.class};
uiManagement.setRenderedChildrenOfTypes(childrenToRender);
event.getRequestContext().addUIComponentToUpdateByAjax(uiManagement);
- PageNavigation nav = uiNodeSelector.getEdittedNavigation();
- if (nav == null)
+ TreeNodeData node = uiNodeSelector.searchNode(nodeID);
+ if (node == null)
{
return;
}
- PageNode[] pageNodes = PageNavigationUtils.searchPageNodesByUri(nav, uri);
- if (pageNodes == null)
- {
- return;
- }
- TreeNodeData selectedNode = new TreeNodeData(nav, pageNodes[0], pageNodes[1]);
- selectedNode.setDeleteNode(false);
- uiNodeSelector.setCopyNode(selectedNode);
+
+ node.setDeleteNode(false);
+ uiNodeSelector.setCopyNode(node);
event.getSource().setActions(
new String[]{"AddNode", "EditPageNode",
"EditSelectedNode", "CopyNode", "CloneNode",
"CutNode",
"PasteNode", "DeleteNode", "MoveUp",
"MoveDown"});
@@ -535,46 +503,32 @@
{
public void execute(Event<UIRightClickPopupMenu> event) throws Exception
{
- String uri = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
- WebuiRequestContext pcontext = event.getRequestContext();
- UIApplication uiApp = pcontext.getUIApplication();
- UINavigationNodeSelector uiNodeSelector =
event.getSource().getAncestorOfType(UINavigationNodeSelector.class);
- UINavigationManagement uiManagement = uiNodeSelector.getParent();
- Class<?>[] childrenToRender = new
Class<?>[]{UINavigationNodeSelector.class};
- uiManagement.setRenderedChildrenOfTypes(childrenToRender);
- event.getRequestContext().addUIComponentToUpdateByAjax(uiManagement);
+ String nodeID =
event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
+ WebuiRequestContext pcontext = event.getRequestContext();
+ UIApplication uiApp = pcontext.getUIApplication();
+ UINavigationNodeSelector uiNodeSelector =
event.getSource().getAncestorOfType(UINavigationNodeSelector.class);
+ UINavigationManagement uiManagement = uiNodeSelector.getParent();
+ Class<?>[] childrenToRender = new
Class<?>[]{UINavigationNodeSelector.class};
+ uiManagement.setRenderedChildrenOfTypes(childrenToRender);
+ event.getRequestContext().addUIComponentToUpdateByAjax(uiManagement);
- PageNavigation nav = uiNodeSelector.getEdittedNavigation();
- if (nav == null)
- {
- return;
- }
-
- PageNode[] pageNodes = PageNavigationUtils.searchPageNodesByUri(nav, uri);
- if (pageNodes == null)
- {
- return;
- }
-
- for (PageNode pageNode : pageNodes) {
- if(pageNode != null && pageNode.isSystem()) {
- uiApp.addMessage(new
ApplicationMessage("UINavigationNodeSelector.msg.systemnode-move", null));
- return;
- }
- }
-
- TreeNodeData selectedNode = new TreeNodeData(nav, pageNodes[0], pageNodes[1]);
- selectedNode.setDeleteNode(false);
- uiNodeSelector.setCopyNode(selectedNode);
- event.getSource().setActions(
- new String[]{"AddNode", "EditPageNode",
"EditSelectedNode", "CopyNode", "CloneNode",
"CutNode",
- "PasteNode", "DeleteNode", "MoveUp",
"MoveDown"});
+ TreeNodeData node = uiNodeSelector.searchNode(nodeID);
+ if (node == null)
+ {
+ return;
+ }
- if (uiNodeSelector.getCopyNode() == null)
- {
- return;
- }
- uiNodeSelector.getCopyNode().setDeleteNode(true);
+ if(Visibility.SYSTEM.equals(node.getVisibility()))
+ {
+ uiApp.addMessage(new
ApplicationMessage("UINavigationNodeSelector.msg.systemnode-move", null));
+ return;
+ }
+
+ node.setDeleteNode(true);
+ uiNodeSelector.setCopyNode(node);
+ event.getSource().setActions(
+ new String[]{"AddNode", "EditPageNode",
"EditSelectedNode", "CopyNode", "CloneNode",
"CutNode",
+ "PasteNode", "DeleteNode", "MoveUp",
"MoveDown"});
}
}
@@ -590,152 +544,108 @@
static public class PasteNodeActionListener extends
EventListener<UIRightClickPopupMenu>
{
+ private UINavigationNodeSelector uiNodeSelector;
+ private DataStorage dataStorage;
+ private UserPortalConfigService service;
+
public void execute(Event<UIRightClickPopupMenu> event) throws Exception
{
- String targetUri =
event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
+ String nodeID =
event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
UIRightClickPopupMenu uiPopupMenu = event.getSource();
- UINavigationNodeSelector uiNodeSelector =
uiPopupMenu.getAncestorOfType(UINavigationNodeSelector.class);
+ uiNodeSelector = uiPopupMenu.getAncestorOfType(UINavigationNodeSelector.class);
UINavigationManagement uiManagement = uiNodeSelector.getParent();
Class<?>[] childrenToRender = new
Class<?>[]{UINavigationNodeSelector.class};
uiManagement.setRenderedChildrenOfTypes(childrenToRender);
event.getRequestContext().addUIComponentToUpdateByAjax(uiManagement);
- TreeNodeData selectedNode = uiNodeSelector.getCopyNode();
- if (selectedNode == null)
+
+ TreeNodeData targetNode = uiNodeSelector.searchNode(nodeID);
+ TreeNodeData sourceNode = uiNodeSelector.getCopyNode();
+ if (sourceNode == null || uiNodeSelector.lazyLoadData(targetNode) == null)
{
return;
}
- PageNode newNode = selectedNode.getNode().clone();
- PageNavigation targetNav = uiNodeSelector.getEdittedNavigation();
- PageNode targetNode = PageNavigationUtils.searchPageNodeByUri(targetNav,
targetUri);
-
- if (targetNode != null && newNode.getUri().equals(targetNode.getUri()))
+ if (targetNode != null &&
sourceNode.getURI().equals(targetNode.getURI()))
{
UIApplication uiApp = Util.getPortalRequestContext().getUIApplication();
uiApp.addMessage(new
ApplicationMessage("UIPageNodeSelector.msg.paste.sameSrcAndDes", null));
return;
}
- if (isExistChild(targetNode, newNode) || (targetNode == null &&
isExitChild(targetNav, newNode)))
+ if (isExistChild(targetNode, sourceNode))
{
UIApplication uiApp = Util.getPortalRequestContext().getUIApplication();
uiApp.addMessage(new
ApplicationMessage("UIPageNodeSelector.msg.paste.sameName", null));
return;
}
- if (selectedNode.isDeleteNode())
+
+ if (sourceNode.isDeleteNode())
{
- if (selectedNode.getParentNode() != null)
- {
-
selectedNode.getParentNode().getChildren().remove(selectedNode.getNode());
- }
- else
- {
-
selectedNode.getPageNavigation().getNodes().remove(selectedNode.getNode());
- }
+ sourceNode.getParent().removeChild(sourceNode);
}
- event.getRequestContext().addUIComponentToUpdateByAjax(uiNodeSelector);
uiNodeSelector.setCopyNode(null);
+
UITree uitree = uiNodeSelector.getChild(UITree.class);
UIRightClickPopupMenu popup = uitree.getUIRightClickPopupMenu();
popup.setActions(new String[]{"AddNode", "EditPageNode",
"EditSelectedNode", "CopyNode", "CutNode",
"CloneNode", "DeleteNode", "MoveUp",
"MoveDown"});
- UserPortalConfigService service =
uiPopupMenu.getApplicationComponent(UserPortalConfigService.class);
- if (targetNode == null)
- {
- newNode.setUri(newNode.getName());
- targetNav.addNode(newNode);
- if (selectedNode.isCloneNode())
- {
- clonePageFromNode(newNode, targetNav.getOwnerType(),
targetNav.getOwnerId(), service);
- }
- return;
- }
- setNewUri(targetNode, newNode);
- targetNode.getChildren().add(newNode);
- if (selectedNode.isCloneNode())
- {
- clonePageFromNode(newNode, targetNav.getOwnerType(), targetNav.getOwnerId(),
service);
- }
- uiNodeSelector.selectPageNodeByUri(targetNode.getUri());
+ service =
uiNodeSelector.getApplicationComponent(UserPortalConfigService.class);
+ dataStorage = uiNodeSelector.getApplicationComponent(DataStorage.class);
+
+ pasteNode(sourceNode, targetNode, sourceNode.isCloneNode());
+ uiNodeSelector.selectNode(targetNode);
}
- private void clonePageFromNode(PageNode node, String ownerType, String ownerId,
UserPortalConfigService service)
- throws Exception
+ private TreeNodeData pasteNode(TreeNodeData sourceNode, TreeNodeData parent,
boolean isClone) throws Exception
{
- String pageId = node.getPageReference();
- if (pageId != null)
+ if (uiNodeSelector.lazyLoadData(sourceNode) == null)
{
- Page page = service.getPage(pageId);
- if (page != null)
- {
- String newName = "page" + node.hashCode();
- page = service.renewPage(pageId, newName, ownerType, ownerId);
- node.setPageReference(page.getPageId());
- }
+ return null;
}
- List<PageNode> children = node.getChildren();
- if (children == null || children.size() < 1)
+ TreeNodeData node = parent.addChild(sourceNode.getName());
+ node.setLabel(sourceNode.getLabel());
+ node.setVisibility(sourceNode.getVisibility());
+ node.setIcon(sourceNode.getIcon());
+ node.setStartPublicationTime(sourceNode.getStartPublicationTime());
+ node.setEndPublicationTime(sourceNode.getEndPublicationTime());
+
+ if (isClone)
{
- return;
+ String pageName = "page" + node.hashCode();
+ node.setPageRef(clonePageFromNode(sourceNode, pageName,
sourceNode.getPageNavigation().getKey()));
}
- for (PageNode ele : children)
+ else
{
- clonePageFromNode(ele, ownerType, ownerId, service);
+ node.setPageRef(sourceNode.getPageRef());
}
- }
- private void setNewUri(PageNode parent, PageNode child)
- {
- String newUri = (parent != null) ? parent.getUri() + "/" +
child.getName() : child.getName();
- child.setUri(newUri);
- List<PageNode> children = child.getChildren();
- if (children != null)
+ for (TreeNodeData child : sourceNode.getChildren())
{
- for (PageNode node : children)
- {
- setNewUri(child, node);
- }
+ pasteNode(child, node, isClone);
}
+
+ return node;
}
- private boolean isExistChild(PageNode parent, PageNode child)
+ private String clonePageFromNode(TreeNodeData node,String pageName, SiteKey
siteKey) throws Exception
{
- if (parent == null)
+ String pageId = node.getPageRef();
+ if (pageId != null)
{
- return false;
- }
- List<PageNode> nodes = parent.getChildren();
- if (nodes == null)
- {
- parent.setChildren(new ArrayList<PageNode>());
- return false;
- }
- for (PageNode node : nodes)
- {
- if (node.getName().equals(child.getName()))
+ Page page = service.getPage(pageId);
+ if (page != null)
{
- return true;
+ page = dataStorage.clonePage(pageId, siteKey.getTypeName(),
siteKey.getName(), pageName);
+ return page.getPageId();
}
}
- return false;
+ return null;
}
- private boolean isExitChild(PageNavigation nav, PageNode child)
+ private boolean isExistChild(TreeNodeData parent, TreeNodeData child)
{
- List<PageNode> nodes = nav.getNodes();
- if (nodes.size() == 0)
- {
- return false;
- }
- for (PageNode node : nodes)
- {
- if (node.getName().equals(child.getName()))
- {
- return true;
- }
- }
- return false;
+ return parent != null && parent.getChild(child.getName()) != null;
}
}
@@ -746,25 +656,28 @@
moveNode(event, -1);
}
- protected void moveNode(Event<UIRightClickPopupMenu> event, int i)
+ protected void moveNode(Event<UIRightClickPopupMenu> event, int i) throws
Exception
{
- String uri =
event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
+ String nodeID =
event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
UINavigationNodeSelector uiNodeSelector =
event.getSource().getAncestorOfType(UINavigationNodeSelector.class);
event.getRequestContext().addUIComponentToUpdateByAjax(uiNodeSelector.getParent());
- PageNavigation nav = uiNodeSelector.getEdittedNavigation();
- PageNode targetNode = PageNavigationUtils.searchPageNodeByUri(nav, uri);
- Object parentNode = PageNavigationUtils.searchParentNode(nav, uri);
- List<PageNode> children = new ArrayList<PageNode>();
- if (parentNode instanceof PageNavigation)
+ TreeNodeData targetNode = uiNodeSelector.searchNode(nodeID);
+ if (targetNode == null)
{
- children = ((PageNavigation)parentNode).getNodes();
+ return;
}
- else if (parentNode instanceof PageNode)
+ TreeNodeData parentNode = targetNode.getParent();
+ Collection<TreeNodeData> children = parentNode.getChildren();
+
+ int k;
+ for (k = 0; k < children.size(); k++)
{
- children = ((PageNode)parentNode).getChildren();
+ if (parentNode.getChild(k).getURI().equals(targetNode.getURI()))
+ {
+ break;
+ }
}
- int k = children.indexOf(targetNode);
- if (k < 0)
+ if (k > children.size())
{
return;
}
@@ -776,8 +689,9 @@
{
return;
}
- children.remove(k);
- children.add(k + i, targetNode);
+ parentNode.addChild(k + i, targetNode);
+
+ uiNodeSelector.selectNode(targetNode);
}
}
@@ -793,69 +707,39 @@
{
public void execute(Event<UIRightClickPopupMenu> event) throws Exception
{
- String uri =
event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
+ String nodeID =
event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);
WebuiRequestContext pcontext = event.getRequestContext();
UIApplication uiApp = pcontext.getUIApplication();
UINavigationNodeSelector uiNodeSelector =
event.getSource().getAncestorOfType(UINavigationNodeSelector.class);
pcontext.addUIComponentToUpdateByAjax(uiNodeSelector);
- PageNavigation nav = uiNodeSelector.getEdittedNavigation();
- if (nav == null)
+ TreeNodeData childNode = uiNodeSelector.searchNode(nodeID);
+ if (childNode == null)
{
return;
}
+ TreeNodeData parentNode = childNode.getParent();
- ParentChildPair parentChildPair =
PageNavigationUtils.searchParentChildPairByUri(nav, uri);
- if (parentChildPair == null)
- {
- return;
- }
-
- PageNode parentNode = parentChildPair.getParentNode();
- PageNode childNode = parentChildPair.getChildNode();
-
- if(childNode.isSystem()) {
+ if(Visibility.SYSTEM.equals(childNode.getVisibility())) {
uiApp.addMessage(new
ApplicationMessage("UINavigationNodeSelector.msg.systemnode-delete", null));
return;
}
-
- if(parentNode == null)
- {
- nav.getNodes().remove(childNode);
- }
- else
- {
- parentNode.getNodes().remove(childNode);
- uiNodeSelector.selectPageNodeByUri(parentNode.getUri());
- }
+
+ parentNode.removeChild(childNode);
+ uiNodeSelector.selectNode(parentNode);
}
}
public TreeNodeData getSelectedNode()
{
- return edittedTreeNodeData;
+ TreeNodeData selectedNode = getChild(UITree.class).getSelected();
+ if (selectedNode == null)
+ {
+ selectedNode = rootNode;
+ }
+ return selectedNode;
}
- public PageNavigation getSelectedNavigation()
- {
- return edittedTreeNodeData == null ? null :
edittedTreeNodeData.getPageNavigation();
- }
-
- public PageNode getSelectedPageNode()
- {
- return edittedTreeNodeData == null ? null : edittedTreeNodeData.getNode();
- }
-
- public String getUpLevelUri()
- {
- return edittedTreeNodeData.getParentNode().getUri();
- }
-
- public List<PageNavigation> getDeleteNavigations()
- {
- return deleteNavigations;
- }
-
/**
* This class encapsulate data bound to an editted tree node. It consists of a page
node (to be added,
* removed, moved) its parent node and its navigation
@@ -867,82 +751,270 @@
public static class TreeNodeData
{
- private PageNavigation nav;
+ private UserNavigation nav;
- private PageNode parentNode;
+ private UserNode node;
- private PageNode node;
+ private UINavigationNodeSelector selector;
private boolean deleteNode = false;
private boolean cloneNode = false;
- public TreeNodeData(PageNavigation nav, PageNode parentNode, PageNode node)
+ private List<TreeNodeData> wrappedChilds;
+
+ private boolean loaded;
+
+ public TreeNodeData(UserNavigation nav, UserNode node, UINavigationNodeSelector
selector)
{
+ if (nav == null || node == null)
+ {
+ throw new IllegalArgumentException("nav or node is null");
+ }
this.nav = nav;
- this.parentNode = parentNode;
this.node = node;
+ this.selector = selector;
}
-
- public TreeNodeData(PageNavigation nav)
+
+ public UserNavigation getPageNavigation()
{
- this.nav = nav;
- List<PageNode> children = nav.getNodes();
- if(children != null && children.size() > 0)
+ return nav;
+ }
+
+ public UserNode getNode()
+ {
+ return node;
+ }
+
+ public boolean isDeleteNode()
+ {
+ return deleteNode;
+ }
+
+ public void setDeleteNode(boolean deleteNode)
+ {
+ this.deleteNode = deleteNode;
+ }
+
+ public boolean isCloneNode()
+ {
+ return cloneNode;
+ }
+
+ public void setCloneNode(boolean b)
+ {
+ cloneNode = b;
+ }
+
+ public List<TreeNodeData> getChildren()
+ {
+ if (wrappedChilds == null)
{
- this.node = children.get(0);
+ wrappedChilds = new ArrayList<TreeNodeData>();
+ for (UserNode child : node.getChildren())
+ {
+ TreeNodeData node = selector.searchNode(child.getURI());
+ //This is for the first time rootNode is loaded
+ if (node == null)
+ {
+ node = new TreeNodeData(nav, child, selector);
+ }
+ wrappedChilds.add(node);
+ }
}
+ return wrappedChilds;
}
- public PageNavigation getPageNavigation()
+ public TreeNodeData getChild(String name)
{
- return nav;
+ UserNode child = node.getChild(name);
+ if (child == null)
+ {
+ return null;
+ }
+ return selector.searchNode(child.getURI());
}
- public void setPageNavigation(PageNavigation nav)
+ public TreeNodeData addChild(String childName)
{
- this.nav = nav;
+ wrappedChilds = null;
+ UserNode child = node.addChild(childName);
+ return selector.addToCached(new TreeNodeData(nav, child, selector));
}
- public PageNode getParentNode()
+ public boolean removeChild(String childName)
{
- return parentNode;
+ wrappedChilds = null;
+ UserNode child = node.getChild(childName);
+ if (child == null)
+ {
+ return false;
+ }
+ selector.removeFromCached(selector.searchNode(child.getURI()));
+ return node.removeChild(childName);
}
- public void setParentNode(PageNode parentNode)
+ public boolean removeChild(TreeNodeData child)
{
- this.parentNode = parentNode;
+ wrappedChilds = null;
+ if (child == null)
+ {
+ return false;
+ }
+ selector.removeFromCached(child);
+ return node.removeChild(child.getName());
}
- public PageNode getNode()
+ public TreeNodeData getParent()
{
- return node;
+ if (node.getParent() == null)
+ return null;
+ return selector.searchNode(node.getParent().getURI());
}
- public void setNode(PageNode node)
+ public String getPageRef()
{
- this.node = node;
+ return node.getPageRef();
}
- public boolean isDeleteNode()
+ public String getId()
{
- return deleteNode;
+ return getURI();
}
- public void setDeleteNode(boolean deleteNode)
+ public String getURI()
{
- this.deleteNode = deleteNode;
+ return node.getURI();
}
- public boolean isCloneNode()
+ public String getIcon()
{
- return cloneNode;
+ return node.getIcon();
}
- public void setCloneNode(boolean b)
+ public void setIcon(String icon)
{
- cloneNode = b;
+ node.setIcon(icon);
}
+
+ public String getEncodedResolvedLabel()
+ {
+ if (node.getParent() == null)
+ {
+ return "";
+ }
+ return node.getResolvedLabel();
+ }
+
+ public String getName()
+ {
+ return node.getName();
+ }
+
+ public void setName(String name)
+ {
+ node.setName(name);
+ }
+
+ public String getLabel()
+ {
+ return node.getLabel();
+ }
+
+ public void setLabel(String label)
+ {
+ node.setLabel(label);
+ }
+
+ public Visibility getVisibility()
+ {
+ return node.getVisibility();
+ }
+
+ public void setVisibility(Visibility visibility)
+ {
+ node.setVisibility(visibility);
+ }
+
+ public long getStartPublicationTime()
+ {
+ return node.getStartPublicationTime();
+ }
+
+ public void setStartPublicationTime(long startPublicationTime)
+ {
+ node.setStartPublicationTime(startPublicationTime);
+ }
+
+ public long getEndPublicationTime()
+ {
+ return node.getEndPublicationTime();
+ }
+
+ public void setEndPublicationTime(long endPublicationTime)
+ {
+ node.setEndPublicationTime(endPublicationTime);
+ }
+
+ public void setPageRef(String pageRef)
+ {
+ node.setPageRef(pageRef);
+ }
+
+ public String getResolvedLabel()
+ {
+ String resolvedLabel = node.getResolvedLabel();
+
+ return resolvedLabel == null ? "" : resolvedLabel;
+ }
+
+ public boolean hasChildrenRelationship()
+ {
+ return node.hasChildrenRelationship();
+ }
+
+ public int getChildrenCount()
+ {
+ return node.getChildrenCount();
+ }
+
+ public TreeNodeData getChild(int childIndex) throws IndexOutOfBoundsException
+ {
+ UserNode child = node.getChild(childIndex);
+ if (child == null)
+ {
+ return null;
+ }
+ return selector.searchNode(child.getURI());
+ }
+
+ public void addChild(TreeNodeData node)
+ {
+ addChild(node.getChildrenCount(), node);
+ }
+
+ public void addChild(int index, TreeNodeData child)
+ {
+ wrappedChilds = null;
+ node.addChild(index, child.getNode());
+ selector.addToCached(child);
+ }
+
+ public boolean isLoaded()
+ {
+ return loaded;
+ }
+
+ public void setLoaded(boolean loaded)
+ {
+ wrappedChilds = null;
+ this.loaded = loaded;
+ }
+
+ public void save() throws NavigationServiceException
+ {
+ selector.cachedNodes.clear();
+ node.save();
+ }
}
-
}
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPageNavigationForm.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPageNavigationForm.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPageNavigationForm.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -1,16 +1,16 @@
/**
* 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
@@ -20,8 +20,10 @@
package org.exoplatform.portal.webui.navigation;
import org.exoplatform.portal.application.PortalRequestContext;
-import org.exoplatform.portal.config.DataStorage;
-import org.exoplatform.portal.config.model.PageNavigation;
+import org.exoplatform.portal.mop.navigation.NavigationService;
+import org.exoplatform.portal.mop.navigation.NavigationState;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserPortal;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.webui.workspace.UIPortalApplication;
import org.exoplatform.portal.webui.workspace.UIWorkingWorkspace;
@@ -29,28 +31,24 @@
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
-import org.exoplatform.webui.core.UIApplication;
import org.exoplatform.webui.core.UIComponent;
import org.exoplatform.webui.core.UIPopupWindow;
import org.exoplatform.webui.core.lifecycle.UIFormLifecycle;
import org.exoplatform.webui.core.model.SelectItemOption;
import org.exoplatform.webui.event.Event;
-import org.exoplatform.webui.event.EventListener;
import org.exoplatform.webui.event.Event.Phase;
+import org.exoplatform.webui.event.EventListener;
import org.exoplatform.webui.form.UIForm;
import org.exoplatform.webui.form.UIFormSelectBox;
import org.exoplatform.webui.form.UIFormStringInput;
-
import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
import java.util.List;
/*
* Created by The eXo Platform SAS
* Author : tam.nguyen
* tamndrok(a)gmail.com
- * June 11, 2009
+ * June 11, 2009
*/
@ComponentConfig(lifecycle = UIFormLifecycle.class, template =
"system:/groovy/webui/form/UIFormWithTitle.gtmpl", events = {
@EventConfig(listeners = UIPageNavigationForm.SaveActionListener.class),
@@ -58,7 +56,7 @@
public class UIPageNavigationForm extends UIForm
{
- private PageNavigation pageNav_;
+ private UserNavigation userNav;
private String ownerId;
@@ -83,17 +81,17 @@
new UIFormSelectBox("priority", null,
priorties).setValue(getPriority()));
}
- public void setValues(PageNavigation pageNavigation) throws Exception
+ public void setValues(UserNavigation userNavigation) throws Exception
{
- setPageNav(pageNavigation);
- invokeGetBindingBean(pageNavigation);
- removeChildById("ownerId");
- UIFormStringInput ownerId = new UIFormStringInput("ownerId",
"ownerId", pageNavigation.getOwnerId());
+ setUserNav(userNavigation);
+ invokeGetBindingBean(userNavigation);
+ removeChildById("ownerId");
+ UIFormStringInput ownerId = new UIFormStringInput("ownerId",
"ownerId", userNavigation.getKey().getName());
ownerId.setEditable(false);
ownerId.setParent(this);
getChildren().add(1, ownerId);
UIFormSelectBox uiSelectBox = findComponentById("priority");
- uiSelectBox.setValue(String.valueOf(pageNavigation.getPriority()));
+ uiSelectBox.setValue(String.valueOf(userNavigation.getPriority()));
}
public void setOwnerId(String ownerId)
@@ -126,14 +124,14 @@
return priority;
}
- public void setPageNav(PageNavigation pageNav_)
+ public void setUserNav(UserNavigation pageNav_)
{
- this.pageNav_ = pageNav_;
+ this.userNav = pageNav_;
}
- public PageNavigation getPageNav()
+ public UserNavigation getUserNav()
{
- return pageNav_;
+ return userNav;
}
static public class SaveActionListener extends
EventListener<UIPageNavigationForm>
@@ -141,17 +139,18 @@
public void execute(Event<UIPageNavigationForm> event) throws Exception
{
UIPageNavigationForm uiForm = event.getSource();
- PageNavigation pageNav = uiForm.getPageNav();
+ UserNavigation userNav = uiForm.getUserNav();
// Check existed
PortalRequestContext prContext = Util.getPortalRequestContext();
- DataStorage dataService = uiForm.getApplicationComponent(DataStorage.class);
- PageNavigation persistNavigation =
dataService.getPageNavigation(pageNav.getOwnerType(), pageNav.getOwnerId());
- if (persistNavigation == null)
+ UserPortal userPortal =
Util.getUIPortalApplication().getUserPortalConfig().getUserPortal();
+
+ userNav = userPortal.getNavigation(userNav.getKey());
+
+ if (userNav == null)
{
- UIApplication uiApp = Util.getPortalRequestContext().getUIApplication();
- uiApp.addMessage(new
ApplicationMessage("UINavigationManagement.msg.NavigationNotExistAnymore",
null));
UIPortalApplication uiPortalApp =
(UIPortalApplication)prContext.getUIApplication();
+ uiPortalApp.addMessage(new
ApplicationMessage("UINavigationManagement.msg.NavigationNotExistAnymore",
null));
UIWorkingWorkspace uiWorkingWS =
uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
UIPopupWindow uiPopup = uiForm.getParent();
uiPopup.setShow(false);
@@ -159,50 +158,24 @@
return;
}
- WebuiRequestContext pcontext = event.getRequestContext();
- uiForm.invokeSetBindingBean(pageNav);
UIFormSelectBox uiSelectBox = uiForm.findComponentById("priority");
int priority = Integer.parseInt(uiSelectBox.getValue());
- pageNav.setPriority(priority);
// update navigation
- dataService.save(pageNav);
+ NavigationService service =
uiForm.getApplicationComponent(NavigationService.class);
+ service.saveNavigation(userNav.getKey(), new NavigationState(priority));
- pageNav = dataService.getPageNavigation(pageNav.getOwnerType(),
pageNav.getOwnerId());
-
- UIPortalApplication uiPortalApp = Util.getUIPortalApplication();
- updateNavPriority(uiPortalApp.getNavigations(), pageNav);
-
- uiPortalApp.localizeNavigations();
-
UIPopupWindow uiPopup = uiForm.getParent();
uiPopup.setShow(false);
UIComponent opener = uiPopup.getParent();
+
UIWorkingWorkspace uiWorkingWS =
Util.getUIPortal().getAncestorOfType(UIPortalApplication.class).getChild(UIWorkingWorkspace.class);
uiWorkingWS.updatePortletsByName("UserToolbarGroupPortlet");
+
+ WebuiRequestContext pcontext = event.getRequestContext();
pcontext.addUIComponentToUpdateByAjax(opener);
}
-
- private void updateNavPriority(List<PageNavigation> navs, PageNavigation
nav)
- {
- for (int i = 0; i < navs.size(); i++)
- {
- if (navs.get(i).getId() == nav.getId())
- {
- navs.set(i, nav);
- break;
- }
- }
-
- Collections.sort(navs, new Comparator<PageNavigation>()
- {
- public int compare(PageNavigation nav1, PageNavigation nav2)
- {
- return nav1.getPriority() - nav2.getPriority();
- }
- });
- }
}
static public class CloseActionListener extends
EventListener<UIPageNavigationForm>
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPageNodeSelector.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPageNodeSelector.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPageNodeSelector.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -19,172 +19,116 @@
package org.exoplatform.portal.webui.navigation;
-import org.exoplatform.portal.application.PortalRequestContext;
-import org.exoplatform.portal.config.UserPortalConfigService;
-import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
-import org.exoplatform.portal.webui.page.UIPage;
-import org.exoplatform.portal.webui.page.UIPageBody;
+import org.exoplatform.portal.mop.navigation.NodeFilter;
+import org.exoplatform.portal.mop.navigation.Scope;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserNode;
+import org.exoplatform.portal.mop.user.UserNodePredicate;
+import org.exoplatform.portal.mop.user.UserPortal;
import org.exoplatform.portal.webui.util.Util;
-import org.exoplatform.portal.webui.workspace.UIPortalApplication;
-import org.exoplatform.portal.webui.workspace.UIPortalToolPanel;
-import org.exoplatform.portal.webui.workspace.UIWorkingWorkspace;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.config.annotation.ComponentConfig;
-import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.UIContainer;
import org.exoplatform.webui.core.UIRightClickPopupMenu;
import org.exoplatform.webui.core.UITree;
-import org.exoplatform.webui.event.Event;
-import org.exoplatform.webui.event.EventListener;
-import java.util.List;
+import java.util.Iterator;
-/** Created by The eXo Platform SARL Author : chungnv nguyenchung136(a)yahoo.com Jun 23,
2006 10:07:15 AM */
-@ComponentConfig(template =
"system:/groovy/portal/webui/navigation/UIPageNodeSelector.gtmpl", events =
{@EventConfig(listeners = UIPageNodeSelector.ChangeNodeActionListener.class)})
+@ComponentConfig(
+ template =
"system:/groovy/portal/webui/navigation/UIPageNodeSelector.gtmpl"
+)
public class UIPageNodeSelector extends UIContainer
{
+ private UserNavigation navigation;
- // private List<PageNavigation> navigations;
- private PageNavigation selectedNavigation;
+ private UserNode selectedNode;
- private SelectedNode selectedNode;
+ private final NodeFilter NODE_SELECTOR_FILTER;
- private SelectedNode copyNode;
+ private UserPortal userPortal;
public UIPageNodeSelector() throws Exception
{
UITree uiTree = addChild(UITree.class, null, "TreePageSelector");
uiTree.setIcon("DefaultPageIcon");
uiTree.setSelectedIcon("DefaultPageIcon");
- uiTree.setBeanIdField("uri");
+ uiTree.setBeanIdField("URI");
uiTree.setBeanLabelField("encodedResolvedLabel");
uiTree.setBeanIconField("icon");
+ uiTree.setBeanChildCountField("childrenCount");
- loadNavigations();
+ userPortal = Util.getUIPortalApplication().getUserPortalConfig().getUserPortal();
+ UserNodePredicate.Builder scopeBuilder = UserNodePredicate.builder();
+ scopeBuilder.withAuthorizationCheck();
+ NODE_SELECTOR_FILTER = userPortal.createFilter(scopeBuilder.build());
}
- private void loadNavigations() throws Exception
+ public void setNavigation(UserNavigation nav) throws Exception
{
- PageNavigation portalSelectedNav = Util.getUIPortal().getSelectedNavigation();
- if (portalSelectedNav != null)
- {
- selectNavigation(portalSelectedNav);
- PageNode portalSelectedNode = Util.getUIPortal().getSelectedNode();
- if (portalSelectedNode != null)
- {
- selectPageNodeByUri(portalSelectedNode.getUri());
- }
- return;
- }
- selectNavigation();
+ navigation = nav;
+ UserNode selectedNode = Util.getUIPortal().getSelectedUserNode();
+ setSelectedNode(selectedNode);
}
- private void selectNavigation()
+ private UserNode load(UserNode node) throws Exception
{
- if (selectedNavigation == null)
- {
- return;
- }
- if (selectedNode == null || selectedNavigation.getId() !=
selectedNode.getPageNavigation().getId())
- {
- selectedNode = new SelectedNode(selectedNavigation, null, null);
- if (selectedNavigation.getNodes().size() > 0)
- {
- selectedNode.setNode(selectedNavigation.getNodes().get(0));
- }
- }
- selectNavigation(selectedNode.getPageNavigation());
- if (selectedNode.getNode() != null)
- {
- selectPageNodeByUri(selectedNode.getNode().getUri());
- }
+ return userPortal.getNode(node, Scope.GRANDCHILDREN).filter(NODE_SELECTOR_FILTER);
}
-
- public void selectNavigation(PageNavigation pageNav)
+
+ private void setSelectedNode(UserNode node) throws Exception
{
- selectedNavigation = pageNav;
- selectedNode = new SelectedNode(pageNav, null, null);
- selectPageNodeByUri(null);
- UITree uiTree = getChild(UITree.class);
- uiTree.setSibbling(pageNav.getNodes());
- }
-
- public void selectPageNodeByUri(String uri)
- {
- if (selectedNode == null || (selectedNavigation.getId() !=
selectedNode.getPageNavigation().getId()))
+ if (node == null)
{
return;
}
UITree tree = getChild(UITree.class);
- List<?> sibbling = tree.getSibbling();
- tree.setSibbling(null);
- tree.setParentSelected(null);
- selectedNode.setNode(searchPageNodeByUri(selectedNode.getPageNavigation(), uri));
- if (selectedNode.getNode() != null)
+ if (node.getParent() != null)
{
- tree.setSelected(selectedNode.getNode());
- tree.setChildren(selectedNode.getNode().getChildren());
- return;
+ node = load(node);
+ tree.setSelected(node);
+ tree.setChildren(node.getChildren());
+ UserNode parent = load(node.getParent());
+ tree.setSibbling(parent.getChildren());
+ tree.setParentSelected(parent);
}
- tree.setSelected(null);
- tree.setChildren(null);
- tree.setSibbling(sibbling);
+ else
+ {
+ tree.setSelected(null);
+ tree.setChildren(null);
+ }
+ selectedNode = node;
}
-
- public PageNode searchPageNodeByUri(PageNavigation pageNav, String uri)
+
+ public void setSelectedURI(String uri) throws Exception
{
- if (pageNav == null || uri == null)
+ UserNode node;
+ if (selectedNode.getParent() != null)
{
- return null;
+ node = findUserNodeByURI(selectedNode.getParent(), uri);
}
- List<PageNode> pageNodes = pageNav.getNodes();
- UITree uiTree = getChild(UITree.class);
- for (PageNode ele : pageNodes)
+ else
{
- PageNode returnPageNode = searchPageNodeByUri(ele, uri, uiTree);
- if (returnPageNode == null)
- {
- continue;
- }
- if (uiTree.getSibbling() == null)
- {
- uiTree.setSibbling(pageNodes);
- }
- return returnPageNode;
+ node = findUserNodeByURI(selectedNode, uri);
}
- return null;
+ setSelectedNode(node);
}
-
- private PageNode searchPageNodeByUri(PageNode pageNode, String uri, UITree tree)
+
+ private UserNode findUserNodeByURI(UserNode rootNode, String uri)
{
- if (pageNode.getUri().equals(uri))
+ if (rootNode.getURI().equals(uri))
{
- return pageNode;
+ return rootNode;
}
- List<PageNode> children = pageNode.getChildren();
- if (children == null)
+ Iterator<UserNode> iterator = rootNode.getChildren().iterator();
+ while (iterator.hasNext())
{
- return null;
- }
- for (PageNode ele : children)
- {
- PageNode returnPageNode = searchPageNodeByUri(ele, uri, tree);
- if (returnPageNode == null)
+ UserNode next = iterator.next();
+ UserNode node = findUserNodeByURI(next, uri);
+ if (node == null)
{
continue;
}
- if (tree.getSibbling() == null)
- {
- tree.setSibbling(children);
- }
- if (tree.getParentSelected() == null)
- {
- tree.setParentSelected(pageNode);
- }
- selectedNode.setParentNode(pageNode);
- return returnPageNode;
+ return node;
}
return null;
}
@@ -199,172 +143,13 @@
super.processRender(context);
}
- public SelectedNode getCopyNode()
+ public UserNode getSelectedNode()
{
- return copyNode;
- }
-
- public void setCopyNode(SelectedNode copyNode)
- {
- this.copyNode = copyNode;
- }
-
- public SelectedNode getSelectedNode()
- {
return selectedNode;
}
- public PageNavigation getSelectedNavigation()
+ public UserNavigation getNavigation()
{
- return selectedNavigation;
+ return navigation;
}
-
- public PageNode getSelectedPageNode()
- {
- return selectedNode == null ? null : selectedNode.getNode();
- }
-
- public String getUpLevelUri()
- {
- return selectedNode.getParentNode().getUri();
- }
-
- // private List<PageNavigation> getExistedNavigation(List<PageNavigation>
navis) throws Exception {
- // Iterator<PageNavigation> itr = navis.iterator() ;
- // UserPortalConfigService configService =
getApplicationComponent(UserPortalConfigService.class);
- // while(itr.hasNext()) {
- // PageNavigation nav = itr.next() ;
- // if(configService.getPageNavigation(nav.getOwnerType(), nav.getOwnerId()) ==
null) itr.remove() ;
- // }
- // return navis ;
- // }
-
- static public class ChangeNodeActionListener extends EventListener<UITree>
- {
- public void execute(Event<UITree> event) throws Exception
- {
- String uri = event.getRequestContext().getRequestParameter(OBJECTID);
- UIPageNodeSelector uiPageNodeSelector = event.getSource().getParent();
- uiPageNodeSelector.selectPageNodeByUri(uri);
-
- PortalRequestContext pcontext =
(PortalRequestContext)event.getRequestContext();
- UIPortalApplication uiPortalApp =
uiPageNodeSelector.getAncestorOfType(UIPortalApplication.class);
- UIPortalToolPanel uiToolPanel = Util.getUIPortalToolPanel();
- uiToolPanel.setRenderSibling(UIPortalToolPanel.class);
- uiToolPanel.setShowMaskLayer(true);
- UIWorkingWorkspace uiWorkingWS =
uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
- pcontext.addUIComponentToUpdateByAjax(uiWorkingWS);
- pcontext.setFullRender(true);
-
- UIContainer uiParent = uiPageNodeSelector.getParent();
- PageNode node = null;
- if (uiPageNodeSelector.getSelectedNode() == null)
- {
- node = Util.getUIPortal().getSelectedNode();
- }
- else
- {
- node = uiPageNodeSelector.getSelectedNode().getNode();
- }
- if (node == null)
- {
-
uiPageNodeSelector.selectNavigation(uiPageNodeSelector.getSelectedNavigation());
- uiToolPanel.setUIComponent(null);
- return;
- }
-
- UserPortalConfigService configService =
uiParent.getApplicationComponent(UserPortalConfigService.class);
- Page page = null;
- if (node.getPageReference() != null)
- {
- page = configService.getPage(node.getPageReference(),
event.getRequestContext().getRemoteUser());
- }
-
- if (page == null)
- {
- uiToolPanel.setUIComponent(null);
- return;
- }
-
- UIPage uiPage = Util.toUIPage(node, uiToolPanel);
- UIPageBody uiPageBody = uiPortalApp.findFirstComponentOfType(UIPageBody.class);
- if (uiPageBody.getUIComponent() != null)
- {
- uiPageBody.setUIComponent(null);
- }
- uiToolPanel.setUIComponent(uiPage);
- }
- }
-
- public static class SelectedNode
- {
-
- private PageNavigation nav;
-
- private PageNode parentNode;
-
- private PageNode node;
-
- private boolean deleteNode = false;
-
- private boolean cloneNode = false;
-
- public SelectedNode(PageNavigation nav, PageNode parentNode, PageNode node)
- {
- this.nav = nav;
- this.parentNode = parentNode;
- this.node = node;
- }
-
- public PageNavigation getPageNavigation()
- {
- return nav;
- }
-
- public void setPageNavigation(PageNavigation nav)
- {
- this.nav = nav;
- }
-
- public PageNode getParentNode()
- {
- return parentNode;
- }
-
- public void setParentNode(PageNode parentNode)
- {
- this.parentNode = parentNode;
- }
-
- public PageNode getNode()
- {
- return node;
- }
-
- public void setNode(PageNode node)
- {
- this.node = node;
- }
-
- public boolean isDeleteNode()
- {
- return deleteNode;
- }
-
- public void setDeleteNode(boolean deleteNode)
- {
- this.deleteNode = deleteNode;
- }
-
- public boolean isCloneNode()
- {
- return cloneNode;
- }
-
- public void setCloneNode(boolean b)
- {
- cloneNode = b;
- }
- }
-
}
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPortalNavigation.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPortalNavigation.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPortalNavigation.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -20,18 +20,25 @@
package org.exoplatform.portal.webui.navigation;
import org.exoplatform.portal.application.PortalRequestContext;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
+import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.SiteType;
+import org.exoplatform.portal.mop.Visibility;
+import org.exoplatform.portal.mop.navigation.NodeFilter;
+import org.exoplatform.portal.mop.navigation.Scope;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserNode;
+import org.exoplatform.portal.mop.user.UserNodePredicate;
+import org.exoplatform.portal.mop.user.UserPortal;
import org.exoplatform.portal.webui.portal.PageNodeEvent;
import org.exoplatform.portal.webui.portal.UIPortal;
import org.exoplatform.portal.webui.util.Util;
-import org.exoplatform.web.application.JavascriptManager;
+import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.core.UIComponent;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
-
import java.util.ArrayList;
+import java.util.LinkedList;
import java.util.List;
/**
@@ -44,22 +51,26 @@
private boolean showUserNavigation = true;
- protected PageNode selectedNode_;
-
- protected Object selectedParent_;
-
private TreeNode treeNode_;
private String cssClassName = "";
private String template;
-
- private final static String PORTAL_NAV = "portal";
-
- private final static String GROUP_NAV = "group";
-
- private final static String USER_NAV = "user";
+ private final NodeFilter NAVIGATION_FILTER;
+ private static final Scope PORTAL_NAVIGATION_SCOPE = Scope.GRANDCHILDREN;
+
+ private static final Scope SITEMAP_SCOPE = Scope.CHILDREN;
+
+ public UIPortalNavigation()
+ {
+ UserPortal userPortal =
Util.getUIPortalApplication().getUserPortalConfig().getUserPortal();
+ UserNodePredicate.Builder scopeBuilder = UserNodePredicate.builder();
+ scopeBuilder.withAuthorizationCheck().withVisibility(Visibility.DISPLAYED,
Visibility.TEMPORAL);
+ scopeBuilder.withTemporalCheck();
+ NAVIGATION_FILTER = userPortal.createFilter(scopeBuilder.build());
+ }
+
@Override
public String getTemplate()
{
@@ -106,69 +117,89 @@
return cssClassName;
}
- public List<PageNavigation> getNavigations() throws Exception
+ public List<UserNode> getNavigations() throws Exception
{
WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
- List<PageNavigation> result = new ArrayList<PageNavigation>();
-
+ List<UserNode> nodes = new ArrayList<UserNode>();
if (context.getRemoteUser() != null)
{
- result.add(PageNavigationUtils.filter(getSelectedNavigation(),
context.getRemoteUser()));
+ UserNode currRootNode = getCurrentNavigation();
+ if (currRootNode != null)
+ {
+ nodes.add(currRootNode);
+ }
}
else
{
- for (PageNavigation nav : Util.getUIPortalApplication().getNavigations())
+ UserPortal userPortal =
Util.getUIPortalApplication().getUserPortalConfig().getUserPortal();
+ List<UserNavigation> navigations = userPortal.getNavigations();
+ for (UserNavigation userNav : navigations)
{
- if (!showUserNavigation &&
nav.getOwnerType().equals("user"))
+ if (!showUserNavigation &&
userNav.getKey().getType().equals(SiteType.USER))
+ {
continue;
- result.add(PageNavigationUtils.filter(nav, null));
+ }
+
+ UserNode rootNode = userPortal.getNode(userNav, PORTAL_NAVIGATION_SCOPE);
+ if (rootNode != null)
+ {
+ rootNode.filter(NAVIGATION_FILTER);
+ nodes.add(rootNode);
+ }
}
}
- return result;
+ return nodes;
}
public void loadTreeNodes() throws Exception
{
- WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
- treeNode_ = new TreeNode(new PageNode(), new PageNavigation(), true);
- List<PageNavigation> listNavigations =
Util.getUIPortalApplication().getNavigations();
-
- for (PageNavigation nav : rearrangeNavigations(listNavigations))
+ treeNode_ = new TreeNode();
+
+ UserPortal userPortal =
Util.getUIPortalApplication().getUserPortalConfig().getUserPortal();
+ List<UserNavigation> listNavigations = userPortal.getNavigations();
+
+ List<UserNode> childNodes = new LinkedList<UserNode>();
+ for (UserNavigation nav : rearrangeNavigations(listNavigations))
{
- if (!showUserNavigation && nav.getOwnerType().equals("user"))
+ if (!showUserNavigation &&
nav.getKey().getTypeName().equals(PortalConfig.USER_TYPE))
{
continue;
}
- PageNavigation filterNav = PageNavigationUtils.filter(nav,
context.getRemoteUser());
- treeNode_.setChildren(filterNav.getNodes(), filterNav);
+ UserNode rootNode = userPortal.getNode(nav, SITEMAP_SCOPE);
+ if (rootNode != null)
+ {
+ rootNode.filter(NAVIGATION_FILTER);
+ childNodes.addAll(rootNode.getChildren());
+ }
}
+ treeNode_.setChildren(childNodes);
}
-
+
/**
*
* @param listNavigation
* @return
*/
- private List<PageNavigation> rearrangeNavigations(List<PageNavigation>
listNavigation)
+ private List<UserNavigation> rearrangeNavigations(List<UserNavigation>
listNavigation)
{
- List<PageNavigation> returnNavs = new ArrayList<PageNavigation>();
+ List<UserNavigation> returnNavs = new ArrayList<UserNavigation>();
- List<PageNavigation> portalNavs = new ArrayList<PageNavigation>();
- List<PageNavigation> groupNavs = new ArrayList<PageNavigation>();
- List<PageNavigation> userNavs = new ArrayList<PageNavigation>();
+ List<UserNavigation> portalNavs = new ArrayList<UserNavigation>();
+ List<UserNavigation> groupNavs = new ArrayList<UserNavigation>();
+ List<UserNavigation> userNavs = new ArrayList<UserNavigation>();
- for (PageNavigation nav : listNavigation)
+ for (UserNavigation nav : listNavigation)
{
- String ownerType = nav.getOwnerType();
- if (PORTAL_NAV.equals(ownerType))
+ String ownerType = nav.getKey().getTypeName();
+ if (PortalConfig.PORTAL_TYPE.equals(ownerType))
{
portalNavs.add(nav);
}
- else if (GROUP_NAV.equals(ownerType))
+ else if (PortalConfig.GROUP_TYPE.equals(ownerType))
{
groupNavs.add(nav);
}
- else if (USER_NAV.equals(ownerType))
+ else if (PortalConfig.USER_TYPE.equals(ownerType))
{
userNavs.add(nav);
}
@@ -186,105 +217,40 @@
return treeNode_;
}
- public PageNavigation getSelectedNavigation() throws Exception
+ public UserNode getCurrentNavigation() throws Exception
{
- PageNavigation nav = Util.getUIPortal().getSelectedNavigation();
- if (nav != null)
- return nav;
- if (Util.getUIPortal().getNavigations().size() < 1)
- return null;
- return Util.getUIPortal().getNavigations().get(0);
- }
-
- public Object getSelectedParent()
- {
- return selectedParent_;
- }
-
- public PageNode getSelectedPageNode() throws Exception
- {
- if (selectedNode_ != null)
- return selectedNode_;
- selectedNode_ = Util.getUIPortal().getSelectedNode();
- return selectedNode_;
- }
-
- public boolean isSelectedNode(PageNode node)
- {
- if (selectedNode_ != null && node.getUri().equals(selectedNode_.getUri()))
- return true;
- if (selectedParent_ == null || selectedParent_ instanceof PageNavigation)
- return false;
- PageNode pageNode = (PageNode)selectedParent_;
- return node.getUri().equals(pageNode.getUri());
- }
-
- public void processRender(WebuiRequestContext context) throws Exception
- {
- UIPortal uiPortal = Util.getUIPortal();
- if ((uiPortal.getSelectedNode() != null) && (uiPortal.getSelectedNode() !=
selectedNode_))
+ UserPortal userPortal =
Util.getUIPortalApplication().getUserPortalConfig().getUserPortal();
+ UserNavigation userNavigation = Util.getUIPortal().getUserNavigation();
+ UserNode rootNode = userPortal.getNode(userNavigation, PORTAL_NAVIGATION_SCOPE);
+ if (rootNode != null)
{
- setSelectedPageNode(uiPortal.getSelectedNode());
+ rootNode.filter(NAVIGATION_FILTER);
}
- super.processRender(context);
+ return rootNode;
}
- private void setSelectedPageNode(PageNode selectedNode) throws Exception
+ public UserNode getSelectedPageNode() throws Exception
{
- selectedNode_ = selectedNode;
- selectedParent_ = null;
- String seletctUri = selectedNode.getUri();
- int index = seletctUri.lastIndexOf("/");
- String parentUri = null;
- if (index > 0)
- parentUri = seletctUri.substring(0, seletctUri.lastIndexOf("/"));
- List<PageNavigation> pageNavs = getNavigations();
- for (PageNavigation pageNav : pageNavs)
- {
- if (PageNavigationUtils.searchPageNodeByUri(pageNav, selectedNode.getUri()) !=
null)
- {
- if (parentUri == null || parentUri.length() < 1)
- selectedParent_ = pageNav;
- else
- selectedParent_ = PageNavigationUtils.searchPageNodeByUri(pageNav,
parentUri);
- break;
- }
- }
+ return Util.getUIPortal().getSelectedUserNode();
}
static public class SelectNodeActionListener extends
EventListener<UIPortalNavigation>
{
public void execute(Event<UIPortalNavigation> event) throws Exception
{
- UIPortalNavigation uiNavigation = event.getSource();
UIPortal uiPortal = Util.getUIPortal();
- String uri = event.getRequestContext().getRequestParameter(OBJECTID);
- int index = uri.lastIndexOf("::");
- String id = uri.substring(index + 2);
- PageNavigation selectNav = null;
- if (index <= 0)
+ String treePath = event.getRequestContext().getRequestParameter(OBJECTID);
+
+ TreeNode selectedode = event.getSource().getTreeNodes().findNodes(treePath);
+ //There're may be interuption between browser and server
+ if (selectedode == null)
{
- selectNav = uiPortal.getSelectedNavigation();
+ event.getRequestContext().addUIComponentToUpdateByAjax(event.getSource());
+ return;
}
- else
- {
- String navId = uri.substring(0, index);
- //selectNav = uiPortal.getPageNavigation(Integer.parseInt(navId));
- selectNav = uiPortal.getSelectedNavigation();
- }
- PageNode selectNode = PageNavigationUtils.searchPageNodeByUri(selectNav, id);
- uiNavigation.selectedNode_ = selectNode;
- String parentUri = null;
- index = uri.lastIndexOf("/");
- if (index > 0)
- parentUri = uri.substring(0, index);
- if (parentUri == null || parentUri.length() < 1)
- uiNavigation.selectedParent_ = selectNav;
- else
- uiNavigation.selectedParent_ =
PageNavigationUtils.searchPageNodeByUri(selectNav, parentUri);
-
+
PageNodeEvent<UIPortal> pnevent;
- pnevent = new PageNodeEvent<UIPortal>(uiPortal,
PageNodeEvent.CHANGE_PAGE_NODE, uri);
+ pnevent = new PageNodeEvent<UIPortal>(uiPortal,
PageNodeEvent.CHANGE_PAGE_NODE, selectedode.getNode().getURI());
uiPortal.broadcast(pnevent, Event.Phase.PROCESS);
}
}
@@ -293,41 +259,34 @@
{
public void execute(Event<UIPortalNavigation> event) throws Exception
{
- UIPortalNavigation uiNavigation = event.getSource();
-
- TreeNode treeNode = uiNavigation.getTreeNodes();
- List<PageNavigation> all_Navigations =
Util.getUIPortalApplication().getNavigations();
-
- // get URI
- String uri = event.getRequestContext().getRequestParameter(OBJECTID);
- int index = uri.lastIndexOf("::");
- String id = uri.substring(index + 2);
-
- // get PageNavigation by uri
- PageNavigation selectNav = null;
-
- String navId = uri.substring(0, index);
- selectNav = PageNavigationUtils.findNavigationByID(all_Navigations,
Integer.parseInt(navId));
- if(selectNav == null)
+ String treePath = event.getRequestContext().getRequestParameter(OBJECTID);
+
+ TreeNode treeNode = event.getSource().getTreeNodes();
+ TreeNode expandTree = treeNode.findNodes(treePath);
+ //There're may be interuption between browser and server
+ if (expandTree == null)
{
+ event.getRequestContext().addUIComponentToUpdateByAjax(event.getSource());
return;
}
-
- // get PageNode by uri
- PageNode expandNode = PageNavigationUtils.searchPageNodeByUri(selectNav, id);
- TreeNode expandTree = null;
- if (treeNode.getChildren() != null)
+ UserPortal userPortal =
Util.getUIPortalApplication().getUserPortalConfig().getUserPortal();
+
+ UserNode expandNode = userPortal.getNode(expandTree.getNode(), SITEMAP_SCOPE);
+ if (expandNode == null)
{
- expandTree = treeNode.getChildByPath(uri, treeNode);
+ event.getSource().loadTreeNodes();
+ event.getRequestContext().getUIApplication().addMessage(new
+ ApplicationMessage("UIPortalNavigation.msg.staleData", null,
ApplicationMessage.WARNING));
}
-
- if(expandTree != null)
+ else
{
- expandTree.setChildren(expandNode.getChildren(), selectNav);
+ expandNode.filter(event.getSource().NAVIGATION_FILTER);
+ expandTree.setChildren(expandNode.getChildren());
+ expandTree.setExpanded(true);
}
-
- event.getRequestContext().addUIComponentToUpdateByAjax(uiNavigation);
+
+ event.getRequestContext().addUIComponentToUpdateByAjax(event.getSource());
}
}
@@ -335,41 +294,19 @@
{
public void execute(Event<UIPortalNavigation> event) throws Exception
{
- UIPortalNavigation uiNavigation = event.getSource();
-
- TreeNode treeNode = uiNavigation.getTreeNodes();
- UIPortal uiPortal = Util.getUIPortal();
-
// get URI
- String uri = event.getRequestContext().getRequestParameter(OBJECTID);
+ String treePath = event.getRequestContext().getRequestParameter(OBJECTID);
- int index = uri.lastIndexOf("::");
- String id = uri.substring(index + 2);
-
- // get PageNavigation by uri
- PageNavigation selectNav = null;
-
- String navId = uri.substring(0, index);
+ UIPortalNavigation uiNavigation = event.getSource();
+ TreeNode rootNode = uiNavigation.getTreeNodes();
- //TODO: Minh Hoang TO
- //selectNav = uiPortal.getPageNavigation(Integer.parseInt(navId));
- selectNav = uiPortal.getSelectedNavigation();
-
- // get PageNode by uri
- PageNode expandNode = PageNavigationUtils.searchPageNodeByUri(selectNav, id);
-
- TreeNode expandTree = null;
- if (treeNode.getChildren() != null)
+ TreeNode collapseTree = rootNode.findNodes(treePath);
+ if (collapseTree != null)
{
- expandTree = treeNode.getChildByPath(uri, treeNode);
- }
+ collapseTree.setExpanded(false);
+ }
- if(expandTree != null)
- {
- expandTree.setExpanded(false);
- }
-
- event.getRequestContext().addUIComponentToUpdateByAjax(uiNavigation);
+ Util.getPortalRequestContext().setResponseComplete(true);
}
}
@@ -377,9 +314,7 @@
{
public void execute(Event<UIPortalNavigation> event) throws Exception
{
- PortalRequestContext prContext = Util.getPortalRequestContext();
UIPortalNavigation uiNavigation = event.getSource();
-
uiNavigation.loadTreeNodes();
event.getRequestContext().addUIComponentToUpdateByAjax(uiNavigation);
@@ -408,19 +343,19 @@
{
for (TreeNode child : treeNode.getChildren())
{
- PageNode expandNode = child.getNode();
- PageNavigation selectNav = child.getNavigation();
+// PageNode expandNode = child.getNode();
+// PageNavigation selectNav = child.getNavigation();
+//
+// // set node to child tree
+// if (expandNode.getChildren().size() > 0)
+// {
+// child.setChildren(expandNode.getChildren(), selectNav);
+// }
- // set node to child tree
- if (expandNode.getChildren().size() > 0)
- {
- child.setChildren(expandNode.getChildren(), selectNav);
- }
-
// expand child tree
expandAllNode(child);
}
}
}
- }
+ }
}
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/PageQueryAccessList.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/PageQueryAccessList.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/PageQueryAccessList.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -27,8 +27,6 @@
import org.exoplatform.portal.config.Query;
import org.exoplatform.portal.config.model.Page;
-import java.util.Comparator;
-
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
* @version $Revision$
@@ -46,12 +44,6 @@
{
ExoContainer container = PortalContainer.getInstance();
DataStorage service =
(DataStorage)container.getComponentInstance(DataStorage.class);
- return service.find2(state, new Comparator<Page>()
- {
- public int compare(Page page1, Page page2)
- {
- return page1.getName().compareTo(page2.getName());
- }
- });
+ return service.find2(state);
}
}
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIDesktopPage.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIDesktopPage.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIDesktopPage.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -22,12 +22,11 @@
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.model.ModelObject;
import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNavigation;
+import org.exoplatform.portal.mop.user.UserNavigation;
import org.exoplatform.portal.webui.application.UIAddNewApplication;
import org.exoplatform.portal.webui.application.UIApplication;
import org.exoplatform.portal.webui.application.UIGadget;
import org.exoplatform.portal.webui.application.UIPortlet;
-import org.exoplatform.portal.webui.navigation.PageNavigationUtils;
import
org.exoplatform.portal.webui.page.UIPageActionListener.DeleteGadgetActionListener;
import org.exoplatform.portal.webui.page.UIPageActionListener.RemoveChildActionListener;
import org.exoplatform.portal.webui.portal.PageNodeEvent;
@@ -75,16 +74,10 @@
return true;
}
- public List<PageNavigation> getNavigations() throws Exception
+ //TODO: This is not used anymore in WebOS 2.0
+ public List<UserNavigation> getNavigations() throws Exception
{
- List<PageNavigation> allNav = Util.getUIPortal().getNavigations();
- String removeUser = Util.getPortalRequestContext().getRemoteUser();
- List<PageNavigation> result = new ArrayList<PageNavigation>();
- for (PageNavigation nav : allNav)
- {
- result.add(PageNavigationUtils.filter(nav, removeUser));
- }
- return result;
+ throw new UnsupportedOperationException("This is not used anymore in WebOS
2.0");
}
static public class SaveGadgetPropertiesActionListener extends
EventListener<UIPage>
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageActionListener.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -19,22 +19,21 @@
package org.exoplatform.portal.webui.page;
-import org.exoplatform.container.ExoContainer;
import org.exoplatform.portal.application.PortalRequestContext;
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.UserPortalConfig;
-import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.ModelObject;
import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.user.NavigationPath;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserPortal;
import org.exoplatform.portal.webui.application.UIGadget;
import org.exoplatform.portal.webui.portal.PageNodeEvent;
import org.exoplatform.portal.webui.portal.UIPortal;
import org.exoplatform.portal.webui.util.PortalDataMapper;
-import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.webui.workspace.UIPortalApplication;
import org.exoplatform.portal.webui.workspace.UIWorkingWorkspace;
import org.exoplatform.web.application.ApplicationMessage;
@@ -52,331 +51,81 @@
*/
public class UIPageActionListener
{
-
static public class ChangePageNodeActionListener extends
EventListener<UIPortal>
{
- @Override
public void execute(Event<UIPortal> event) throws Exception
{
UIPortal showedUIPortal = event.getSource();
UIPortalApplication uiPortalApp =
showedUIPortal.getAncestorOfType(UIPortalApplication.class);
- //This code snippet is to make sure that Javascript/Skin is fully loaded at the
first request
- UIWorkingWorkspace uiWorkingWS =
uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
- PortalRequestContext pcontext = Util.getPortalRequestContext();
- pcontext.setFullRender(true);
- pcontext.addUIComponentToUpdateByAjax(uiWorkingWS);
+ UserPortal userPortal = uiPortalApp.getUserPortalConfig().getUserPortal();
- PageNavigation currentNav = showedUIPortal.getSelectedNavigation();
- String currentUri = showedUIPortal.getSelectedNode().getUri();
- if(currentUri.startsWith("/"))
- {
- currentUri = currentUri.substring(1);
- }
+ String uri = ((PageNodeEvent<UIPortal>)event).getTargetNodeUri();
+ NavigationPath naviPath = userPortal.resolvePath(uri);
+ UserNavigation targetNav = naviPath.getNavigation();
- //This if branche is to make sure that the first time user logs in,
showedUIPortal has selectedPaths
- //Otherwise, there will be NPE on BreadcumbsPortlet
- if(showedUIPortal.getSelectedPath() == null)
- {
- List<PageNode> currentSelectedPath = findPath(currentNav,
currentUri.split("/"));
- showedUIPortal.setSelectedPath(currentSelectedPath);
- }
+ NavigationPath currentNavPath = showedUIPortal.getNavPath();
- String targetedUri = ((PageNodeEvent<UIPortal>)event).getTargetNodeUri();
- if(targetedUri.startsWith("/"))
+ if(currentNavPath != null &&
currentNavPath.getNavigation().getKey().equals(targetNav.getKey()))
{
- targetedUri = targetedUri.substring(1);
- }
-
- PageNavigation targetedNav = getTargetedNav(uiPortalApp, targetedUri);
-
- if(targetedNav == null)
- {
- return;
- }
-
- String formerNavType = currentNav.getOwnerType();
- String formerNavId = currentNav.getOwnerId();
- String newNavType = targetedNav.getOwnerType();
- String newNavId = targetedNav.getOwnerId();
-
- String[] targetPath = targetedUri.split("/");
- PageNode targetPageNode = getTargetedNode(targetedNav, targetPath);
- List<PageNode> targetedPathNodes = findPath(targetedNav, targetPath);
-
- if(formerNavType.equals(newNavType) && formerNavId.equals(newNavId))
- {
//Case 1: Both navigation type and id are not changed, but current page node
is changed
- if(!currentUri.equals(targetedUri))
+
if(!currentNavPath.getTarget().getURI().equals(naviPath.getTarget().getURI()))
{
- showedUIPortal.setSelectedNode(targetPageNode);
- showedUIPortal.setSelectedPath(targetedPathNodes);
+ showedUIPortal.setNavPath(naviPath);
}
}
else
{
// Case 2: Either navigation type or id has been changed
// First, we try to find a cached UIPortal
+ UIWorkingWorkspace uiWorkingWS =
uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
uiWorkingWS.setRenderedChild(UIPortalApplication.UI_VIEWING_WS_ID);
uiPortalApp.setModeState(UIPortalApplication.NORMAL_MODE);
- showedUIPortal = uiPortalApp.getCachedUIPortal(newNavType, newNavId);
+ showedUIPortal = uiPortalApp.getCachedUIPortal(targetNav.getKey());
if (showedUIPortal != null)
{
- showedUIPortal.setSelectedNode(targetPageNode);
- showedUIPortal.setSelectedPath(targetedPathNodes);
+ showedUIPortal.setNavPath(naviPath);
uiPortalApp.setShowedUIPortal(showedUIPortal);
//Temporary solution to fix edit inline error while switching between
navigations
DataStorage storageService =
uiPortalApp.getApplicationComponent(DataStorage.class);
- PortalConfig associatedPortalConfig =
storageService.getPortalConfig(newNavType, newNavId);
+ PortalConfig associatedPortalConfig =
storageService.getPortalConfig(targetNav.getKey().getTypeName(),
targetNav.getKey().getName());
UserPortalConfig userPortalConfig = uiPortalApp.getUserPortalConfig();
//Update layout-related data on UserPortalConfig
userPortalConfig.setPortal(associatedPortalConfig);
-
- //Update selected navigation on UserPortalConfig, that is mandatory as at
the moment the PortalConfig
- //does not hold any navigation data.
- userPortalConfig.updateSelectedNavigation(newNavType, newNavId);
}
else
{
- showedUIPortal = buildUIPortal(targetedNav, uiPortalApp,
uiPortalApp.getUserPortalConfig());
+ showedUIPortal = buildUIPortal(targetNav.getKey(), uiPortalApp,
uiPortalApp.getUserPortalConfig());
if(showedUIPortal == null)
{
return;
}
- showedUIPortal.setSelectedNode(targetPageNode);
- showedUIPortal.setSelectedPath(targetedPathNodes);
+ showedUIPortal.setNavPath(naviPath);
uiPortalApp.setShowedUIPortal(showedUIPortal);
uiPortalApp.putCachedUIPortal(showedUIPortal);
}
}
+
showedUIPortal.refreshUIPage();
}
-
- /**
- * Get the targeted <code>PageNavigation</code>
- *
- * @param uiPortalApp
- * @param targetedUri
- * @return
- */
- private PageNavigation getTargetedNav(UIPortalApplication uiPortalApp, String
targetedUri)
- {
- List<PageNavigation> allNavs =
uiPortalApp.getUserPortalConfig().getNavigations();
-
- //That happens when user browses to an empty-nodeUri URL like
../portal/public/classic/
- //In this case, we returns default navigation
- if(targetedUri.length() == 0)
- {
- return uiPortalApp.getNavigations().get(0);
- }
-
- String[] pathNodes = targetedUri.split("/");
-
- return getBestMatchNavigation(allNavs, pathNodes);
- }
-
- /**
- * Get the navigation containing longest subpath of 'pathNodes'
- *
- * @param listNav
- * @param pathNodes
- * @return
- */
- private PageNavigation getBestMatchNavigation(List<PageNavigation> listNav,
String[] pathNodes)
- {
- int temporalMaximalMatching = 0;
- PageNavigation temporalBestNavigation = listNav.get(0);
-
- for(PageNavigation nav : listNav)
- {
- int currentNumberOfMatching = countNumberOfMatchedPathNodes(nav, pathNodes);
-
- //The whole pathNodes matches current navigation
- if(currentNumberOfMatching == pathNodes.length)
- {
- return nav;
- }
-
- if(currentNumberOfMatching > temporalMaximalMatching)
- {
- temporalMaximalMatching = currentNumberOfMatching;
- temporalBestNavigation = nav;
- }
- }
- return temporalBestNavigation;
- }
-
- /**
- * Count the maximal number of nodes matching the pathNodes while descending the
navigation 'nav'
- *
- * @param nav
- * @param pathNodes
- * @return
- */
- private int countNumberOfMatchedPathNodes(PageNavigation nav, String[] pathNodes)
- {
- if(pathNodes.length == 0)
- {
- return 0;
- }
-
- PageNode currentNode = nav.getNode(pathNodes[0]);
- int numberOfMatch = (currentNode != null)? 1 : 0 ;
-
- for(int i = 1; i < pathNodes.length; i++)
- {
- if(currentNode == null)
- {
- break;
- }
- currentNode = currentNode.getChild(pathNodes[i]);
- }
- return numberOfMatch;
- }
-
- /**
- * Fetch the currently selected pageNode under a PageNavigation. It is the last
node encountered
- * while descending the pathNodes
- *
- * This method returns <code>null</code> iff only 'notfound'
node remains in the navigation
- *
- * @param targetedNav
- * @param pathNodes
- * @return
- */
- private PageNode getTargetedNode(PageNavigation targetedNav, String[] pathNodes)
- {
- //Case users browses to a URL of the form */portal/public/classic
- if(pathNodes.length == 0)
- {
- return getDefaultNode(targetedNav);
- }
-
- PageNode currentNode = targetedNav.getNode(pathNodes[0]);
- if(currentNode == null)
- {
- return getDefaultNode(targetedNav);
- }
-
- PageNode tempNode = null;
-
- for(int i = 1; i < pathNodes.length; i++)
- {
- tempNode = currentNode.getChild(pathNodes[i]);
- if (tempNode == null)
- {
- break;
- }
- else
- {
- currentNode = tempNode;
- }
- }
- return currentNode;
- }
-
- /**
- * Default node of a navigation. This method returns
- *
- * 1. The first node in the list of 'nav' 's children if the list
contains
- * at least one child other than 'notfound'
- *
- * 2. <code>null</code> otherwise
- *
- * @param nav
- * @return
- */
- private PageNode getDefaultNode(PageNavigation nav)
- {
- PageNode defaultNode = null;
- try
- {
- if (nav != null && nav.getNodes().size() > 0)
- {
- WebuiRequestContext context = Util.getPortalRequestContext();
- ExoContainer appContainer =
context.getApplication().getApplicationServiceContainer();
- UserPortalConfigService userPortalConfigService =
(UserPortalConfigService)appContainer.getComponentInstanceOfType(UserPortalConfigService.class);
-
- for (PageNode pageNode : nav.getNodes())
- {
- Page page =
userPortalConfigService.getPage(pageNode.getPageReference(), context.getRemoteUser());
- if (page != null)
- {
- defaultNode = pageNode;
- break;
- }
- }
- }
- else
- {
- return null;
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- return null;
- }
- if (defaultNode != null &&
!("notfound".equals(defaultNode.getName())))
- {
- return defaultNode;
- }
- else
- {
- return null;
- }
- }
-
- private List<PageNode> findPath(PageNavigation nav, String[] pathNodes)
- {
- List<PageNode> nodes = new ArrayList<PageNode>(4);
-
- //That happens when user browses to a URL like /portal/public/classic
- if(pathNodes.length == 0)
- {
- nodes.add(getDefaultNode(nav));
- return nodes;
- }
- PageNode startNode = nav.getNode(pathNodes[0]);
- if (startNode == null)
- {
- nodes.add(getDefaultNode(nav));
- return nodes;
- }
- nodes.add(startNode);
- for (int i = 1; i < pathNodes.length; i++)
- {
- startNode = startNode.getChild(pathNodes[i]);
- if(startNode == null)
- {
- break;
- }
- else
- {
- nodes.add(startNode);
- }
- }
- return nodes;
- }
-
- private UIPortal buildUIPortal(PageNavigation newPageNav, UIPortalApplication
uiPortalApp, UserPortalConfig userPortalConfig) throws Exception
+ private UIPortal buildUIPortal(SiteKey newPageNav, UIPortalApplication uiPortalApp,
UserPortalConfig userPortalConfig) throws Exception
{
DataStorage storage = uiPortalApp.getApplicationComponent(DataStorage.class);
if(storage == null){
return null;
}
- PortalConfig portalConfig = storage.getPortalConfig(newPageNav.getOwnerType(),
newPageNav.getOwnerId());
+ PortalConfig portalConfig = storage.getPortalConfig(newPageNav.getTypeName(),
newPageNav.getName());
Container layout = portalConfig.getPortalLayout();
if(layout != null)
{
userPortalConfig.setPortal(portalConfig);
}
UIPortal uiPortal = uiPortalApp.createUIComponent(UIPortal.class, null, null);
+
//Reset selected navigation on userPortalConfig
- userPortalConfig.setSelectedNavigation(newPageNav);
PortalDataMapper.toUIPortal(uiPortal, userPortalConfig);
return uiPortal;
}
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBody.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBody.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBody.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -23,13 +23,11 @@
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.Page;
import org.exoplatform.portal.config.model.PageBody;
-import org.exoplatform.portal.config.model.PageNode;
+import org.exoplatform.portal.mop.user.UserNode;
import org.exoplatform.portal.webui.portal.UIPortal;
import org.exoplatform.portal.webui.portal.UIPortalComponent;
import org.exoplatform.portal.webui.util.PortalDataMapper;
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.config.annotation.ComponentConfig;
import org.exoplatform.webui.core.UIComponent;
@@ -46,7 +44,6 @@
private String storageId;
- @SuppressWarnings("unused")
public UIPageBody(PageBody model) throws Exception
{
setId("UIPageBody");
@@ -67,13 +64,12 @@
setId("UIPageBody");
}
- @SuppressWarnings("unused")
public void init(PageBody model) throws Exception
{
setId("UIPageBody");
}
- public void setPageBody(PageNode pageNode, UIPortal uiPortal) throws Exception
+ public void setPageBody(UserNode pageNode, UIPortal uiPortal) throws Exception
{
WebuiRequestContext context = Util.getPortalRequestContext();
uiPortal.setMaximizedUIComponent(null);
@@ -114,7 +110,7 @@
* @param uiPortal
* @return
*/
- private UIPage getUIPage(PageNode pageNode, UIPortal uiPortal, WebuiRequestContext
context)
+ private UIPage getUIPage(UserNode pageNode, UIPortal uiPortal, WebuiRequestContext
context)
throws Exception
{
Page page = null;
@@ -122,7 +118,7 @@
if (pageNode != null)
{
- pageReference = pageNode.getPageReference();
+ pageReference = pageNode.getPageRef();
if (pageReference != null)
{
ExoContainer appContainer =
context.getApplication().getApplicationServiceContainer();
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBrowser.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBrowser.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageBrowser.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -29,9 +29,13 @@
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.ModelObject;
import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.navigation.Scope;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserNode;
+import org.exoplatform.portal.mop.user.UserNodePredicate;
+import org.exoplatform.portal.mop.user.UserPortal;
import org.exoplatform.portal.webui.application.UIPortlet;
import org.exoplatform.portal.webui.portal.PageNodeEvent;
import org.exoplatform.portal.webui.portal.UIPortal;
@@ -57,8 +61,8 @@
import org.exoplatform.webui.core.lifecycle.UIFormLifecycle;
import org.exoplatform.webui.core.model.SelectItemOption;
import org.exoplatform.webui.event.Event;
-import org.exoplatform.webui.event.EventListener;
import org.exoplatform.webui.event.Event.Phase;
+import org.exoplatform.webui.event.EventListener;
import org.exoplatform.webui.form.UIForm;
import org.exoplatform.webui.form.UIFormInputItemSelector;
import org.exoplatform.webui.form.UIFormInputSet;
@@ -278,6 +282,11 @@
PageListAccess datasource = (PageListAccess)repeater.getDataSource();
int currentPage = datasource.getCurrentPage();
+ //Update navigation and UserToolbarGroupPortlet if deleted page is dashboard
page
+ if(page.getOwnerType().equals(PortalConfig.USER_TYPE)){
+ removePageNode(page, event);
+ }
+
dataService.remove(page);
//Minh Hoang TO: The cached UIPage objects corresponding to removed Page should
be removed here.
//As we have multiple UIPortal, which means multiple caches of UIPage. It 's
unwise to garbage
@@ -285,11 +294,11 @@
//removed
UIPortal uiPortal = Util.getUIPortal();
- if (uiPortal.getSelectedNode().getPageReference().equals(page.getPageId()))
+ UserNode userNode = uiPortal.getSelectedUserNode();
+ if (userNode.getPageRef().equals(page.getPageId()))
{
PageNodeEvent<UIPortal> pnevent =
- new PageNodeEvent<UIPortal>(uiPortal,
PageNodeEvent.CHANGE_PAGE_NODE, uiPortal.getSelectedNode()
- .getUri());
+ new PageNodeEvent<UIPortal>(uiPortal,
PageNodeEvent.CHANGE_PAGE_NODE, userNode.getURI());
uiPortal.broadcast(pnevent, Phase.PROCESS);
}
else
@@ -304,11 +313,6 @@
datasource.getPage(currentPage);
event.getRequestContext().addUIComponentToUpdateByAjax(uiPageBrowser);
}
-
- //Update navigation and UserToolbarGroupPortlet if deleted page is dashboard
page
- if(page.getOwnerType().equals(PortalConfig.USER_TYPE)){
- removePageNode(page, event);
- }
}
/**
@@ -323,58 +327,40 @@
*/
private void removePageNode(Page page, Event<UIPageBrowser> event) throws
Exception
{
- UIPageBrowser uiPageBrowser = event.getSource();
- DataStorage dataService =
uiPageBrowser.getApplicationComponent(DataStorage.class);
-
- PageNavigation pageNavigation = null;
UIPortalApplication portalApplication = Util.getUIPortalApplication();
+ UserPortal userPortal =
portalApplication.getUserPortalConfig().getUserPortal();
- List<PageNavigation> listPageNavigation =
portalApplication.getNavigations();
-
- for (PageNavigation pageNvg : listPageNavigation)
+ UserNavigation userNav =
userPortal.getNavigation(SiteKey.user(event.getRequestContext().getRemoteUser()));
+ UserNode rootNode = userPortal.getNode(userNav, Scope.CHILDREN);
+ if (rootNode == null)
{
- if (pageNvg.getOwnerType().equals(PortalConfig.USER_TYPE))
- {
- pageNavigation = pageNvg;
- break;
- }
+ return;
}
- UIPortal uiPortal = Util.getUIPortal();
+ rootNode.filter(userPortal.createFilter(UserNodePredicate.builder().build()));
- PageNode tobeRemoved = null;
- List<PageNode> nodes = pageNavigation.getNodes();
- for (PageNode pageNode : nodes)
+ for (UserNode userNode : rootNode.getChildren())
{
- String pageReference = pageNode.getPageReference();
- String pageId = page.getPageId();
-
- if (pageReference != null && pageReference.equals(pageId))
+ if (page.getPageId().equals(userNode.getPageRef()))
{
- tobeRemoved = pageNode;
- break;
- }
- }
+ // Remove pageNode
+ rootNode.removeChild(userNode.getName());
+ rootNode.save();
- if (tobeRemoved != null)
- {
- // Remove pageNode
- pageNavigation.getNodes().remove(tobeRemoved);
+ // Update navigation and UserToolbarGroupPortlet
- // Update navigation and UserToolbarGroupPortlet
+ String pageRef = page.getPageId();
+ if (pageRef != null && pageRef.length() > 0)
+ {
+ // Remove from cache
+ UIPortal uiPortal = Util.getUIPortal();
+ uiPortal.clearUIPage(pageRef);
+ }
- String pageRef = tobeRemoved.getPageReference();
- if (pageRef != null && pageRef.length() > 0)
- {
- // Remove from cache
- uiPortal.clearUIPage(pageRef);
+ //Update UserToolbarGroupPortlet
+ UIWorkingWorkspace uiWorkingWS =
portalApplication.getChild(UIWorkingWorkspace.class);
+
uiWorkingWS.updatePortletsByName("UserToolbarDashboardPortlet");
+ return;
}
-
- dataService.save(pageNavigation);
-
- //Update UserToolbarGroupPortlet
- UIWorkingWorkspace uiWorkingWS =
portalApplication.getChild(UIWorkingWorkspace.class);
- uiWorkingWS.updatePortletsByName("UserToolbarDashboardPortlet");
-
}
}
}
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageCreationWizard.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -23,9 +23,9 @@
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.UserACL;
import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserNode;
import org.exoplatform.portal.webui.navigation.UIPageNodeSelector;
import org.exoplatform.portal.webui.portal.PageNodeEvent;
import org.exoplatform.portal.webui.portal.UIPortal;
@@ -36,18 +36,16 @@
import org.exoplatform.portal.webui.workspace.UIPortalToolPanel;
import org.exoplatform.portal.webui.workspace.UIWorkingWorkspace;
import org.exoplatform.web.application.ApplicationMessage;
-import org.exoplatform.web.application.JavascriptManager;
import org.exoplatform.webui.application.WebuiRequestContext;
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.event.Event;
import org.exoplatform.webui.event.EventListener;
+import org.exoplatform.webui.form.UIFormStringInput;
-import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
-import java.util.List;
/** Created by The eXo Platform SARL Author : Dang Van Minh minhdv81(a)yahoo.com Jun 23,
2006 */
@ComponentConfigs(@ComponentConfig(template =
"system:/groovy/webui/core/UIWizard.gtmpl", events = {
@@ -75,62 +73,38 @@
setNumberSteps(NUMBER_OF_STEPs);
viewStep(FIRST_STEP);
setShowWelcomeComponent(false);
- boolean isUserNav =
Util.getUIPortal().getSelectedNavigation().getOwnerType().equals(PortalConfig.USER_TYPE);
+ boolean isUserNav =
Util.getUIPortal().getSiteKey().getTypeName().equals(PortalConfig.USER_TYPE);
+ UserNavigation navigation = Util.getUIPortal().getNavPath().getNavigation();
+ uiPageInfo.getChild(UIPageNodeSelector.class).setNavigation(navigation);
+
if (isUserNav)
{
uiPageInfo.getChild(UIPageNodeSelector.class).setRendered(false);
}
}
- private void saveData() throws Exception
+ private UserNode saveData() throws Exception
{
UIPagePreview uiPagePreview = getChild(UIPagePreview.class);
UIPage uiPage = (UIPage)uiPagePreview.getUIComponent();
-
UIWizardPageSetInfo uiPageInfo = getChild(UIWizardPageSetInfo.class);
UIPageNodeSelector uiNodeSelector = uiPageInfo.getChild(UIPageNodeSelector.class);
- PageNode selectedNode = uiNodeSelector.getSelectedPageNode();
- PageNavigation pageNav = uiNodeSelector.getSelectedNavigation();
- if (PortalConfig.USER_TYPE.equals(pageNav.getOwnerType()))
- selectedNode = null;
+ UserNode selectedNode = uiNodeSelector.getSelectedNode();
Page page = (Page)PortalDataMapper.buildModelObject(uiPage);
- PageNode pageNode = uiPageInfo.getPageNode();
- pageNode.setPageReference(page.getPageId());
+ UserNode pageNode = uiPageInfo.createUserNode(selectedNode);
+
+ pageNode.setPageRef(page.getPageId());
if (selectedNode != null)
{
- List<PageNode> children = selectedNode.getChildren();
- if (children == null)
- {
- children = new ArrayList<PageNode>();
- }
- children.add(pageNode);
- selectedNode.setChildren((ArrayList<PageNode>)children);
+ selectedNode.addChild(pageNode);
}
- else
- {
- pageNav.addNode(pageNode);
- }
- uiNodeSelector.selectPageNodeByUri(pageNode.getUri());
-
DataStorage dataService = getApplicationComponent(DataStorage.class);
dataService.create(page);
- dataService.save(pageNav);
- UIPortal uiPortal = Util.getUIPortal();
- setNavigation(uiPortal.getNavigations(), uiNodeSelector.getSelectedNavigation());
- }
+ selectedNode.save();
+ return pageNode;
- private void setNavigation(List<PageNavigation> navs, PageNavigation nav)
- {
- for (int i = 0; i < navs.size(); i++)
- {
- if (navs.get(i).getId() == nav.getId())
- {
- navs.set(i, nav);
- return;
- }
- }
}
/**
@@ -143,29 +117,12 @@
private boolean isSelectedNodeExist() throws Exception
{
UIWizardPageSetInfo uiPageSetInfo = getChild(UIWizardPageSetInfo.class);
- PageNavigation navigation =
uiPageSetInfo.getChild(UIPageNodeSelector.class).getSelectedNavigation();
- PageNode pageNode = uiPageSetInfo.getPageNode();
- PageNode selectedPageNode = uiPageSetInfo.getSelectedPageNode();
- List<PageNode> sibbling = null;
- if (selectedPageNode != null)
+ String pageName =
uiPageSetInfo.getUIStringInput(UIWizardPageSetInfo.PAGE_NAME).getValue();
+ UserNode selectedPageNode = uiPageSetInfo.getSelectedPageNode();
+ if (selectedPageNode.getChild(pageName) != null)
{
- sibbling = selectedPageNode.getChildren();
+ return true;
}
- else
- {
- sibbling = navigation.getNodes();
- }
- if (sibbling != null)
- {
- for (PageNode ele : sibbling)
- {
- if (ele.getUri().equals(pageNode.getUri()))
- {
- return true;
- }
- }
- }
-
return false;
}
@@ -215,7 +172,7 @@
UIWizardPageSetInfo uiPageSetInfo =
uiWizard.getChild(UIWizardPageSetInfo.class);
UIPageNodeSelector uiNodeSelector =
uiPageSetInfo.getChild(UIPageNodeSelector.class);
uiWizard.updateWizardComponent();
- PageNavigation navigation = uiNodeSelector.getSelectedNavigation();
+ UserNavigation navigation = uiNodeSelector.getNavigation();
if (navigation == null)
{
uiPortalApp.addMessage(new
ApplicationMessage("UIPageCreationWizard.msg.notSelectedPageNavigation",
@@ -318,14 +275,14 @@
UIWizardPageSetInfo uiPageInfo = uiWizard.getChild(UIWizardPageSetInfo.class);
UIPageNodeSelector uiNodeSelector =
uiPageInfo.getChild(UIPageNodeSelector.class);
- PageNavigation pageNavi = uiNodeSelector.getSelectedNavigation();
- String ownerType = pageNavi.getOwnerType();
- String ownerId = pageNavi.getOwnerId();
+ UserNavigation pageNavi = uiNodeSelector.getNavigation();
+ String ownerType = pageNavi.getKey().getTypeName();
+ String ownerId = pageNavi.getKey().getName();
- PageNode pageNode = uiPageInfo.getPageNode();
+ UIFormStringInput pageName =
uiPageInfo.getUIStringInput(UIWizardPageSetInfo.PAGE_NAME);
Page page = uiPageTemplateOptions.createPageFromSelectedOption(ownerType,
ownerId);
page.setName("page" + page.hashCode());
- String pageId = pageNavi.getOwnerType() + "::" + pageNavi.getOwnerId()
+ "::" + page.getName();
+ String pageId = ownerType + "::" + ownerId + "::" +
page.getName();
DataStorage storage = uiWizard.getApplicationComponent(DataStorage.class);
if (storage.getPage(pageId) != null)
{
@@ -340,7 +297,7 @@
if (page.getTitle() == null || page.getTitle().trim().length() == 0)
{
- page.setTitle(pageNode.getName());
+ page.setTitle(pageName.getValue());
}
boolean isDesktopPage = Page.DESKTOP_PAGE.equals(page.getFactoryId());
@@ -365,10 +322,9 @@
if (isDesktopPage)
{
- uiWizard.saveData();
- PageNode selectedNode = uiNodeSelector.getSelectedPageNode();
+ UserNode newNode = uiWizard.saveData();
UIPortal uiPortal = Util.getUIPortal();
- PageNodeEvent<UIPortal> pnevent = new
PageNodeEvent<UIPortal>(uiPortal, PageNodeEvent.CHANGE_PAGE_NODE,
selectedNode.getUri());
+ PageNodeEvent<UIPortal> pnevent = new
PageNodeEvent<UIPortal>(uiPortal, PageNodeEvent.CHANGE_PAGE_NODE,
newNode.getURI());
uiPortal.broadcast(pnevent, Event.Phase.PROCESS);
uiWizard.updateUIPortal(event);
return;
@@ -397,16 +353,13 @@
}
uiPortalApp.setModeState(UIPortalApplication.NORMAL_MODE);
uiWorkingWS.setRenderedChild(UIPortalApplication.UI_VIEWING_WS_ID);
- uiWizard.saveData();
+ UserNode newNode = uiWizard.saveData();
UIPortalToolPanel toolPanel =
uiWorkingWS.findFirstComponentOfType(UIPortalToolPanel.class);
toolPanel.setUIComponent(null);
uiWizard.updateUIPortal(event);
- UIWizardPageSetInfo uiPageInfo = uiWizard.getChild(UIWizardPageSetInfo.class);
- UIPageNodeSelector uiNodeSelector =
uiPageInfo.getChild(UIPageNodeSelector.class);
- PageNode selectedNode = uiNodeSelector.getSelectedPageNode();
PortalRequestContext pcontext = Util.getPortalRequestContext();
- String uri = pcontext.getPortalURI() + selectedNode.getUri();
+ String uri = pcontext.getPortalURI() + newNode.getURI();
pcontext.getResponse().sendRedirect(uri);
}
}
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageNodeForm.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageNodeForm.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageNodeForm.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -24,12 +24,10 @@
import org.exoplatform.portal.config.UserACL;
import org.exoplatform.portal.config.model.ModelObject;
import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.mop.Visibility;
-import org.exoplatform.portal.webui.navigation.PageNavigationUtils;
-import org.exoplatform.portal.webui.navigation.ParentChildPair;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.webui.navigation.UINavigationNodeSelector.TreeNodeData;
import org.exoplatform.portal.webui.portal.UIPortal;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.portal.webui.workspace.UIPortalApplication;
@@ -39,8 +37,8 @@
import org.exoplatform.webui.core.UIComponent;
import org.exoplatform.webui.core.UIPopupWindow;
import org.exoplatform.webui.event.Event;
-import org.exoplatform.webui.event.EventListener;
import org.exoplatform.webui.event.Event.Phase;
+import org.exoplatform.webui.event.EventListener;
import org.exoplatform.webui.exception.MessageException;
import org.exoplatform.webui.form.UIFormCheckBoxInput;
import org.exoplatform.webui.form.UIFormDateTimeInput;
@@ -58,6 +56,7 @@
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
+import java.util.EnumSet;
import java.util.List;
/**
@@ -66,23 +65,14 @@
public class UIPageNodeForm extends UIFormTabPane
{
- private PageNode pageNode_;
+ private TreeNodeData pageNode_;
- private String owner_;
-
- private String ownerType_;
-
private Object selectedParent;
-
- /**
- * Wrapper of editted PageNode and its parent
- */
- private ParentChildPair contextParentChildPair;
/**
* PageNavigation to which editted PageNode belongs
*/
- private PageNavigation contextPageNavigation;
+ private UserNavigation contextPageNavigation;
final private static String SHOW_PUBLICATION_DATE = "showPublicationDate";
@@ -98,12 +88,12 @@
UIFormInputSet uiSettingSet = new UIFormInputSet("PageNodeSetting");
UIFormCheckBoxInput<Boolean> uiDateInputCheck =
- new UIFormCheckBoxInput<Boolean>(SHOW_PUBLICATION_DATE,
SHOW_PUBLICATION_DATE, false);
- UIFormCheckBoxInput<Boolean> uiVisibleCheck = new
UIFormCheckBoxInput<Boolean>(VISIBLE, VISIBLE, true);
+ new UIFormCheckBoxInput<Boolean>(SHOW_PUBLICATION_DATE, null, false);
+ UIFormCheckBoxInput<Boolean> uiVisibleCheck = new
UIFormCheckBoxInput<Boolean>(VISIBLE, null, true);
uiDateInputCheck.setOnChange("SwitchPublicationDate");
uiVisibleCheck.setOnChange("SwitchVisible");
- uiSettingSet.addUIFormInput(new UIFormStringInput("uri", "uri",
null).setEditable(false))
+ uiSettingSet.addUIFormInput(new UIFormStringInput("URI", "URI",
null).setEditable(false))
.addUIFormInput(new UIFormStringInput("name", "name",
null).addValidator(MandatoryValidator.class).addValidator(StringLengthValidator.class, 3,
30).addValidator(IdentifierValidator.class))
.addUIFormInput(new UIFormStringInput("label", "label",
null).addValidator(StringLengthValidator.class, 3, 120))
.addUIFormInput(uiVisibleCheck.setChecked(true))
@@ -114,8 +104,8 @@
addUIFormInput(uiSettingSet);
setSelectedTab(uiSettingSet.getId());
- UIPageSelector2 uiPageSelector = createUIComponent(UIPageSelector2.class, null,
null);
- uiPageSelector.configure("UIPageSelector2", "pageReference");
+ UIPageSelector uiPageSelector = createUIComponent(UIPageSelector.class, null,
null);
+ uiPageSelector.configure("UIPageSelector", "pageRef");
addUIFormInput(uiPageSelector);
UIFormInputIconSelector uiIconSelector = new
UIFormInputIconSelector("Icon", "icon");
@@ -123,12 +113,12 @@
setActions(new String[]{"Save", "Back"});
}
- public PageNode getPageNode()
+ public TreeNodeData getPageNode()
{
return pageNode_;
}
- public void setValues(PageNode pageNode) throws Exception
+ public void setValues(TreeNodeData pageNode) throws Exception
{
pageNode_ = pageNode;
if (pageNode == null)
@@ -145,12 +135,13 @@
public void invokeGetBindingBean(Object bean) throws Exception
{
super.invokeGetBindingBean(bean);
- PageNode pageNode = (PageNode)bean;
- String icon = pageNode_.getIcon();
+ TreeNodeData pageNode = (TreeNodeData)bean;
+
+ String icon = pageNode.getIcon();
if (icon == null || icon.length() < 0)
icon = "Default";
getChild(UIFormInputIconSelector.class).setSelectedIcon(icon);
- getUIStringInput("label").setValue(pageNode_.getLabel());
+ getUIStringInput("label").setValue(pageNode.getLabel());
if(pageNode.getVisibility() == Visibility.SYSTEM)
{
UIFormInputSet uiSettingSet = getChildById("PageNodeSetting");
@@ -161,20 +152,22 @@
}
else
{
- getUIFormCheckBoxInput(VISIBLE).setChecked(pageNode_.isVisible());
-
getUIFormCheckBoxInput(SHOW_PUBLICATION_DATE).setChecked(pageNode.isShowPublicationDate());
- setShowCheckPublicationDate(pageNode_.isVisible());
+ Visibility visibility = pageNode.getVisibility();
+ boolean isVisible = visibility == null || EnumSet.of(Visibility.DISPLAYED,
Visibility.TEMPORAL).contains(visibility);
+ getUIFormCheckBoxInput(VISIBLE).setChecked(isVisible);
+
getUIFormCheckBoxInput(SHOW_PUBLICATION_DATE).setChecked(Visibility.TEMPORAL.equals(visibility));
+ setShowCheckPublicationDate(isVisible);
Calendar cal = Calendar.getInstance();
- if (pageNode.getStartPublicationDate() != null)
+ if (pageNode.getStartPublicationTime() != -1)
{
- cal.setTime(pageNode.getStartPublicationDate());
+ cal.setTime(new Date(pageNode.getStartPublicationTime()));
getUIFormDateTimeInput(START_PUBLICATION_DATE).setCalendar(cal);
}
else
getUIFormDateTimeInput(START_PUBLICATION_DATE).setValue(null);
- if (pageNode.getEndPublicationDate() != null)
+ if (pageNode.getEndPublicationTime() != -1)
{
- cal.setTime(pageNode.getEndPublicationDate());
+ cal.setTime(new Date(pageNode.getEndPublicationTime()));
getUIFormDateTimeInput(END_PUBLICATION_DATE).setCalendar(cal);
}
else
@@ -185,17 +178,46 @@
public void invokeSetBindingBean(Object bean) throws Exception
{
+ UIFormStringInput nameTextBox = getUIStringInput("name");
+ //this help to ignore name textbox
+ nameTextBox.setEditable(false);
super.invokeSetBindingBean(bean);
- PageNode node = (PageNode) bean;
+ nameTextBox.setEditable(true);
+
+ TreeNodeData node = (TreeNodeData) bean;
+
+ Visibility visibility;
+ if (getUIFormCheckBoxInput(VISIBLE).isChecked())
+ {
+ UIFormCheckBoxInput showPubDate =
getUIFormCheckBoxInput(SHOW_PUBLICATION_DATE);
+ visibility = showPubDate.isChecked() ? Visibility.TEMPORAL :
Visibility.DISPLAYED;
+ }
+ else
+ {
+ visibility = Visibility.HIDDEN;
+ }
+ node.setVisibility(visibility);
+
if (node.getVisibility() != Visibility.SYSTEM)
{
Calendar cal = getUIFormDateTimeInput(START_PUBLICATION_DATE).getCalendar();
Date date = (cal != null) ? cal.getTime() : null;
- node.setStartPublicationDate(date);
+ node.setStartPublicationTime(date == null ? -1 : date.getTime());
cal = getUIFormDateTimeInput(END_PUBLICATION_DATE).getCalendar();
date = (cal != null) ? cal.getTime() : null;
- node.setEndPublicationDate(date);
+ node.setEndPublicationTime(date == null ? -1 : date.getTime());
}
+
+ UIPageSelector pageSelector = getChild(UIPageSelector.class);
+ if (pageSelector.getPage() == null)
+ node.setPageRef(null);
+ UIFormInputIconSelector uiIconSelector = getChild(UIFormInputIconSelector.class);
+ if (uiIconSelector.getSelectedIcon().equals("Default"))
+ node.setIcon(null);
+ else
+ node.setIcon(uiIconSelector.getSelectedIcon());
+ if (node.getLabel() == null)
+ node.setLabel(node.getName());
}
public void setShowCheckPublicationDate(boolean show)
@@ -221,22 +243,12 @@
{
this.selectedParent = obj;
}
-
- public void setContextParentChildPair(ParentChildPair _contextParentChildPair)
- {
- this.contextParentChildPair = _contextParentChildPair;
- }
- public ParentChildPair getContextParentChildPair()
- {
- return this.contextParentChildPair;
- }
-
public void processRender(WebuiRequestContext context) throws Exception
{
super.processRender(context);
- UIPageSelector2 uiPageSelector = getChild(UIPageSelector2.class);
+ UIPageSelector uiPageSelector = getChild(UIPageSelector.class);
if (uiPageSelector == null)
return;
UIPopupWindow uiPopupWindowPage = uiPageSelector.getChild(UIPopupWindow.class);
@@ -247,20 +259,20 @@
public String getOwner()
{
- return contextPageNavigation.getOwnerId();
+ return contextPageNavigation.getKey().getName();
}
public String getOwnerType()
{
- return contextPageNavigation.getOwnerType();
+ return contextPageNavigation.getKey().getTypeName();
}
- public void setContextPageNavigation(PageNavigation _contextPageNav)
+ public void setContextPageNavigation(UserNavigation _contextPageNav)
{
this.contextPageNavigation = _contextPageNav;
}
- public PageNavigation getContextPageNavigation()
+ public UserNavigation getContextPageNavigation()
{
return this.contextPageNavigation;
}
@@ -272,11 +284,10 @@
WebuiRequestContext ctx = event.getRequestContext();
UIPageNodeForm uiPageNodeForm = event.getSource();
UIApplication uiPortalApp = ctx.getUIApplication();
- PageNode pageNode = uiPageNodeForm.getPageNode();
- if (pageNode == null)
- pageNode = new PageNode();
+ TreeNodeData pageNode = uiPageNodeForm.getPageNode();
- if (pageNode.getVisibility() != Visibility.SYSTEM &&
uiPageNodeForm.getUIFormCheckBoxInput(SHOW_PUBLICATION_DATE).isChecked())
+ if (pageNode == null || (pageNode.getVisibility() != Visibility.SYSTEM
&&
+ uiPageNodeForm.getUIFormCheckBoxInput(SHOW_PUBLICATION_DATE).isChecked()))
{
Calendar currentCalendar = Calendar.getInstance();
currentCalendar.set(currentCalendar.get(Calendar.YEAR),
currentCalendar.get(Calendar.MONTH), currentCalendar.get(Calendar.DAY_OF_MONTH), 0, 0,
0);
@@ -312,56 +323,24 @@
}
}
-
- uiPageNodeForm.invokeSetBindingBean(pageNode);
- UIPageSelector2 pageSelector = uiPageNodeForm.getChild(UIPageSelector2.class);
- if (pageSelector.getPage() == null)
- pageNode.setPageReference(null);
- UIFormInputIconSelector uiIconSelector =
uiPageNodeForm.getChild(UIFormInputIconSelector.class);
- if (uiIconSelector.getSelectedIcon().equals("Default"))
- pageNode.setIcon(null);
- else
- pageNode.setIcon(uiIconSelector.getSelectedIcon());
- if (pageNode.getLabel() == null)
- pageNode.setLabel(pageNode.getName());
- Object selectedParent = uiPageNodeForm.getSelectedParent();
- PageNavigation pageNav = null;
+ UIFormStringInput nameInput =
uiPageNodeForm.getUIStringInput("name");
+ String nodeName = nameInput.getValue();
- if (selectedParent instanceof PageNavigation)
+ TreeNodeData selectedParent = (TreeNodeData)uiPageNodeForm.getSelectedParent();
+ if (pageNode == null && selectedParent.getChild(nodeName) != null)
{
- pageNav = (PageNavigation)selectedParent;
- pageNode.setUri(pageNode.getName());
- if (!pageNav.getNodes().contains(pageNode))
- {
- if (PageNavigationUtils.searchPageNodeByUri(pageNav, pageNode.getUri()) !=
null)
- {
- uiPortalApp.addMessage(new
ApplicationMessage("UIPageNodeForm.msg.SameName", null));
- return;
- }
- pageNav.addNode(pageNode);
- }
+ uiPortalApp.addMessage(new
ApplicationMessage("UIPageNodeForm.msg.SameName", null));
+ return;
}
- else if (selectedParent instanceof PageNode)
+
+ if (pageNode == null)
{
- PageNode parentNode = (PageNode)selectedParent;
- List<PageNode> children = parentNode.getChildren();
- if (children == null)
- {
- children = new ArrayList<PageNode>();
- parentNode.setChildren((ArrayList<PageNode>)children);
- }
- pageNode.setUri(parentNode.getUri() + "/" + pageNode.getName());
- if (!children.contains(pageNode))
- {
- if (PageNavigationUtils.searchPageNodeByUri(parentNode, pageNode.getUri())
!= null)
- {
- uiPortalApp.addMessage(new
ApplicationMessage("UIPageNodeForm.msg.SameName", null));
- return;
- }
- children.add(pageNode);
- }
+ pageNode = selectedParent.addChild(nodeName);
}
+
+ uiPageNodeForm.invokeSetBindingBean(pageNode);
+
uiPageNodeForm.createEvent("Back", Phase.DECODE, ctx).broadcast();
}
}
@@ -403,7 +382,7 @@
public void execute(Event<UIPageNodeForm> event) throws Exception
{
UIPageNodeForm uiForm = event.getSource();
- UIPageSelector2 pageSelector =
uiForm.findFirstComponentOfType(UIPageSelector2.class);
+ UIPageSelector pageSelector =
uiForm.findFirstComponentOfType(UIPageSelector.class);
pageSelector.setPage(null);
event.getRequestContext().addUIComponentToUpdateByAjax(pageSelector);
}
@@ -414,7 +393,7 @@
public void execute(Event<UIPageNodeForm> event) throws Exception
{
UIPageNodeForm uiForm = event.getSource();
- UIPageSelector2 pageSelector =
uiForm.findFirstComponentOfType(UIPageSelector2.class);
+ UIPageSelector pageSelector =
uiForm.findFirstComponentOfType(UIPageSelector.class);
PortalRequestContext pcontext = Util.getPortalRequestContext();
UIPortalApplication uiPortalApp = Util.getUIPortalApplication();
@@ -473,7 +452,7 @@
page.setOwnerType(uiForm.getOwnerType());
page.setOwnerId(ownerId);
page.setName(uiPageName.getValue());
- String title = uiPageTitle.getValue();;
+ String title = uiPageTitle.getValue();
if (title == null || title.trim().length() < 1)
title = page.getName();
page.setTitle(title);
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageSelector.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageSelector.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageSelector.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -30,6 +30,8 @@
import org.exoplatform.webui.config.annotation.ComponentConfigs;
import org.exoplatform.webui.config.annotation.EventConfig;
import org.exoplatform.webui.core.UIApplication;
+import org.exoplatform.webui.core.UIComponent;
+import org.exoplatform.webui.core.UIPopupWindow;
import org.exoplatform.webui.core.UIRepeater;
import org.exoplatform.webui.core.UIVirtualList;
import org.exoplatform.webui.event.Event;
@@ -37,16 +39,22 @@
import org.exoplatform.webui.form.UIForm;
import org.exoplatform.webui.form.UIFormInput;
import org.exoplatform.webui.form.UIFormInputContainer;
+import org.exoplatform.webui.form.UIFormInputSet;
import org.exoplatform.webui.form.UIFormPopupWindow;
+import org.exoplatform.webui.form.UIFormStringInput;
+import org.exoplatform.webui.form.validator.IdentifierValidator;
+import org.exoplatform.webui.form.validator.MandatoryValidator;
+import org.exoplatform.webui.form.validator.StringLengthValidator;
+import java.util.List;
/**
- * Author : Dang Van Minh
- * minhdv81(a)yahoo.com
- * Jun 14, 2006
+ * Author : Dang Van Minh minhdv81(a)yahoo.com Jun 14, 2006
*/
@ComponentConfigs({
- @ComponentConfig(template =
"system:/groovy/portal/webui/page/UIPageSelector.gtmpl"),
- @ComponentConfig(id = "SelectPage", type = UIPageBrowser.class, template =
"system:/groovy/portal/webui/page/UIPageBrowser.gtmpl", events =
@EventConfig(listeners = UIPageSelector.SelectPageActionListener.class))})
+ @ComponentConfig(template =
"system:/groovy/portal/webui/page/UIPageSelector.gtmpl", events =
@EventConfig(listeners = UIPageSelector.OpenSelectPagePopUp.class)),
+ @ComponentConfig(id = "SelectPage", type = UIPageBrowser.class, template =
"system:/groovy/portal/webui/page/UIPageBrowser.gtmpl", events =
@EventConfig(listeners = UIPageSelector.SelectPageActionListener.class)),
+ @ComponentConfig(type = UIFormPopupWindow.class, template =
"system:/groovy/webui/core/UIPopupWindow.gtmpl",
+ events = @EventConfig(listeners = UIPageSelector.CloseActionListener.class, name =
"CloseFormPopup", phase = Event.Phase.DECODE))})
public class UIPageSelector extends UIFormInputContainer<String>
{
@@ -57,15 +65,19 @@
public UIPageSelector() throws Exception
{
super("UIPageSelector", null);
- UIFormPopupWindow uiPopup = addChild(UIFormPopupWindow.class, null,
"PopupPageSelector");
+ UIFormPopupWindow uiPopup = addChild(UIFormPopupWindow.class, null,
"PopupPageSelector2");
uiPopup.setWindowSize(900, 400);
- uiPopup.setRendered(false);
- UIPageBrowser uiPageBrowser = createUIComponent(UIPageBrowser.class,
"SelectPage", null);
- uiPopup.setUIComponent(uiPageBrowser);
- //UIGrid uiGrid = uiPageBrowser.getChild(UIGrid.class);
- //uiGrid.configure("pageId", UIPageBrowser.BEAN_FIELD, new
String[]{"SelectPage"});
- UIVirtualList uiVirtualList = uiPageBrowser.getChild(UIVirtualList.class);
- configureVirtualList(uiVirtualList);
+ uiPopup.setShow(false);
+
+ UIFormInputSet uiInputSet = new UIFormInputSet("PageNodeSetting");
+
+ uiInputSet.addChild(new UIFormStringInput("pageId", "pageId",
null));
+ uiInputSet.addChild(new UIFormStringInput("pageName",
"pageName", null).addValidator(StringLengthValidator.class,
+ 3,
30).addValidator(IdentifierValidator.class).addValidator(MandatoryValidator.class));
+ uiInputSet.addChild(new UIFormStringInput("pageTitle",
"pageTitle", null).addValidator(
+ StringLengthValidator.class, 3, 120));
+
+ addChild(uiInputSet);
}
private static void configureVirtualList(UIVirtualList vList)
@@ -118,9 +130,56 @@
{
super.processDecode(context);
UIPageBrowser uiPageBrowser = findFirstComponentOfType(UIPageBrowser.class);
- uiPageBrowser.processDecode(context);
+ if (uiPageBrowser != null)
+ {
+ uiPageBrowser.processDecode(context);
+ }
+
+ UIFormInputSet uiInputSet = getChild(UIFormInputSet.class);
+
+ List<UIComponent> children = uiInputSet.getChildren();
+ for (UIComponent ele : children)
+ {
+ ele.processDecode(context);
+ }
+ // UIFormStringInput uiPageId = getChildById("pageId");
+ // uiPageId.processDecode(context);
+ //
+ // UIFormStringInput uiPageName = getChildById("pageName");
+ // uiPageName.processDecode(context);
+ //
+ // UIFormStringInput uiPageTitle = getChildById("pageTitle");
+ // uiPageTitle.processDecode(context);
}
+ static public class OpenSelectPagePopUp extends EventListener<UIPageSelector>
+ {
+ @Override
+ public void execute(Event<UIPageSelector> event) throws Exception
+ {
+ UIPageSelector pageSelector = event.getSource();
+ UIFormPopupWindow uiPopup = pageSelector.getChild(UIFormPopupWindow.class);
+
+ UIPageBrowser uiPageBrowser =
pageSelector.createUIComponent(UIPageBrowser.class, "SelectPage", null);
+ uiPopup.setUIComponent(uiPageBrowser);
+ uiPopup.setShow(true);
+
+ UIVirtualList uiVirtualList = uiPageBrowser.getChild(UIVirtualList.class);
+ configureVirtualList(uiVirtualList);
+ }
+ }
+
+ static public class CloseActionListener extends UIFormPopupWindow.CloseActionListener
+ {
+ @Override
+ public void execute(Event<UIPopupWindow> event) throws Exception
+ {
+ UIPopupWindow popWindow = event.getSource();
+ popWindow.setUIComponent(null);
+ super.execute(event);
+ }
+ }
+
static public class SelectPageActionListener extends
EventListener<UIPageBrowser>
{
public void execute(Event<UIPageBrowser> event) throws Exception
@@ -137,7 +196,7 @@
uiApp.addMessage(new
ApplicationMessage("UIPageBrowser.msg.NoPermission", new String[]{id}));;
}
uiPageSelector.setValue(id);
- uiPageBrowser.feedDataWithQuery(null);
+// uiPageBrowser.feedDataWithQuery(null);
UIForm uiForm = uiPageSelector.getAncestorOfType(UIForm.class);
if (uiForm != null)
@@ -149,6 +208,7 @@
ctx.addUIComponentToUpdateByAjax(uiPageSelector.getParent());
}
UIFormPopupWindow uiPopup = uiPageSelector.getChild(UIFormPopupWindow.class);
+ uiPopup.setUIComponent(null);
uiPopup.setShow(false);
}
}
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIWizardPageSetInfo.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIWizardPageSetInfo.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIWizardPageSetInfo.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -19,27 +19,18 @@
package org.exoplatform.portal.webui.page;
-import org.exoplatform.portal.config.UserPortalConfigService;
-import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
-import org.exoplatform.portal.config.model.PortalConfig;
+import org.exoplatform.portal.mop.Visibility;
+import org.exoplatform.portal.mop.user.UserNode;
import org.exoplatform.portal.webui.navigation.UIPageNodeSelector;
-import org.exoplatform.portal.webui.portal.UIPortal;
-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.config.annotation.ComponentConfig;
-import org.exoplatform.webui.config.annotation.ComponentConfigs;
import org.exoplatform.webui.config.annotation.EventConfig;
-import org.exoplatform.webui.core.UIComponent;
-import org.exoplatform.webui.core.UITree;
import org.exoplatform.webui.core.UIWizard;
import org.exoplatform.webui.core.lifecycle.UIFormLifecycle;
import org.exoplatform.webui.event.Event;
-import org.exoplatform.webui.event.EventListener;
import org.exoplatform.webui.event.Event.Phase;
+import org.exoplatform.webui.event.EventListener;
import org.exoplatform.webui.form.UIForm;
import org.exoplatform.webui.form.UIFormCheckBoxInput;
import org.exoplatform.webui.form.UIFormDateTimeInput;
@@ -50,7 +41,6 @@
import org.exoplatform.webui.form.validator.StringLengthValidator;
import java.util.Calendar;
-import java.util.Date;
/**
* Created by The eXo Platform SARL
@@ -58,10 +48,10 @@
* hoa.nguyen(a)exoplatform.com
* Oct 31, 2006
*/
-@ComponentConfigs({@ComponentConfig(lifecycle = UIFormLifecycle.class, template =
"system:/groovy/portal/webui/page/UIWizardPageSetInfo.gtmpl", events = {
+@ComponentConfig(lifecycle = UIFormLifecycle.class, template =
"system:/groovy/portal/webui/page/UIWizardPageSetInfo.gtmpl", events = {
@EventConfig(listeners = UIWizardPageSetInfo.ChangeNodeActionListener.class, phase =
Phase.DECODE),
@EventConfig(listeners = UIWizardPageSetInfo.SwitchVisibleActionListener.class, phase
= Phase.DECODE),
- @EventConfig(listeners =
UIWizardPageSetInfo.SwitchPublicationDateActionListener.class, phase = Phase.DECODE)})})
+ @EventConfig(listeners =
UIWizardPageSetInfo.SwitchPublicationDateActionListener.class, phase = Phase.DECODE)})
public class UIWizardPageSetInfo extends UIForm
{
@@ -83,23 +73,24 @@
public UIWizardPageSetInfo() throws Exception
{
- UIFormCheckBoxInput<Boolean> uiDateInputCheck =
- new UIFormCheckBoxInput<Boolean>(SHOW_PUBLICATION_DATE,
SHOW_PUBLICATION_DATE, false);
- UIFormCheckBoxInput<Boolean> uiVisibleCheck = new
UIFormCheckBoxInput<Boolean>(VISIBLE, VISIBLE, false);
- uiDateInputCheck.setOnChange("SwitchPublicationDate");
- uiVisibleCheck.setOnChange("SwitchVisible");
-
+ UIFormCheckBoxInput<Boolean> uiDateInputCheck =
+ new UIFormCheckBoxInput<Boolean>(SHOW_PUBLICATION_DATE, null, false);
+ UIFormCheckBoxInput<Boolean> uiVisibleCheck = new
UIFormCheckBoxInput<Boolean>(VISIBLE, null, false);
+ uiDateInputCheck.setOnChange("SwitchPublicationDate");
+ uiVisibleCheck.setOnChange("SwitchVisible");
+
addChild(UIPageNodeSelector.class, null, null);
addUIFormInput(new UIFormStringInput(PAGE_NAME, "name",
null).addValidator(MandatoryValidator.class)
- .addValidator(StringLengthValidator.class, 3,
30).addValidator(IdentifierValidator.class));
- addUIFormInput(new UIFormStringInput(PAGE_DISPLAY_NAME, "label", null)
- .setMaxLength(255).addValidator(StringLengthValidator.class, 3, 120));
+ .addValidator(StringLengthValidator.class, 3,
30).addValidator(IdentifierValidator.class));
+ addUIFormInput(new UIFormStringInput(PAGE_DISPLAY_NAME, "label",
null).setMaxLength(255).addValidator(
+ StringLengthValidator.class, 3, 120));
addUIFormInput(uiVisibleCheck.setChecked(true));
addUIFormInput(uiDateInputCheck);
addUIFormInput(new UIFormDateTimeInput(START_PUBLICATION_DATE, null,
null).addValidator(DateTimeValidator.class));
addUIFormInput(new UIFormDateTimeInput(END_PUBLICATION_DATE, null,
null).addValidator(DateTimeValidator.class));
}
+ //TODO: it looks like this method is not used
public void setEditMode() throws Exception
{
isEditMode = true;
@@ -115,55 +106,37 @@
public void invokeSetBindingBean(Object bean) throws Exception
{
super.invokeSetBindingBean(bean);
- PageNode node = (PageNode)bean;
- if(!getUIFormCheckBoxInput(SHOW_PUBLICATION_DATE).isChecked())
+ UserNode node = (UserNode)bean;
+
+ Visibility visibility;
+ if (getUIFormCheckBoxInput(VISIBLE).isChecked())
{
- node.setVisible(getUIFormCheckBoxInput(VISIBLE).isChecked());
+ UIFormCheckBoxInput showPubDate =
getUIFormCheckBoxInput(SHOW_PUBLICATION_DATE);
+ visibility = showPubDate.isChecked() ? Visibility.TEMPORAL :
Visibility.DISPLAYED;
}
+ else
+ {
+ visibility = Visibility.HIDDEN;
+ }
+ node.setVisibility(visibility);
+
Calendar cal = getUIFormDateTimeInput(START_PUBLICATION_DATE).getCalendar();
- Date date = (cal != null) ? cal.getTime() : null;
- node.setStartPublicationDate(date);
+ long time = (cal != null) ? cal.getTimeInMillis() : -1;
+ node.setStartPublicationTime(time);
cal = getUIFormDateTimeInput(END_PUBLICATION_DATE).getCalendar();
- date = (cal != null) ? cal.getTime() : null;
- node.setEndPublicationDate(date);
+ time = (cal != null) ? cal.getTimeInMillis() : -1;
+ node.setEndPublicationTime(time);
}
- public PageNode getPageNode() throws Exception
+ public UserNode createUserNode(UserNode parent) throws Exception
{
- if (isEditMode)
+ UserNode child = parent.addChild("temp");
+ invokeSetBindingBean(child);
+ if (child.getLabel() == null || child.getLabel().trim().length() == 0)
{
- PageNode pageNode = getSelectedPageNode();
- PageNode clonedNode = (pageNode != null) ? pageNode.clone() : null;
- invokeSetBindingBean(clonedNode);
- if (clonedNode.getLabel() == null || clonedNode.getLabel().trim().length() ==
0)
- {
- clonedNode.setLabel(clonedNode.getName());
- }
- return clonedNode;
+ child.setLabel(child.getName());
}
-
- PageNode pageNode = new PageNode();
- invokeSetBindingBean(pageNode);
- if (pageNode.getLabel() == null || pageNode.getLabel().trim().length() == 0)
- {
- pageNode.setLabel(pageNode.getName());
- }
-
- UIPageNodeSelector uiNodeSelector = getChild(UIPageNodeSelector.class);
- PageNode selectedNode = uiNodeSelector.getSelectedPageNode();
- PageNavigation nav = uiNodeSelector.getSelectedNavigation();
- if(nav.getOwnerType().equals(PortalConfig.USER_TYPE))
- pageNode.setUri(pageNode.getName());
- else
- {
- if (selectedNode != null)
- {
- pageNode.setUri(selectedNode.getUri() + "/" + pageNode.getName());
- }
- else
- pageNode.setUri(pageNode.getName());
- }
- return pageNode;
+ return child;
}
public void setShowCheckPublicationDate(boolean show)
@@ -173,63 +146,26 @@
uiForm.setRendered(show);
setShowPublicationDate(show && uiForm.isChecked());
}
-
+
public void setShowPublicationDate(boolean show)
{
getUIFormDateTimeInput(START_PUBLICATION_DATE).setRendered(show);
getUIFormDateTimeInput(END_PUBLICATION_DATE).setRendered(show);
}
- public void setPageNode(PageNode pageNode) throws Exception
+ public UserNode getSelectedPageNode()
{
- if (pageNode.getName() != null)
- getUIStringInput(PAGE_NAME).setValue(pageNode.getName());
- if (pageNode.getLabel() != null)
- getUIStringInput(PAGE_DISPLAY_NAME).setValue(pageNode.getLabel());
- getUIFormCheckBoxInput(VISIBLE).setChecked(pageNode.isVisible());
- setShowPublicationDate(pageNode.isShowPublicationDate());
- Calendar cal = Calendar.getInstance();
- if (pageNode.getStartPublicationDate() != null)
- {
- cal.setTime(pageNode.getStartPublicationDate());
- getUIFormDateTimeInput(START_PUBLICATION_DATE).setCalendar(cal);
- }
- else
- getUIFormDateTimeInput(START_PUBLICATION_DATE).setValue(null);
- if (pageNode.getEndPublicationDate() != null)
- {
- cal.setTime(pageNode.getEndPublicationDate());
- getUIFormDateTimeInput(END_PUBLICATION_DATE).setCalendar(cal);
- }
- else
- getUIFormDateTimeInput(END_PUBLICATION_DATE).setValue(null);
- }
-
- public PageNode getSelectedPageNode()
- {
UIPageNodeSelector uiPageNodeSelector = getChild(UIPageNodeSelector.class);
- PageNavigation nav = uiPageNodeSelector.getSelectedNavigation();
- if(nav.getOwnerType().equals(PortalConfig.USER_TYPE))
- return null;
- return uiPageNodeSelector.getSelectedPageNode();
+ return uiPageNodeSelector.getSelectedNode();
}
public void processRender(WebuiRequestContext context) throws Exception
{
- if (isEditMode && getChild(UIPageNodeSelector.class).getSelectedPageNode()
== null)
+ if (isEditMode && getChild(UIPageNodeSelector.class).getSelectedNode() ==
null)
reset();
super.processRender(context);
}
- public void processDecode(WebuiRequestContext context) throws Exception
- {
- super.processDecode(context);
- String action = context.getRequestParameter(UIForm.ACTION);
- Event<UIComponent> event = createEvent(action, Event.Phase.DECODE, context);
- if (event != null)
- event.broadcast();
- }
-
public boolean isFirstTime()
{
return firstTime;
@@ -245,61 +181,13 @@
public void execute(Event<UIWizardPageSetInfo> event) throws Exception
{
String uri = event.getRequestContext().getRequestParameter(OBJECTID);
- UIWizardPageSetInfo uiForm = event.getSource();
UIPageNodeSelector uiPageNodeSelector =
event.getSource().getChild(UIPageNodeSelector.class);
- UITree tree = uiPageNodeSelector.getChild(UITree.class);
+ uiPageNodeSelector.setSelectedURI(uri);
- if (tree.getParentSelected() == null && (uri == null || uri.length()
< 1))
- {
-
uiPageNodeSelector.selectNavigation(uiPageNodeSelector.getSelectedNavigation());
- }
- else
- {
- uiPageNodeSelector.selectPageNodeByUri(uri);
- }
-
UIPortalApplication uiPortalApp =
uiPageNodeSelector.getAncestorOfType(UIPortalApplication.class);
UIWizard uiWizard = uiPortalApp.findFirstComponentOfType(UIWizard.class);
event.getRequestContext().addUIComponentToUpdateByAjax(uiWizard);
-
- if (!event.getSource().isEditMode())
- {
- return;
- }
- PageNode pageNode = uiPageNodeSelector.getSelectedPageNode();
-
- if (pageNode == null && uiForm.isFirstTime())
- {
- uiForm.setShowPublicationDate(false);
- uiForm.setFirstTime(false);
- UIPortal uiPortal = Util.getUIPortal();
- uiPageNodeSelector.selectNavigation(uiPortal.getSelectedNavigation());
- if (uiPortal.getSelectedNode() != null)
- {
-
uiPageNodeSelector.selectPageNodeByUri(uiPortal.getSelectedNode().getUri());
- }
- pageNode = uiPageNodeSelector.getSelectedPageNode();
- }
-
- if (pageNode == null)
- {
- uiForm.setShowPublicationDate(false);
- return;
- }
- UserPortalConfigService configService =
uiWizard.getApplicationComponent(UserPortalConfigService.class);
- String accessUser = event.getRequestContext().getRemoteUser();
- Page page = null;
- if (pageNode.getPageReference() != null)
- page = configService.getPage(pageNode.getPageReference(), accessUser);
- if (page == null)
- {
- uiPortalApp.addMessage(new
ApplicationMessage("UIWizardPageSetInfo.msg.null", null));
- uiForm.reset();
- uiForm.setShowPublicationDate(false);
- return;
- }
- uiForm.setPageNode(pageNode);
}
}
@@ -316,17 +204,17 @@
}
}
-
+
static public class SwitchVisibleActionListener extends
EventListener<UIWizardPageSetInfo>
{
- @Override
- public void execute(Event<UIWizardPageSetInfo> event) throws Exception
- {
- UIWizardPageSetInfo uiForm = event.getSource();
- boolean isCheck = uiForm.getUIFormCheckBoxInput(VISIBLE).isChecked();
- uiForm.setShowCheckPublicationDate(isCheck);
- event.getRequestContext().addUIComponentToUpdateByAjax(uiForm);
- }
+ @Override
+ public void execute(Event<UIWizardPageSetInfo> event) throws Exception
+ {
+ UIWizardPageSetInfo uiForm = event.getSource();
+ boolean isCheck = uiForm.getUIFormCheckBoxInput(VISIBLE).isChecked();
+ uiForm.setShowCheckPublicationDate(isCheck);
+ event.getRequestContext().addUIComponentToUpdateByAjax(uiForm);
+ }
}
}
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UILanguageSelector.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UILanguageSelector.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UILanguageSelector.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -178,8 +178,6 @@
localeConfig = localeConfigService.getDefaultLocaleConfig();
PortalRequestContext prqCtx = PortalRequestContext.getCurrentInstance();
prqCtx.setLocale(localeConfig.getLocale());
- //uiApp.setOrientation(localeConfig.getOrientation());
- //uiApp.localizeNavigations();
}
}
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortal.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortal.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortal.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -21,16 +21,17 @@
import org.exoplatform.portal.account.UIAccountSetting;
import org.exoplatform.portal.application.PortalRequestContext;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
-import org.exoplatform.portal.config.model.PortalConfig;
import org.exoplatform.portal.config.model.PortalProperties;
import org.exoplatform.portal.config.model.Properties;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.user.NavigationPath;
+import org.exoplatform.portal.mop.user.UserNavigation;
+import org.exoplatform.portal.mop.user.UserNode;
import org.exoplatform.portal.webui.application.UIPortlet;
import org.exoplatform.portal.webui.container.UIContainer;
import org.exoplatform.portal.webui.page.UIPage;
-import org.exoplatform.portal.webui.page.UIPageBody;
import
org.exoplatform.portal.webui.page.UIPageActionListener.ChangePageNodeActionListener;
+import org.exoplatform.portal.webui.page.UIPageBody;
import
org.exoplatform.portal.webui.portal.UIPortalComponentActionListener.ChangeApplicationListActionListener;
import
org.exoplatform.portal.webui.portal.UIPortalComponentActionListener.ChangeLanguageActionListener;
import
org.exoplatform.portal.webui.portal.UIPortalComponentActionListener.ChangeSkinActionListener;
@@ -43,7 +44,7 @@
import org.exoplatform.portal.webui.workspace.UIPortalApplication;
import org.exoplatform.services.organization.OrganizationService;
import org.exoplatform.services.organization.User;
-import org.exoplatform.services.resources.ResourceBundleManager;
+import org.exoplatform.web.application.JavascriptManager;
import org.exoplatform.web.login.InitiateLoginServlet;
import org.exoplatform.web.security.security.AbstractTokenService;
import org.exoplatform.web.security.security.CookieTokenService;
@@ -53,15 +54,10 @@
import org.exoplatform.webui.core.UIComponent;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
-import org.exoplatform.web.application.JavascriptManager;
import java.net.URLEncoder;
-import java.util.ArrayList;
import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
import java.util.Map;
-import java.util.ResourceBundle;
import javax.portlet.WindowState;
import javax.servlet.http.Cookie;
@@ -95,18 +91,19 @@
private Properties properties;
- private PageNavigation navigation;
-
- private List<PageNode> selectedPath;
+ private NavigationPath navPath;
- private PageNode selectedNode_;
-
private Map<String, UIPage> all_UIPages;
private Map<String, String[]> publicParameters_ = new HashMap<String,
String[]>();
private UIComponent maximizedUIComponent;
+ public SiteKey getSiteKey()
+ {
+ return new SiteKey(ownerType, name_);
+ }
+
public String getOwner()
{
return owner;
@@ -166,13 +163,20 @@
{
publicParameters_ = publicParams;
}
+
+ public NavigationPath getNavPath() throws Exception
+ {
+ if (navPath == null)
+ {
+ UIPortalApplication uiApp = Util.getUIPortalApplication();
+ navPath = uiApp.getUserPortalConfig().getUserPortal().getDefaultPath();
+ }
+ return navPath;
+ }
- /** At the moment, this method ensure compatibility with legacy code */
- public List<PageNavigation> getNavigations() throws Exception
+ public void setNavPath(NavigationPath nav)
{
- List<PageNavigation> listNavs = new ArrayList<PageNavigation>();
- listNavs.add(navigation);
- return listNavs;
+ this.navPath = nav;
}
/**
@@ -206,9 +210,11 @@
this.all_UIPages.remove(pageReference);
}
- public void setNavigation(PageNavigation _navigation)
+ public UserNavigation getUserNavigation() throws Exception
{
- this.navigation = _navigation;
+ UIPortalApplication uiPortalApp = getAncestorOfType(UIPortalApplication.class);
+ SiteKey siteKey = new SiteKey(ownerType, owner);
+ return uiPortalApp.getUserPortalConfig().getUserPortal().getNavigation(siteKey);
}
/**
@@ -218,11 +224,6 @@
*/
public void refreshUIPage() throws Exception
{
- if(selectedNode_ == null)
- {
- selectedNode_ = navigation.getNodes().get(0);
- }
-
UIPageBody uiPageBody = findFirstComponentOfType(UIPageBody.class);
if(uiPageBody == null)
{
@@ -235,84 +236,14 @@
currentPortlet.setCurrentWindowState(WindowState.NORMAL);
uiPageBody.setMaximizedUIComponent(null);
}
- uiPageBody.setPageBody(selectedNode_, this);
-
- //Refresh locale
- Locale locale = Util.getPortalRequestContext().getLocale();
- localizePageNavigation(navigation, locale);
+ uiPageBody.setPageBody(getSelectedUserNode(), this);
}
- public synchronized void setSelectedNode(PageNode node)
+ public UserNode getSelectedUserNode() throws Exception
{
- selectedNode_ = node;
+ return getNavPath().getTarget();
}
- /*
- public PageNode getSelectedNode() throws Exception
- {
- if (selectedNode_ != null)
- return selectedNode_;
- if (getSelectedNavigation() == null || selectedNavigation_.getNodes() == null
- || selectedNavigation_.getNodes().size() < 1)
- return null;
- selectedNode_ = selectedNavigation_.getNodes().get(0);
- return selectedNode_;
- }
- */
-
- public PageNode getSelectedNode() throws Exception
- {
- if(selectedNode_ != null)
- {
- return selectedNode_;
- }
- if(navigation == null || navigation.getNodes() == null ||
navigation.getNodes().size() < 1)
- {
- return null;
- }
- return navigation.getNodes().get(0);
- }
-
- public List<PageNode> getSelectedPath()
- {
- return selectedPath;
- }
-
- public void setSelectedPath(List<PageNode> nodes)
- {
- selectedPath = nodes;
- }
-
- public PageNavigation getSelectedNavigation() throws Exception
- {
- return navigation;
- }
-
- public void setSelectedNavigation(PageNavigation _navigation)
- {
- this.navigation = _navigation;
- }
-
- /**
- public PageNavigation getPageNavigation(int id)
- {
- for (PageNavigation nav : navigations)
- {
- if (nav.getId() == id)
- return nav;
- }
- return null;
- }
-
-*/
- /*
- public void setSelectedNavigation(PageNavigation selectedNavigation)
- {
- selectedNavigation_ = selectedNavigation;
- }
-
- */
-
public UIComponent getMaximizedUIComponent()
{
return maximizedUIComponent;
@@ -376,30 +307,7 @@
{
setProperty(PortalProperties.SESSION_ALIVE, type);
}
-
- private void localizePageNavigation(PageNavigation nav,Locale locale)
- {
- ResourceBundleManager mgr = getApplicationComponent(ResourceBundleManager.class);
- if (nav.getOwnerType().equals(PortalConfig.USER_TYPE))
- return;
- ResourceBundle res = mgr.getNavigationResourceBundle(locale.getLanguage(),
nav.getOwnerType(), nav.getOwnerId());
- for (PageNode node : nav.getNodes())
- {
- resolveLabel(res, node);
- }
- }
- private void resolveLabel(ResourceBundle res, PageNode node)
- {
- node.setResolvedLabel(res);
- if (node.getChildren() == null)
- return;
- for (PageNode childNode : node.getChildren())
- {
- resolveLabel(res, childNode);
- }
- }
-
static public class LogoutActionListener extends EventListener<UIComponent>
{
public void execute(Event<UIComponent> event) throws Exception
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalComposer.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -56,8 +56,8 @@
import org.exoplatform.webui.core.UITabPane;
import org.exoplatform.webui.core.UIWizard;
import org.exoplatform.webui.event.Event;
+import org.exoplatform.webui.event.Event.Phase;
import org.exoplatform.webui.event.EventListener;
-import org.exoplatform.webui.event.Event.Phase;
import java.util.List;
import java.util.ResourceBundle;
@@ -414,7 +414,7 @@
UIPortal uiPortal = uiWorkingWS.getBackupUIPortal();
siteBody.setUIComponent(uiPortal);
- String uri = uiPortal.getSelectedNode() != null ?
uiPortal.getSelectedNode().getUri() : null;
+ String uri = uiPortal.getSelectedUserNode() != null ?
uiPortal.getSelectedUserNode().getURI() : null;
PageNodeEvent<UIPortal> pnevent = new
PageNodeEvent<UIPortal>(uiPortal, PageNodeEvent.CHANGE_PAGE_NODE, uri);
uiPortal.broadcast(pnevent, Event.Phase.PROCESS);
prContext.addUIComponentToUpdateByAjax(uiWorkingWS);
@@ -461,14 +461,13 @@
uiWorkingWS.setRenderedChild(UIPortalApplication.UI_VIEWING_WS_ID);
prContext.setFullRender(true);
- String uri = (uiPortal.getSelectedNode() != null)?
(uiPortal.getSelectedNode().getUri()) : null;
+ String uri = (uiPortal.getSelectedUserNode() != null)?
(uiPortal.getSelectedUserNode().getURI()) : null;
if (uiComposer.isPortalExist(editPortal))
{
DataStorage storage =
uiPortalApp.getApplicationComponent(DataStorage.class);
PortalConfig pConfig =
- storage.getPortalConfig(uiPortal.getSelectedNavigation().getOwnerType(),
uiPortal
- .getSelectedNavigation().getOwnerId());
+ storage.getPortalConfig(uiPortal.getSiteKey().getTypeName(),
uiPortal.getSiteKey().getName());
if (pConfig != null)
{
uiPortalApp.getUserPortalConfig().setPortal(pConfig);
@@ -655,7 +654,8 @@
UIPortalApplication uiPortalApp = Util.getUIPortalApplication();
uiPortalApp.setModeState(UIPortalApplication.NORMAL_MODE);
uiWorkingWS.setRenderedChild(UIPortalApplication.UI_VIEWING_WS_ID);
- Util.getPortalRequestContext().setFullRender(true);
+ PortalRequestContext prContext = Util.getPortalRequestContext();
+ prContext.setFullRender(true);
UIPortal uiPortal = uiPortalApp.getShowedUIPortal();
uiPortal.setRenderSibling(UIPortal.class);
@@ -665,9 +665,10 @@
uiPortal.refreshUIPage();
PageNodeEvent<UIPortal> pnevent =
- new PageNodeEvent<UIPortal>(uiPortal, PageNodeEvent.CHANGE_PAGE_NODE,
(uiPortal.getSelectedNode() != null
- ? uiPortal.getSelectedNode().getUri() : null));
+ new PageNodeEvent<UIPortal>(uiPortal, PageNodeEvent.CHANGE_PAGE_NODE,
(uiPortal.getSelectedUserNode() != null
+ ? uiPortal.getSelectedUserNode().getURI() : null));
uiPortal.broadcast(pnevent, Event.Phase.PROCESS);
+ prContext.addUIComponentToUpdateByAjax(uiWorkingWS);
JavascriptManager jsManager = event.getRequestContext().getJavascriptManager();
jsManager.addJavascript("eXo.portal.portalMode=" +
UIPortalApplication.NORMAL_MODE + ";");
}
@@ -688,7 +689,8 @@
UIEditInlineWorkspace editInlineWS = event.getSource().getParent();
UIWorkingWorkspace uiWorkingWS = editInlineWS.getParent();
UIPortalToolPanel uiToolPanel =
uiWorkingWS.findFirstComponentOfType(UIPortalToolPanel.class);
-
+ Util.getPortalRequestContext().addUIComponentToUpdateByAjax(uiWorkingWS);
+
UIPage uiPage = uiToolPanel.findFirstComponentOfType(UIPage.class);
Page page = (Page)PortalDataMapper.buildModelObject(uiPage);
String pageId = page.getPageId();
@@ -707,7 +709,7 @@
Util.getPortalRequestContext().setFullRender(true);
PageNodeEvent<UIPortal> pnevent =
new PageNodeEvent<UIPortal>(uiPortal,
PageNodeEvent.CHANGE_PAGE_NODE,
- (uiPortal.getSelectedNode() != null ?
uiPortal.getSelectedNode().getUri() : null));
+ (uiPortal.getSelectedUserNode() != null ?
uiPortal.getSelectedUserNode().getURI() : null));
uiPortal.broadcast(pnevent, Event.Phase.PROCESS);
JavascriptManager jsManager =
event.getRequestContext().getJavascriptManager();
jsManager.addJavascript("eXo.portal.portalMode=" +
UIPortalApplication.NORMAL_MODE + ";");
@@ -763,8 +765,8 @@
uiWorkingWS.setRenderedChild(UIPortalApplication.UI_VIEWING_WS_ID);
Util.getPortalRequestContext().setFullRender(true);
PageNodeEvent<UIPortal> pnevent =
- new PageNodeEvent<UIPortal>(uiPortal, PageNodeEvent.CHANGE_PAGE_NODE,
(uiPortal.getSelectedNode() != null
- ? uiPortal.getSelectedNode().getUri() : null));
+ new PageNodeEvent<UIPortal>(uiPortal, PageNodeEvent.CHANGE_PAGE_NODE,
(uiPortal.getSelectedUserNode() != null
+ ? uiPortal.getSelectedUserNode().getURI() : null));
uiPortal.broadcast(pnevent, Event.Phase.PROCESS);
JavascriptManager jsManager = event.getRequestContext().getJavascriptManager();
jsManager.addJavascript("eXo.portal.portalMode=" +
UIPortalApplication.NORMAL_MODE + ";");
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -315,7 +315,7 @@
{
PortalConfig portalConfig =
(PortalConfig)PortalDataMapper.buildModelObject(uiPortal);
dataService.save(portalConfig);
- prContext.setAttribute(UserPortalConfig.class,
service.getUserPortalConfig(uiForm.getPortalOwner(), prContext.getRemoteUser()));
+ prContext.setAttribute(UserPortalConfig.class,
service.getUserPortalConfig(uiForm.getPortalOwner(), prContext.getRemoteUser(),
PortalRequestContext.USER_PORTAL_CONTEXT));
uiPortalApp.reloadSkinPortal(prContext);
}
else
@@ -363,9 +363,7 @@
UserPortalConfig userPortalConfig = service.getUserPortalConfig(portalName,
pcontext.getRemoteUser());
PortalConfig pconfig = userPortalConfig.getPortalConfig();
uiForm.invokeSetBindingBean(pconfig);
- PageNavigation navigation =
dataService.getPageNavigation(PortalConfig.PORTAL_TYPE, portalName);
dataService.save(pconfig);
- dataService.save(navigation);
UIPortalApplication uiPortalApp =
event.getSource().getAncestorOfType(UIPortalApplication.class);
UIMaskWorkspace uiMaskWS =
uiPortalApp.getChildById(UIPortalApplication.UI_MASK_WS_ID);
uiMaskWS.setUIComponent(null);
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/util/PortalDataMapper.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -361,7 +361,7 @@
}
}
//uiPortal.setNavigation(userPortalConfig.getNavigations());
- uiPortal.setNavigation(userPortalConfig.getSelectedNavigation());
+// uiPortal.setNavigation(userPortalConfig.getSelectedNavigation());
}
private static void buildUIContainer(UIContainer uiContainer, Object model, boolean
dashboard) throws Exception
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/util/Util.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/util/Util.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/util/Util.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -213,10 +213,24 @@
}
}
+ /**
+ * @deprecated use {@link #toUIPage(String, UIComponent)} instead
+ *
+ * @param node
+ * @param uiParent
+ * @return
+ * @throws Exception
+ */
+ @Deprecated
static public UIPage toUIPage(PageNode node, UIComponent uiParent) throws Exception
{
+ return toUIPage(node.getPageReference(), uiParent);
+ }
+
+ static public UIPage toUIPage(String pageRef, UIComponent uiParent) throws Exception
+ {
UserPortalConfigService configService =
uiParent.getApplicationComponent(UserPortalConfigService.class);
- Page page = configService.getPage(node.getPageReference(),
getPortalRequestContext().getRemoteUser());
+ Page page = configService.getPage(pageRef,
getPortalRequestContext().getRemoteUser());
return toUIPage(page, uiParent);
}
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIMainActionListener.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -137,14 +137,7 @@
private boolean hasPageCreationPermission() throws Exception
{
UIPortal currentPortal = Util.getUIPortal();
- UserACL userACL =
Util.getUIPortalApplication().getApplicationComponent(UserACL.class);
- PageNavigation selectedNavigation = currentPortal.getSelectedNavigation();
- if (PortalConfig.PORTAL_TYPE.equals(selectedNavigation.getOwnerType()))
- {
- return userACL.hasEditPermissionOnPortal(currentPortal.getOwnerType(),
currentPortal.getOwner(), currentPortal.getEditPermission());
- }
-
- return userACL.hasEditPermission(selectedNavigation);
+ return currentPortal.getUserNavigation().isModifiable();
}
}
@@ -183,9 +176,10 @@
UIPortal newPortal = uiWorkingWS.createUIComponent(UIPortal.class, null, null);
PortalDataMapper.toUIPortal(newPortal, userConfig);
- newPortal.setSelectedNode(uiPortal.getSelectedNode());
- newPortal.setSelectedNavigation(uiPortal.getSelectedNavigation());
- newPortal.setSelectedPath(uiPortal.getSelectedPath());
+// newPortal.setSelectedNode(uiPortal.getSelectedNode());
+// newPortal.setNavigation(uiPortal.getNavigation());
+// newPortal.setSelectedPath(uiPortal.getSelectedPath());
+ newPortal.setNavPath(uiPortal.getNavPath());
newPortal.refreshUIPage();
UIEditInlineWorkspace uiEditWS =
uiWorkingWS.getChild(UIEditInlineWorkspace.class);
Modified:
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java
===================================================================
---
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java 2011-03-16
21:01:52 UTC (rev 6050)
+++
epp/portal/branches/EPP_5_1_RH_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/workspace/UIPortalApplication.java 2011-03-16
21:04:51 UTC (rev 6051)
@@ -28,14 +28,13 @@
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.Container;
import org.exoplatform.portal.config.model.Page;
-import org.exoplatform.portal.config.model.PageNavigation;
-import org.exoplatform.portal.config.model.PageNode;
+import org.exoplatform.portal.mop.SiteKey;
+import org.exoplatform.portal.mop.user.UserNode;
import org.exoplatform.portal.resource.Skin;
import org.exoplatform.portal.resource.SkinConfig;
import org.exoplatform.portal.resource.SkinService;
import org.exoplatform.portal.resource.SkinURL;
import org.exoplatform.portal.webui.application.UIPortlet;
-import org.exoplatform.portal.webui.navigation.PageNavigationUtils;
import org.exoplatform.portal.webui.page.UISiteBody;
import org.exoplatform.portal.webui.portal.PageNodeEvent;
import org.exoplatform.portal.webui.portal.UIPortal;
@@ -48,7 +47,6 @@
import org.exoplatform.services.resources.LocaleConfigService;
import org.exoplatform.services.resources.LocaleContextInfo;
import org.exoplatform.services.resources.Orientation;
-import org.exoplatform.services.resources.ResourceBundleManager;
import org.exoplatform.web.application.javascript.JavascriptConfigService;
import org.exoplatform.webui.application.WebuiRequestContext;
import org.exoplatform.webui.config.annotation.ComponentConfig;
@@ -111,10 +109,8 @@
private boolean isSessionOpen = false;
- private Map<UIPortalKey, UIPortal> all_UIPortals;
+ private Map<SiteKey, UIPortal> all_UIPortals;
- private List<PageNavigation> all_Navigations;
-
private UIPortal showedUIPortal;
/**
@@ -168,15 +164,13 @@
// -------------------------------------------------------------------------------
context.setUIApplication(this);
- this.all_UIPortals = new HashMap<UIPortalKey, UIPortal>(5);
+ this.all_UIPortals = new HashMap<SiteKey, UIPortal>(5);
addWorkingWorkspace();
setOwner(context.getPortalOwner());
//Minh Hoang TO: Localizes navigations, need to put this code snippet below
'setLocale' block
- this.all_Navigations = userPortalConfig_.getNavigations();
- localizeNavigations();
}
/**
@@ -219,9 +213,18 @@
{
return null;
}
- return this.all_UIPortals.get(new UIPortalKey(ownerType, ownerId));
+ return this.all_UIPortals.get(new SiteKey(ownerType, ownerId));
}
+ public UIPortal getCachedUIPortal(SiteKey key)
+ {
+ if(key == null)
+ {
+ return null;
+ }
+ return this.all_UIPortals.get(key);
+ }
+
/**
* Associates the specified UIPortal to a cache map with specified key which bases on
OwnerType and OwnerId
*
@@ -234,7 +237,7 @@
if(ownerType != null && ownerId != null)
{
- this.all_UIPortals.put(new UIPortalKey(ownerType, ownerId), uiPortal);
+ this.all_UIPortals.put(new SiteKey(ownerType, ownerId), uiPortal);
}
}
@@ -250,7 +253,7 @@
{
return;
}
- this.all_UIPortals.remove(new UIPortalKey(ownerType, ownerId));
+ this.all_UIPortals.remove(new SiteKey(ownerType, ownerId));
}
public boolean isSessionOpen()
@@ -672,14 +675,14 @@
UserPortalConfigService userPortalConfigService =
(UserPortalConfigService)appContainer.getComponentInstanceOfType(UserPortalConfigService.class);
Page page = null;
- PageNode pageNode = Util.getUIPortal().getSelectedNode();
+ UserNode pageNode = Util.getUIPortal().getSelectedUserNode();
if (pageNode != null)
{
try
{
- if (pageNode.getPageReference() != null)
+ if (pageNode.getPageRef() != null)
{
- page = userPortalConfigService.getPage(pageNode.getPageReference(),
context.getRemoteUser());
+ page = userPortalConfigService.getPage(pageNode.getPageRef(),
context.getRemoteUser());
}
}
catch (NoSuchDataException nsde)
@@ -690,17 +693,6 @@
return (page != null);
}
- public void localizeNavigations()
- {
- ResourceBundleManager i18nManager =
getApplicationComponent(ResourceBundleManager.class);
- Locale locale = getLocale();
-
- for(PageNavigation nav : this.getNavigations())
- {
- PageNavigationUtils.localizePageNavigation(nav, locale, i18nManager);
- }
- }
-
/**
* Get portal skin from {@link UserProfile} or from {@link UserPortalConfig}
*
@@ -741,65 +733,4 @@
skin_ = userPortalConfigSkin;
}
}
-
- public void setNavigations(List<PageNavigation> navs)
- {
- this.all_Navigations = navs;
- }
-
- public List<PageNavigation> getNavigations()
- {
- return this.all_Navigations;
- }
-
- private class UIPortalKey
- {
-
- /** . */
- private final String ownerType;
-
- /** . */
- private final String ownerId;
-
- UIPortalKey(String _ownerType, String _ownerId)
- {
- if (_ownerType == null)
- {
- throw new NullPointerException();
- }
- if (_ownerId == null)
- {
- throw new NullPointerException();
- }
- this.ownerType = _ownerType;
- this.ownerId = _ownerId;
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (this == null || obj == null)
- {
- return this == null && obj == null;
- }
- if (!(obj instanceof UIPortalKey))
- {
- return false;
- }
- return this.ownerType.equals(((UIPortalKey)obj).ownerType) &&
this.ownerId.equals(((UIPortalKey)obj).ownerId);
- }
-
- @Override
- public int hashCode()
- {
- return this.ownerType.hashCode() * 2 + this.ownerId.hashCode();
- }
-
- @Override
- public String toString()
- {
- return "OWNERTYPE: " + ownerType + " OWNERID: " + ownerId;
- }
- }
-
}