KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opencms > workplace > editors > CmsEditorFrameset


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src/org/opencms/workplace/editors/CmsEditorFrameset.java,v $
3  * Date : $Date: 2006/04/04 14:39:50 $
4  * Version: $Revision: 1.14 $
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.editors;
33
34 import org.opencms.jsp.CmsJspActionElement;
35 import org.opencms.main.CmsException;
36 import org.opencms.main.CmsLog;
37 import org.opencms.security.CmsPermissionSet;
38 import org.opencms.util.CmsStringUtil;
39 import org.opencms.workplace.CmsWorkplaceSettings;
40
41 import javax.servlet.http.HttpServletRequest JavaDoc;
42
43 import org.apache.commons.logging.Log;
44
45 /**
46  * Helper class to create the editor frameset.<p>
47  *
48  * The following files use this class:
49  * <ul>
50  * <li>/jsp/editors/editor_html
51  * </ul>
52  * <p>
53  *
54  * @author Andreas Zahner
55  *
56  * @version $Revision: 1.14 $
57  *
58  * @since 6.0.0
59  */

60 public class CmsEditorFrameset extends CmsEditor {
61
62     /** The log object for this class. */
63     private static final Log LOG = CmsLog.getLog(CmsEditorFrameset.class);
64
65     /** The title to be displayed in the editor. */
66     private String JavaDoc m_paramEditorTitle;
67
68     /**
69      * Public constructor.<p>
70      *
71      * @param jsp an initialized JSP action element
72      */

73     public CmsEditorFrameset(CmsJspActionElement jsp) {
74
75         super(jsp);
76     }
77
78     /**
79      * Deletes the temporary file and unlocks the edited resource when in direct edit mode.<p>
80      *
81      * This method is needed in the editor close help frame, which is called when the user presses
82      * the "back" button or closes the browser window when editing a page.<p>
83      *
84      * @param forceUnlock if true, the resource will be unlocked anyway
85      */

86     public void actionClear(boolean forceUnlock) {
87
88         // delete the temporary file
89
deleteTempFile();
90         if (Boolean.valueOf(getParamDirectedit()).booleanValue() || forceUnlock) {
91             // unlock the resource when in direct edit mode or force unlock is true
92
try {
93                 getCms().unlockResource(getParamResource());
94             } catch (CmsException e) {
95                 // should usually never happen
96
if (LOG.isInfoEnabled()) {
97                     LOG.info(e);
98                 }
99             }
100         }
101     }
102
103     /**
104      * @see org.opencms.workplace.editors.CmsEditor#actionExit()
105      */

106     public final void actionExit() {
107
108         // do nothing
109
}
110
111     /**
112      * @see org.opencms.workplace.editors.CmsEditor#actionSave()
113      */

114     public final void actionSave() {
115
116         // do nothing
117
}
118
119     /**
120      * @see org.opencms.workplace.editors.CmsEditor#getEditorResourceUri()
121      */

122     public final String JavaDoc getEditorResourceUri() {
123
124         // return emtpy String
125
return "";
126     }
127
128     /**
129      * Returns the editor title.<p>
130      *
131      * @return the editor title
132      */

133     public String JavaDoc getParamEditorTitle() {
134
135         if (CmsStringUtil.isEmpty(m_paramEditorTitle)) {
136             return key(Messages.GUI_EDITOR_TITLE_PREFIX_0) + " " + getParamResource();
137         }
138         return m_paramEditorTitle;
139     }
140
141     /**
142      * Sets the editor title.<p>
143      *
144      * @param editorTitle the editor title to set
145      */

146     public void setParamEditorTitle(String JavaDoc editorTitle) {
147
148         m_paramEditorTitle = editorTitle;
149     }
150
151     /**
152      * @see org.opencms.workplace.editors.CmsEditor#initContent()
153      */

154     protected final void initContent() {
155
156         // do nothing
157
}
158
159     /**
160      * @see org.opencms.workplace.CmsWorkplace#initWorkplaceRequestValues(org.opencms.workplace.CmsWorkplaceSettings, javax.servlet.http.HttpServletRequest)
161      */

162     protected void initWorkplaceRequestValues(CmsWorkplaceSettings settings, HttpServletRequest JavaDoc request) {
163
164         // fill the parameter values in the get/set methods
165
fillParamValues(settings, request);
166
167         if (getDialogRealUri().endsWith("editor.jsp")) {
168             // check the required permissions to edit the resource only in the main frame
169
if (!checkResourcePermissions(CmsPermissionSet.ACCESS_WRITE, true)) {
170                 // not write permissions in the folder, close editor
171
try {
172                     actionClose();
173                 } catch (Exception JavaDoc e) {
174                     // should usually never happen
175
if (LOG.isInfoEnabled()) {
176                         LOG.info(e);
177                     }
178                 }
179             }
180         }
181     }
182 }
183
Popular Tags