KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > workplace > tools > modules > CmsModulesDelete


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src-modules/org/opencms/workplace/tools/modules/CmsModulesDelete.java,v $
3  * Date : $Date: 2006/03/28 13:54:48 $
4  * Version: $Revision: 1.10 $
5  *
6  * This library is part of OpenCms -
7  * the Open Source Content Mananagement System
8  *
9  * Copyright (c) 2005 Alkacon Software GmbH (http://www.alkacon.com)
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2.1 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * Lesser General Public License for more details.
20  *
21  * For further information about Alkacon Software GmbH, please see the
22  * company website: http://www.alkacon.com
23  *
24  * For further information about OpenCms, please see the
25  * project website: http://www.opencms.org
26  *
27  * You should have received a copy of the GNU Lesser General Public
28  * License along with this library; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */

31
32 package org.opencms.workplace.tools.modules;
33
34 import org.opencms.jsp.CmsJspActionElement;
35 import org.opencms.workplace.CmsDialog;
36 import org.opencms.workplace.CmsWorkplaceSettings;
37 import org.opencms.workplace.tools.CmsToolDialog;
38 import org.opencms.workplace.tools.CmsToolManager;
39
40 import java.util.HashMap JavaDoc;
41 import java.util.Map JavaDoc;
42
43 import javax.servlet.http.HttpServletRequest JavaDoc;
44 import javax.servlet.http.HttpServletResponse JavaDoc;
45 import javax.servlet.jsp.JspException JavaDoc;
46 import javax.servlet.jsp.PageContext JavaDoc;
47
48 /**
49  * Provides an confirm screen for module deletion.<p>
50  *
51  * @author Michael Emmerich
52  *
53  * @version $Revision: 1.10 $
54  *
55  * @since 6.0.0
56  */

57 public class CmsModulesDelete extends CmsDialog {
58
59     /** The dialog type. */
60     public static final String JavaDoc DIALOG_TYPE = "DeleteModuleConfirm";
61
62     /** Modulename parameter. */
63     public static final String JavaDoc PARAM_MODULE = "module";
64
65     /** The delete action. */
66     private static final String JavaDoc DELETE_ACTION_REPORT = "/system/workplace/admin/modules/reports/delete.jsp";
67
68     /** Modulename. */
69     protected String JavaDoc m_paramModule;
70
71     /**
72      * Public constructor.<p>
73      *
74      * @param jsp an initialized JSP action element
75      */

76     public CmsModulesDelete(CmsJspActionElement jsp) {
77
78         super(jsp);
79     }
80
81     /**
82      * Public constructor with JSP variables.<p>
83      *
84      * @param context the JSP page context
85      * @param req the JSP request
86      * @param res the JSP response
87      */

88     public CmsModulesDelete(PageContext JavaDoc context, HttpServletRequest JavaDoc req, HttpServletResponse JavaDoc res) {
89
90         this(new CmsJspActionElement(context, req, res));
91     }
92
93     /**
94      * Performs the re-initialization report, will be called by the JSP page.<p>
95      *
96      * @throws JspException if including the error JSP element fails
97      */

98     public void actionReport() throws JspException JavaDoc {
99
100         // save initialized instance of this class in request attribute for included sub-elements
101
getJsp().getRequest().setAttribute(SESSION_WORKPLACE_CLASS, this);
102         switch (getAction()) {
103             case ACTION_CONFIRMED:
104             default:
105                 try {
106                     Map JavaDoc params = new HashMap JavaDoc();
107                     params.put(PARAM_MODULE, getParamModule());
108                     // set style to display report in correct layout
109
params.put(PARAM_STYLE, CmsToolDialog.STYLE_NEW);
110                     // set close link to get back to overview after finishing the import
111
params.put(PARAM_CLOSELINK, CmsToolManager.linkForToolPath(getJsp(), "/modules"));
112                     // redirect to the report output JSP
113
getToolManager().jspForwardPage(this, DELETE_ACTION_REPORT, params);
114
115                     actionCloseDialog();
116                 } catch (Throwable JavaDoc e) {
117                     // create a new Exception with custom message
118
includeErrorpage(this, e);
119                 }
120                 break;
121         }
122     }
123
124     /**
125      * Gets the module parameter.<p>
126      *
127      * @return the module parameter
128      */

129     public String JavaDoc getParamModule() {
130
131         return m_paramModule;
132     }
133
134     /**
135      * Sets the module parameter.<p>
136      * @param paramModule the module parameter
137      */

138     public void setParamModule(String JavaDoc paramModule) {
139
140         m_paramModule = paramModule;
141     }
142
143     /**
144      * @see org.opencms.workplace.CmsWorkplace#initWorkplaceRequestValues(org.opencms.workplace.CmsWorkplaceSettings, javax.servlet.http.HttpServletRequest)
145      */

146     protected void initWorkplaceRequestValues(CmsWorkplaceSettings settings, HttpServletRequest JavaDoc request) {
147
148         // fill the parameter values in the get/set methods
149
fillParamValues(request);
150         // set the dialog type
151
setParamDialogtype(DIALOG_TYPE);
152         // set the action for the JSP switch
153
if (DIALOG_CONFIRMED.equals(getParamAction())) {
154             setAction(ACTION_CONFIRMED);
155         } else if (DIALOG_CANCEL.equals(getParamAction())) {
156             setAction(ACTION_CANCEL);
157         } else {
158             setAction(ACTION_DEFAULT);
159             // add the title for the dialog
160
setParamTitle(key(Messages.GUI_DELETEMODULE_ADMIN_TOOL_NAME_0));
161         }
162     }
163 }
Popular Tags