cancel
Showing results for 
Search instead for 
Did you mean: 

Show Details button in a custom view

spust
Champ in-the-making
Champ in-the-making
I am trying to adjust a custom view template to my needs and get stuck on the problem on how to show the action buttons to edit, show details, check out and deletion of a document, like the buttons shown on the right side in the standard view.

I tried the following code, but the part

<a href='#' onclick="document.forms['browse']['browse:act'].value='browse:details_doc_id_216';document.forms['browse']['id'].value='${child.properties.node-uuid}';document.forms['browse'].submit();return false;"

does not work. The part ${child.properties.node-uuid} is not replaced with the uuid by the parser. Do I need to enter any escape characters or something else like

" + ${child.properties.node-uuid} +"

Here is the complete code of my template:

<table>
   <tr>
      <td></td>
      <td><b>Name</b></td>
      <td><b>Title</b></td>
      <td><b>Description</b></td>
      <td><b>Created</b></td>     
      <td><b>Modified</b></td>
      <td><b>Size</b></td>
      <td><b>Locked</b></td>
      <td><b>Details</b></td>
   </tr>
   <#list space.childrenByXPath[".//*[subtypeOf('cm:content')]"] as child>
      <#if child.isDocument>
         <tr>
            <td><a href="/alfresco${child.url}" target="new"><img src="/alfresco${child.icon16}" border=0></a></td>
            <td><a href="/alfresco${child.url}" target="new">${child.properties.name}</a></td>
            <td>${child.properties.title}</td>
            <td>${child.properties.description}</td>
            <td>${child.properties.created?date}</td>           
            <td>${child.properties.modified?date}</td>
            <td>${(child.size / 1000)?string("0.##")} KB</td>
            <td> <#if child.isLocked>Yes</#if></td>
            <td><a href='#' onclick="document.forms['browse']['browse:act'].value='browse:details_doc_id_216';document.forms['browse']['id'].value='${child.properties.node-uuid}';document.forms['browse'].submit();return false;" id="details_doc_id_216" class=inlineAction><img src="/alfresco/images/icons/View_details.gif" border=0 alt="Details ansehen" title="Details ansehen" align=absmiddle></a><a href='#' </td>
         </tr>
      </#if>
   </#list>
</table>

Is it possible to show the  edit, show details, check out and delete buttons in a custom view? Has anybody an idea?

thanks in advance,

Simon
5 REPLIES 5

kevinr
Star Contributor
Star Contributor
The 'node-uuid' property is part of the system 'sys' model namespace and the "-" operator is probably interpreted in the expression, so try this instead:
${child.properties["sys:node-uuid"]}

Thanks,

Kevin

spust
Champ in-the-making
Champ in-the-making
Thanx a lot Kevin, it works perfect.

You made my day  Smiley Happy

spust
Champ in-the-making
Champ in-the-making
Here is the final version of my customized view, if somebody might have the same problem:

<#– Table of the documents in my Home Space –>
<#– Shows the Icon and link to the content for the doc, also the size in KB and lock status –>
<table>
   <tr>
      <td></td>
      <td><b>Name</b></td>
      <td><b>Title</b></td>
      <td><b>Description</b></td>
      <td><b>Created</b></td>     
      <td><b>Modified</b></td>
      <td><b>Size</b></td>
      <td><b>Locked</b></td>   
      <td><b>Actions</b></td> 
   </tr>
   <#list space.childrenByXPath[".//*[subtypeOf('cm:content')]"] as child>
      <#if child.isDocument>
         <tr>
            <td><a href="/alfresco${child.url}" target="new"><img src="/alfresco${child.icon16}" border=0></a></td>
            <td><a href="/alfresco${child.url}" target="new">${child.properties.name}</a></td>
            <td>${child.properties.title}</td>
            <td>${child.properties.description}</td>
            <td>${child.properties.created?date}</td>           
            <td>${child.properties.modified?date}</td>
            <td>${(child.size / 1000)?string("0.##")} KB</td>
            <td> <#if child.isLocked>Yes</#if></td>   
<td style="text-align: left;"><nobr><a href="#" onclick="document.forms['browse']['browse:act'].value='browse:edit_doc_http_id_4438';document.forms['browse']['id'].value='${child.properties["sys:node-uuid"]}';document.forms['browse'].submit();return false;" id="edit_doc_http_id_4438" class="inlineAction"><img src="/alfresco/images/icons/edit_icon.gif" alt="edit" title="edit" align="absmiddle" border="0"></a>

<a href="#" onclick="document.forms['browse']['browse:act'].value='browse:checkout_doc_id_4447';document.forms['browse']['id'].value='${child.properties["sys:node-uuid"]}';document.forms['browse'].submit();return false;" id="checkout_doc_id_4447" class="inlineAction"><img src="/alfresco/images/icons/CheckOut_icon.gif" alt="check out" title="check out" align="absmiddle" border="0"></a>

<a href="#" onclick="document.forms['browse']['browse:act'].value='browse:details_doc_id_4452';document.forms['browse']['id'].value='${child.properties["sys:node-uuid"]}';document.forms['browse'].submit();return false;" id="details_doc_id_4452" class="inlineAction"><img src="/alfresco/images/icons/View_details.gif" alt="view details" title="view details" align="absmiddle" border="0"></a>

