How to get current node object from node id in javascript

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2006 06:26 AM
Hi all,
I was trying to implement action on forum. For that I have configured "web-client-config-forum-actions.xml" and written following code
I have used parametes like
1. SpaceDetailsBean.space - to get current forum as space - Got Exceptions
2. ForumBean.forum - to get all children of the forum - Throws Exception in ArrayList
How can i get access to Forum space and children of current forum
waiting for your replys….
Thanks in advance…
Mitesh
I was trying to implement action on forum. For that I have configured "web-client-config-forum-actions.xml" and written following code
<action id="create_summary"> <label>Create Summary</label> <image>/images/icons/recover.gif</image> <script>/Company Home/Data Dictionary/Scripts/atest.js</script> <params> <param name="id">#{actionContext.id}</param> </params></action>
here param "id" is node UID.Now How can i get the javascript node object from args["id"] in my atest.js.
And after getting it I want to access topics and posts of the forum and based on that i want to make summary html page.
I have used parametes like
1. SpaceDetailsBean.space - to get current forum as space - Got Exceptions
2. ForumBean.forum - to get all children of the forum - Throws Exception in ArrayList
How can i get access to Forum space and children of current forum
waiting for your replys….
Thanks in advance…
Mitesh
Labels:
- Labels:
-
Archive
5 REPLIES 5

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2006 12:39 AM
Hi all I have used following code to get current node
Following code I am using for forums actions. In the following code args["id"] is actionContext.id. On which i have executed a javascript as an action which is configured in web-client-config-forum-actions.xml.
So by using above code curForum is my node on which i have clicked and executed a javascript action.
Is there any alternate way .????????
I have one more dought regarding Forums
—> I can get Forums' children by using children property. I can get topics of the Forum by using children property of the Forum.
But I am not able to get posts of the topic by using children property of topic. So which property can give me all the posts of topics ??????
Waiting for the reply….
Thanks
Following code I am using for forums actions. In the following code args["id"] is actionContext.id. On which i have executed a javascript as an action which is configured in web-client-config-forum-actions.xml.
var curForum;forums = companyhome.childByNamePath("Forums");logger.log(forums.name);forumsChildren =forums.children;for(i=0;i<forumsChildren .length;i++){ child =forumsChildren[i]; if(child.id.equals(args["id"])) { curForum = child; logger.log("Current Forum Name : " + curForum .name); }}
So by using above code curForum is my node on which i have clicked and executed a javascript action.
Is there any alternate way .????????
I have one more dought regarding Forums
—> I can get Forums' children by using children property. I can get topics of the Forum by using children property of the Forum.
But I am not able to get posts of the topic by using children property of topic. So which property can give me all the posts of topics ??????
Waiting for the reply….
Thanks

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2006 05:25 AM
I have used parametes like
1. SpaceDetailsBean.space - to get current forum as space - Got Exceptions
2. ForumBean.forum - to get all children of the forum - Throws Exception in ArrayList
The script URLs only support simple string arguments at present (as they have to be appended to the URL that calls the script). So actionContext.id will work as you have found, but trying to pass objects like SpaceDetailsBean.space won't - however you can pass the ID for the space e.g. SpaceDetailsBean.space.id should work ok. Of course SpaceDetailsBean.space.id is only valid when in the context of the Space Details dialog page. Generally the "current" space can be found using:
NavigationBean.currentNodeId
Which you can pass to your script.
Thanks,
Kevin

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2006 05:27 AM
Are you sure you can't get the topics from the forum? As looking at the code they are just child nodes like any other (they use the same association name so node.children should work). Remember that topics themselves a sub-type of folder which then have child nodes which represent the posts…
Thanks,
Kevin
Thanks,
Kevin

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2006 06:16 AM
Thanks
Yes as children of topic I am able to get all posts. and now it works fine.
But after executing the same script I want that it will show me the current jsp page but it doesnt?
So pls tell me which parameter in javascript i have to set so it shows me the same page ???
Yes as children of topic I am able to get all posts. and now it works fine.
But after executing the same script I want that it will show me the current jsp page but it doesnt?
So pls tell me which parameter in javascript i have to set so it shows me the same page ???
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2006 06:21 AM
You can use the return-page parameter tospecify which page to return to after executing the script. eg:
http://localhost:8080/alfresco/<normal script url stuff>?paramA=lalalalalala¶mB=qwerty&return-page=/alfresco/faces/jsp/browse/browse.jsp
http://localhost:8080/alfresco/<normal script url stuff>?paramA=lalalalalala¶mB=qwerty&return-page=/alfresco/faces/jsp/browse/browse.jsp
