Recherche

Sommaire

Pages enfant
  • Les contentViews

Comparaison des versions

Légende

  • Ces lignes ont été ajoutées. Ce mot a été ajouté.
  • Ces lignes ont été supprimées. Ce mot a été supprimé.
  • La mise en forme a été modifiée.
Sommaire

Principe

Depuis les versions 5.4 de Nuxeo est apparue la notion de ContentViews.

...

Bloc de code
<?xml version="1.0"?>
<component name="org.esup.ecm.webapp.contentview.contrib">
<require>org.nuxeo.ecm.webapp.contentview.contrib</require>
  <extension target="org.nuxeo.ecm.platform.ui.web.ContentViewService"
    point="contentViews">

    <contentView name="esup_document_content">
     <title>label.contentview.document_content</title>
      <translateTitle>true</translateTitle>
      <showTitle>false</showTitle>

      <coreQueryPageProvider>
        <property name="coreSession">#{documentManager}</property>
        <whereClause docType="AdvancedSearch">
          <predicate parameter="ecm:fulltext" operator="FULLTEXT">
            <field schema="advanced_search" name="fulltext_all" />
          </predicate>
          <predicate parameter="dc:title" operator="FULLTEXT">
            <field schema="advanced_search" name="title" />
          </predicate>
          <predicate parameter="dc:modified" operator="BETWEEN">
            <field schema="advanced_search" name="modified_min" />
            <field schema="advanced_search" name="modified_max" />
          </predicate>
          <fixedPart>
            ecm:parentId = ? AND ecm:isCheckedInVersion = 0 AND
            ecm:mixinType !=
            'HiddenInNavigation' AND ecm:currentLifeCycleState
            != 'deleted'
          </fixedPart>
        </whereClause>
        <parameter>#{currentDocument.id}</parameter>
        <sort column="dc:title" ascending="true" />
        <pageSize>20</pageSize>
      </coreQueryPageProvider>

      <searchLayout name="document_content_filter"
        filterDisplayType="quick" />
      <showFilterForm>true</showFilterForm>

      <showPageSizeSelector>true</showPageSizeSelector>
      <useGlobalPageSize>true</useGlobalPageSize>
      <refresh>
        <event>documentChanged</event>
        <event>documentChildrenChanged</event>
      </refresh>
      <cacheKey>#{currentDocument.id}</cacheKey>
      <cacheSize>20</cacheSize>

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

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

    </contentView>

    <contentView name="esup_document_trash_content">

      <title>label.contentview.document_trash_content</title>
      <translateTitle>true</translateTitle>
      <showTitle>false</showTitle>

      <coreQueryPageProvider>
        <property name="coreSession">#{documentManager}</property>
        <whereClause docType="AdvancedSearch">
          <predicate parameter="ecm:fulltext" operator="FULLTEXT">
            <field schema="advanced_search" name="fulltext_all" />
          </predicate>
          <predicate parameter="dc:title" operator="FULLTEXT">
            <field schema="advanced_search" name="title" />
          </predicate>
          <predicate parameter="dc:modified" operator="BETWEEN">
            <field schema="advanced_search" name="modified_min" />
            <field schema="advanced_search" name="modified_max" />
          </predicate>
          <fixedPart>
            ecm:parentId = ? AND ecm:isCheckedInVersion = 0 AND
            ecm:mixinType !=
            'HiddenInNavigation' AND ecm:currentLifeCycleState =
            'deleted'
          </fixedPart>
        </whereClause>
        <parameter>#{currentDocument.id}</parameter>
        <sort column="dc:title" ascending="true" />
        <pageSize>20</pageSize>
      </coreQueryPageProvider>

      <searchLayout name="document_content_filter"
        filterDisplayType="quick" />
      <showFilterForm>false</showFilterForm>

      <showPageSizeSelector>true</showPageSizeSelector>
      <useGlobalPageSize>true</useGlobalPageSize>
      <refresh>
        <event>documentChanged</event>
        <event>documentChildrenChanged</event>
      </refresh>
      <cacheKey>#{currentDocument.id}</cacheKey>
      <cacheSize>10</cacheSize>

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

      <selectionList>CURRENT_SELECTION_TRASH</selectionList>
      <actions category="CURRENT_SELECTION_TRASH_LIST" />

    </contentView>

    <contentView name="esup_section_content">

      <title>label.contentview.section_content</title>
      <translateTitle>true</translateTitle>
      <showTitle>false</showTitle>

      <coreQueryPageProvider>
        <property name="coreSession">#{documentManager}</property>
        <whereClause docType="AdvancedSearch">
          <predicate parameter="ecm:fulltext" operator="FULLTEXT">
            <field schema="advanced_search" name="fulltext_all" />
          </predicate>
          <predicate parameter="dc:title" operator="FULLTEXT">
            <field schema="advanced_search" name="title" />
          </predicate>
          <predicate parameter="dc:modified" operator="BETWEEN">
            <field schema="advanced_search" name="modified_min" />
            <field schema="advanced_search" name="modified_max" />
          </predicate>
          <fixedPart>
            ecm:parentId = ? AND ecm:isCheckedInVersion = 0 AND
            ecm:mixinType !=
            'HiddenInNavigation' AND ecm:currentLifeCycleState
            != 'deleted'
          </fixedPart>
        </whereClause>
        <parameter>#{currentDocument.id}</parameter>
        <sort column="dc:title" ascending="true" />
        <pageSize>20</pageSize>
      </coreQueryPageProvider>

      <searchLayout name="document_content_filter"
        filterDisplayType="quick" />
      <showFilterForm>true</showFilterForm>

      <showPageSizeSelector>true</showPageSizeSelector>
      <useGlobalPageSize>true</useGlobalPageSize>
      <refresh>
        <event>documentChanged</event>
        <event>documentChildrenChanged</event>
      </refresh>
      <cacheKey>#{currentDocument.id}</cacheKey>
      <cacheSize>10</cacheSize>

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

      <selectionList>CURRENT_SELECTION_SECTIONS</selectionList>
      <actions category="CURRENT_SELECTION_SECTIONS_LIST" />

    </contentView>

    <contentView name="esup_orderable_document_content">

      <title>label.contentview.orderable_document_content</title>
      <translateTitle>true</translateTitle>
      <showTitle>false</showTitle>

      <coreQueryPageProvider>
        <property name="coreSession">#{documentManager}</property>
        <whereClause docType="AdvancedSearch">
          <predicate parameter="ecm:fulltext" operator="FULLTEXT">
            <field schema="advanced_search" name="fulltext_all" />
          </predicate>
          <predicate parameter="dc:title" operator="FULLTEXT">
            <field schema="advanced_search" name="title" />
          </predicate>
          <predicate parameter="dc:modified" operator="BETWEEN">
            <field schema="advanced_search" name="modified_min" />
            <field schema="advanced_search" name="modified_max" />
          </predicate>
          <fixedPart>
            ecm:parentId = ? AND ecm:isCheckedInVersion = 0 AND
            ecm:mixinType !=
            'HiddenInNavigation' AND ecm:currentLifeCycleState
            != 'deleted'
          </fixedPart>
        </whereClause>
        <parameter>#{currentDocument.id}</parameter>
        <sort column="ecm:pos" ascending="true" />
        <sortable>false</sortable>
        <pageSize>25</pageSize>
      </coreQueryPageProvider>
      <searchLayout name="document_content_filter"
        filterDisplayType="quick" />
      <showFilterForm>true</showFilterForm>
      <showPageSizeSelector>true</showPageSizeSelector>
      <useGlobalPageSize>true</useGlobalPageSize>
      <refresh>
        <event>documentChanged</event>
        <event>documentChildrenChanged</event>
      </refresh>
      <cacheKey>#{currentDocument.id}</cacheKey>
      <cacheSize>10</cacheSize>
      <resultLayouts>
        <layout name="esup_document_listing_ajax" title="document_listing"
          translateTitle="true" iconPath="/icons/document_listing_icon.png"
          showCSVExport="true" showPDFExport="false" showSyndicationLinks="true" />
      </resultLayouts>
      <selectionList>CURRENT_SELECTION</selectionList>
      <actions category="CURRENT_SELECTION_LIST" />
      <actions category="ORDERABLE_CURRENT_SELECTION_LIST" />
    </contentView>
  </extension>
</component>

On a défini trois ici plusieurs layouts spécifiques (commençant par esup-) pour la présentation des résultats, il faudra s'occuper par la suite de la définition de ces derniers. Cette étape est décrite dans le chapitre sur les layouts.

Il faut maintenant spécifier que ce sont ces contentViews qu'il faut utiliser. Pour ce faire, on crée un fichier esup-contentview-config.xml  que l'on place dans le répertoire templates/custom/config

...

Note : Nous avons également introduit deux nouveaux layouts dans de fichier : esupdublincor esupdublincore et lightdublincore que nous utliserons dans lechapitre sur les layouts.