KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > raptus > owxv3 > modules > categories > EACategoryContentsAction


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

5
6 package com.raptus.owxv3.modules.categories;
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.*;
14
15 /**
16  *
17  * <hr>
18  * <table width="100%" border="0">
19  * <tr>
20  * <td width="24%"><b>Filename</b></td><td width="76%">EACategoryContentsAction.java</td>
21  * </tr>
22  * <tr>
23  * <td width="24%"><b>Author</b></td><td width="76%">REEA</td>
24  * </tr>
25  * <tr>
26  * <td width="24%"><b>Date</b></td><td width="76%">10th of December 2001</td>
27  * </tr>
28  * </table>
29  * <hr>
30  * <table width="100%" border="0">
31  * <tr>
32  * <td width="24%"><b>Date / Author</b></td><td width="76%"><b>Changes</b></td>
33  * </tr>
34  * </table>
35  * <table width="100%" border="0">
36  * <tr>
37  * <td>This action is called to display the Category Contents screen</td>
38  * </tr>
39  * </table>
40  * <hr>
41  */

42 //public class EACategoryContentsAction extends VModuleAuthAction
43
public class EACategoryContentsAction extends VModuleRoleAction
44 {
45     /**
46      *Method for populating the CategorySelector object of the corresponding
47      *EACategoryContentsBean.
48      *Also the unlink action is handled too.
49      */

50     public String JavaDoc dispatchVModuleElement(HttpServletRequest JavaDoc request,
51                                          String JavaDoc 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_CONTENTS) == 0)
58         {
59             EACategoryContentsBean contentsbean=(EACategoryContentsBean) form;
60
61             String JavaDoc action="";
62              //Checking what kind of action should perform
63
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_UNLINK)==0)
68             {
69                 int linkid=0;
70
71                 //We need the itemid of the item that should be deleted
72

73                 try
74                 {
75                     if(request.getParameter(CategoryConstants.HTTPGET_PARAM_LINKID)!=null)
76                        linkid=Integer.parseInt( request.getParameter(CategoryConstants.HTTPGET_PARAM_LINKID) );
77                 }catch(NumberFormatException JavaDoc nfe){}
78
79                 if(linkid!=0)
80                 {
81
82                    CategoriesObject catobj=new CategoriesObject();
83
84                    int deleteres=catobj.deleteCatLink(linkid);
85                    ActionErrors errors=new ActionErrors();
86
87                    if(deleteres==CategoryConstants.RESPONSE_SQLERROR)
88                    {
89                        errors.add( ActionErrors.GLOBAL_ERROR, new ActionError("module.categories.error.sqlerror") ); }
90                    if(errors.size()>0)
91                    {
92                         saveErrors(request,errors);
93
94                    }
95                 }//end big if
96
}
97
98
99
100             //the category list should be reloaded all the time
101
try
102             {
103                 contentsbean.setCategorySelector( new CategorySelector(vm.getLocales(),user.getLocale()) );
104             }catch(Exception JavaDoc e)
105             {
106                 LoggingManager.log("Error while adding the CategorySelector!"+e,this);
107             }
108
109
110
111         }
112         else
113             return null; // display unknown element screen
114

115         return Constants.SECTION_EADMIN + Constants.DEFAULT_SPACER + element;
116
117     }
118
119 }
120
121 // eof
122

123
124
Popular Tags