cancel
Showing results for 
Search instead for 
Did you mean: 

how to add a virtual navigation tree ?

jeremie_
Confirmed Champ
Confirmed Champ

hi, i m trying to enable another navigation tree. for the moment, my contribution looks like this :

i declared a schema to hold my query
/> target="org.nuxeo.ecm.core.schema.TypeService" point="schema"

create a document LocationSearch
/> target="org.nuxeo.ecm.core.schema.TypeService" point="doctype" and the tree
/> target="org.nuxeo.ecm.webapp.directory.DirectoryTreeService" point="trees"

but i certainly miss something with the new content view byLocationsContentView:

i declared my view with this extension point
/> target="org.nuxeo.ecm.platform.ui.web.ContentViewService" point="contentViews"

adding locations_virtual_navigation.xhtml under nuxeo.war

<ui:decorate template="/incl/virtual_navigation_template.xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets">
    <ui:param name="contentViewName" value="byLocationsContentView" />
</ui:decorate>

and my deployment fragment

<?xml version="1.0"?>
<fragment>
  <extension target="application#MODULE">
    <module>
      <java>${bundle.fileName}</java>
    </module>
  </extension>
  
  <install>

    <!-- Unzip the contents of our nuxeo.war into the server -->
    <unzip from="${bundle.fileName}" to="/">
      <include>nuxeo.war/**</include>
    </unzip>

  </install>
  
    <extension target="faces-config#NAVIGATION">

		<navigation-case>
		  <from-outcome>locations_virtual_navigation</from-outcome>
		  <to-view-id>/locations_virtual_navigation.xhtml</to-view-id>
		  <redirect />
		</navigation-case>
	
	</extension>

  <extension target="pages#PAGES">

    <page view-id="/locations_virtual_navigation.xhtml">
      breadcrumb=test
    </page>

  </extension>
    
</fragment>

@Anahide, everything else is working, and if i call the bySubjectContentView instead of my view in the DirectoryTreeService extension point, the result is another Subject tree.

for example, this is a try in the coverage view. DEBUG [org.nuxeo.ecm.platform.ui.web.binding.alias.AliasValueExpression] Resolved expression var='contentViewName' for mapper with id '1176491654_3d42a2f6_1': byCoverageContentView

and this is in my custom view. obviously, it did not call the good view, but i can't figure out why ?
/> DEBUG [org.nuxeo.ecm.platform.ui.web.binding.alias.AliasValueExpression] Resolved expression var='contentViewName' for mapper with id '-574529264_4dcfd17_1': document_content

1 ACCEPTED ANSWER

jeremie_
Confirmed Champ
Confirmed Champ

ok, i finnaly find the problem...i was testing my contribution within the ide.

The view was not registred when i deploy my contribution directly in the eclispe nuxeo-ide, but everything is working when i export a jar file.

here is the contribution :

     <!-- le schema qui contient la navigation virtuelle -->  
<extension target="org.nuxeo.ecm.core.schema.TypeService" point="schema">
	<schema name="locationsearch" src="schemas/location_search.xsd" prefix="ls"/>
</extension>	  

    <!-- le document qui contient le schema précedent -->
<extension target="org.nuxeo.ecm.core.schema.TypeService" point="doctype">   
    <doctype extends="Document" name="LocationSearch">
		<schema name="locationsearch"/>
    </doctype>
</extension>

    <!-- Crée la vue qui va permettre d'afficher les résultats -->

<extension target="org.nuxeo.ecm.platform.ui.web.ContentViewService"
point="contentViews">

<contentView name="byLocationsContentView">
  <title>location search</title>
  <translateTitle>false</translateTitle>
  <showTitle>true</showTitle>
  <emptySentence>label.content.empty.search</emptySentence>
  <translateEmptySentence>false</translateEmptySentence>
 
  <coreQueryPageProvider>
    <property name="coreSession">#{documentManager}</property>
    <whereClause docType="LocationSearch">
      <predicate operator="STARTSWITH" parameter="lc:locations">
        <field name="location_search_query" schema="locationsearch"/>
      </predicate>
      <fixedPart>
        ecm:mixinType != 'HiddenInNavigation' AND
        ecm:currentLifeCycleState
        !='deleted' AND ecm:isCheckedInVersion = 0
      </fixedPart>
    </whereClause>
    <sort column="dc:title" ascending="true" />
    <pageSize>10</pageSize>
  </coreQueryPageProvider>

  <showPageSizeSelector>true</showPageSizeSelector>
  <useGlobalPageSize>true</useGlobalPageSize>
  <refresh>
    <event>documentChildrenChanged</event>
  </refresh>
  <cacheKey>only_one_cache</cacheKey>
  <cacheSize>1</cacheSize>

  <resultLayouts>
    <layout name="document_virtual_navigation_listing_ajax" title="document_listing"
      translateTitle="true" iconPath="/icons/document_listing_icon.png"
      showCSVExport="true" showPDFExport="false" showSyndicationLinks="true" />
    <layout name="document_virtual_navigation_listing_ajax_compact_2_columns"
      title="document_listing_compact_2_columns" translateTitle="true"
      iconPath="/icons/document_listing_compact_2_columns_icon.png"
      showSyndicationLinks="true" />
    <layout name="document_virtual_navigation_listing_ajax_icon_2_columns"
      title="document_listing_icon_2_columns" translateTitle="true"
      iconPath="/icons/document_listing_icon_2_columns_icon.png"
      showSyndicationLinks="true" />
  </resultLayouts>

  <selectionList>CURRENT_SELECTION</selectionList>
  <actions category="CURRENT_SELECTION_LIST" />

</contentView>
 
</extension>


<!-- ajout de la navigation virtuelle  -->
<extension target="org.nuxeo.ecm.webapp.directory.DirectoryTreeService"
point="trees">

    <directoryTree name="byLocationsNavigation" label="My location Test"
    contentView="byLocationsContentView" field="location_search_query"
    schema="locationsearch" outcome="locations_virtual_navigation">
        <directory>departements</directory>
        <directory>villes</directory>
	</directoryTree>

</extension>

View answer in original post

7 REPLIES 7

Anahide_Tchertc
Elite Collaborator
Elite Collaborator

hi,

jeremie_
Confirmed Champ
Confirmed Champ

sorry for the xml but the pre-formatted button doesn't look's to work on my computer...apparently, it's not possible to mix code and unordered list in the same post.

Anahide_Tchertc
Elite Collaborator
Elite Collaborator

Thanks for the update, i'm assuming you don't have any ERROR logs?

jeremie_
Confirmed Champ
Confirmed Champ

no, no errors are displayed on the logs.

jeremie_
Confirmed Champ
Confirmed Champ

ok, i finnaly find the problem...i was testing my contribution within the ide.

The view was not registred when i deploy my contribution directly in the eclispe nuxeo-ide, but everything is working when i export a jar file.

here is the contribution :

     <!-- le schema qui contient la navigation virtuelle -->  
<extension target="org.nuxeo.ecm.core.schema.TypeService" point="schema">
	<schema name="locationsearch" src="schemas/location_search.xsd" prefix="ls"/>
</extension>	  

    <!-- le document qui contient le schema précedent -->
<extension target="org.nuxeo.ecm.core.schema.TypeService" point="doctype">   
    <doctype extends="Document" name="LocationSearch">
		<schema name="locationsearch"/>
    </doctype>
</extension>

    <!-- Crée la vue qui va permettre d'afficher les résultats -->

<extension target="org.nuxeo.ecm.platform.ui.web.ContentViewService"
point="contentViews">

<contentView name="byLocationsContentView">
  <title>location search</title>
  <translateTitle>false</translateTitle>
  <showTitle>true</showTitle>
  <emptySentence>label.content.empty.search</emptySentence>
  <translateEmptySentence>false</translateEmptySentence>
 
  <coreQueryPageProvider>
    <property name="coreSession">#{documentManager}</property>
    <whereClause docType="LocationSearch">
      <predicate operator="STARTSWITH" parameter="lc:locations">
        <field name="location_search_query" schema="locationsearch"/>
      </predicate>
      <fixedPart>
        ecm:mixinType != 'HiddenInNavigation' AND
        ecm:currentLifeCycleState
        !='deleted' AND ecm:isCheckedInVersion = 0
      </fixedPart>
    </whereClause>
    <sort column="dc:title" ascending="true" />
    <pageSize>10</pageSize>
  </coreQueryPageProvider>

  <showPageSizeSelector>true</showPageSizeSelector>
  <useGlobalPageSize>true</useGlobalPageSize>
  <refresh>
    <event>documentChildrenChanged</event>
  </refresh>
  <cacheKey>only_one_cache</cacheKey>
  <cacheSize>1</cacheSize>

  <resultLayouts>
    <layout name="document_virtual_navigation_listing_ajax" title="document_listing"
      translateTitle="true" iconPath="/icons/document_listing_icon.png"
      showCSVExport="true" showPDFExport="false" showSyndicationLinks="true" />
    <layout name="document_virtual_navigation_listing_ajax_compact_2_columns"
      title="document_listing_compact_2_columns" translateTitle="true"
      iconPath="/icons/document_listing_compact_2_columns_icon.png"
      showSyndicationLinks="true" />
    <layout name="document_virtual_navigation_listing_ajax_icon_2_columns"
      title="document_listing_icon_2_columns" translateTitle="true"
      iconPath="/icons/document_listing_icon_2_columns_icon.png"
      showSyndicationLinks="true" />
  </resultLayouts>

  <selectionList>CURRENT_SELECTION</selectionList>
  <actions category="CURRENT_SELECTION_LIST" />

</contentView>
 
</extension>


<!-- ajout de la navigation virtuelle  -->
<extension target="org.nuxeo.ecm.webapp.directory.DirectoryTreeService"
point="trees">

    <directoryTree name="byLocationsNavigation" label="My location Test"
    contentView="byLocationsContentView" field="location_search_query"
    schema="locationsearch" outcome="locations_virtual_navigation">
        <directory>departements</directory>
        <directory>villes</directory>
	</directoryTree>

</extension>

You may create a JIRA ticket or use the Forum and explain exactly the procedure to reproduce the way to not have the bundle deployed with Nuxeo IDE. This feature works and we may miss something or you may miss something. If you want to benefit of the hot reload features, this could be better for you

ok, i post my contribution in the french forum