How to create document into the Default Domain ?

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.

0 votes

1 answers

2846 views

ANSWER



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 :D

  <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.

0 votes