cancel
Showing results for 
Search instead for 
Did you mean: 

Descripción de un documento en un template de correo

carlos_gonzalez
Champ in-the-making
Champ in-the-making
Hola,
Estoy intentado añadir la propiedad description a una plantilla para el envío de correo. Si utilizo document.properties["description"] en una plantilla de presentación me funciona correctamente pero no ocurre lo mismo si lo hago en el template de correo (de hecho, ni me envía el correo ya que se produce un error inidcando que no encuentra dicha propiedad)

¿alguna sugerencia?

Gracias.
25 REPLIES 25

carlos_gonzalez
Champ in-the-making
Champ in-the-making
Tampoco me funciona. Sin embargo son el siguiente codigo tomado de un ftl de plantillas si obtengo la propiedad

<title>Alfresco RSS</title>
      <copyright>Copyright © 2006 Alfresco Software, Inc. All rights reserved.</copyright>
      <#assign hostname="http://localhost:8080/alfresco">
      <#assign spaceref="${hostname}/navigate/browse/${space.nodeRef.storeRef.protocol}/${space.nodeRef.storeRef.identifier}/${space.nodeRef.id}">
      <#assign datetimeformat="EEE, dd MMM yyyy HH:mm:ss zzz">
      <link>${spaceref}</link>
      <description>Recent Changes to '${space.name}'</description>
      <language>en-us</language>
      <lastBuildDate>${date?string(datetimeformat)}</lastBuildDate>
      <pubDate>${date?string(datetimeformat)}</pubDate>
      <ttl>120</ttl>
      <generator>Alfresco 1.4</generator>
      <image>
         <title>${space.name}</title>
         <width>32</width>
         <height>32</height>
         <link>${spaceref}</link>
         <url>${hostname}${space.icon32}</url>
      </image>
      <#assign weekms=1000*60*60*24*7>
      <#list space.childrenByXPath[".//*[subtypeOf('cm:content')]"] as child>
      <#if (dateCompare(child.properties["cm:modified"], date, weekms) == 1) || (dateCompare(child.properties["cm:created"], date, weekms) == 1)>
      <item>
         <title>${child.properties.name}</title>
         <link>${hostname}${child.url}</link>
         <description>
            ${"<a href='${hostname}${child.url}'>"?xml}${child.properties.name}${"</a>"?xml}
            <#if child.properties["cm:description"]?exists && child.properties["cm:description"] != "">
               ${child.properties["cm:description"]}
            </#if>
         </description>
         <pubDate>${child.properties["cm:modified"]?string(datetimeformat)}</pubDate>
         <guid isPermaLink="false">${hostname}${child.url}</guid>
      </item>
      </#if>
      </#list>

A través de ${child.properties["cm:description"]} obtengo el valor, sin embargo me gustaria llegar a esta propiedad sin tener que hacer un bucle inncecesario.

carlos_gonzalez
Champ in-the-making
Champ in-the-making
añado un poco mas de información:

Usando el siguiente ftl :
<b>Name:</b> ${document.name}<br>
<b>Ref:</b> ${document.nodeRef}<br>
<b>Type:</b> ${document.type}<br>
<b>Content URL:</b> <a href="/alfresco${document.url}">/alfresco${document.url}</a><br>
<b>Locked:</b> <#if document.isLocked>Yes<#else>No</#if><br>
<b>Aspects:</b>
<table>
<#list document.aspects as aspect>
    <tr><td>${aspect}</td></tr>
</#list>
</table>


<table>
<#– Get a list of all the property names for the document –>
<#assign props = document.properties?keys>
<#list props as t>
    <#– If the property exists –>
    <#if document.properties[t]?exists>
       <#– If it is a date, format it accordingly–>
       <#if document.properties[t]?is_date>
       <tr><td>${t} = ${document.properties[t]?date}</td></tr>
      
       <#– If it is a boolean, format it accordingly–>
       <#elseif document.properties[t]?is_boolean>
       <tr><td>${t} = ${document.properties[t]?string("yes", "no")}</td></tr>
      
       <#– Otherwise treat it as a string –>
       <#else>
       <tr><td>${t} = ${document.properties[t]}</td></tr>
       </#if>
    </#if>
