1 5 6 package com.raptus.owxv3.modules.categories; 7 8 import javax.servlet.http.HttpServletRequest ; 9 10 import org.apache.struts.action.*; 11 12 import com.raptus.owxv3.*; 13 import com.raptus.owxv3.api.*; 14 15 43 public class EACategoryListAction extends VModuleRoleAction 45 { 46 50 public String dispatchVModuleElement(HttpServletRequest request, 51 String element, 52 org.apache.struts.action.ActionForm form, 53 VModule vm, 54 com.raptus.owxv3.api.usermgr.User user) 55 { 56 57 if(element.compareToIgnoreCase(CategoryConstants.ELEMENT_LIST) == 0) 58 { 59 EACategoryListBean listbean=(EACategoryListBean) form; 60 61 String action=""; 62 if(request.getParameter(CategoryConstants.HTTPGET_PARAM_ACTION)!=null) 64 action=request.getParameter(CategoryConstants.HTTPGET_PARAM_ACTION); 65 66 67 if(action.compareToIgnoreCase(CategoryConstants.VMODULE_ACTION_DELETE)==0) 68 { 69 int catid=0; 70 71 74 try 75 { 76 if(request.getParameter(CategoryConstants.HTTPGET_PARAM_CATID)!=null) 77 catid=Integer.parseInt( request.getParameter(CategoryConstants.HTTPGET_PARAM_CATID) ); 78 }catch(NumberFormatException nfe){} 79 80 if(catid!=0) 81 { 82 83 CategoriesObject catobj=new CategoriesObject(); 84 85 int deleteres=catobj.deleteCategory(catid); 86 ActionErrors errors=new ActionErrors(); 87 90 if(deleteres==CategoryConstants.RESPONSE_NOTEMTPY_ERROR) 91 { 92 errors.add( ActionErrors.GLOBAL_ERROR, new ActionError("module.categories.error.categorynotempty") ); 93 } 94 else if(deleteres==CategoryConstants.RESPONSE_NODELETESTATIC_ERROR) 95 { 96 errors.add( ActionErrors.GLOBAL_ERROR, new ActionError("module.categories.error.nodeletestaticcat") ); 97 } 98 else if(deleteres==CategoryConstants.RESPONSE_SQLERROR) 99 { 100 errors.add( ActionErrors.GLOBAL_ERROR, new ActionError("module.categories.error.sqlerror") ); 101 } 102 if(errors.size()>0) 103 { 104 saveErrors(request,errors); 105 106 } 107 } } 109 110 111 112 try 114 { 115 listbean.setCategorySelector( new CategorySelector(vm.getLocales(),user.getLocale()) ); 116 }catch(Exception e) 117 { 118 LoggingManager.log("Error while adding the CategorySelector!"+e,this); 119 } 120 121 122 123 } 124 else 125 return null; 127 return Constants.SECTION_EADMIN + Constants.DEFAULT_SPACER + element; 128 129 } 130 131 } 132 133 | Popular Tags |