KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > raptus > owxv3 > modules > base > EABaseEditAction


1 /*
2  * eAdmin/OWX
3  * Copyright (C) 1996-2003 OWX-Project Team <owx-team@gmx.net>
4  */

5
6 package com.raptus.owxv3.modules.base;
7
8 import javax.servlet.http.HttpServletRequest JavaDoc;
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 /**
18  *
19  * <hr>
20  * <table width="100%" border="0">
21  * <tr>
22  * <td width="24%"><b>Filename</b></td><td width="76%">EABaseEditAction.java</td>
23  * </tr>
24  * <tr>
25  * <td width="24%"><b>Author</b></td><td width="76%">Guy Z�rcher (gzuercher@raptus.com)</td>
26  * </tr>
27  * <tr>
28  * <td width="24%"><b>Date</b></td><td width="76%">13th of June 2001</td>
29  * </tr>
30  * </table>
31  * <hr>
32  * <table width="100%" border="0">
33  * <tr>
34  * <td width="24%"><b>Date / Author</b></td><td width="76%"><b>Changes</b></td>
35  * </tr>
36  * </table>
37  * <hr>
38  */

39 //public class EABaseEditAction extends VModuleAuthAction
40
public class EABaseEditAction extends VModuleRoleAction
41 {
42     /**
43      *
44      */

45     public String JavaDoc dispatchVModuleElement(HttpServletRequest JavaDoc request,
46                                          String JavaDoc 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                 //the bean was initialized by a vmodule, check to see if we
61
//are in the same vmodule or not
62
if( ! cc.getInitVModule().equals(vm.getIdentification()) )
63                 {
64                     cc.removeAllComponents();
65                 }
66             }
67
68             if((cc != null && cc.getComponents() == null))
69             {
70
71                 // in eAdmin news module sections only one component can be
72
// opend at a time. This is due to displaying logic.
73
cc.setOpenMultiple(false);
74                 cc.setInitVmodule(vm.getIdentification());
75
76                 // create the components used for this section
77

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                 // initialize all components
122
if(!cca.initialize(cc, request))
123                     LoggingManager.log("Failed to initialize some or all of the components!", this);
124             } //end if
125

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         }//end bigif
145

146         return Constants.SECTION_EADMIN + Constants.DEFAULT_SPACER + element;
147     }
148
149 }
150
151 // eof
152
Popular Tags