cancel
Showing results for 
Search instead for 
Did you mean: 

Need email notification to point to Share not Alfresco

tctim
Champ in-the-making
Champ in-the-making
Hello-

I want to change the following code to point to Share instead of to Alfresco since my users only have access to Share.

From notify_user_email.ftl
**************
You can view it through this link:
https: //mydomain/alfresco${document.url}
*************

An example desired rendered URL would look like this –
https: //mydomain/share/page/site/hq/document-details?nodeRef=workspace://SpacesStore/253ac02f-02a9-4016-a108-bfe98ea8c17b

Where would I find out how to programatically define this?

Thanks,

Tim
14 REPLIES 14

tctim
Champ in-the-making
Champ in-the-making
What I am trying to achieve can be seen on the document details page for any content item in Share - in the right hand nav there is a box titled Share with "Document URL".  In this box is the URL to this particular document - I need to know how that URL is dynamically generated.  I thought I had it figured out when I changed the URL in the notify_user_email.ftl to http: //mydomain/share/proxy/alfresco-feed/api/node/content${document.url} but the ${document.url} generates a leading /d/d that breaks the URL.

For example -
The URL to the document is:
https: //mydomain/share/proxy/alfresco-feed/api/node/content/workspace/SpacesStore/b2e3c064-9988-422e-8416-05795e70d5fe/notify_user_email-3.ftl

The above example generates the following URL:
https: //mydomain/share/proxy/alfresco-feed/api/node/content/d/d/workspace/SpacesStore/b2e3c064-9988-422e-8416-05795e70d5fe/notify_user_email-3.ftl

Thoughts?

tctim
Champ in-the-making
Champ in-the-making
Yup - one of those days.  I meant to say I wanted to know how the URL was generated in the "This Page URL"….

mikeh
Star Contributor
Star Contributor
Unfortunately it's a bit tricky, assuming you want to direct the user to the details page..? The "The Page URL" is literally copied from window.location.href, so it's not really generated at all.

As for the others, there's some work in the DocLib webscripts to work out whether an arbitrary nodeRef (which could live anywhere in the Repository) is actually part of a Site or not. This is done by examining the node's qnamePath. Something like:
var qnamePaths = node.qnamePath.split("/");
var displayPaths = node.displayPath.split("/");
if ((qnamePaths.length > 5) && (qnamePaths[2] == "st:sites"))
{
   // This asset belongs to a site
   var site = displayPaths[3];
   [generate the url]
}

You should be able to generate the URL from there, although you'd have to "know" the first part, e.g. http://serverSmiley Tongueort/share/page/site/{site}/document-details?nodeRef={nodeRef}

Thanks,
Mike

tctim
Champ in-the-making
Champ in-the-making
First - thanks for the reply…

This is beyond my skill set - I was hoping it was as easy as adding something like ${document-link.page} to the end of the known part of the URL. 

I sure would have thought this would have been basic functionality for the application - even this forum has the email alert ability.

mikeh
Star Contributor
Star Contributor
The core Repository (where your e-mail template gets populated) knows nothing about Share Sites or how to generate URLs to arbitrary pages that may or may not exist. Share is one example of a remote application that uses the Repository for storage, so this separation is valid. URLs would have to be generate by code that was "Share aware" such as the example I gave.

Thanks,
Mike

P.S. I'm not sure how comparing a REST-based two-tier CMS to a PHP forum is particularly relevant.  :?

tctim
Champ in-the-making
Champ in-the-making
Ok - I'm not that great of a coder and all I want is the code to put into the notify_email_user.ftl to provide the correct URL on the email notifications. 

Is there a document somewhere that can walk me through the process of how to create the appropriate dynamic URL?

Tim

tctim
Champ in-the-making
Champ in-the-making
I still haven't figured this out but here's how I **think** one would dynamically construct the URL.

Sample URL
https://mydomain.com/share/page/site/az/document-details?nodeRef=workspace://SpacesStore/66c42c1b-0d...

So it seems to me the only thing I need to figure out is how to reference the site - az in this example and the variable that represents the document in the SpaceStore - 66c42c1b-0d58-4757-a08b-c20ab51f3be6 in this example.

I would think it would be something like
https://mydomain.com/share/page/site/${document.site}/document-details?nodeRef=workspace://SpacesSto...}

But I can't find the reference document that outlines the list of the ${…}

janvg
Champ in-the-making
Champ in-the-making
Will the introduction of the repository browser in 3.2 r bring any solutions for this ? I believe more and more users will only face Alfresco through the share client (not the webclient), so it would be very useful if the e-mail templates would re-direct us to the correct interface.

felipe_gdr
Champ in-the-making
Champ in-the-making
Hi,

what do I do with this piece of code?

var qnamePaths = node.qnamePath.split("/");
var displayPaths = node.displayPath.split("/");
if ((qnamePaths.length > 5) && (qnamePaths[2] == "st:sites"))
{
// This asset belongs to a site
var site = displayPaths[3];
[generate the url]
}

I cannot put it inside a template, so where should it go?

Thanks