cancel
Showing results for 
Search instead for 
Did you mean: 

Get CIFS Path with Freemarker and characters conversion

dranakan
Champ on-the-rise
Champ on-the-rise
Hello,

I need your help to get the CIFS Path in a Freemarker with a conversion of characters ("%C3%A9" will be "é").

Get the CIFS Path (without conversion):
<#assign relativePath = (child.displayPath?substring(companyhome.name?length+1) + '/' + child.name)?url?replace('%2F', '/')?replace('/', '\\') />
<cifsUrl>\Alfresco${relativePath}</cifsUrl>
If I ask webscript to get the file é.pdf without the conversion, I get :
<cifsUrl>\Alfresco\%C3%A9.pdf</cifsUrl>
But I would like to get the path with the characters conversion… I have done this :
<#assign relativePath = (child.displayPath?substring(companyhome.name?length+1) + '/' + child.name)?url?replace('%2F', '/')?replace('/', '\\')?replace('%20',' ')?replace('%21','!')?replace('%23','#')?replace('%24','$')?replace('%25','%')?replace('%26','&')?replace('%27','')?replace('%28','(')?replace('%29',')')?replace('%2A','*')?replace('%2B','+')?replace('%2D','-')?replace('%2E','.')?replace('%3A',':')?replace('%3C','<')?replace('%3D','=')?replace('%3E','>')?replace('%3F','?')?replace('%40','@')?replace('%5B','[')?replace('%5D',']')?replace('%5E','^')?replace('%5F','_')?replace('%60','`')?replace('%C2%A1','¡')?replace('%C2%A2','¢')?replace('%C2%A3','£')?replace('%C2%A4','¤')?replace('%C2%A5','¥')?replace('%C2%A6','¦')?replace('%C2%A7','§')?replace('%C2%A8','¨')?replace('%C2%A9','©')?replace('%C2%AA','ª')?replace('%C2%AB','«')?replace('%C2%AC','¬')?replace('%C2%AD','­')?replace('%C2%AE','®')?replace('%C2%AF','¯')?replace('%C2%B0','°')?replace('%C2%B1','±')?replace('%C2%B2','²')?replace('%C2%B3','³')?replace('%C2%B4','´')?replace('%C2%B5','µ')?replace('%C2%B6','¶')?replace('%C2%B7','·')?replace('%C2%B8','¸')?replace('%C2%B9','¹')?replace('%C2%BA','º')?replace('%C2%BB','»')?replace('%C2%BC','¼')?replace('%C2%BD','½')?replace('%C2%BE','¾')?replace('%C2%BF','¿')?replace('%C3%80','À')?replace('%C3%81','Á')?replace('%C3%82','Â')?replace('%C3%83','Ã')?replace('%C3%84','Ä')?replace('%C3%85','Å')?replace('%C3%86','Æ')?replace('%C3%87','Ç')?replace('%C3%88','È')?replace('%C3%89','É')?replace('%C3%8A','Ê')?replace('%C3%8B','Ë')?replace('%C3%8C','Ì')?replace('%C3%8D','Í')?replace('%C3%8E','Î')?replace('%C3%8F','Ï')?replace('%C3%90','Ð')?replace('%C3%91','Ñ')?replace('%C3%92','Ò')?replace('%C3%93','Ó')?replace('%C3%94','Ô')?replace('%C3%95','Õ')?replace('%C3%96','Ö')?replace('%C3%97','×')?replace('%C3%98','Ø')?replace('%C3%99','Ù')?replace('%C3%9A','Ú')?replace('%C3%9B','Û')?replace('%C3%9C','Ü')?replace('%C3%9D','Ý')?replace('%C3%9E','Þ')?replace('%C3%9F','ß')?replace('%C3%A0','à')?replace('%C3%A1','á')?replace('%C3%2','â')?replace('%C3%A3','ã')?replace('%C3%A4','ä')?replace('%C3%A5','å')?replace('%C3%A6','æ')?replace('%C3%A7','ç')?replace('%C3%A8','è')?replace('%C3%A9','é')?replace('%C3%AA','ê')?replace('%C3%AB','ë')?replace('%C3%AC','ì')?replace('%C3%AD','í')?replace('%C3%AE','î')?replace('%C3%AF','ï')?replace('%C3%B0','ð')?replace('%C3%B1','ñ')?replace('%C3%B2','ò')?replace('%C3%B3','ó')?replace('%C3%B4','ô')?replace('%C3%B5','õ')?replace('%C3%B6','ö')?replace('%C3%B7','÷')?replace('%C3%B8','ø')?replace('%C3%B9','ù')?replace('%C3%BA','ú')?replace('%C3%BB','û')?replace('%C3%BC','ü')?replace('%C3%BD','ý')?replace('%C3%BE','þ')?replace('%C3%BF','ÿ')?replace('%2C',',')?replace('%7B','{')?replace('%7D','}')?replace('%3B',';')?replace('%E2%82%AC','€') /> />
It works good on Windows (XP, Alfresco 3.0 Labs, 3.2 Community)…
<cifsUrl>\Alfresco\é.pdf</cifsUrl>
but when I use it on Linux (Redhat 5.2, Alfresco 3.0 Labs, 3.2 Community), I get this :
<cifsUrl>\Alfresco\�.pdf</cifsUrl>

What can I do to get good CIFS path under Windows and Linux  :?:

Thanks
5 REPLIES 5

mikeh
Star Contributor
Star Contributor
Wow. I think you could have just used ?xml instead of ?url

Mike

dranakan
Champ on-the-rise
Champ on-the-rise
Yes ! Thank you 🙂

It's look running…
<#assign relativePath = (child.displayPath?substring(companyhome.name?length+1) + '/' + child.name)?xml?replace('/', '\\')?replace('&apos;','\'') />

Do I need more replace after the "?XML" ?

piski
Champ on-the-rise
Champ on-the-rise
Hi,

I'm interesting in using a freemarker email template to display a link that allow user to open (and modify) a document via CIFS.
I tried to use this (email/fork within jbpm workflow) but I experienced an (generic) error.

Here is my template :

Le document '${document.name}' <#if document.properties.title??>'${document.properties.title}'</#if> a été créé par ${args['demandeur']}.<br/> 

<#assign relativePath = (child.displayPath?substring(companyhome.name?length+1) + '/' + child.name)?xml?replace('/', '\\')?replace('&apos;','\'') />

Vous devez le relire et y annoter vos commentaires en vous connectant <a href='${relativePath}'>ici</a>.<br/>

Pour cela, une tâche a été ajoutée dans votre <a href="${args['shareUrl']}/page/task-edit?taskId=jbpm$${args['taskId']}">tableau de bord Alfresco</a>.

I don't know what's wrong with your script/my template … PS : I'm using Alfresco 3.4.e

Thanks for your help,
Pascal.

dranakan
Champ on-the-rise
Champ on-the-rise
Hello,

It's easier to help you if you give us the error…But I think you should replace "child" by "document".

piski
Champ on-the-rise
Champ on-the-rise
Thanks for your reply, it works fine now !

PS : the error was generic (such as "Failed to signal transition")