Xhtml : get all a document path with "Title" and not "name"

Hello,

I want to get all the path of a document in my code XHTML but not with “name”, with title as in the breadcrumbActions navigation tool.

I would like this code, but with a documentModel in parameter and not the currentDocument :

      <h:column>
        <nxu:dataList var="pathElement" value="#{breadcrumbActions.backendPath}">
          <f:verbatim>&amp;gt;&amp;nbsp;</f:verbatim>
          <h:outputText value="#{pathElement.name}" />
        </nxu:dataList>
      </h:column>

do you know how to loop on a documentModel path in xhtml ?

thanks

0 votes

2 answers

1262 views

ANSWER



Hi,

I'm a bit late, but there's also another bean that implements this:

publishActions.getFormattedPath(model.pathAsString)

The only issue is that it concatenates documents with a hard-coded “>“. Of course you could hack it with a:

publishActions.getFormattedPath(model.pathAsString).replaceAll(">", " / ")
0 votes



thank you very much ! Everything in one line !!! So cool ! code became ==> < c : set var="parentPathTitle" value="#{publishActions.getFormattedPath(doc.path).replaceAll('>', ' / ')}" />
10/02/2013

Can I use this bean in MVEL or Freemarker template (and how ?) thank you
10/02/2013

Sorry but it's more complicated to insert this in a template, also it depends on what templates exactly (workflow notification? other mail notifications? document template?) Anyway you'd probably have to write some Java to be able to do this.
10/02/2013

Oh :-( It's in document template as email, or xls, pdf generation
10/02/2013

You could post this as a new question, maybe the Nuxeo team has more to say about it.
10/02/2013

Ok thanks ;-)
10/02/2013


Hello me,

This is the code. It's cut because some code wasn't display with this web site (1) (2) & (3).

      <c:set var="tabPath" value="${fn:split(doc.path,'/')}" />
      <c:set var="pathSize" value="${fn:length(tabPath)}" />
      <c:set var="currentDoc" value="#{doc}" />
      <c:forEach var="i" begin="1" end="#{pathSize-1}">
         <c:set var="theDoc" value="#{currentDoc.parentRef}" scope="page"/>
          <c:if test="#{not empty theDoc}">
             <c:choose>
               (1)
             </c:choose>
            (2)
         </c:if>
      </c:forEach>
      (3)

(1) <c:when test="#{not empty resultPath}">

<c:set var="resultPath" value="#{currentDoc.title.concat('/').concat(resultPath)}" />


</c:when>

<c:otherwise>

<c:set var="resultPath" value="#{currentDoc.title}" />


</c:otherwise>

(2) <c:set var="currentDoc" value="#{documentManager.getDocument(theDoc)}" />


(3) <h:outputText value="#{resultPath}" />

0 votes



Ok, look at the other answer more simple…
10/02/2013