<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Javascript 'Var with user info from alfresco' - question in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/javascript-var-with-user-info-from-alfresco-question/m-p/158622#M112713</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a question on how to retrieve info of the current user.&amp;nbsp; I had a temporary solution but it is completely inadequate and doesn't work very well either.&amp;nbsp; In fact it doesn't work at all like I meant.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A made a presentation template to apply to certain spaces which adds an URL with a few parameters.&amp;nbsp; The parameters are the users' first and last name, which is passed to a custom bean with JSF page.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'll add the code momentarily.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The parameter gets the first and last name from the name of the space, or at least that's what I wanted to try for temporary solution.&amp;nbsp; It would of course be much better to get the current user and add his/her first and lastname to the path.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&amp;lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&amp;gt;&lt;BR /&gt;&amp;lt;html&amp;gt;&lt;BR /&gt;&amp;lt;head&amp;gt;&lt;BR /&gt;&amp;lt;title&amp;gt;Adjust CV&amp;lt;/title&amp;gt;&lt;BR /&gt;&amp;lt;script language="JavaScript" type="text/javascript"&amp;gt;&lt;BR /&gt;var ch=space.children;&lt;BR /&gt;for(var i=0; i&amp;lt;ch.length;i++)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; if(ch[i].isContainer)&lt;BR /&gt;&amp;nbsp; {&lt;BR /&gt;function createURL(){&lt;BR /&gt;&lt;BR /&gt;location.href="/Alf_CV/jsp/personal.jsf?username="+ch[i];&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;/head&amp;gt;&lt;BR /&gt;&amp;lt;body&amp;gt;&lt;BR /&gt;&amp;lt;a href="javascript:createURL()"&amp;gt; Adjust CV &amp;lt;/a&amp;gt;&lt;BR /&gt;&amp;lt;/body&amp;gt;&lt;BR /&gt;&amp;lt;/html&amp;gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;This creates the url but there seems to be something wrong with the var.&amp;nbsp; If I'd be able to get the last and first name from the context, that would be great.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;And also note that there is a link to an external page.&amp;nbsp; This is also temporary.&amp;nbsp; I'm also working on getting the page inside the alfresco.war with the bean class in a .jar file working with the current session.&amp;nbsp; However the whole bean thing is still in development so for debugging and fast adjusting purpose I'm working like this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for any insights on the matter &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://connect.hyland.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 28 Mar 2008 10:58:44 GMT</pubDate>
    <dc:creator>fhomasp</dc:creator>
    <dc:date>2008-03-28T10:58:44Z</dc:date>
    <item>
      <title>Javascript 'Var with user info from alfresco' - question</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/javascript-var-with-user-info-from-alfresco-question/m-p/158622#M112713</link>
      <description>Hey,I have a question on how to retrieve info of the current user.&amp;nbsp; I had a temporary solution but it is completely inadequate and doesn't work very well either.&amp;nbsp; In fact it doesn't work at all like I meant.A made a presentation template to apply to certain spaces which adds an URL with a few parame</description>
      <pubDate>Fri, 28 Mar 2008 10:58:44 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/javascript-var-with-user-info-from-alfresco-question/m-p/158622#M112713</guid>
      <dc:creator>fhomasp</dc:creator>
      <dc:date>2008-03-28T10:58:44Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript 'Var with user info from alfresco' - question</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/javascript-var-with-user-info-from-alfresco-question/m-p/158623#M112714</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This won't work either.&amp;nbsp; The link is just not followable.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;For testing purposes I tried to print some info to the output area, which won't work either.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Perhaps a certain few std variables or properties won't work with a presentation template applied as custom view?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&amp;lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&amp;gt;&lt;BR /&gt;&amp;lt;html&amp;gt;&lt;BR /&gt;&amp;lt;head&amp;gt;&lt;BR /&gt;&amp;lt;title&amp;gt;Adjust CV&amp;lt;/title&amp;gt;&lt;BR /&gt;&amp;lt;script language="JavaScript" type="text/javascript"&amp;gt;&lt;BR /&gt;var ch=space.children;&lt;BR /&gt;var name2 = userhome.properties["name"];&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; function createURL() {&lt;BR /&gt;var name1 = userhome.properties.name;&lt;BR /&gt;&lt;BR /&gt;println("test");&lt;BR /&gt;println(name1);&lt;BR /&gt;println(name2);&lt;BR /&gt;location.href="/Alf_CV/jsp/personal.jsf?username="+name2;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;/head&amp;gt;&lt;BR /&gt;&amp;lt;body&amp;gt;&lt;BR /&gt;&amp;lt;a href="javascript:createURL()"&amp;gt; Adjust CV &amp;lt;/a&amp;gt;&lt;BR /&gt;&amp;lt;/body&amp;gt;&lt;BR /&gt;&amp;lt;/html&amp;gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;edit:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Some extra notes.&amp;nbsp; The link works if I remove the var at the end of the url.&amp;nbsp; If I hardcode a name it'll also work but that's an even bigger nono than the current solution &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://connect.hyland.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Mar 2008 14:04:24 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/javascript-var-with-user-info-from-alfresco-question/m-p/158623#M112714</guid>
      <dc:creator>fhomasp</dc:creator>
      <dc:date>2008-03-28T14:04:24Z</dc:date>
    </item>
  </channel>
</rss>

