1 16 package com.blandware.atleap.webapp.action.testimonials; 17 18 import com.blandware.atleap.webapp.action.core.BaseAction; 19 import com.blandware.atleap.webapp.form.TestimonialForm; 20 import com.blandware.atleap.webapp.util.core.LocaleUtil; 21 import com.blandware.atleap.webapp.util.core.WebappConstants; 22 import com.blandware.atleap.webapp.util.testimonials.TestimonialModuleWebConstants; 23 import com.blandware.atleap.model.core.ContentLocale; 24 import org.apache.struts.action.ActionForm; 25 import org.apache.struts.action.ActionForward; 26 import org.apache.struts.action.ActionMapping; 27 28 import javax.servlet.http.HttpServletRequest ; 29 import javax.servlet.http.HttpServletResponse ; 30 import java.util.List ; 31 import java.util.Map ; 32 import java.util.Iterator ; 33 34 53 public final class CallCreateTestimonialAction extends BaseAction { 54 63 public ActionForward execute(ActionMapping mapping, ActionForm form, 64 HttpServletRequest request, HttpServletResponse response) throws Exception { 65 66 TestimonialForm testimonialForm = (TestimonialForm) form; 67 68 request.getSession().removeAttribute(TestimonialModuleWebConstants.TESTIMONIAL_SUBMITTED_ACTION_KEY); 69 70 List contentLocales = LocaleUtil.getInstance(servlet.getServletContext()).getAvailableLocales(); 71 request.getSession().setAttribute(WebappConstants.CONTENT_LOCALES_COLLECTION_KEY, contentLocales); 72 73 String localesMode = testimonialForm.getLocalesMode(); 74 if ( !"current".equalsIgnoreCase(localesMode) && !"all".equalsIgnoreCase(localesMode) ) { 75 localesMode = "selected"; 76 } 77 testimonialForm.setLocalesMode(localesMode); 78 79 if ("selected".equalsIgnoreCase(localesMode)) { 80 Map bodyCheckedBoxes = testimonialForm.getBodyCheckedBoxes(); 82 for (Iterator i = contentLocales.iterator(); i.hasNext();) { 83 ContentLocale contentLocale = (ContentLocale) i.next(); 84 bodyCheckedBoxes.put(contentLocale.getIdentifier(), Boolean.TRUE); 85 } 86 87 request.setAttribute(WebappConstants.SELECT_ALL_LOCALES_CHECKBOX_IS_CHECKED, Boolean.TRUE); 89 } 90 91 saveToken(request); 93 return mapping.findForward("createTestimonial"); 94 } 95 } | Popular Tags |