<a href="#" onclick="document.forms['browse']['browse:act'].value='browse:delete_doc_id_4456';document.forms['browse']['id'].value='${child.properties["sys:node-uuid"]}';document.forms['browse'].submit();return false;" id="delete_doc_id_4456" class="inlineAction"><img src="/alfresco/images/icons/delete.gif" alt="delete" title="delete" align="absmiddle" border="0"></a>

<a href="#" onclick="javascript:_toggleMenu(event, 'browse:content-more-menu_4');return false;" title="more actions"><img src="/alfresco/images/icons/more.gif" align="absmiddle" border="0"></a>

<br><div id="browse:content-more-menu_4" style="position: absolute; display: none; padding-left: 2px;">
<table class="moreActionsMenu" border="0" cellpadding="0" cellspacing="4">
<tbody>
<tr>

<td><img src="/alfresco/images/icons/preview.gif" alt="Vorschau mit Vorlage" title="Vorschau mit Vorlage" border="0"></td>
<td><a href="#" onclick="document.forms['browse']['browse:act'].value='browse:preview_doc_id_4462';document.forms['browse']['id'].value='${child.properties["sys:node-uuid"]}';document.forms['browse'].submit();return false;">preview with a template</a></td></tr><tr>

<td><img src="/alfresco/images/icons/update.gif" alt="update" title="update" border="0"></td>

<td><a href="#" onclick="document.forms['browse']['browse:act'].value='browse:update_doc_id_4466';document.forms['browse']['id'].value='${child.properties["sys:node-uuid"]}';document.forms['browse'].submit();return false;">update</a></td></tr>

<tr><td><img src="/alfresco/images/icons/cut.gif" alt="Cut" title="cut" border="0"></td>
<td><a href="#" onclick="document.forms['browse']['browse:act'].value='browse:cut_node_id_4479';document.forms['browse']['ref'].value='workspace://SpacesStore/${child.properties["sys:node-uuid"]}';document.forms['browse'].submit();return false;">Ausschneiden</a></td></tr>

<tr><td><img src="/alfresco/images/icons/copy.gif" alt="copy" title="copy" border="0"></td><td><a href="#" onclick="document.forms['browse']['browse:act'].value='browse:copy_node_id_4482';document.forms['browse']['ref'].value='workspace://SpacesStore/${child.properties["sys:node-uuid"]}';document.forms['browse'].submit();return false;">copy</a></td></tr>

<tr><td><img src="/alfresco/images/icons/create_forum.gif" alt="start a discussion" title="start a discussion" border="0"></td>
<td><a href="#" onclick="document.forms['browse']['browse:act'].value='browse:create_forum_node_id_4486';document.forms['browse']['id'].value='${child.properties["sys:node-uuid"]}';document.forms['browse'].submit();return false;">start a discussion</a></td></tr>

<tr><td><img src="/alfresco/images/icons/new_workflow.gif" alt="Start Advanced Workflow" title="Start Advanced Workflow" border="0"></td><td><a href="#" onclick="document.forms['browse']['browse:act'].value='browse:start_workflow_id_4489';document.forms['browse']['item-to-workflow'].value='${child.properties["sys:node-uuid"]}';document.forms['browse'].submit();return false;">Start Advanced Workflow</a></td>

</tr></tbody></table></div></nobr>

         </tr>
      </#if>
   </#list>
</table>

Does somebody know, if it is possible to add paging to custom views? To limit the amount of currently shown documents to 20 for example?

thanks,

Simon

spust
Champ in-the-making
Champ in-the-making
Sorry, it does not work as I thought. The number in edit_doc_http_id_4438 (used in document.forms['browse']['browse:act'].value='browse:edit_doc_http_id_4438')changes on every login. It might possibly be connected to the session of the specific user, or something similiar.

I´m not sure if it is somehow possible to get the actual number and to paste it in the href link, but it seems that this is not the best way to display the edit,  update, delete buttons in a custom view.

Does somebody have a better idea?

I want to give the user a possibility to show custom fields in the search list table. As an example should it be possible to show the customer number or the adress in the search list, which I added manually. The custom view seemed to be perfect for that, because the user itself could choose a custom view that fits the custom fields.

A solution to modificate the original alfresco jsp page would not allow a user to select a specific view schema. So this would not be my prefered way to solve this issue.

Thanks,

Simon

lexxborg
Champ in-the-making
Champ in-the-making
hi Simon, here is a way to link to detailpage and download content link:


<#assign ref=child.nodeRef>
<#assign workspace=ref[0..ref?index_of("://")-1]>
<#assign storenode=ref[ref?index_of("://")+3..]>
<td><img src="/alfresco/images/icons/View_details.gif"></td>
<td><a href="/alfresco/navigate/showDocDetails/${workspace}/${storenode}"> Details</a></td> 
<td><img src="/alfresco/images/icons/export.gif"></td>
<td><a href="/alfresco/download/attach/${workspace}/${storenode}/${child.properties.name}"> Download</a></td>

did you find out, how to read out this value???
Sorry, it does not work as I thought. The number in edit_doc_http_id_4438 (used in document.forms['browse']['browse:act'].value='browse:edit_doc_http_id_4438')changes on every login. It might possibly be connected to the session of the specific user, or something similiar.

I´m not sure if it is somehow possible to get the actual number and to paste it in the href link, but it seems that this is not the best way to display the edit, update, delete buttons in a custom view.


Thanks,

LeXx