* @throws Exception
*/
protected ActionForward doCreateForum(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
BBSForumForm forum = (BBSForumForm)form;
ActionMessages msgs = new ActionMessages();
if(StringUtils.isEmpty(forum.getName())){
msgs.add("name", new ActionMessage("error.forum_name_empty"));
}
else{
super.validateClientId(request, forum);
SiteBean site = super.getSiteBean(request);
ForumBean fbean = new ForumBean();
fbean.setName(forum.getName());
if(!StringUtils.isEmpty(forum.getDesc()))
fbean.setDesc(forum.getDesc());
fbean.setCreateTime(new Date());
fbean.setSite(site);
int s = forum.getStatus();
if(s==ForumBean.STATUS_NORMAL||s==ForumBean.STATUS_HIDDEN||s==ForumBean.STATUS_LOCKED)
fbean.setStatus(forum.getStatus());
else
fbean.setStatus(ForumBean.STATUS_NORMAL);
if(forum.getCatalog()>0){
fbean.setCatalog(new TypeBean(forum.getCatalog()));
}
BBSForumDAO.createForum(fbean, forum.getId(), forum.getDirection()==1);
}
if(!msgs.isEmpty()){
saveMessages(request, msgs);
return mapping.findForward("forum_add");
}
return super.makeForward(mapping.findForward("forums"), forum.getSid());
}