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, 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.directedit;
029
030import org.opencms.xml.containerpage.CmsContainerElementBean;
031
032/**
033 * A parameter set to start a direct edit element, for internal use only.<p>
034 *
035 * @since 6.2.3
036 */
037public class CmsDirectEditParams {
038
039    /** The collector name. */
040    protected String m_collectorName;
041
042    /** The collector params. */
043    protected String m_collectorParams;
044
045    /** The selected element in the target content.*/
046    protected String m_element;
047
048    /** The link to the current page useed when closing an editor or dialog. */
049    protected String m_linkForClose;
050
051    /** The link to create a new VFS resource of the edited type. */
052    protected String m_linkForNew;
053
054    /** The direct edit mode to use. */
055    protected CmsDirectEditMode m_mode;
056
057    /** The direct edit options to display buttons for. */
058    protected CmsDirectEditButtonSelection m_options;
059
060    /** The edit target VFS resource name. */
061    protected String m_resourceName;
062
063    /** The upload folder. */
064    protected String m_uploadFolder;
065
066    /** The 'container' element (when using display tag). */
067    private CmsContainerElementBean m_containerElement;
068
069    /** ID to identify the contentload instance. */
070    private String m_id;
071
072    /** The post-create handler class name. */
073    private String m_postCreateHandler;
074
075    /**
076     * Creates a new direct edit parameter set usually used for including the head HTML.<p>
077     *
078     * @param linkForClose the link to the current page useed when closing an editor or dialog
079     */
080    public CmsDirectEditParams(String linkForClose) {
081
082        m_resourceName = null;
083        m_options = null;
084        m_element = null;
085        m_linkForNew = null;
086        m_linkForClose = linkForClose;
087        m_mode = CmsDirectEditMode.TRUE;
088    }
089
090    /**
091     * Creates a new direct edit parameter set usually used within a XML content load loop for a <code>xmlcontent</code>.<p>
092     *
093     * @param resourceName the edit target VFS resource name
094     * @param options the direct edit options to display buttons for
095     * @param linkForNew the link to create a new VFS resource of the edited type
096     * @param mode the direct edit mode to use
097     */
098    public CmsDirectEditParams(
099        String resourceName,
100        CmsDirectEditButtonSelection options,
101        CmsDirectEditMode mode,
102        String linkForNew) {
103
104        m_resourceName = resourceName;
105        m_options = options;
106        m_element = null;
107        m_linkForNew = linkForNew;
108        m_linkForClose = null;
109        m_mode = mode != null ? mode : CmsDirectEditMode.TRUE;
110    }
111
112    /**
113     * Creates a new direct edit parameter set usually used within a <code>cms:include</code> call for a <code>xmlpage</code>.<p>
114     *
115     * @param resourceName the edit target VFS resource name
116     * @param element the selected element in the target content
117     */
118    public CmsDirectEditParams(String resourceName, String element) {
119
120        m_resourceName = resourceName;
121        m_options = CmsDirectEditButtonSelection.EDIT;
122        m_element = element;
123        m_linkForNew = null;
124        m_linkForClose = null;
125        m_mode = CmsDirectEditMode.TRUE;
126    }
127
128    /**
129     * Returns the direct edit buttons selection to display.<p>
130     *
131     * @return the direct edit buttons selection to display
132     */
133    public CmsDirectEditButtonSelection getButtonSelection() {
134
135        return m_options;
136    }
137
138    /**
139     * Returns the collectorName.<p>
140     *
141     * @return the collectorName
142     */
143    public String getCollectorName() {
144
145        return m_collectorName;
146    }
147
148    /**
149     * Returns the collectorParams.<p>
150     *
151     * @return the collectorParams
152     */
153    public String getCollectorParams() {
154
155        return m_collectorParams;
156    }
157
158    /**
159     * Gets the container element (used for display formatters).<p>
160     *
161     * @return the container element
162     */
163    public CmsContainerElementBean getContainerElement() {
164
165        return m_containerElement;
166    }
167
168    /**
169     * Returns the selected element in the target content.<p>
170     *
171     * @return the selected element in the target content
172     */
173    public String getElement() {
174
175        return m_element;
176    }
177
178    /**
179     * Gets the ID for the contentload tag instance.<p>
180     *
181     * @return the id
182     */
183    public String getId() {
184
185        return m_id;
186    }
187
188    /**
189     * Returns the link to the current page useed when closing an editor or dialog.<p>
190     *
191     * @return the link to the current page useed when closing an editor or dialog
192     */
193    public String getLinkForClose() {
194
195        return m_linkForClose;
196    }
197
198    /**
199     * Returns the link to delete the selected VFS resource.<p>
200     *
201     * @return the link to delete the selected VFS resource
202     */
203    public String getLinkForDelete() {
204
205        return "/system/workplace/commons/delete.jsp";
206    }
207
208    /**
209     * Returns the link to edit the selected VFS resource (element).<p>
210     *
211     * @return the link to edit the selected VFS resource (element)
212     */
213    public String getLinkForEdit() {
214
215        return "/system/workplace/editors/editor.jsp";
216    }
217
218    /**
219     * Returns the link to create a new VFS resource of the edited type.<p>
220     *
221     * @return the link to create a new VFS resource of the edited type
222     */
223    public String getLinkForNew() {
224
225        return m_linkForNew;
226    }
227
228    /**
229     * Returns the direct edit mode.<p>
230     *
231     * @return the direct edit mode
232     */
233    public CmsDirectEditMode getMode() {
234
235        return m_mode;
236    }
237
238    /**
239     * Gets the post-create handler class name.<p>
240     *
241     * @return the post-create handler class name
242     */
243    public String getPostCreateHandler() {
244
245        return m_postCreateHandler;
246    }
247
248    /**
249     * Returns the edit target VFS resource name.<p>
250     *
251     * @return the edit target VFS resource name
252     */
253    public String getResourceName() {
254
255        return m_resourceName;
256    }
257
258    /**
259     * Gets the upload folder.
260     *
261     * @return the upload folder
262     */
263    public String getUploadFolder() {
264
265        return m_uploadFolder;
266    }
267
268    /**
269     * Sets the collectorName.<p>
270     *
271     * @param collectorName the collectorName to set
272     */
273    public void setCollectorName(String collectorName) {
274
275        m_collectorName = collectorName;
276    }
277
278    /**
279     * Sets the collectorParams.<p>
280     *
281     * @param collectorParams the collectorParams to set
282     */
283    public void setCollectorParams(String collectorParams) {
284
285        m_collectorParams = collectorParams;
286    }
287
288    /**
289     * Sets the container element bean.<p>
290     *
291     * @param element the container element
292     */
293    public void setContainerElement(CmsContainerElementBean element) {
294
295        m_containerElement = element;
296    }
297
298    /**
299     * Sets the ID for the contentload tag instance.<p>
300     *
301     * @param id the id to set
302     */
303    public void setId(String id) {
304
305        m_id = id;
306    }
307
308    /**
309     * Sets the post-create handler class name.<p>
310     *
311     * @param postCreateHandler the post-create handler class name
312     */
313    public void setPostCreateHandler(String postCreateHandler) {
314
315        m_postCreateHandler = postCreateHandler;
316    }
317
318    /**
319     * Sets the upload folder.
320     *
321     * @param uploadFolder the upload folder
322     */
323    public void setUploadFolder(String uploadFolder) {
324
325        m_uploadFolder = uploadFolder;
326    }
327}