1 5 6 package com.raptus.owxv3.modules.base; 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.VModuleRoleAction; 14 import com.raptus.owxv3.api.components.*; 15 16 17 39 public class EABaseEditAction extends VModuleRoleAction 41 { 42 45 public String dispatchVModuleElement(HttpServletRequest request, 46 String element, 47 org.apache.struts.action.ActionForm form, 48 VModule vm, 49 com.raptus.owxv3.api.usermgr.User user) 50 { 51 if(element.compareToIgnoreCase(BaseConstants.ELEMENT_EDIT) == 0) 52 { 53 BaseObject nwObj = new BaseObject(vm, user.getLocale()); 54 ComponentContainerAction cca = new ComponentContainerAction(); 55 56 ComponentContainer cc = (ComponentContainer) form; 57 58 if(cc.getInitVModule()!=null) 59 { 60 if( ! cc.getInitVModule().equals(vm.getIdentification()) ) 63 { 64 cc.removeAllComponents(); 65 } 66 } 67 68 if((cc != null && cc.getComponents() == null)) 69 { 70 71 cc.setOpenMultiple(false); 74 cc.setInitVmodule(vm.getIdentification()); 75 76 78 if(nwObj.isPreviewEnabled()) 79 { 80 cc.addComponent(BaseConstants.COMPONENT_PREVIEW_ID); 81 82 } 83 84 if(nwObj.arePropertiesEnabled()) 85 { 86 cc.addComponent(BaseConstants.COMPONENT_ENTRY_ID); 87 88 } 89 90 if(nwObj.areFieldsEnabled()) 91 { 92 cc.addComponent(BaseConstants.COMPONENT_FIELDS_ID); 93 94 } 95 96 if(nwObj.areLinksEnabled()) 97 { 98 cc.addComponent(BaseConstants.COMPONENT_LINKS_ID); 99 100 } 101 102 if(nwObj.areFilesEnabled()) 103 { 104 cc.addComponent(BaseConstants.COMPONENT_FILES_ID); 105 106 } 107 108 if(nwObj.arePicturesEnabled()) 109 { 110 cc.addComponent(BaseConstants.COMPONENT_PICS_ID); 111 112 } 113 114 115 if(nwObj.areCategoriesEnabled()) 116 { 117 cc.addComponent(BaseConstants.COMPONENT_CATEGORIES_ID); 118 119 } 120 121 if(!cca.initialize(cc, request)) 123 LoggingManager.log("Failed to initialize some or all of the components!", this); 124 } 126 int result=cca.process(cc, request, nwObj); 127 128 if(result==BaseConstants.RESPONSE_ERROR) 129 LoggingManager.log("Error while processing request.", this); 130 131 else if(result==BaseConstants.RESPONSE_LIMIT) 132 { 133 ActionErrors errors=new ActionErrors(); 134 errors.add(ActionErrors.GLOBAL_ERROR, 135 new ActionError(BaseConstants.EDIT_ERROR_ENTRYLIMIT)); 136 saveErrors(request,errors); 137 } 138 else if(result==BaseConstants.RESPONSE_SAVED) 139 { 140 return Constants.SECTION_EADMIN + 141 Constants.DEFAULT_SPACER + 142 BaseConstants.ELEMENT_LIST; 143 } 144 } 146 return Constants.SECTION_EADMIN + Constants.DEFAULT_SPACER + element; 147 } 148 149 } 150 151 | Popular Tags |