0

I want a dynamic link to be generated and placed in a users' alfresco dashboard. The link would be say "inbox" which will have to be in the following format http://www.mysite.com/preauth.jsp?email=hello@domain.com . The only dynamic part of the link would be hello@domain.com which will be the email address of the user currently logged in. How can this be achieved Any help will be greatly appreciated.

Using alresco community 4.2a

darkblack
  • 21
  • 1
  • 4

1 Answers1

2

If you'd like to implement this using a dashlet then take a look at will's sample dashlet on github: https://github.com/share-extras/sdk-sample-dashlet

All you need to do is to modify the ftl of the dashlet:

...normal html
<a href ="http://www.mysite.com/preauth.jsp?email=${user.email}">link</a>

Another approach is to add your link to Alfresco Share's header & add the following item (http://wiki.alfresco.com/wiki/Share_Header):

<item type="external-link" id="pre-auth">http://www.mysite.com/preauth.jsp?email={useremail}</item>

{useremail} is an unkown token here, thus you'll have to customize site-webscripts\org\alfresco\components\header\header.get.html.ftl & add your token there (sorry only 4.1 code as i don't have a 4.2 in-place):

    <script type="text/javascript">//<![CDATA[
   var ${jsid} = new Alfresco.component.Header("${jsid}").setOptions(
   {
      siteId: "${page.url.templateArgs.site!""}",
      siteTitle: "${siteTitle?js_string}",
      minSearchTermLength: ${args.minSearchTermLength!config.scoped["Search"]["search"].getChildValue("min-search-term-length")},
      tokens:
      {
         site: "${page.url.templateArgs.site!""}",
         pageid: "${page.url.templateArgs.pageid!""}",
         userid: "${user.name?js_string}",
         useremail: "${user.email?js_string}",
      }
   }).setMessages(${messages});
   Alfresco.util.createTwister.collapsed = "${collapsedTwisters?js_string}";
//]]></script>
alfrescian
  • 4,079
  • 1
  • 18
  • 20
  • After I posted the question, I dug around that the 2nd approach you have provided is the way to go . Went ahead and modified share-config.xml and added the link. BUT ${user.email} is not getting picked up. I tried a couple of other tags as well. None works. Any help? – darkblack Jul 24 '13 at 13:14
  • edited my answer - you'll have to customize site-webscripts\org\alfresco\components\header\header.get.html.ftl - pls use 4.2-compatible best-practice here - my 4.1 example is dirty – alfrescian Jul 24 '13 at 14:06
  • I understand the code that you have given is not 4.2 compliant, but when I copy paste it on top of the header.get.html.ftl , alfresco throws a whole bunch of errors and not display the header. Any help? – darkblack Jul 26 '13 at 08:08