cancel
Showing results for 
Search instead for 
Did you mean: 

How to create document into the Default Domain ?

Benjamin_Jalon1
Elite Collaborator
Elite Collaborator

I create a new doc type into Studio, and I deploy it into my Nuxeo instance.

When I navigate into the Default Domain, there is no New Document button and I have no way to create my document type.

1 ACCEPTED ANSWER

Benjamin_Jalon1
Elite Collaborator
Elite Collaborator

Yes, Nuxeo guys don't like to let you create document into Domain. This is not fair...

But I can help you to that and thanks Alain for my karma...

In fact there is a filter that hide the "New document" action for Domain documents.

To make the "new Document" button appear, you can create your own action with the same configuration of the default new document type but with a different filter (ugly way) or just appends to the filter used by the "New Document" action to let it displayed for Domains (clean way).

So the for the clean way, you just have to add the following XML extension in Studio (Project > Advanced Settings > XML Extensions):

  <extension target="org.nuxeo.ecm.platform.actions.ActionService"
    point="filters">
    <filter id="create" append="true">
      <rule grant="true">
        <permission>AddChildren</permission>
        <type>Domain</type>
        <condition>#{typeManager.getAllowedSubTypes(document.getType(), document).size() > 0}</condition>
      </rule>
    </filter>
  </extension>

or if you are tired and don't want to make it clean 😄

  <extension point="actions" target="org.nuxeo.ecm.platform.actions.ActionService"> 
     <action icon="/icons/action_add.gif" id="newDocumentBis" label="action.new.document" link="javascript:Richfaces.showModalPanel('selectDocTypePanel');">
    <category>SUBVIEW_UPPER_LIST_HREF</category>

    <filter id="customAdditionalRuleForNewDocumentButton">
      <rule grant="true">
        <permission>AddChildren</permission>
        <type>Domain</type>
      </rule>
  </filter>
</action>
</extension>

When you want to override or copy the behavior of a link, you can have a look at the contributed links here and, exhaustively there.

View answer in original post

1 REPLY 1

Benjamin_Jalon1
Elite Collaborator
Elite Collaborator

Yes, Nuxeo guys don't like to let you create document into Domain. This is not fair...

But I can help you to that and thanks Alain for my karma...

In fact there is a filter that hide the "New document" action for Domain documents.

To make the "new Document" button appear, you can create your own action with the same configuration of the default new document type but with a different filter (ugly way) or just appends to the filter used by the "New Document" action to let it displayed for Domains (clean way).

So the for the clean way, you just have to add the following XML extension in Studio (Project > Advanced Settings > XML Extensions):

  <extension target="org.nuxeo.ecm.platform.actions.ActionService"
    point="filters">
    <filter id="create" append="true">
      <rule grant="true">
        <permission>AddChildren</permission>
        <type>Domain</type>
        <condition>#{typeManager.getAllowedSubTypes(document.getType(), document).size() > 0}</condition>
      </rule>
    </filter>
  </extension>

or if you are tired and don't want to make it clean 😄

  <extension point="actions" target="org.nuxeo.ecm.platform.actions.ActionService"> 
     <action icon="/icons/action_add.gif" id="newDocumentBis" label="action.new.document" link="javascript:Richfaces.showModalPanel('selectDocTypePanel');">
    <category>SUBVIEW_UPPER_LIST_HREF</category>

    <filter id="customAdditionalRuleForNewDocumentButton">
      <rule grant="true">
        <permission>AddChildren</permission>
        <type>Domain</type>
      </rule>
  </filter>
</action>
</extension>

When you want to override or copy the behavior of a link, you can have a look at the contributed links here and, exhaustively there.

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.