001/*
002 * This library is part of OpenCms -
003 * the Open Source Content Management System
004 *
005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com)
006 *
007 * This library is free software; you can redistribute it and/or
008 * modify it under the terms of the GNU Lesser General Public
009 * License as published by the Free Software Foundation; either
010 * version 2.1 of the License, or (at your option) any later version.
011 *
012 * This library is distributed in the hope that it will be useful,
013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015 * Lesser General Public License for more details.
016 *
017 * For further information about Alkacon Software GmbH & Co. KG, please see the
018 * company website: http://www.alkacon.com
019 *
020 * For further information about OpenCms, please see the
021 * project website: http://www.opencms.org
022 *
023 * You should have received a copy of the GNU Lesser General Public
024 * License along with this library; if not, write to the Free Software
025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
026 */
027
028package org.opencms.workplace.editors;
029
030import org.opencms.jsp.CmsJspActionElement;
031import org.opencms.workplace.editors.directedit.CmsDirectEditButtonSelection;
032import org.opencms.workplace.editors.directedit.CmsDirectEditJspIncludeProvider;
033import org.opencms.workplace.editors.directedit.CmsDirectEditPermissions;
034
035import java.io.IOException;
036
037import javax.servlet.jsp.JspException;
038
039/**
040 * Provides a method for performing an individual action if the user pressed a special button in the editor.<p>
041 *
042 * You can define the class of your own editor action method in the OpenCms XML configuration files.
043 * The class you enter must implement this interface to perform the editor action.<p>
044 *
045 * @since 6.0.0
046 */
047public interface I_CmsEditorActionHandler {
048
049    /**
050     * Prefix for direct edit end elements, used on JPS pages that supply the direct edit html.
051     *
052     * @deprecated use {@link CmsDirectEditJspIncludeProvider#DIRECT_EDIT_AREA_END}
053     */
054    @Deprecated
055    String DIRECT_EDIT_AREA_END = CmsDirectEditJspIncludeProvider.DIRECT_EDIT_AREA_END;
056
057    /**
058     * Prefix for direct edit start elements, used on JPS pages that supply the direct edit html.
059     *
060     * @deprecated use {@link CmsDirectEditJspIncludeProvider#DIRECT_EDIT_AREA_END}
061     */
062    @Deprecated
063    String DIRECT_EDIT_AREA_START = CmsDirectEditJspIncludeProvider.DIRECT_EDIT_AREA_START;
064
065    /**
066     * Key to identify the direct edit configuration file.
067     *
068     * @deprecated not longer used (the file URI is not longer stored in the page context)
069     */
070    @Deprecated
071    String DIRECT_EDIT_INCLUDE_FILE_URI = "__directEditIncludeFileUri";
072
073    /**
074     * Default direct edit include file URI.
075     *
076     * @deprecated use {@link CmsDirectEditJspIncludeProvider#DIRECT_EDIT_INCLUDE_FILE_URI_DEFAULT}
077     */
078    @Deprecated
079    String DIRECT_EDIT_INCLUDE_FILE_URI_DEFAULT = CmsDirectEditJspIncludeProvider.DIRECT_EDIT_INCLUDE_FILE_URI_DEFAULT;
080
081    /**
082     * Element name for direct edit includes.
083     *
084     * @deprecated use {@link CmsDirectEditJspIncludeProvider#DIRECT_EDIT_INCLUDES}
085     */
086    @Deprecated
087    String DIRECT_EDIT_INCLUDES = "directedit_includes";
088
089    /**
090     * Constant for: direct edit mode disabled.
091     *
092     * @deprecated use {@link CmsDirectEditPermissions#VALUE_DISABLED} or better {@link CmsDirectEditPermissions#DISABLED}
093     */
094    @Deprecated
095    String DIRECT_EDIT_MODE_DISABLED = CmsDirectEditPermissions.VALUE_DISABLED;
096
097    /**
098     * Constant for: direct edit mode enabled.
099     *
100     * @deprecated use {@link CmsDirectEditPermissions#VALUE_ENABLED} or better {@link CmsDirectEditPermissions#ENABLED}
101     */
102    @Deprecated
103    String DIRECT_EDIT_MODE_ENABLED = CmsDirectEditPermissions.VALUE_ENABLED;
104
105    /**
106     * Constant for: direct edit mode inactive.
107     *
108     * @deprecated use {@link CmsDirectEditPermissions#VALUE_INACTIVE} or better {@link CmsDirectEditPermissions#INACTIVE}
109     */
110    @Deprecated
111    String DIRECT_EDIT_MODE_INACTIVE = CmsDirectEditPermissions.VALUE_INACTIVE;
112
113    /**
114     * Option value that indicates the "delete" button should be displayed.
115     *
116     * @deprecated use {@link CmsDirectEditButtonSelection#VALUE_DELETE}
117     */
118    @Deprecated
119    String DIRECT_EDIT_OPTION_DELETE = CmsDirectEditButtonSelection.VALUE_DELETE;
120
121    /**
122     * Option value that indicates the "edit" button should be displayed.
123     *
124     * @deprecated use {@link CmsDirectEditButtonSelection#VALUE_EDIT} or better {@link CmsDirectEditButtonSelection#EDIT}
125     */
126    @Deprecated
127    String DIRECT_EDIT_OPTION_EDIT = CmsDirectEditButtonSelection.VALUE_EDIT;
128
129    /**
130     * Option value that indicates the "new" button should be displayed.
131     *
132     * @deprecated use {@link CmsDirectEditButtonSelection#VALUE_NEW}
133     */
134    @Deprecated
135    String DIRECT_EDIT_OPTION_NEW = CmsDirectEditButtonSelection.VALUE_NEW;
136
137    /**
138     * Key to identify the edit button style, used on JPS pages that supply the direct edit html.
139     *
140     * @deprecated use {@link CmsDirectEditJspIncludeProvider#DIRECT_EDIT_PARAM_BUTTONSTYLE}
141     */
142    @Deprecated
143    String DIRECT_EDIT_PARAM_BUTTONSTYLE = CmsDirectEditJspIncludeProvider.DIRECT_EDIT_PARAM_BUTTONSTYLE;
144
145    /**
146     * Key to identify the edit element, used on JPS pages that supply the direct edit html.
147     *
148     * @deprecated use {@link CmsDirectEditJspIncludeProvider#DIRECT_EDIT_PARAM_ELEMENT}
149     */
150    @Deprecated
151    String DIRECT_EDIT_PARAM_ELEMENT = CmsDirectEditJspIncludeProvider.DIRECT_EDIT_PARAM_ELEMENT;
152
153    /**
154     * Key to identify the edit language, used on JPS pages that supply the direct edit html.
155     *
156     * @deprecated use {@link CmsDirectEditJspIncludeProvider#DIRECT_EDIT_PARAM_LOCALE}
157     */
158    @Deprecated
159    String DIRECT_EDIT_PARAM_LOCALE = CmsDirectEditJspIncludeProvider.DIRECT_EDIT_PARAM_LOCALE;
160
161    /**
162     * Key to identify the link to use for the "new" button (if enabled).
163     *
164     * @deprecated use {@link CmsDirectEditJspIncludeProvider#DIRECT_EDIT_PARAM_NEWLINK}
165     */
166    @Deprecated
167    String DIRECT_EDIT_PARAM_NEWLINK = CmsDirectEditJspIncludeProvider.DIRECT_EDIT_PARAM_NEWLINK;
168
169    /**
170     * Key to identify additional direct edit options, used e.g. to control which direct edit buttons are displayed
171     *
172     * @deprecated use {@link CmsDirectEditJspIncludeProvider#DIRECT_EDIT_PARAM_OPTIONS}
173     */
174    @Deprecated
175    String DIRECT_EDIT_PARAM_OPTIONS = CmsDirectEditJspIncludeProvider.DIRECT_EDIT_PARAM_OPTIONS;
176
177    /**
178     * Key to identify the edit target, used on JPS pages that supply the direct edit html.
179     *
180     * @deprecated use {@link CmsDirectEditJspIncludeProvider#DIRECT_EDIT_PARAM_TARGET}
181     */
182    @Deprecated
183    String DIRECT_EDIT_PARAM_TARGET = CmsDirectEditJspIncludeProvider.DIRECT_EDIT_PARAM_TARGET;
184
185    /**
186     * Performs an action which is configurable in the implementation of the interface, e.g. save, exit, publish.<p>
187     *
188     * @param editor the current editor instance
189     * @param jsp the JSP action element
190     * @throws IOException if a redirection fails
191     * @throws JspException if including a JSP fails
192     */
193    void editorAction(CmsEditor editor, CmsJspActionElement jsp) throws IOException, JspException;
194
195    /**
196     * Returns the key name of the button displayed in the editor.<p>
197     *
198     * @return the key name of the button
199     */
200    String getButtonName();
201
202    /**
203     * Returns the URL of the button displayed in the editor.<p>
204     *
205     * @param jsp the JSP action element
206     * @param resourceName the name of the edited resource
207     * @return the URL of the button
208     */
209    String getButtonUrl(CmsJspActionElement jsp, String resourceName);
210
211    /**
212     * Returns true if the customized button should be active, otherwise false.<p>
213     *
214     * @param jsp the JSP action element
215     * @param resourceName the name of the edited resource
216     * @return true if the customized button should be active, otherwise false
217     */
218    boolean isButtonActive(CmsJspActionElement jsp, String resourceName);
219}