Return to Jive Software

1,179 Views 5 Replies Last post: May 13, 2009 12:14 AM by markskipper RSS
markskipper Novice 65 posts since
Apr 7, 2009
Currently Being Moderated

May 11, 2009 4:51 AM

What is available to my freemarker for a widget context

Hi I built a widget plugin and Im keen to explore this way of using the applications' functionality.

 

I want your guidance on how to access information about the context from my freemarker files.

My question is in two parts:

 

 

a) For a widget in the home page of a socail group, how would I find the group name from within my widget's freemarker file?

Is this available from the context already or would my java class have to provide that information? If the latter, where do I get that information in my widget's Java code?

 

b) how, in general, do answer questions like this? I am guessing there is some place in the source where I can look for this information. Is there a document that describes this process? The notes on Freemarker I have seen are not specific to clearspace and most of the clearspace documentation is for template theme customisation, im not clear how much of this is the same in the cae of widget templates.

 

Hopefully I can avoid questions like this in future if you are able to give me good answers to a) and b) above.

 

Mark

Todd West Jive Employee 15,918 posts since
Jul 14, 2008
Currently Being Moderated
May 11, 2009 4:04 PM in response to: markskipper
Re: What is available to my freemarker for a widget context

Hey Mark,

 

a) For a widget in the home page of a socail group, how would I find the group name from within my widget's freemarker file?

Is this available from the context already or would my java class have to provide that information? If the latter, where do I get that information in my widget's Java code?

 

The easiest way to do this (instead of messing around with freemarker statics and such) is to simply get it from your java code. In your widget, you will want to create a getter method for the social group:

 

public SocialGroup getCurrentSocialGroup() {
   return currentSocialGroup;   (this would be a global variable in your widget)
}

 

Then in your loadProperties method you will set the social group appropriately:

 

if (widgetContext.getWidgetType() == WidgetType.SOCIALGROUP) {
            SocialGroupWidgetContext socialGroupWidgetContext = (SocialGroupWidgetContext) widgetContext;
            currentSocialGroup = socialGroupWidgetContext.getSocialGroup();
}
 
properties.put("currentSocialGroup", currentSocialGroup);

 

Then in your FTL you can reference the social group object like this:

 

${socialGroup.name}

 

In FTL's that are mapped to java actions, any get methods automatically strip this when you use the variable. Otherwise the variable would be like this:

 

${getSocialGroup().getName()}   // The first is much easier to read and is what you should use

 

 

b) how, in general, do answer questions like this? I am guessing there is some place in the source where I can look for this information. Is there a document that describes this process? The notes on Freemarker I have seen are not specific to clearspace and most of the clearspace documentation is for template theme customisation, im not clear how much of this is the same in the cae of widget templates.

 

Check out our developer community, we have tons of documentation around customizations:

 

http://www.jivesoftware.com/jivespace/community/developer

 

 

Thanks.

 

-Todd

Aaron Johnson Jive Employee 1,169 posts since
Jan 7, 2004
Currently Being Moderated
May 11, 2009 11:28 PM in response to: markskipper
Re: What is available to my freemarker for a widget context
Is there a document that describes this process?

There's also a pretty good document on building widgets available here: http://www.jivesoftware.com/builds/docs/jive_sbs_employee/latest/developer/BuildingWidgets.html

 

Would love your feedback on that if it helps at all.

 

Cheers,

 

AJ

Todd West Jive Employee 15,918 posts since
Jul 14, 2008
Currently Being Moderated
May 12, 2009 6:30 AM in response to: markskipper
Re: What is available to my freemarker for a widget context

Hey Mark,

 

Thanks for all of the feedback, this is really good stuff. I just wanted to touch on a few points here myself.

 

I must confess that I find replies on suppurt tickets saying "please check out this document" annoying, and especially so when the document is one I have seen a dozen times already and does not provide the information I am looking for. It smacks of a polite RTFM which makes me look like someone who can't locate a good tutorial. Anyone who has actually written a widget for your app certainly deserves credit for having been able to find the tutorial.

 

I general (and I am definitely generalizing here) these support tickets are very likely dealing with customizations or complex functionality outside of the scope of normal application operations and usage. As much as I would love to be able to be a dedicated customizations and consulting resource unfortunately this is just not currently possible and as noted here this is not covered by the support contract (sorry for more link spam):

 

http://www.jivesoftware.com/services/support

 

Issues not covered by support:

  • Feature enhancements
  • Debugging code not written by Jive Software
  • Custom development
  • HTML authoring
  • Training
  • Integrating Jive into other web applications

 

Even given that case, we tend to try to help out as much as we can because we know what its like to be in your position (sometimes thrown into something you've never used before) and have deadlines that need to be met.

 

 

 

I understand you are keen to get people to give feedback on the documents you preare and it would be very cool if we added our feelings and suggestions as comments to them so you could respnd by improving them. But if that's not what's happening, maybe its time to start to think about how the oveall workflow for users and support is working from our point of view.

 

This is among some of the features that would we love to have in the Supportal in the future. The ability for users to quickly rate the usefulness of a document and provide quick feedback for us so we know which documents need to be improved as well as which are getting utilized the most so we can add on to them.

 

 

Thanks again for your feedback and good luck with your custom development! Once you get into it and have a handle on things, its a blast to see what you can do.

 

-Todd

More Like This

  • Retrieving data ...

Bookmarked By (0)

To better serve our customers we have included functionality to automatically follow up on a case after it has been idle for more than 5 days, and then auto close after an additional 3 days of inactivity. Choose No to acknowledge that this case will remain idle for longer than 5 days.
Making cases public allows other customers to learn from the solution of the case. It can also be used to gain feedback from others in the community. Ask our Support Engineers for more info, but we encourage you to make your cases public.