Changeset 18876

Show
Ignore:
Timestamp:
05/17/07 11:26:14 (1 year ago)
Author:
jmorliaguet
Message:

- NXP-165: added a local theme negotiator based on the placeful configuration service

A management bean / UI for setting and removing local theme annotations is still needed.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • org.nuxeo.ecm.platform/trunk/nuxeo-platform-webapp-core/pom.xml

    r18652 r18876  
    5656    </dependency> 
    5757    <dependency> 
     58      <groupId>org.nuxeo.ecm.platform</groupId> 
     59      <artifactId>nuxeo-platform-placeful-facade</artifactId> 
     60      <type>ejb</type> 
     61    </dependency> 
     62    <dependency> 
    5863      <groupId>org.nuxeo.theme</groupId> 
    5964      <artifactId>nuxeo-theme-core</artifactId> 
     
    111116    </dependency> 
    112117  </dependencies> 
    113   <!--  
     118  <!-- 
    114119  <build> 
    115120    <resources> 
     
    121126  </build> 
    122127   --> 
    123   <!-- this is used (the above build section also)  
     128  <!-- this is used (the above build section also) 
    124129       to replace jboss.ws:di endpoint impl location in web.xml --> 
    125130  <properties> 
  • org.nuxeo.ecm.platform/trunk/nuxeo-platform-webapp-core/src/main/java/org/nuxeo/ecm/webapp/theme/negotiation/LocalTheme.java

    r13246 r18876  
    11/* 
    2  * (C) Copyright 2006 Nuxeo SAS <http://nuxeo.com> and others 
     2 * (C) Copyright 2006-2007 Nuxeo SAS <http://nuxeo.com> and others 
    33 * 
    44 * All rights reserved. This program and the accompanying materials 
     
    1313 */ 
    1414 
    15 package org.nuxeo.ecm.webapp.theme; 
    1615 
     16package org.nuxeo.ecm.webapp.theme.negotiation; 
     17 
     18import org.apache.commons.logging.Log; 
     19import org.apache.commons.logging.LogFactory; 
     20import org.jboss.seam.contexts.Contexts; 
    1721import org.nuxeo.ecm.core.api.DocumentModel; 
    1822import org.nuxeo.theme.Manager; 
    1923import org.nuxeo.theme.elements.PageElement; 
    2024import org.nuxeo.theme.negotiation.Scheme; 
    21 import org.nuxeo.ecm.platform.ui.web.util.SeamContextHelper; 
    2225 
    2326/** 
    2427 * Custom negotiation scheme for obtaining the local theme from the current 
    25  * document item
     28 * document
    2629 * 
    27  * @author Jean-Marc Orliaguet 
    28  * 
     30 * @author Jean-Marc Orliaguet <jmo@chalmers.se> 
    2931 */ 
    3032public class LocalTheme implements Scheme { 
     33 
     34    private static Log log = LogFactory.getLog(LocalTheme.class); 
    3135 
    3236    /** 
     
    3741     */ 
    3842    public String getOutcome(Object context) { 
    39         SeamContextHelper seamCtxHelper = new SeamContextHelper(); 
    40         DocumentModel currentDocument = (DocumentModel) seamCtxHelper.get("currentDocument"); 
    41  
     43        DocumentModel currentDocument = ((DocumentModel) Contexts.lookupInStatefulContexts("currentDocument")); 
    4244        if (currentDocument == null) { 
    4345            return null; 
    4446        } 
    4547 
    46         // FIXME: get the theme/page token from the document model 
    47         String path = null; 
     48        String docId = currentDocument.getId(); 
     49        if (docId == null) { 
     50            return null; 
     51        } 
    4852 
     53        // Get the placeful local theme configuration for the current document. 
     54        LocalThemeConfig localThemeConfig = LocalThemeHelper.getLocalThemeConfig(docId); 
     55        if (localThemeConfig == null) { 
     56            return null; 
     57        } 
     58 
     59        // Extract the page path 
     60        String path = localThemeConfig.getPagePath(); 
    4961        if (path == null) { 
    5062            return null; 
    5163        } 
     64        log.debug(path); 
     65 
     66        // Look up the page 
    5267        PageElement page = Manager.getThemeManager().getPageByPath(path); 
    5368        if (page != null) { 
    5469            return path; 
    5570        } 
     71        log.debug(page); 
    5672        return null; 
     73 
    5774    } 
    5875 
  • org.nuxeo.ecm.platform/trunk/nuxeo-platform-webapp-core/src/main/resources/META-INF/MANIFEST.MF

    r18480 r18876  
    1919  OSGI-INF/ecm-schemas-contrib.xml, 
    2020  OSGI-INF/nxdirectories-contrib.xml, 
     21  OSGI-INF/nxplacefulservice-configs-contrib.xml, 
    2122  OSGI-INF/nxsearchui-framework.xml, 
    2223  OSGI-INF/nxsearchui-contrib.xml, 
    2324  OSGI-INF/documentslists-framework.xml, 
    2425  OSGI-INF/documentslists-contrib.xml, 
    25   OSGI-INF/services-binding-contrib.xml 
     26  OSGI-INF/services-binding-contrib.xml, 
    2627Require-Bundle: org.nuxeo.ecm.platform.usermanager, 
    2728 org.nuxeo.ecm.platform.filemanager.core, 
     
    3637 org.nuxeo.ecm.platform.workflow.api, 
    3738 org.nuxeo.ecm.platform.workflow.document.api 
     39Nuxeo-RequiredBy: org.nuxeo.ecm.platform.placeful.facade 
  • org.nuxeo.ecm.platform/trunk/nuxeo-platform-webapp-core/src/main/resources/OSGI-INF/deployment-fragment.xml

    r18799 r18876  
    1616      </web> 
    1717    </module> 
     18  </extension> 
     19 
     20  <extension target="persistence#CLASS"> 
     21    <class>org.nuxeo.ecm.webapp.theme.negotiation.LocalThemeConfig</class> 
    1822  </extension> 
    1923 
     
    189193 
    190194  <extension target="components#PAGEFLOW"> 
    191        <value>config/addWorkspace.jpdl.xml</value> 
     195  <value>config/addWorkspace.jpdl.xml</value> 
    192196  </extension> 
    193197 
     
    336340    </navigation-case> 
    337341 
    338        <navigation-case> 
     342  <navigation-case> 
    339343      <from-outcome>edit_user_password</from-outcome> 
    340344      <to-view-id>/edit_user_password.xhtml</to-view-id> 
  • org.nuxeo.ecm.platform/trunk/nuxeo-platform-webapp-core/src/main/resources/OSGI-INF/theme-contrib.xml

    r18872 r18876  
    219219      <scheme>org.nuxeo.theme.jsf.negotiation.theme.ViewId</scheme> 
    220220      <!-- local theme (specific to nuxeo5) --> 
    221       <scheme>org.nuxeo.ecm.webapp.theme.LocalTheme</scheme> 
     221      <scheme>org.nuxeo.ecm.webapp.theme.negotiation.LocalTheme</scheme> 
    222222      <scheme>org.nuxeo.theme.jsf.negotiation.theme.DefaultTheme</scheme> 
    223223    </negotiation>