AnsweredAssumed Answered

Only a template to show a document

Question asked by mrey on Jun 25, 2009
Latest reply on Jul 21, 2009 by shaund
Good afternoon all

Have a question about FreeMarker Templates that I would need help with. What I need to get is a space to review some kind of documents, to do so what I want is the user to see the documents of this space in a view splited in two parts, first one showing the pdf document, and the second one showing the alfresco metadata linked to it.

This way, reviewing the document and metadata is much easier for our users. I got this "template" using FreeMarker and linked it to the "Review" Space, using this code

<table>
   <tr>
      <td>
         <#list space.children as child>
            <#if child.isDocument && (child.mimetype = "application/pdf")>
               <a href="/alfresco${child.url}" target="new"><embed src="/alfresco${child.url}"width="500" height="700"></embed>
            </#if>
         </#list>
      </td>
      <td>
            <table>      <form name="miFormulario" onSubmit="return valida(this);">

         
               <tr>
                     <#list space.childrenByXPath[".//*[subtypeOf('cm:content')]"] as child>
                     <td>Fecha de emision:</td><td> <input type="text" name="fecha" value=${child.properties["custom:fecha"]?datetime}></td> 
               </tr>
               <tr>
                     <td>CIF de la empresa emisora:</td><td><input type="text" name="CIF" value=${child.properties["custom:CIF"]}> </td>
               </tr>
               <tr>
                     <td>Numero de factura: </td><td><input type="text" name="num_factura" value= ${child.properties["custom:numfactura"]}></td>
               </tr>
               <tr>
                     <td>Precio Base: </td><td><input type="text" name="Base" value= ${child.properties["custom:base"]}></td>
               </tr>
               <tr>
                     <td>Iva: </td><td><input type="text" name="nombre" value= ${child.properties["custom:iva"]}></td>
               </tr>
               <tr>
                     <td>Precio Total:</td><td><input type="text" name="nombre" value=${child.properties["custom:total"]}></td>
               </tr>
                  </#list>   
               <tr>
                     <td><input type=submit value="Rechazar"> </td><td><input type=submit value="Aprobar"></td>
               </tr>
            </table>   </form>      
      </td>
   </tr>
</table>

However this only works if there is only a document in the space, if I have more than one, this template is repeated in the screen as many times as the number of docs in the space.

As what I want is the user to review both doc and metadata and then click on a "Approve" button to review next document, I would need to find the way to get only a document shown per time until the document is approved.

Does anyone have any idea of how can I get this done automatically in code?…. any other ideas to show only once per document in the Alfresco screen the content of the document in one side and in the other side the metadata of the document?

Any help will be much appreciated.

Cheers

Outcomes