AnsweredAssumed Answered

Javascript 'Var with user info from alfresco' - question

Question asked by fhomasp on Mar 28, 2008
Latest reply on Mar 28, 2008 by fhomasp
Hey,

I have a question on how to retrieve info of the current user.  I had a temporary solution but it is completely inadequate and doesn't work very well either.  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 parameters.  The parameters are the users' first and last name, which is passed to a custom bean with JSF page.
I'll add the code momentarily.
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.  It would of course be much better to get the current user and add his/her first and lastname to the path.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Adjust CV</title>
<script language="JavaScript" type="text/javascript">
var ch=space.children;
for(var i=0; i<ch.length;i++)
{
  if(ch[i].isContainer)
  {
function createURL(){

location.href="/Alf_CV/jsp/personal.jsf?username="+ch[i];
}
}
}
</script>
</head>
<body>
<a href="javascript:createURL()"> Adjust CV </a>
</body>
</html>

This creates the url but there seems to be something wrong with the var.  If I'd be able to get the last and first name from the context, that would be great.
And also note that there is a link to an external page.  This is also temporary.  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.  However the whole bean thing is still in development so for debugging and fast adjusting purpose I'm working like this.

Thanks for any insights on the matter :)

Outcomes