</#list>
</table>

Obtengo los siguientes resultados:

<b>Name:</b> alta2222 de usuario.txt<br>
<b>Ref:</b> workspace://SpacesStore/3ba7e93f-d14f-4872-b6be-2704fdc81612<br>
<b>Type:</b> {http://www.alfresco.org/model/content/1.0}content<br>
<b>Content URL:</b> <a href="/alfresco/d/d/workspace/SpacesStore/3ba7e93f-d14f-4872-b6be-2704fdc81612/alta2222%20de%20usuario.txt">/alfresco/d/d/workspace/SpacesStore/3ba7e93f-d14f-4872-b6be-2704fdc81612/alta2222%20de%20usuario.txt</a><br>
<b>Locked:</b> No<br>
<b>Aspects:</b>
<table>
    <tr><td>{http://www.alfresco.org/model/content/1.0}auditable</td></tr>
    <tr><td>{http://www.alfresco.org/model/system/1.0}referenceable</td></tr>
    <tr><td>{http://www.alfresco.org/model/content/1.0}titled</td></tr>
    <tr><td>{http://www.alfresco.org/model/content/1.0}author</td></tr>
    <tr><td>{http://www.alfresco.org/model/application/1.0}inlineeditable</td></tr>
</table>


<table>
       <tr><td>{http://www.alfresco.org/model/content/1.0}name = alta2222 de usuario.txt</td></tr>
       <tr><td>{http://www.alfresco.org/model/content/1.0}modified = 28-jul-2009</td></tr>
      
       <tr><td>{http://www.alfresco.org/model/content/1.0}creator = admin</td></tr>
       <tr><td>{http://www.alfresco.org/model/system/1.0}store-protocol = workspace</td></tr>
       <tr><td>{http://www.alfresco.org/model/system/1.0}store-identifier = SpacesStore</td></tr>
       <tr><td>{http://www.alfresco.org/model/content/1.0}created = 28-jul-2009</td></tr>
      
       <tr><td>{http://www.alfresco.org/model/application/1.0}editInline = yes</td></tr>
      
       <tr><td>{http://www.alfresco.org/model/system/1.0}node-dbid = 2.483</td></tr>
       <tr><td>{http://www.alfresco.org/model/content/1.0}content = org.alfresco.repo.template.BaseContentNode$TemplateContentData@4fdeaf01</td></tr>
       <tr><td>{http://www.alfresco.org/model/content/1.0}title = alta2222 de usuario.txt</td></tr>
       <tr><td>{http://www.alfresco.org/model/system/1.0}node-uuid = 3ba7e93f-d14f-4872-b6be-2704fdc81612</td></tr>
       <tr><td>{http://www.alfresco.org/model/content/1.0}modifier = admin</td></tr>
</table>

No existe referencia alguna a la propiedad description y no sé el porqué

pjcaracuel_2349
Confirmed Champ
Confirmed Champ
Podria ser que dicha propiedad este asociada a un aspecto??


<aspect name="cm:titled">
         <title>Titled</title>
         <properties>
            <property name="cm:title">
               <title>Title</title>
               <type>d:mltext</type>
            </property>
            <property name="cm:description">
               <title>Description</title>
               <type>d:mltext</type>
            </property>
         </properties>
      </aspect>
  

carlos_gonzalez
Champ in-the-making
Champ in-the-making
El log me dice lo siguiente:

Se ha producido un Error al procesar la plantilla 'Expected extended hash. documen$
        at org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:206)

venzia
Star Collaborator
Star Collaborator
Hola Carlos, presupongo que habrás probado document.properties["cm:description"]
Si ni con esas la cosa tiene mala pinta  :x
Saludos y suerte!

miguel_gil_mart
Champ in-the-making
Champ in-the-making
${document.properties["cm:description"]} me funciona perfectamente. Sin embargo document.size no tira.