KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opencms > workplace > CmsBackbutton


1 /*
2  * File : $Source: /usr/local/cvs/opencms/src-modules/com/opencms/workplace/CmsBackbutton.java,v $
3  * Date : $Date: 2005/06/21 15:49:59 $
4  * Version: $Revision: 1.2 $
5  *
6  * This library is part of OpenCms -
7  * the Open Source Content Mananagement System
8  *
9  * Copyright (C) 2001 The OpenCms Group
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 OpenCms, please see the
22  * OpenCms Website: http://www.opencms.org
23  *
24  * You should have received a copy of the GNU Lesser General Public
25  * License along with this library; if not, write to the Free Software
26  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27  */

28
29 package com.opencms.workplace;
30
31 import org.opencms.file.CmsObject;
32 import org.opencms.main.CmsException;
33
34 import com.opencms.core.I_CmsSession;
35 import com.opencms.legacy.CmsXmlTemplateLoader;
36 import com.opencms.template.A_CmsXmlContent;
37
38 import java.util.Hashtable JavaDoc;
39
40 import org.w3c.dom.Element JavaDoc;
41
42 /**
43  * Class for building workplace icons. <BR>
44  * Called by CmsXmlTemplateFile for handling the special XML tag <code>&lt;ICON&gt;</code>.
45  *
46  * Creation date: (09.08.00 15:21:44)
47  * @author Hanjo Riege
48  * @version $Name: $ $Revision: 1.2 $ $Date: 2005/06/21 15:49:59 $
49  * @see com.opencms.workplace.CmsXmlWpTemplateFile
50  *
51  * @deprecated Will not be supported past the OpenCms 6 release.
52  */

53
54 public class CmsBackbutton extends A_CmsWpElement implements I_CmsWpElement {
55
56     /**
57      * Handling of the special workplace <CODE>&lt;BACKBUTTON&gt;</CODE> tags.
58      * <P>
59      * Returns the processed code with the actual elements.
60      * <P>
61      * A backbutton can be referenced in any workplace template by <br>
62      * <CODE>&lt;BACKBUTTON name="..." label="..." action="..." HREF="..." target="..."/&gt;</CODE>
63      *
64      * @param cms CmsObject Object for accessing resources.
65      * @param n XML element containing the <code>&lt;BACKBUTTON&gt;</code> tag.
66      * @param doc Reference to the A_CmsXmlContent object of the initiating XLM document.
67      * @param callingObject reference to the calling object.
68      * @param parameters Hashtable containing all user parameters <em>(not used here)</em>.
69      * @param lang CmsXmlLanguageFile conataining the currently valid language file.
70      * @return Processed button.
71      * @throws CmsException
72      */

73
74     public Object JavaDoc handleSpecialWorkplaceTag(
75         CmsObject cms,
76         Element JavaDoc n,
77         A_CmsXmlContent doc,
78         Object JavaDoc callingObject,
79         Hashtable JavaDoc parameters,
80         CmsXmlLanguageFile lang) throws CmsException {
81
82         CmsXmlWpTemplateFile buttondef = this.getBackbuttonDefinitions(cms);
83         CmsXmlWpConfigFile confFile = new CmsXmlWpConfigFile(cms);
84         I_CmsSession session = CmsXmlTemplateLoader.getSession(cms.getRequestContext(), true);
85         String JavaDoc navPos = (String JavaDoc)session.getValue(com.opencms.core.I_CmsConstants.C_SESSION_ADMIN_POS);
86         if ((navPos == null) || (navPos.equals(confFile.getWorkplaceAdministrationPath()))) {
87
88             // first call or on top-level => disable Button
89
return buttondef.getProcessedDataValue("disable", callingObject);
90         } else {
91
92             // enable backbutton
93
String JavaDoc linkValue = navPos.substring(0, navPos.length() - 1);
94             linkValue = linkValue.substring(0, linkValue.lastIndexOf("/") + 1);
95             buttondef.setData("linkTo", "?sender=" + linkValue);
96             return buttondef.getProcessedDataValue("enable", callingObject);
97         }
98     } //end of handleSpecialWorkplaceTag
99
}
100
Popular Tags