You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2007/02/15 17:47:48 UTC
svn commit: r508005 - in /lenya/trunk/src:
modules-core/usecase/config/cocoon-xconf/
modules-core/usecase/java/src/org/apache/lenya/cms/usecase/cocoon/ webapp/
webapp/lenya/xslt/menu/
Author: andreas
Date: Thu Feb 15 08:47:48 2007
New Revision: 508005
URL: http://svn.apache.org/viewvc?view=rev&rev=508005
Log:
Added UsecaseModule which allows to choose the top-level tab according to the usecase's tab group
Added:
lenya/trunk/src/modules-core/usecase/config/cocoon-xconf/usecasemodule.xconf
lenya/trunk/src/modules-core/usecase/java/src/org/apache/lenya/cms/usecase/cocoon/
lenya/trunk/src/modules-core/usecase/java/src/org/apache/lenya/cms/usecase/cocoon/UsecaseModule.java
Modified:
lenya/trunk/src/webapp/global-sitemap.xmap
lenya/trunk/src/webapp/lenya/xslt/menu/menu2xhtml.xsl
Added: lenya/trunk/src/modules-core/usecase/config/cocoon-xconf/usecasemodule.xconf
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/usecase/config/cocoon-xconf/usecasemodule.xconf?view=auto&rev=508005
==============================================================================
--- lenya/trunk/src/modules-core/usecase/config/cocoon-xconf/usecasemodule.xconf (added)
+++ lenya/trunk/src/modules-core/usecase/config/cocoon-xconf/usecasemodule.xconf Thu Feb 15 08:47:48 2007
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- $Id: doctypes.xconf 164635 2005-04-25 20:01:43Z tschlabach $ -->
+
+<xconf xpath="/cocoon/input-modules" unless="/cocoon/input-modules/component-instance[@name = 'usecase']">
+
+ <component-instance logger="core.modules.input.usecase" name="usecase"
+ class="org.apache.lenya.cms.usecase.cocoon.UsecaseModule"/>
+
+</xconf>
Added: lenya/trunk/src/modules-core/usecase/java/src/org/apache/lenya/cms/usecase/cocoon/UsecaseModule.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/usecase/java/src/org/apache/lenya/cms/usecase/cocoon/UsecaseModule.java?view=auto&rev=508005
==============================================================================
--- lenya/trunk/src/modules-core/usecase/java/src/org/apache/lenya/cms/usecase/cocoon/UsecaseModule.java (added)
+++ lenya/trunk/src/modules-core/usecase/java/src/org/apache/lenya/cms/usecase/cocoon/UsecaseModule.java Thu Feb 15 08:47:48 2007
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.lenya.cms.usecase.cocoon;
+
+import java.util.Map;
+
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.Serviceable;
+import org.apache.cocoon.components.modules.input.AbstractInputModule;
+import org.apache.cocoon.environment.ObjectModelHelper;
+import org.apache.cocoon.environment.Request;
+import org.apache.lenya.cms.usecase.Usecase;
+import org.apache.lenya.cms.usecase.UsecaseResolver;
+import org.apache.lenya.cms.usecase.gui.Tab;
+import org.apache.lenya.util.ServletHelper;
+
+/**
+ * Input module to obtain information about usecases.
+ */
+public class UsecaseModule extends AbstractInputModule implements Serviceable {
+
+ public Object getAttribute(String name, Configuration modeConf, Map objectModel)
+ throws ConfigurationException {
+
+ Object value = "";
+
+ String prefix = "tabGroup:";
+ if (name.startsWith(prefix) && name.length() > prefix.length()) {
+ String[] steps = name.split(":");
+ String usecaseName = steps[1];
+
+ Request request = ObjectModelHelper.getRequest(objectModel);
+ String webappUrl = ServletHelper.getWebappURI(request);
+
+ UsecaseResolver resolver = null;
+ Usecase usecase = null;
+ try {
+ resolver = (UsecaseResolver) this.manager.lookup(UsecaseResolver.ROLE);
+ usecase = resolver.resolve(webappUrl, usecaseName);
+ if (usecase.getView() != null) {
+ Tab tab = usecase.getView().getTab();
+ if (tab != null) {
+ value = tab.getGroup();
+ }
+ }
+ } catch (ServiceException e) {
+ throw new ConfigurationException("Error: ", e);
+ }
+ finally {
+ if (resolver != null) {
+ if (usecase != null) {
+ try {
+ resolver.release(usecase);
+ } catch (ServiceException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ this.manager.release(resolver);
+ }
+ }
+ }
+
+ return value;
+
+ }
+
+ private ServiceManager manager;
+
+ public void service(ServiceManager manager) throws ServiceException {
+ this.manager = manager;
+ }
+
+}
Modified: lenya/trunk/src/webapp/global-sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/trunk/src/webapp/global-sitemap.xmap?view=diff&rev=508005&r1=508004&r2=508005
==============================================================================
--- lenya/trunk/src/webapp/global-sitemap.xmap (original)
+++ lenya/trunk/src/webapp/global-sitemap.xmap Thu Feb 15 08:47:48 2007
@@ -173,6 +173,7 @@
<map:parameter name="workflowstate" value="{workflow:state}"/>
<map:parameter name="islive" value="{workflow:variable.is_live}"/>
<map:parameter name="usecase" value="{request-param:lenya.usecase}"/>
+ <map:parameter name="tabGroup" value="{usecase:tabGroup:{request-param:lenya.usecase}}"/>
<map:parameter name="newMessages" value="{inbox:newMessageCount}"/>
</map:transform>
</map:otherwise>
Modified: lenya/trunk/src/webapp/lenya/xslt/menu/menu2xhtml.xsl
URL: http://svn.apache.org/viewvc/lenya/trunk/src/webapp/lenya/xslt/menu/menu2xhtml.xsl?view=diff&rev=508005&r1=508004&r2=508005
==============================================================================
--- lenya/trunk/src/webapp/lenya/xslt/menu/menu2xhtml.xsl (original)
+++ lenya/trunk/src/webapp/lenya/xslt/menu/menu2xhtml.xsl Thu Feb 15 08:47:48 2007
@@ -36,12 +36,12 @@
<xsl:param name="workflowstate"/>
<xsl:param name="islive"/>
<xsl:param name="usecase"/>
+<xsl:param name="tabGroup"/>
<xsl:param name="newMessages"/>
<xsl:variable name="currentTab">
<xsl:choose>
- <xsl:when test="starts-with($usecase, 'admin.')">admin</xsl:when>
- <xsl:when test="starts-with($usecase, 'tab.')">site</xsl:when>
+ <xsl:when test="$tabGroup != ''"><xsl:value-of select="$tabGroup"/></xsl:when>
<xsl:otherwise>authoring</xsl:otherwise>
</xsl:choose>
</xsl:variable>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org