1 5 6 package com.raptus.owxv3.modules.filemgr; 7 8 import java.sql.SQLException ; 9 10 import javax.servlet.http.HttpServletRequest ; 11 12 import org.apache.struts.action.*; 13 14 import com.raptus.owxv3.*; 15 import com.raptus.owxv3.api.*; 16 17 18 48 public class EAFileMgrListAction extends VModuleRoleAction 50 { 51 57 58 public String dispatchVModuleElement(HttpServletRequest request, 59 String element, 60 org.apache.struts.action.ActionForm form, 61 VModule vm, 62 com.raptus.owxv3.api.usermgr.User user) 63 { 64 65 if(element.compareToIgnoreCase(FileMgrConstants.ELEMENT_LIST) == 0) 66 { 67 EAFileMgrListBean listbean=(EAFileMgrListBean)form; 68 69 70 73 74 String action=request.getParameter(FileMgrConstants.HTTPGET_PARAM_ACTION); 75 76 79 if (action==null) action=FileMgrConstants.VMODULE_ACTION_LIST; 80 81 84 String filter=listbean.getFilter(); 85 if(filter==null) filter=""; 86 87 if(action.compareToIgnoreCase(FileMgrConstants.VMODULE_ACTION_DELETE)==0){ 88 91 92 int fileid=0; 93 try 94 { 95 98 if(request.getParameter(FileMgrConstants.HTTPGET_PARAM_FILEID)!=null) 99 fileid=Integer.parseInt( request.getParameter(FileMgrConstants.HTTPGET_PARAM_FILEID) ); 100 101 if(fileid!=0){ 102 GlobalResources gres=new GlobalResources(); 103 107 FileMgrDeleteObject delobj=new FileMgrDeleteObject(vm,gres); 108 if(! delobj.deleteFile(fileid) ) 109 { 110 113 ActionErrors errors=new ActionErrors(); 114 errors.add( ActionErrors.GLOBAL_ERROR, new ActionError(FileMgrConstants.VMODULE_LIST_ERROR_INVALIDDELETE) ); 115 saveErrors(request,errors); 116 } 117 } 118 }catch(NumberFormatException nfe) 119 { 120 LoggingManager.log("Wrong number supplied as fileid for deleting:"+nfe.getMessage(), this); 121 }catch(SQLException sqle){ 122 LoggingManager.log("Could not delete file from database"+sqle.getMessage(), this); 123 }catch(Exception e){ 124 LoggingManager.log("Could not delete file from disk"+e.getMessage(), this); 125 } 126 127 } 129 130 131 132 136 137 139 try{ 141 GlobalResources gres=new GlobalResources(); 142 listbean.setList(gres.loadFiles(filter)); 143 144 }catch(SQLException e){LoggingManager.log("Error while calling loadFiles() from GlobalResources"+e.getMessage(), this);} 145 147 return Constants.SECTION_EADMIN + Constants.DEFAULT_SPACER + element; 148 } 150 return null; 151 } 152 153 } 154 155 | Popular Tags |