1 5 6 package com.raptus.owxv3.modules.base; 7 8 import java.util.*; 9 10 import javax.servlet.http.HttpServletRequest ; 11 12 import com.raptus.owxv3.*; 13 import com.raptus.owxv3.api.*; 14 15 37 public class PubBaseAction2 extends VModuleRoleAction 39 { 40 43 public static final String SECTION_ELEMENT_PROPERTY_MAXROWS = "maxlistrows"; 44 45 48 protected String dispatchVModuleElement(HttpServletRequest request, 49 String element, 50 org.apache.struts.action.ActionForm form, 51 VModule vm, 52 Locale locale) 53 { 54 XMLConfigManager cm = XMLConfigManager.getInstance(); 55 59 Hashtable hash = new Hashtable(); 60 Enumeration pnames = request.getParameterNames(); 61 while(pnames.hasMoreElements()) 62 { 63 String key = (String )pnames.nextElement(); 64 hash.put(key, request.getParameter(key)); 65 } 66 67 String pageNoParam = request.getParameter("page"); 68 if( (((CategoryPagedBean) form).isListLoaded(locale,vm.getIdentification()) == false)) 70 { 71 LoggingManager.log("Loading " + locale.toString() + " public news list from " + 72 "database for virtual module " + vm.getIdentification(), this); 73 74 try 75 { 76 CategorySelector old=((CategoryPagedBean) form).getCategorySelector(); 77 CategorySelector sel = new CategorySelector(vm.getLocales(), locale, vm.getIdentification()); 78 if(old!=null) sel.inheritState(old); 79 ((CategoryPagedBean) form).setCategorySelector(sel); 80 } 81 catch(java.sql.SQLException ex) 82 { 83 LoggingManager.log("Can't create category selector",this); 84 } 85 86 int maxRows = 0; 87 maxRows=cm.getIntegerByTree("virtualhost/vmodules/vmodule?name="+vm.getIdentification()+"/section/publics/element?name="+element+"/property?name=maxlistrow", "value"); 97 102 BaseObject nwobj = new BaseObject(vm, locale); 104 Vector newsList = nwobj.loadPubBaseListEntries(null); 105 106 107 108 ((CategoryPagedBean) form).setMaxRows(maxRows); 111 ((CategoryPagedBean) form).setList(newsList, locale, vm.getIdentification()); 112 ((CategoryPagedBean) form).setURI(request.getRequestURI()); 113 } 114 else 115 { 116 LoggingManager.log("Using session copy of public news list for virtual module " + 118 vm.getIdentification(), this); 119 int pageNo = 1; 120 if(pageNoParam != null) 121 { 122 try 123 { 124 pageNo = Integer.parseInt(pageNoParam); 125 } 126 catch(NumberFormatException e) { 127 LoggingManager.log("NumberFormatException while converting parameter <page> " + pageNoParam, this); 128 } 129 } 130 131 ((PagedListBean) form).setCurrentPage(pageNo); 132 } 133 134 ((CategoryPagedBean) form).setValues(hash); 136 return Constants.SECTION_PUBLICS + Constants.DEFAULT_SPACER + element; 138 140 } 142 143 } 144 145 | Popular Tags |