hokim101

DWR - Widget property

Discussion created by hokim101 on Sep 15, 2008

Case #32424

Details


Status: Closed
Case Type: /
Severity: /
Product: /
Component: /
Environment: /
Internal Discussion Link: /

Description


Anyone knows how to access widget property using DWR?

 

I have a DWR bean inside widget FTL file that needs to know widget properties which are set by the commnuity admin as well as which community its widget is reside in.

 

I found JiveDWRUtils but it does not provide those information.

 

Please help!

 

Thanks


Comments


Hi,

 

I am not sure if I am understanding your question correctly but you should be able to make these variables available to the FTL by doing the following:

 

 

In your Widget class, loadProperties() method, you will want to make the variables available by doing something like:

 

properties.put("myPropertyVariable", getMyPropertyVariable());

 

You should already have a function like getMyPropertyVariable for each property available to your widget and the variable should reside in the widget class.

 

 

In order to get the container that the widget is executing in, you will need to do something like this:

 

JiveContainer container;
try {
     container = getContainer(widgetContext);
}
catch (UnauthorizedException ue) {
     if (log.isDebugEnabled()) {
          log.debug("User is not authorized to view container.", ue);
     }
     addError(properties, getLocalizedString("widget.recentcontent.unauthorized", widgetContext));
     return properties;
}

properties.put("container", container);

 

 

Hopefully this answers your question. Thanks!

 

-Todd



Thank you for your super fast response.

I knew about loadProperties() method but I need widget properties be accessible directly from the DWR bean.  This is because security is important in my case.  I want to do following:

 

1.  My ftl is drawing the GUI based on the widget properties

2.  My DWR bean is making data available to ftl based on the widget property

3.  My ftl is populating GUI with data from DWR bean

 

Item 2 is important because I don't want my ftl file be hacked in the client side to get unauthorized data from the server.

 

Is this possible?

 

Thank you very much!



Hi again,

 

I haven't ever done anything like that specifically but I found some code that might help you:

 

https://svn.jivesoftware.com/svn/dev/repos/jive/clearspace_2_0/feedblog/

 

 

The place to look would be the spring.xml config:

 

https://svn.jivesoftware.com/svn/dev/repos/jive/clearspace_2_0/feedblog/spring.xml

 

 

You can see the DWR bean in there that uses the custom feedBlogManager. You should be able to look through this code and modify it to work in your case. Hopefully this helps. Please let me know if you have any specific questions regarding your implementation and I would be happy to help. Thanks!

 

-Todd


Outcomes