1 5 6 package com.raptus.owxv3.modules.base; 7 8 import java.text.ParseException ; 9 import java.util.*; 10 11 import javax.servlet.http.HttpServletRequest ; 12 13 import com.raptus.owxv3.*; 14 import com.raptus.owxv3.api.*; 15 16 38 public class PubBaseAction extends VModuleRoleAction 40 { 41 44 public static final String SECTION_ELEMENT_PROPERTY_MAXROWS = "maxlistrows"; 45 46 49 protected String dispatchVModuleElement(HttpServletRequest request, 50 String element, 51 org.apache.struts.action.ActionForm form, 52 VModule vm, 53 Locale locale) 54 { 55 CategoryFilter filter=null; 59 String catid = request.getParameter("selcatid"); 60 61 if(catid!=null) 62 { 63 filter = new CategoryFilter(catid); 64 } 65 66 String pageNoParam = request.getParameter("page"); 67 68 LoggingManager.log("Loading " + locale.toString() + " public news list from " + 71 "database for virtual module " + vm.getIdentification(), this); 72 73 int maxRows = 0; 74 try 75 { 76 VModuleSectionElement elemObj = vm.getSection(Constants.SECTION_PUBLICS).getElement(element); 78 maxRows = elemObj.getIntegerProperty(SECTION_ELEMENT_PROPERTY_MAXROWS); 79 } 80 catch(ParseException e) { 81 LoggingManager.log("ParseException while retrieving custom vm properties!", this); 82 } 83 84 BaseObject nwobj = new BaseObject(vm, locale); 86 87 Vector newsList = nwobj.loadPubBaseListEntries(filter); 91 92 93 ((PagedListBean) form).setMaxRows(maxRows); 95 ((PagedListBean) form).setList(newsList, locale,vm.getIdentification()); 96 ((PagedListBean) form).setURI(request.getRequestURI()); 97 LoggingManager.log("Using session copy of public news list for virtual module " + 102 vm.getIdentification(), this); 103 int pageNo = 1; 104 if(pageNoParam != null) 105 { 106 try 107 { 108 pageNo = Integer.parseInt(pageNoParam); 109 } 110 catch(NumberFormatException e) { 111 LoggingManager.log("NumberFormatException while converting parameter <page> " + pageNoParam, this); 112 } 113 } 114 115 ((PagedListBean) form).setCurrentPage(pageNo); 116 118 return Constants.SECTION_PUBLICS + Constants.DEFAULT_SPACER + element; 120 122 } 124 125 } 126 127 | Popular Tags |