Creating Groups
One of the most common features provided by community sites is the users' ability to form groups together. VCE comes with built-in feature to support the concept of user groups.
A user group basically consists of a group profile content, a section and an owner of the group. To create a group, we will need a content type with the following parameter:
<parameter name="com.escenic.community.articleType" value="groupProfile"/>
The feature is implemented using the Struts framework. Hence we will need some Struts action declarations before we can write the template to let a user create a group. An example Struts configuration can be as follows:
<form-bean name="groupProfileForm" type="com.ndc.usercontent.struts.actions.forms.GroupProfileForm" /> <action path="/group/profile/add" name="groupProfileForm" scope="request" parameter="groupProfile" type="com.ndc.usercontent.struts.actions.save.SaveGroupProfile"> <!-- Error and Success url are set in the template --> </action>
Note that, the form class com.ndc.usercontent.struts.actions.forms.GroupProfileForm
is a
subclass of the article form class com.ndc.usercontent.struts.actions.forms.ArticleForm
, so
the form properties of the group form is almost identical to the properties of the article form.
An example JSP template that will let a user create a group can be as follows:
<community:user id="user"/> <html:form styleId="addGroupForm" action="/group/profile/add"> <html:hidden property="articleType" value="groupProfile"/> <html:hidden property="homeSectionId" value="${user.section.id}"/> <html:hidden property="state" value="published"/> Group name: <html:text property="field(name)"/><br/> Description: <html:text property="field(description)" /><br/> <html:hidden property="errorUrl" value="error-url" /> <html:submit value="Create"/> </html:form>
The name
field is used as the group name. This is also used for group profile section url.